diff options
author | Gregory Maxwell <greg@xiph.org> | 2013-12-02 11:33:44 -0800 |
---|---|---|
committer | Gregory Maxwell <greg@xiph.org> | 2013-12-02 11:33:44 -0800 |
commit | 9b59e3bda8c137bff885db5b1f9150346e36e076 (patch) | |
tree | b00689d36050d3c2f301329a863234c510546b88 /src/key.cpp | |
parent | 9ab7a0609ee920b1095235bc7460c9c0b60acf29 (diff) |
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.cpp | 7 |
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); } |