summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_exp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_exp.c')
-rw-r--r--src/lib/libcrypto/bn/bn_exp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c
index 8ff518e938..129c12495c 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.54 2025/01/21 15:44:22 tb Exp $ */ 1/* $OpenBSD: bn_exp.c,v 1.55 2025/01/22 10:08:10 tb 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 *
@@ -1023,7 +1023,7 @@ BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
1023 1023
1024 window = BN_window_bits_for_exponent_size(bits); 1024 window = BN_window_bits_for_exponent_size(bits);
1025 if (window > 1) { 1025 if (window > 1) {
1026 if (!BN_mod_mul_reciprocal(aa, val[0], val[0], recp, ctx)) 1026 if (!BN_mod_sqr_reciprocal(aa, val[0], recp, ctx))
1027 goto err; 1027 goto err;
1028 j = 1 << (window - 1); 1028 j = 1 << (window - 1);
1029 for (i = 1; i < j; i++) { 1029 for (i = 1; i < j; i++) {
@@ -1047,7 +1047,7 @@ BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
1047 for (;;) { 1047 for (;;) {
1048 if (BN_is_bit_set(q, wstart) == 0) { 1048 if (BN_is_bit_set(q, wstart) == 0) {
1049 if (!start) 1049 if (!start)
1050 if (!BN_mod_mul_reciprocal(r, r, r, recp, ctx)) 1050 if (!BN_mod_sqr_reciprocal(r, r, recp, ctx))
1051 goto err; 1051 goto err;
1052 if (wstart == 0) 1052 if (wstart == 0)
1053 break; 1053 break;
@@ -1076,7 +1076,7 @@ BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m,
1076 /* add the 'bytes above' */ 1076 /* add the 'bytes above' */
1077 if (!start) 1077 if (!start)
1078 for (i = 0; i < j; i++) { 1078 for (i = 0; i < j; i++) {
1079 if (!BN_mod_mul_reciprocal(r, r, r, recp, ctx)) 1079 if (!BN_mod_sqr_reciprocal(r, r, recp, ctx))
1080 goto err; 1080 goto err;
1081 } 1081 }
1082 1082