aboutsummaryrefslogtreecommitdiff
path: root/src/key.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2013-12-02 11:33:44 -0800
committerGregory Maxwell <greg@xiph.org>2013-12-02 11:33:44 -0800
commit9b59e3bda8c137bff885db5b1f9150346e36e076 (patch)
treeb00689d36050d3c2f301329a863234c510546b88 /src/key.cpp
parent9ab7a0609ee920b1095235bc7460c9c0b60acf29 (diff)
downloadbitcoin-9b59e3bda8c137bff885db5b1f9150346e36e076.tar.xz
Sanitize assert usage and refuse to compile with NDEBUG.
There were quite a few places where assert() was used with side effects, making operation with NDEBUG non-functional. This commit fixes all the cases I know about, but also adds an #error on NDEBUG because the code is untested without assertions and may still have vulnerabilities if used without assert.
Diffstat (limited to 'src/key.cpp')
-rw-r--r--src/key.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/key.cpp b/src/key.cpp
index 2fd68fa56b..b57b7c506c 100644
--- a/src/key.cpp
+++ b/src/key.cpp
@@ -148,10 +148,13 @@ public:
}
void SetSecretBytes(const unsigned char vch[32]) {
+ bool ret;
BIGNUM bn;
BN_init(&bn);
- assert(BN_bin2bn(vch, 32, &bn));
- assert(EC_KEY_regenerate_key(pkey, &bn));
+ ret = BN_bin2bn(vch, 32, &bn);
+ assert(ret);
+ ret = EC_KEY_regenerate_key(pkey, &bn);
+ assert(ret);
BN_clear_free(&bn);
}