From 6a815969776e3329fdffcc12c77e047e3a15be78 Mon Sep 17 00:00:00 2001 From: Andy Polyakov Date: Wed, 25 Jul 2018 10:29:51 +0200 Subject: [PATCH] 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/6810) (cherry picked from commit 70a579ae2f37437a1e02331eeaa84e1b68ba021e) --- crypto/bn/bn_mod.c | 1 + 1 file changed, 1 insertion(+) diff --git a/crypto/bn/bn_mod.c b/crypto/bn/bn_mod.c index df6f1e2452..23ddd4805d 100644 --- a/crypto/bn/bn_mod.c +++ b/crypto/bn/bn_mod.c @@ -197,6 +197,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); -- 2.25.1