diff options
author | Richard Levitte <levitte@openssl.org> | 2017-02-01 00:46:09 +0100 |
---|---|---|
committer | Richard Levitte <levitte@openssl.org> | 2017-02-01 02:03:29 +0100 |
commit | 26141babcfad85469383c3919dcff5713fecad16 (patch) | |
tree | 5ec823dd16dd79633baf12a0a3fbde881ef62946 /test/bntest.c | |
parent | 773053386656ab1198e5692b9a63d21942f3adfb (diff) |
bntest: make sure that equalBN takes note of negative zero
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2335)
Diffstat (limited to 'test/bntest.c')
-rw-r--r-- | test/bntest.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/test/bntest.c b/test/bntest.c index f9e36869c2..77c7af62c2 100644 --- a/test/bntest.c +++ b/test/bntest.c @@ -146,8 +146,14 @@ static int equalBN(const char *op, const BIGNUM *expected, const BIGNUM *actual) if (BN_cmp(expected, actual) == 0) return 1; - exstr = BN_bn2hex(expected); - actstr = BN_bn2hex(actual); + if (BN_is_zero(expected) && BN_is_negative(expected)) + exstr = OPENSSL_strdup("-0"); + else + exstr = BN_bn2hex(expected); + if (BN_is_zero(actual) && BN_is_negative(actual)) + actstr = OPENSSL_strdup("-0"); + else + actstr = BN_bn2hex(actual); if (exstr == NULL || actstr == NULL) goto err; |