From: Andy Polyakov Date: Wed, 25 Jul 2018 08:29:51 +0000 (+0200) Subject: bn/bn_mod.c: harmonize BN_mod_add_quick with original implementation. X-Git-Tag: OpenSSL_1_1_0i~23 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=ed04bcf67426888e8f8556b9eb37e9e2cf4eb04b;p=oweals%2Fopenssl.git bn/bn_mod.c: harmonize BN_mod_add_quick with original implementation. New implementation failed to correctly reset r->neg flag. Spotted by OSSFuzz. Reviewed-by: Rich Salz (Merged from https://github.com/openssl/openssl/pull/6796) (cherry picked from commit 70a579ae2f37437a1e02331eeaa84e1b68ba021e) --- diff --git a/crypto/bn/bn_mod.c b/crypto/bn/bn_mod.c index 99929f9278..e33e3f3eb9 100644 --- a/crypto/bn/bn_mod.c +++ b/crypto/bn/bn_mod.c @@ -83,6 +83,7 @@ int bn_mod_add_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, ((volatile BN_ULONG *)tp)[i] = 0; } r->top = mtop; + r->neg = 0; if (tp != storage) OPENSSL_free(tp);