Browse Source

Merge pull request #868 from sipa/fix_650

Fix #650: CKey::SetSecret BIGNUM leak
miguelfreitas
Pieter Wuille 13 years ago
parent
commit
49355d9993
  1. 5
      src/key.h

5
src/key.h

@ -141,10 +141,13 @@ public: @@ -141,10 +141,13 @@ public:
if (vchSecret.size() != 32)
throw key_error("CKey::SetSecret() : secret must be 32 bytes");
BIGNUM *bn = BN_bin2bn(&vchSecret[0],32,BN_new());
if (bn == NULL)
if (bn == NULL)
throw key_error("CKey::SetSecret() : BN_bin2bn failed");
if (!EC_KEY_regenerate_key(pkey,bn))
{
BN_clear_free(bn);
throw key_error("CKey::SetSecret() : EC_KEY_regenerate_key failed");
}
BN_clear_free(bn);
fSet = true;
if (fCompressed || fCompressedPubKey)

Loading…
Cancel
Save