summaryrefslogtreecommitdiffstats
path: root/crypto/bn
diff options
context:
space:
mode:
authorGeoff Thorpe <geoff@openssl.org>2016-10-06 16:02:38 +0200
committerRichard Levitte <levitte@openssl.org>2017-02-01 02:06:38 +0100
commit2fc9b36a96ccd77cbd9ecfb3a3cdaa7ad2ca305e (patch)
tree05be5c03eb5bbcf639d679a9dc6e3126116bda69 /crypto/bn
parentbn: fix BN_DEBUG + BN_DEBUG_RAND support (diff)
downloadopenssl-2fc9b36a96ccd77cbd9ecfb3a3cdaa7ad2ca305e.tar.xz
openssl-2fc9b36a96ccd77cbd9ecfb3a3cdaa7ad2ca305e.zip
bn: catch negative zero as an error
Change-Id: I5ab72ad0aae9069b47d5b7b7b9e25bd1b7afa251 Signed-off-by: Geoff Thorpe <geoff@openssl.org> Reviewed-by: Richard Levitte <levitte@openssl.org> (Merged from https://github.com/openssl/openssl/pull/1672)
Diffstat (limited to 'crypto/bn')
-rw-r--r--crypto/bn/bn_lcl.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/bn/bn_lcl.h b/crypto/bn/bn_lcl.h
index b5be6fc814..5fb3814554 100644
--- a/crypto/bn/bn_lcl.h
+++ b/crypto/bn/bn_lcl.h
@@ -177,8 +177,8 @@ int RAND_bytes(unsigned char *buf, int num);
do { \
const BIGNUM *_bnum2 = (a); \
if (_bnum2 != NULL) { \
- OPENSSL_assert((_bnum2->top == 0) || \
- (_bnum2->d[_bnum2->top - 1] != 0)); \
+ OPENSSL_assert(((_bnum2->top == 0) && !_bnum2->neg) || \
+ (_bnum2->top && (_bnum2->d[_bnum2->top - 1] != 0))); \
bn_pollute(_bnum2); \
} \
} while(0)