From 54681f6e5b689299bada4363adc2edc46a1d67b4 Mon Sep 17 00:00:00 2001 From: Richard Levitte Date: Mon, 27 Oct 2025 20:47:44 +0100 Subject: [PATCH] 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) --- crypto/bn/bn_exp.c | 1 + 1 file changed, 1 insertion(+) 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)) -- 2.47.3