diff options
Diffstat (limited to 'src/lib/libcrypto/bn/bn_gcd.c')
-rw-r--r-- | src/lib/libcrypto/bn/bn_gcd.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index d756398c8f..3d92a43cef 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.16 2021/12/26 15:16:50 tb Exp $ */ | 1 | /* $OpenBSD: bn_gcd.c,v 1.17 2022/11/26 13:56:33 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 | * |
@@ -123,8 +123,6 @@ BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) | |||
123 | BIGNUM *a, *b, *t; | 123 | BIGNUM *a, *b, *t; |
124 | int ret = 0; | 124 | int ret = 0; |
125 | 125 | ||
126 | bn_check_top(in_a); | ||
127 | bn_check_top(in_b); | ||
128 | 126 | ||
129 | BN_CTX_start(ctx); | 127 | BN_CTX_start(ctx); |
130 | if ((a = BN_CTX_get(ctx)) == NULL) | 128 | if ((a = BN_CTX_get(ctx)) == NULL) |
@@ -154,7 +152,6 @@ BN_gcd(BIGNUM *r, const BIGNUM *in_a, const BIGNUM *in_b, BN_CTX *ctx) | |||
154 | 152 | ||
155 | err: | 153 | err: |
156 | BN_CTX_end(ctx); | 154 | BN_CTX_end(ctx); |
157 | bn_check_top(r); | ||
158 | return (ret); | 155 | return (ret); |
159 | } | 156 | } |
160 | 157 | ||
@@ -179,8 +176,6 @@ euclid(BIGNUM *a, BIGNUM *b) | |||
179 | BIGNUM *t; | 176 | BIGNUM *t; |
180 | int shifts = 0; | 177 | int shifts = 0; |
181 | 178 | ||
182 | bn_check_top(a); | ||
183 | bn_check_top(b); | ||
184 | 179 | ||
185 | /* 0 <= b <= a */ | 180 | /* 0 <= b <= a */ |
186 | while (!BN_is_zero(b)) { | 181 | while (!BN_is_zero(b)) { |
@@ -236,7 +231,6 @@ euclid(BIGNUM *a, BIGNUM *b) | |||
236 | if (!BN_lshift(a, a, shifts)) | 231 | if (!BN_lshift(a, a, shifts)) |
237 | goto err; | 232 | goto err; |
238 | } | 233 | } |
239 | bn_check_top(a); | ||
240 | return (a); | 234 | return (a); |
241 | 235 | ||
242 | err: | 236 | err: |
@@ -259,8 +253,6 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
259 | if (ct) | 253 | if (ct) |
260 | return BN_mod_inverse_no_branch(in, a, n, ctx); | 254 | return BN_mod_inverse_no_branch(in, a, n, ctx); |
261 | 255 | ||
262 | bn_check_top(a); | ||
263 | bn_check_top(n); | ||
264 | 256 | ||
265 | BN_CTX_start(ctx); | 257 | BN_CTX_start(ctx); |
266 | if ((A = BN_CTX_get(ctx)) == NULL) | 258 | if ((A = BN_CTX_get(ctx)) == NULL) |
@@ -536,7 +528,6 @@ err: | |||
536 | if ((ret == NULL) && (in == NULL)) | 528 | if ((ret == NULL) && (in == NULL)) |
537 | BN_free(R); | 529 | BN_free(R); |
538 | BN_CTX_end(ctx); | 530 | BN_CTX_end(ctx); |
539 | bn_check_top(ret); | ||
540 | return (ret); | 531 | return (ret); |
541 | } | 532 | } |
542 | 533 | ||
@@ -573,8 +564,6 @@ BN_mod_inverse_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, | |||
573 | BIGNUM *ret = NULL; | 564 | BIGNUM *ret = NULL; |
574 | int sign; | 565 | int sign; |
575 | 566 | ||
576 | bn_check_top(a); | ||
577 | bn_check_top(n); | ||
578 | 567 | ||
579 | BN_init(&local_A); | 568 | BN_init(&local_A); |
580 | BN_init(&local_B); | 569 | BN_init(&local_B); |
@@ -725,7 +714,6 @@ err: | |||
725 | if ((ret == NULL) && (in == NULL)) | 714 | if ((ret == NULL) && (in == NULL)) |
726 | BN_free(R); | 715 | BN_free(R); |
727 | BN_CTX_end(ctx); | 716 | BN_CTX_end(ctx); |
728 | bn_check_top(ret); | ||
729 | return (ret); | 717 | return (ret); |
730 | } | 718 | } |
731 | 719 | ||
@@ -750,8 +738,6 @@ BN_gcd_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, | |||
750 | BN_init(&local_A); | 738 | BN_init(&local_A); |
751 | BN_init(&local_B); | 739 | BN_init(&local_B); |
752 | 740 | ||
753 | bn_check_top(a); | ||
754 | bn_check_top(n); | ||
755 | 741 | ||
756 | BN_CTX_start(ctx); | 742 | BN_CTX_start(ctx); |
757 | if ((A = BN_CTX_get(ctx)) == NULL) | 743 | if ((A = BN_CTX_get(ctx)) == NULL) |
@@ -871,6 +857,5 @@ err: | |||
871 | if ((ret == NULL) && (in == NULL)) | 857 | if ((ret == NULL) && (in == NULL)) |
872 | BN_free(R); | 858 | BN_free(R); |
873 | BN_CTX_end(ctx); | 859 | BN_CTX_end(ctx); |
874 | bn_check_top(ret); | ||
875 | return (ret); | 860 | return (ret); |
876 | } | 861 | } |