diff -up ./mozilla/security/nss/lib/pk11wrap/pk11skey.c.800676 ./mozilla/security/nss/lib/pk11wrap/pk11skey.c --- ./mozilla/security/nss/lib/pk11wrap/pk11skey.c.800676 2012-03-07 18:29:16.679551532 -0800 +++ ./mozilla/security/nss/lib/pk11wrap/pk11skey.c 2012-03-07 18:29:42.338733488 -0800 @@ -1664,7 +1664,10 @@ PK11_PubDerive(SECKEYPrivateKey *privKey keyType = PK11_GetKeyType(target,keySize); key_size = keySize; - symKey->size = keySize; + /* There's a bug in FreeBL where this size is treated as a max. + * if we are using softoken, Don't set that size value here, but + * set it to zero we we will query softoken for the size */ + symKey->size = slot->isInternal ? 0 : keySize; if (key_size == 0) templateCount--; mechanism.mechanism = derive;