git://git.novaco.in
/
novacoin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
caad1ad
)
Fix #650: CKey::SetSecret BIGNUM leak
author
Pieter Wuille
<pieter.wuille@gmail.com>
Sun, 19 Feb 2012 17:44:51 +0000 (18:44 +0100)
committer
Luke Dashjr
<luke-jr+git@utopios.org>
Mon, 27 Feb 2012 17:42:48 +0000 (12:42 -0500)
src/key.h
patch
|
blob
|
history
diff --git
a/src/key.h
b/src/key.h
index
8b033a0
..
89d82fc
100644
(file)
--- a/
src/key.h
+++ b/
src/key.h
@@
-153,10
+153,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;
return true;