diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_gcd.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_gcd.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index fa5d71a7f3..319d9ca390 100644 --- a/src/lib/libcrypto/bn/bn_gcd.c +++ b/src/lib/libcrypto/bn/bn_gcd.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: bn_gcd.c,v 1.29 2024/04/10 14:58:06 beck Exp $ */ | 1 | /* $OpenBSD: bn_gcd.c,v 1.31 2025/06/02 12:40: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 | * |
@@ -109,9 +109,8 @@ | |||
109 | * | 109 | * |
110 | */ | 110 | */ |
111 | 111 | ||
112 | #include <openssl/err.h> | ||
113 | |||
114 | #include "bn_local.h" | 112 | #include "bn_local.h" |
113 | #include "err_local.h" | ||
115 | 114 | ||
116 | static BIGNUM * | 115 | static BIGNUM * |
117 | euclid(BIGNUM *a, BIGNUM *b) | 116 | euclid(BIGNUM *a, BIGNUM *b) |
@@ -681,8 +680,10 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
681 | /* A >= 2*B, so D=2 or D=3 */ | 680 | /* A >= 2*B, so D=2 or D=3 */ |
682 | if (!BN_sub(M, A, T)) | 681 | if (!BN_sub(M, A, T)) |
683 | goto err; | 682 | goto err; |
684 | if (!BN_add(D,T,B)) goto err; /* use D (:= 3*B) as temp */ | 683 | /* use D (:= 3*B) as temp */ |
685 | if (BN_ucmp(A, D) < 0) { | 684 | if (!BN_add(D, T, B)) |
685 | goto err; | ||
686 | if (BN_ucmp(A, D) < 0) { | ||
686 | /* A < 3*B, so D=2 */ | 687 | /* A < 3*B, so D=2 */ |
687 | if (!BN_set_word(D, 2)) | 688 | if (!BN_set_word(D, 2)) |
688 | goto err; | 689 | goto err; |