summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto')
-rw-r--r--src/lib/libcrypto/bn/bn_exp.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c
index 4011bb4890..9abf574b57 100644
--- a/src/lib/libcrypto/bn/bn_exp.c
+++ b/src/lib/libcrypto/bn/bn_exp.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: bn_exp.c,v 1.37 2023/02/03 05:30:49 jsing Exp $ */ 1/* $OpenBSD: bn_exp.c,v 1.38 2023/03/15 04:30:20 jsing Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -459,12 +459,9 @@ BN_mod_exp_mont_consttime(BIGNUM *rr, const BIGNUM *a, const BIGNUM *p,
459#endif 459#endif
460 460
461 /* prepare a^1 in Montgomery domain */ 461 /* prepare a^1 in Montgomery domain */
462 if (a->neg || BN_ucmp(a, m) >= 0) { 462 if (!BN_nnmod(&am, a, m, ctx))
463 if (!BN_mod_ct(&am, a,m, ctx)) 463 goto err;
464 goto err; 464 if (!BN_to_montgomery(&am, &am, mont, ctx))
465 if (!BN_to_montgomery(&am, &am, mont, ctx))
466 goto err;
467 } else if (!BN_to_montgomery(&am, a,mont, ctx))
468 goto err; 465 goto err;
469 466
470#if defined(OPENSSL_BN_ASM_MONT5) 467#if defined(OPENSSL_BN_ASM_MONT5)