From: Richard Levitte Date: Wed, 1 Feb 2017 01:29:46 +0000 (+0100) Subject: bn: fix occurance of negative zero in BN_rshift1() X-Git-Tag: OpenSSL_1_1_0e~37 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dfb109c522a450af7f387d66ad32afeee87f9805;p=openssl bn: fix occurance of negative zero in BN_rshift1() Reviewed-by: Rich Salz (cherry picked from commit 0a2dcb6990dacc94337f746f4f4a6dfac1fbeac4) --- diff --git a/crypto/bn/bn_shift.c b/crypto/bn/bn_shift.c index b320602871..6a1eec80af 100644 --- a/crypto/bn/bn_shift.c +++ b/crypto/bn/bn_shift.c @@ -74,6 +74,8 @@ int BN_rshift1(BIGNUM *r, const BIGNUM *a) c = (t & 1) ? BN_TBIT : 0; } r->top = j; + if (!r->top) + r->neg = 0; /* don't allow negative zero */ bn_check_top(r); return (1); }