summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/bn_gcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/bn/bn_gcd.c')
-rw-r--r--src/lib/libcrypto/bn/bn_gcd.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c
index 84c3d85850..138befc868 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.21 2023/01/21 09:21:11 jsing Exp $ */ 1/* $OpenBSD: bn_gcd.c,v 1.22 2023/03/27 10:21:23 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 *
@@ -221,9 +221,9 @@ BN_gcd_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n,
221 if (!BN_one(X)) 221 if (!BN_one(X))
222 goto err; 222 goto err;
223 BN_zero(Y); 223 BN_zero(Y);
224 if (BN_copy(B, a) == NULL) 224 if (!bn_copy(B, a))
225 goto err; 225 goto err;
226 if (BN_copy(A, n) == NULL) 226 if (!bn_copy(A, n))
227 goto err; 227 goto err;
228 A->neg = 0; 228 A->neg = 0;
229 229
@@ -337,9 +337,9 @@ BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
337 if ((b = BN_CTX_get(ctx)) == NULL) 337 if ((b = BN_CTX_get(ctx)) == NULL)
338 goto err; 338 goto err;
339 339
340 if (BN_copy(a, in_a) == NULL) 340 if (!bn_copy(a, in_a))
341 goto err; 341 goto err;
342 if (BN_copy(b, in_b) == NULL) 342 if (!bn_copy(b, in_b))
343 goto err; 343 goto err;
344 a->neg = 0; 344 a->neg = 0;
345 b->neg = 0; 345 b->neg = 0;
@@ -353,7 +353,7 @@ BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx)
353 if (t == NULL) 353 if (t == NULL)
354 goto err; 354 goto err;
355 355
356 if (BN_copy(r, t) == NULL) 356 if (!bn_copy(r, t))
357 goto err; 357 goto err;
358 ret = 1; 358 ret = 1;
359 359
@@ -419,9 +419,9 @@ BN_mod_inverse_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n,
419 if (!BN_one(X)) 419 if (!BN_one(X))
420 goto err; 420 goto err;
421 BN_zero(Y); 421 BN_zero(Y);
422 if (BN_copy(B, a) == NULL) 422 if (!bn_copy(B, a))
423 goto err; 423 goto err;
424 if (BN_copy(A, n) == NULL) 424 if (!bn_copy(A, n))
425 goto err; 425 goto err;
426 A->neg = 0; 426 A->neg = 0;
427 427
@@ -582,9 +582,9 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct
582 if (!BN_one(X)) 582 if (!BN_one(X))
583 goto err; 583 goto err;
584 BN_zero(Y); 584 BN_zero(Y);
585 if (BN_copy(B, a) == NULL) 585 if (!bn_copy(B, a))
586 goto err; 586 goto err;
587 if (BN_copy(A, n) == NULL) 587 if (!bn_copy(A, n))
588 goto err; 588 goto err;
589 A->neg = 0; 589 A->neg = 0;
590 if (B->neg || (BN_ucmp(B, A) >= 0)) { 590 if (B->neg || (BN_ucmp(B, A) >= 0)) {