From: Richard Levitte Date: Mon, 27 Oct 2025 19:47:44 +0000 (+0100) Subject: Set the 'tmp' flag BN_FLG_FIXED_TOP in bn_mod_exp_mont_fixed_top() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=54681f6e5b689299bada4363adc2edc46a1d67b4;p=thirdparty%2Fopenssl.git Set the 'tmp' flag BN_FLG_FIXED_TOP in bn_mod_exp_mont_fixed_top() If not set, bn_check_top() trips when BN_DEBUG is defined Reviewed-by: Dmitry Belyavskiy Reviewed-by: Tom Cosgrove Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/28801) --- diff --git a/crypto/bn/bn_exp.c b/crypto/bn/bn_exp.c index 1dda2e017f1..ae6d9a21005 100644 --- a/crypto/bn/bn_exp.c +++ b/crypto/bn/bn_exp.c @@ -766,6 +766,7 @@ int bn_mod_exp_mont_fixed_top(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p, for (i = 1; i < top; i++) tmp.d[i] = (~m->d[i]) & BN_MASK2; tmp.top = top; + tmp.flags |= BN_FLG_FIXED_TOP; } else #endif if (!bn_to_mont_fixed_top(&tmp, BN_value_one(), mont, ctx))