diff options
| author | tb <> | 2023-03-27 10:25:02 +0000 |
|---|---|---|
| committer | tb <> | 2023-03-27 10:25:02 +0000 |
| commit | f01ccc7c36ff1a6f9eaa959f859f2fe82c336039 (patch) | |
| tree | ba91913b4904177f237fb62457d06d7234e7ad69 /src/lib/libcrypto/bn | |
| parent | 00aea13536dd9c7115e084e54260c208dfdfb18a (diff) | |
| download | openbsd-f01ccc7c36ff1a6f9eaa959f859f2fe82c336039.tar.gz openbsd-f01ccc7c36ff1a6f9eaa959f859f2fe82c336039.tar.bz2 openbsd-f01ccc7c36ff1a6f9eaa959f859f2fe82c336039.zip | |
Replace the remaining BN_copy() with bn_copy()
ok jsing
Diffstat (limited to 'src/lib/libcrypto/bn')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_blind.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_exp.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_gcd.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_gf2m.c | 18 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_isqrt.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mont.c | 8 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_recp.c | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_sqrt.c | 10 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/bn_x931p.c | 6 |
10 files changed, 38 insertions, 38 deletions
diff --git a/src/lib/libcrypto/bn/bn_blind.c b/src/lib/libcrypto/bn/bn_blind.c index 61d0cf7a95..9c07f33e1f 100644 --- a/src/lib/libcrypto/bn/bn_blind.c +++ b/src/lib/libcrypto/bn/bn_blind.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_blind.c,v 1.20 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: bn_blind.c,v 1.21 2023/03/27 10:25:02 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. | 3 | * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. |
| 4 | * | 4 | * |
| @@ -244,7 +244,7 @@ BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx) | |||
| 244 | return (0); | 244 | return (0); |
| 245 | 245 | ||
| 246 | if (r != NULL) { | 246 | if (r != NULL) { |
| 247 | if (!BN_copy(r, b->Ai)) | 247 | if (!bn_copy(r, b->Ai)) |
| 248 | ret = 0; | 248 | ret = 0; |
| 249 | } | 249 | } |
| 250 | 250 | ||
diff --git a/src/lib/libcrypto/bn/bn_exp.c b/src/lib/libcrypto/bn/bn_exp.c index b756d2b305..4e90d5d871 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.43 2023/03/27 10:22:47 tb Exp $ */ | 1 | /* $OpenBSD: bn_exp.c,v 1.44 2023/03/27 10:25:02 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 | * |
| @@ -816,7 +816,7 @@ BN_mod_exp_mont_word(BIGNUM *rr, BN_ULONG a, const BIGNUM *p, const BIGNUM *m, | |||
| 816 | (BN_mod_ct(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1)))) | 816 | (BN_mod_ct(t, r, m, ctx) && (swap_tmp = r, r = t, t = swap_tmp, 1)))) |
| 817 | /* BN_MOD_MUL_WORD is only used with 'w' large, | 817 | /* BN_MOD_MUL_WORD is only used with 'w' large, |
| 818 | * so the BN_ucmp test is probably more overhead | 818 | * so the BN_ucmp test is probably more overhead |
| 819 | * than always using BN_mod (which uses BN_copy if | 819 | * than always using BN_mod (which uses bn_copy if |
| 820 | * a similar test returns true). */ | 820 | * a similar test returns true). */ |
| 821 | /* We can use BN_mod and do not need BN_nnmod because our | 821 | /* We can use BN_mod and do not need BN_nnmod because our |
| 822 | * accumulator is never negative (the result of BN_mod does | 822 | * accumulator is never negative (the result of BN_mod does |
| @@ -985,7 +985,7 @@ BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, | |||
| 985 | 985 | ||
| 986 | if (m->neg) { | 986 | if (m->neg) { |
| 987 | /* ignore sign of 'm' */ | 987 | /* ignore sign of 'm' */ |
| 988 | if (!BN_copy(aa, m)) | 988 | if (!bn_copy(aa, m)) |
| 989 | goto err; | 989 | goto err; |
| 990 | aa->neg = 0; | 990 | aa->neg = 0; |
| 991 | if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0) | 991 | if (BN_RECP_CTX_set(&recp, aa, ctx) <= 0) |
diff --git a/src/lib/libcrypto/bn/bn_gcd.c b/src/lib/libcrypto/bn/bn_gcd.c index 138befc868..4a79f26c6f 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.22 2023/03/27 10:21:23 tb Exp $ */ | 1 | /* $OpenBSD: bn_gcd.c,v 1.23 2023/03/27 10:25:02 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 | * |
| @@ -314,7 +314,7 @@ BN_gcd_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, | |||
| 314 | * A == gcd(a,n); | 314 | * A == gcd(a,n); |
| 315 | */ | 315 | */ |
| 316 | 316 | ||
| 317 | if (!BN_copy(R, A)) | 317 | if (!bn_copy(R, A)) |
| 318 | goto err; | 318 | goto err; |
| 319 | ret = R; | 319 | ret = R; |
| 320 | err: | 320 | err: |
| @@ -524,7 +524,7 @@ BN_mod_inverse_no_branch(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, | |||
| 524 | if (BN_is_one(A)) { | 524 | if (BN_is_one(A)) { |
| 525 | /* Y*a == 1 (mod |n|) */ | 525 | /* Y*a == 1 (mod |n|) */ |
| 526 | if (!Y->neg && BN_ucmp(Y, n) < 0) { | 526 | if (!Y->neg && BN_ucmp(Y, n) < 0) { |
| 527 | if (!BN_copy(R, Y)) | 527 | if (!bn_copy(R, Y)) |
| 528 | goto err; | 528 | goto err; |
| 529 | } else { | 529 | } else { |
| 530 | if (!BN_nnmod(R, Y, n, ctx)) | 530 | if (!BN_nnmod(R, Y, n, ctx)) |
| @@ -779,7 +779,7 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
| 779 | if (!BN_lshift(tmp, X, 2)) | 779 | if (!BN_lshift(tmp, X, 2)) |
| 780 | goto err; | 780 | goto err; |
| 781 | } else if (D->top == 1) { | 781 | } else if (D->top == 1) { |
| 782 | if (!BN_copy(tmp, X)) | 782 | if (!bn_copy(tmp, X)) |
| 783 | goto err; | 783 | goto err; |
| 784 | if (!BN_mul_word(tmp, D->d[0])) | 784 | if (!BN_mul_word(tmp, D->d[0])) |
| 785 | goto err; | 785 | goto err; |
| @@ -815,7 +815,7 @@ BN_mod_inverse_internal(BIGNUM *in, const BIGNUM *a, const BIGNUM *n, BN_CTX *ct | |||
| 815 | if (BN_is_one(A)) { | 815 | if (BN_is_one(A)) { |
| 816 | /* Y*a == 1 (mod |n|) */ | 816 | /* Y*a == 1 (mod |n|) */ |
| 817 | if (!Y->neg && BN_ucmp(Y, n) < 0) { | 817 | if (!Y->neg && BN_ucmp(Y, n) < 0) { |
| 818 | if (!BN_copy(R, Y)) | 818 | if (!bn_copy(R, Y)) |
| 819 | goto err; | 819 | goto err; |
| 820 | } else { | 820 | } else { |
| 821 | if (!BN_nnmod(R, Y,n, ctx)) | 821 | if (!BN_nnmod(R, Y,n, ctx)) |
diff --git a/src/lib/libcrypto/bn/bn_gf2m.c b/src/lib/libcrypto/bn/bn_gf2m.c index 3a0accb4a2..62ac2a5151 100644 --- a/src/lib/libcrypto/bn/bn_gf2m.c +++ b/src/lib/libcrypto/bn/bn_gf2m.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_gf2m.c,v 1.31 2023/03/27 10:20:27 tb Exp $ */ | 1 | /* $OpenBSD: bn_gf2m.c,v 1.32 2023/03/27 10:25:02 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -643,7 +643,7 @@ BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 643 | if (BN_is_zero(u)) | 643 | if (BN_is_zero(u)) |
| 644 | goto err; | 644 | goto err; |
| 645 | 645 | ||
| 646 | if (!BN_copy(v, p)) | 646 | if (!bn_copy(v, p)) |
| 647 | goto err; | 647 | goto err; |
| 648 | #if 0 | 648 | #if 0 |
| 649 | if (!BN_one(b)) | 649 | if (!BN_one(b)) |
| @@ -773,7 +773,7 @@ BN_GF2m_mod_inv(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 773 | } | 773 | } |
| 774 | #endif | 774 | #endif |
| 775 | 775 | ||
| 776 | if (!BN_copy(r, b)) | 776 | if (!bn_copy(r, b)) |
| 777 | goto err; | 777 | goto err; |
| 778 | ret = 1; | 778 | ret = 1; |
| 779 | 779 | ||
| @@ -865,7 +865,7 @@ BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, const BIGNUM *p, | |||
| 865 | goto err; | 865 | goto err; |
| 866 | if (!BN_GF2m_mod(a, x, p)) | 866 | if (!BN_GF2m_mod(a, x, p)) |
| 867 | goto err; | 867 | goto err; |
| 868 | if (!BN_copy(b, p)) | 868 | if (!bn_copy(b, p)) |
| 869 | goto err; | 869 | goto err; |
| 870 | 870 | ||
| 871 | while (!BN_is_odd(a)) { | 871 | while (!BN_is_odd(a)) { |
| @@ -912,7 +912,7 @@ BN_GF2m_mod_div(BIGNUM *r, const BIGNUM *y, const BIGNUM *x, const BIGNUM *p, | |||
| 912 | } | 912 | } |
| 913 | } while (1); | 913 | } while (1); |
| 914 | 914 | ||
| 915 | if (!BN_copy(r, u)) | 915 | if (!bn_copy(r, u)) |
| 916 | goto err; | 916 | goto err; |
| 917 | ret = 1; | 917 | ret = 1; |
| 918 | 918 | ||
| @@ -985,7 +985,7 @@ BN_GF2m_mod_exp_arr(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, const int p[], | |||
| 985 | goto err; | 985 | goto err; |
| 986 | } | 986 | } |
| 987 | } | 987 | } |
| 988 | if (!BN_copy(r, u)) | 988 | if (!bn_copy(r, u)) |
| 989 | goto err; | 989 | goto err; |
| 990 | ret = 1; | 990 | ret = 1; |
| 991 | 991 | ||
| @@ -1117,7 +1117,7 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
| 1117 | if (p[0] & 0x1) /* m is odd */ | 1117 | if (p[0] & 0x1) /* m is odd */ |
| 1118 | { | 1118 | { |
| 1119 | /* compute half-trace of a */ | 1119 | /* compute half-trace of a */ |
| 1120 | if (!BN_copy(z, a)) | 1120 | if (!bn_copy(z, a)) |
| 1121 | goto err; | 1121 | goto err; |
| 1122 | for (j = 1; j <= (p[0] - 1) / 2; j++) { | 1122 | for (j = 1; j <= (p[0] - 1) / 2; j++) { |
| 1123 | if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) | 1123 | if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) |
| @@ -1143,7 +1143,7 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
| 1143 | if (!BN_GF2m_mod_arr(rho, rho, p)) | 1143 | if (!BN_GF2m_mod_arr(rho, rho, p)) |
| 1144 | goto err; | 1144 | goto err; |
| 1145 | BN_zero(z); | 1145 | BN_zero(z); |
| 1146 | if (!BN_copy(w, rho)) | 1146 | if (!bn_copy(w, rho)) |
| 1147 | goto err; | 1147 | goto err; |
| 1148 | for (j = 1; j <= p[0] - 1; j++) { | 1148 | for (j = 1; j <= p[0] - 1; j++) { |
| 1149 | if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) | 1149 | if (!BN_GF2m_mod_sqr_arr(z, z, p, ctx)) |
| @@ -1174,7 +1174,7 @@ BN_GF2m_mod_solve_quad_arr(BIGNUM *r, const BIGNUM *a_, const int p[], | |||
| 1174 | goto err; | 1174 | goto err; |
| 1175 | } | 1175 | } |
| 1176 | 1176 | ||
| 1177 | if (!BN_copy(r, z)) | 1177 | if (!bn_copy(r, z)) |
| 1178 | goto err; | 1178 | goto err; |
| 1179 | 1179 | ||
| 1180 | ret = 1; | 1180 | ret = 1; |
diff --git a/src/lib/libcrypto/bn/bn_isqrt.c b/src/lib/libcrypto/bn/bn_isqrt.c index ec77e1b078..4a757b02ce 100644 --- a/src/lib/libcrypto/bn/bn_isqrt.c +++ b/src/lib/libcrypto/bn/bn_isqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_isqrt.c,v 1.6 2022/12/17 15:56:25 jsing Exp $ */ | 1 | /* $OpenBSD: bn_isqrt.c,v 1.7 2023/03/27 10:25:02 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2022 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -141,7 +141,7 @@ bn_isqrt(BIGNUM *out_sqrt, int *out_perfect, const BIGNUM *n, BN_CTX *in_ctx) | |||
| 141 | *out_perfect = perfect; | 141 | *out_perfect = perfect; |
| 142 | 142 | ||
| 143 | if (out_sqrt != NULL) { | 143 | if (out_sqrt != NULL) { |
| 144 | if (!BN_copy(out_sqrt, a)) | 144 | if (!bn_copy(out_sqrt, a)) |
| 145 | goto err; | 145 | goto err; |
| 146 | } | 146 | } |
| 147 | 147 | ||
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 9da03e2c6e..49cc6662db 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.77 2023/03/27 08:37:33 tb Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.78 2023/03/27 10:25:02 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 | * |
| @@ -333,7 +333,7 @@ BN_dup(const BIGNUM *a) | |||
| 333 | t = BN_new(); | 333 | t = BN_new(); |
| 334 | if (t == NULL) | 334 | if (t == NULL) |
| 335 | return NULL; | 335 | return NULL; |
| 336 | if (!BN_copy(t, a)) { | 336 | if (!bn_copy(t, a)) { |
| 337 | BN_free(t); | 337 | BN_free(t); |
| 338 | return NULL; | 338 | return NULL; |
| 339 | } | 339 | } |
diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index b7b2384cff..4b904c876a 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mont.c,v 1.54 2023/03/27 10:21:23 tb Exp $ */ | 1 | /* $OpenBSD: bn_mont.c,v 1.55 2023/03/27 10:25:02 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 | * |
| @@ -166,9 +166,9 @@ BN_MONT_CTX_copy(BN_MONT_CTX *dst, BN_MONT_CTX *src) | |||
| 166 | if (dst == src) | 166 | if (dst == src) |
| 167 | return dst; | 167 | return dst; |
| 168 | 168 | ||
| 169 | if (!BN_copy(&dst->RR, &src->RR)) | 169 | if (!bn_copy(&dst->RR, &src->RR)) |
| 170 | return NULL; | 170 | return NULL; |
| 171 | if (!BN_copy(&dst->N, &src->N)) | 171 | if (!bn_copy(&dst->N, &src->N)) |
| 172 | return NULL; | 172 | return NULL; |
| 173 | 173 | ||
| 174 | dst->ri = src->ri; | 174 | dst->ri = src->ri; |
| @@ -198,7 +198,7 @@ BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx) | |||
| 198 | /* Save modulus and determine length of R. */ | 198 | /* Save modulus and determine length of R. */ |
| 199 | if (BN_is_zero(mod)) | 199 | if (BN_is_zero(mod)) |
| 200 | goto err; | 200 | goto err; |
| 201 | if (!BN_copy(&mont->N, mod)) | 201 | if (!bn_copy(&mont->N, mod)) |
| 202 | goto err; | 202 | goto err; |
| 203 | mont->N.neg = 0; | 203 | mont->N.neg = 0; |
| 204 | mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2; | 204 | mont->ri = ((BN_num_bits(mod) + BN_BITS2 - 1) / BN_BITS2) * BN_BITS2; |
diff --git a/src/lib/libcrypto/bn/bn_recp.c b/src/lib/libcrypto/bn/bn_recp.c index 117f8933bb..35390e30d4 100644 --- a/src/lib/libcrypto/bn/bn_recp.c +++ b/src/lib/libcrypto/bn/bn_recp.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_recp.c,v 1.18 2023/02/13 04:25:37 jsing Exp $ */ | 1 | /* $OpenBSD: bn_recp.c,v 1.19 2023/03/27 10:25:02 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 | * |
| @@ -99,7 +99,7 @@ BN_RECP_CTX_free(BN_RECP_CTX *recp) | |||
| 99 | int | 99 | int |
| 100 | BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) | 100 | BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *d, BN_CTX *ctx) |
| 101 | { | 101 | { |
| 102 | if (!BN_copy(&(recp->N), d)) | 102 | if (!bn_copy(&(recp->N), d)) |
| 103 | return 0; | 103 | return 0; |
| 104 | BN_zero(&(recp->Nr)); | 104 | BN_zero(&(recp->Nr)); |
| 105 | recp->num_bits = BN_num_bits(d); | 105 | recp->num_bits = BN_num_bits(d); |
| @@ -160,7 +160,7 @@ BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, | |||
| 160 | 160 | ||
| 161 | if (BN_ucmp(m, &(recp->N)) < 0) { | 161 | if (BN_ucmp(m, &(recp->N)) < 0) { |
| 162 | BN_zero(d); | 162 | BN_zero(d); |
| 163 | if (!BN_copy(r, m)) { | 163 | if (!bn_copy(r, m)) { |
| 164 | BN_CTX_end(ctx); | 164 | BN_CTX_end(ctx); |
| 165 | return 0; | 165 | return 0; |
| 166 | } | 166 | } |
diff --git a/src/lib/libcrypto/bn/bn_sqrt.c b/src/lib/libcrypto/bn/bn_sqrt.c index 9bbca4267a..3d9f017f59 100644 --- a/src/lib/libcrypto/bn/bn_sqrt.c +++ b/src/lib/libcrypto/bn/bn_sqrt.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_sqrt.c,v 1.15 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: bn_sqrt.c,v 1.16 2023/03/27 10:25:02 tb Exp $ */ |
| 2 | /* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
| 3 | * and Bodo Moeller for the OpenSSL project. */ | 3 | * and Bodo Moeller for the OpenSSL project. */ |
| 4 | /* ==================================================================== | 4 | /* ==================================================================== |
| @@ -209,7 +209,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 209 | if (!BN_mod_mul(x, x, t, p, ctx)) | 209 | if (!BN_mod_mul(x, x, t, p, ctx)) |
| 210 | goto end; | 210 | goto end; |
| 211 | 211 | ||
| 212 | if (!BN_copy(ret, x)) | 212 | if (!bn_copy(ret, x)) |
| 213 | goto end; | 213 | goto end; |
| 214 | err = 0; | 214 | err = 0; |
| 215 | goto vrfy; | 215 | goto vrfy; |
| @@ -217,7 +217,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 217 | 217 | ||
| 218 | /* e > 2, so we really have to use the Tonelli/Shanks algorithm. | 218 | /* e > 2, so we really have to use the Tonelli/Shanks algorithm. |
| 219 | * First, find some y that is not a square. */ | 219 | * First, find some y that is not a square. */ |
| 220 | if (!BN_copy(q, p)) /* use 'q' as temp */ | 220 | if (!bn_copy(q, p)) /* use 'q' as temp */ |
| 221 | goto end; | 221 | goto end; |
| 222 | q->neg = 0; | 222 | q->neg = 0; |
| 223 | i = 2; | 223 | i = 2; |
| @@ -344,7 +344,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 344 | */ | 344 | */ |
| 345 | 345 | ||
| 346 | if (BN_is_one(b)) { | 346 | if (BN_is_one(b)) { |
| 347 | if (!BN_copy(ret, x)) | 347 | if (!bn_copy(ret, x)) |
| 348 | goto end; | 348 | goto end; |
| 349 | err = 0; | 349 | err = 0; |
| 350 | goto vrfy; | 350 | goto vrfy; |
| @@ -368,7 +368,7 @@ BN_mod_sqrt(BIGNUM *in, const BIGNUM *a, const BIGNUM *p, BN_CTX *ctx) | |||
| 368 | } | 368 | } |
| 369 | 369 | ||
| 370 | /* t := y^2^(e - i - 1) */ | 370 | /* t := y^2^(e - i - 1) */ |
| 371 | if (!BN_copy(t, y)) | 371 | if (!bn_copy(t, y)) |
| 372 | goto end; | 372 | goto end; |
| 373 | for (j = e - i - 1; j > 0; j--) { | 373 | for (j = e - i - 1; j > 0; j--) { |
| 374 | if (!BN_mod_sqr(t, t, p, ctx)) | 374 | if (!BN_mod_sqr(t, t, p, ctx)) |
diff --git a/src/lib/libcrypto/bn/bn_x931p.c b/src/lib/libcrypto/bn/bn_x931p.c index e73c416e3f..9105be11cd 100644 --- a/src/lib/libcrypto/bn/bn_x931p.c +++ b/src/lib/libcrypto/bn/bn_x931p.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_x931p.c,v 1.15 2022/12/26 07:18:51 jmc Exp $ */ | 1 | /* $OpenBSD: bn_x931p.c,v 1.16 2023/03/27 10:25:02 tb Exp $ */ |
| 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL | 2 | /* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL |
| 3 | * project 2005. | 3 | * project 2005. |
| 4 | */ | 4 | */ |
| @@ -73,7 +73,7 @@ bn_x931_derive_pi(BIGNUM *pi, const BIGNUM *Xpi, BN_CTX *ctx, BN_GENCB *cb) | |||
| 73 | { | 73 | { |
| 74 | int i = 0, is_prime; | 74 | int i = 0, is_prime; |
| 75 | 75 | ||
| 76 | if (!BN_copy(pi, Xpi)) | 76 | if (!bn_copy(pi, Xpi)) |
| 77 | return 0; | 77 | return 0; |
| 78 | if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) | 78 | if (!BN_is_odd(pi) && !BN_add_word(pi, 1)) |
| 79 | return 0; | 79 | return 0; |
| @@ -170,7 +170,7 @@ BN_X931_derive_prime_ex(BIGNUM *p, BIGNUM *p1, BIGNUM *p2, const BIGNUM *Xp, | |||
| 170 | for (;;) { | 170 | for (;;) { |
| 171 | int i = 1; | 171 | int i = 1; |
| 172 | BN_GENCB_call(cb, 0, i++); | 172 | BN_GENCB_call(cb, 0, i++); |
| 173 | if (!BN_copy(pm1, p)) | 173 | if (!bn_copy(pm1, p)) |
| 174 | goto err; | 174 | goto err; |
| 175 | if (!BN_sub_word(pm1, 1)) | 175 | if (!BN_sub_word(pm1, 1)) |
| 176 | goto err; | 176 | goto err; |
