diff options
Diffstat (limited to 'src/lib/libcrypto/ec')
-rw-r--r-- | src/lib/libcrypto/ec/ec2_mult.c | 6 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec2_smpl.c | 44 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_key.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 16 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_mont.c | 4 | ||||
-rw-r--r-- | src/lib/libcrypto/ec/ecp_smpl.c | 66 |
6 files changed, 70 insertions, 70 deletions
diff --git a/src/lib/libcrypto/ec/ec2_mult.c b/src/lib/libcrypto/ec/ec2_mult.c index 8b8aaf7122..d32b7442c4 100644 --- a/src/lib/libcrypto/ec/ec2_mult.c +++ b/src/lib/libcrypto/ec/ec2_mult.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_mult.c,v 1.15 2022/11/26 16:08:52 tb Exp $ */ | 1 | /* $OpenBSD: ec2_mult.c,v 1.16 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 | * |
@@ -137,7 +137,7 @@ gf2m_Madd(const EC_GROUP *group, const BIGNUM *x, BIGNUM *x1, BIGNUM *z1, | |||
137 | if ((t2 = BN_CTX_get(ctx)) == NULL) | 137 | if ((t2 = BN_CTX_get(ctx)) == NULL) |
138 | goto err; | 138 | goto err; |
139 | 139 | ||
140 | if (!BN_copy(t1, x)) | 140 | if (!bn_copy(t1, x)) |
141 | goto err; | 141 | goto err; |
142 | if (!group->meth->field_mul(group, x1, x1, z2, ctx)) | 142 | if (!group->meth->field_mul(group, x1, x1, z2, ctx)) |
143 | goto err; | 143 | goto err; |
@@ -183,7 +183,7 @@ gf2m_Mxy(const EC_GROUP *group, const BIGNUM *x, const BIGNUM *y, BIGNUM *x1, | |||
183 | return 1; | 183 | return 1; |
184 | } | 184 | } |
185 | if (BN_is_zero(z2)) { | 185 | if (BN_is_zero(z2)) { |
186 | if (!BN_copy(x2, x)) | 186 | if (!bn_copy(x2, x)) |
187 | return 0; | 187 | return 0; |
188 | if (!BN_GF2m_add(z2, x, y)) | 188 | if (!BN_GF2m_add(z2, x, y)) |
189 | return 0; | 189 | return 0; |
diff --git a/src/lib/libcrypto/ec/ec2_smpl.c b/src/lib/libcrypto/ec/ec2_smpl.c index 84cba1b83b..1ad339cbd7 100644 --- a/src/lib/libcrypto/ec/ec2_smpl.c +++ b/src/lib/libcrypto/ec/ec2_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec2_smpl.c,v 1.33 2023/03/08 05:45:31 jsing Exp $ */ | 1 | /* $OpenBSD: ec2_smpl.c,v 1.34 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 | * |
@@ -115,11 +115,11 @@ ec_GF2m_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
115 | { | 115 | { |
116 | int i; | 116 | int i; |
117 | 117 | ||
118 | if (!BN_copy(&dest->field, &src->field)) | 118 | if (!bn_copy(&dest->field, &src->field)) |
119 | return 0; | 119 | return 0; |
120 | if (!BN_copy(&dest->a, &src->a)) | 120 | if (!bn_copy(&dest->a, &src->a)) |
121 | return 0; | 121 | return 0; |
122 | if (!BN_copy(&dest->b, &src->b)) | 122 | if (!bn_copy(&dest->b, &src->b)) |
123 | return 0; | 123 | return 0; |
124 | dest->poly[0] = src->poly[0]; | 124 | dest->poly[0] = src->poly[0]; |
125 | dest->poly[1] = src->poly[1]; | 125 | dest->poly[1] = src->poly[1]; |
@@ -146,7 +146,7 @@ ec_GF2m_simple_group_set_curve(EC_GROUP *group, | |||
146 | int ret = 0, i; | 146 | int ret = 0, i; |
147 | 147 | ||
148 | /* group->field */ | 148 | /* group->field */ |
149 | if (!BN_copy(&group->field, p)) | 149 | if (!bn_copy(&group->field, p)) |
150 | goto err; | 150 | goto err; |
151 | i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1; | 151 | i = BN_GF2m_poly2arr(&group->field, group->poly, 6) - 1; |
152 | if ((i != 5) && (i != 3)) { | 152 | if ((i != 5) && (i != 3)) { |
@@ -185,15 +185,15 @@ ec_GF2m_simple_group_get_curve(const EC_GROUP *group, | |||
185 | int ret = 0; | 185 | int ret = 0; |
186 | 186 | ||
187 | if (p != NULL) { | 187 | if (p != NULL) { |
188 | if (!BN_copy(p, &group->field)) | 188 | if (!bn_copy(p, &group->field)) |
189 | return 0; | 189 | return 0; |
190 | } | 190 | } |
191 | if (a != NULL) { | 191 | if (a != NULL) { |
192 | if (!BN_copy(a, &group->a)) | 192 | if (!bn_copy(a, &group->a)) |
193 | goto err; | 193 | goto err; |
194 | } | 194 | } |
195 | if (b != NULL) { | 195 | if (b != NULL) { |
196 | if (!BN_copy(b, &group->b)) | 196 | if (!bn_copy(b, &group->b)) |
197 | goto err; | 197 | goto err; |
198 | } | 198 | } |
199 | ret = 1; | 199 | ret = 1; |
@@ -274,11 +274,11 @@ ec_GF2m_simple_point_finish(EC_POINT *point) | |||
274 | static int | 274 | static int |
275 | ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src) | 275 | ec_GF2m_simple_point_copy(EC_POINT *dest, const EC_POINT *src) |
276 | { | 276 | { |
277 | if (!BN_copy(&dest->X, &src->X)) | 277 | if (!bn_copy(&dest->X, &src->X)) |
278 | return 0; | 278 | return 0; |
279 | if (!BN_copy(&dest->Y, &src->Y)) | 279 | if (!bn_copy(&dest->Y, &src->Y)) |
280 | return 0; | 280 | return 0; |
281 | if (!BN_copy(&dest->Z, &src->Z)) | 281 | if (!bn_copy(&dest->Z, &src->Z)) |
282 | return 0; | 282 | return 0; |
283 | dest->Z_is_one = src->Z_is_one; | 283 | dest->Z_is_one = src->Z_is_one; |
284 | 284 | ||
@@ -310,13 +310,13 @@ ec_GF2m_simple_point_set_affine_coordinates(const EC_GROUP *group, EC_POINT *poi | |||
310 | ECerror(ERR_R_PASSED_NULL_PARAMETER); | 310 | ECerror(ERR_R_PASSED_NULL_PARAMETER); |
311 | return 0; | 311 | return 0; |
312 | } | 312 | } |
313 | if (!BN_copy(&point->X, x)) | 313 | if (!bn_copy(&point->X, x)) |
314 | goto err; | 314 | goto err; |
315 | BN_set_negative(&point->X, 0); | 315 | BN_set_negative(&point->X, 0); |
316 | if (!BN_copy(&point->Y, y)) | 316 | if (!bn_copy(&point->Y, y)) |
317 | goto err; | 317 | goto err; |
318 | BN_set_negative(&point->Y, 0); | 318 | BN_set_negative(&point->Y, 0); |
319 | if (!BN_copy(&point->Z, BN_value_one())) | 319 | if (!bn_copy(&point->Z, BN_value_one())) |
320 | goto err; | 320 | goto err; |
321 | BN_set_negative(&point->Z, 0); | 321 | BN_set_negative(&point->Z, 0); |
322 | point->Z_is_one = 1; | 322 | point->Z_is_one = 1; |
@@ -345,12 +345,12 @@ ec_GF2m_simple_point_get_affine_coordinates(const EC_GROUP *group, | |||
345 | return 0; | 345 | return 0; |
346 | } | 346 | } |
347 | if (x != NULL) { | 347 | if (x != NULL) { |
348 | if (!BN_copy(x, &point->X)) | 348 | if (!bn_copy(x, &point->X)) |
349 | goto err; | 349 | goto err; |
350 | BN_set_negative(x, 0); | 350 | BN_set_negative(x, 0); |
351 | } | 351 | } |
352 | if (y != NULL) { | 352 | if (y != NULL) { |
353 | if (!BN_copy(y, &point->Y)) | 353 | if (!bn_copy(y, &point->Y)) |
354 | goto err; | 354 | goto err; |
355 | BN_set_negative(y, 0); | 355 | BN_set_negative(y, 0); |
356 | } | 356 | } |
@@ -406,18 +406,18 @@ ec_GF2m_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, | |||
406 | goto err; | 406 | goto err; |
407 | 407 | ||
408 | if (a->Z_is_one) { | 408 | if (a->Z_is_one) { |
409 | if (!BN_copy(x0, &a->X)) | 409 | if (!bn_copy(x0, &a->X)) |
410 | goto err; | 410 | goto err; |
411 | if (!BN_copy(y0, &a->Y)) | 411 | if (!bn_copy(y0, &a->Y)) |
412 | goto err; | 412 | goto err; |
413 | } else { | 413 | } else { |
414 | if (!EC_POINT_get_affine_coordinates(group, a, x0, y0, ctx)) | 414 | if (!EC_POINT_get_affine_coordinates(group, a, x0, y0, ctx)) |
415 | goto err; | 415 | goto err; |
416 | } | 416 | } |
417 | if (b->Z_is_one) { | 417 | if (b->Z_is_one) { |
418 | if (!BN_copy(x1, &b->X)) | 418 | if (!bn_copy(x1, &b->X)) |
419 | goto err; | 419 | goto err; |
420 | if (!BN_copy(y1, &b->Y)) | 420 | if (!bn_copy(y1, &b->Y)) |
421 | goto err; | 421 | goto err; |
422 | } else { | 422 | } else { |
423 | if (!EC_POINT_get_affine_coordinates(group, b, x1, y1, ctx)) | 423 | if (!EC_POINT_get_affine_coordinates(group, b, x1, y1, ctx)) |
@@ -647,9 +647,9 @@ ec_GF2m_simple_make_affine(const EC_GROUP *group, EC_POINT *point, BN_CTX *ctx) | |||
647 | 647 | ||
648 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) | 648 | if (!EC_POINT_get_affine_coordinates(group, point, x, y, ctx)) |
649 | goto err; | 649 | goto err; |
650 | if (!BN_copy(&point->X, x)) | 650 | if (!bn_copy(&point->X, x)) |
651 | goto err; | 651 | goto err; |
652 | if (!BN_copy(&point->Y, y)) | 652 | if (!bn_copy(&point->Y, y)) |
653 | goto err; | 653 | goto err; |
654 | if (!BN_one(&point->Z)) | 654 | if (!BN_one(&point->Z)) |
655 | goto err; | 655 | goto err; |
diff --git a/src/lib/libcrypto/ec/ec_key.c b/src/lib/libcrypto/ec/ec_key.c index 3799498ab1..2f9f05cc56 100644 --- a/src/lib/libcrypto/ec/ec_key.c +++ b/src/lib/libcrypto/ec/ec_key.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_key.c,v 1.31 2023/03/07 09:27:10 jsing Exp $ */ | 1 | /* $OpenBSD: ec_key.c,v 1.32 2023/03/27 10:25:02 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project. | 3 | * Written by Nils Larsch for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -172,7 +172,7 @@ EC_KEY_copy(EC_KEY *dest, const EC_KEY *src) | |||
172 | if (dest->priv_key == NULL) | 172 | if (dest->priv_key == NULL) |
173 | return NULL; | 173 | return NULL; |
174 | } | 174 | } |
175 | if (!BN_copy(dest->priv_key, src->priv_key)) | 175 | if (!bn_copy(dest->priv_key, src->priv_key)) |
176 | return NULL; | 176 | return NULL; |
177 | } | 177 | } |
178 | /* copy method/extra data */ | 178 | /* copy method/extra data */ |
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 2d14f9c9c5..38ddd7af9f 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.51 2023/03/08 06:47:30 jsing Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.52 2023/03/27 10:25:02 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -181,9 +181,9 @@ EC_GROUP_copy(EC_GROUP *dest, const EC_GROUP *src) | |||
181 | dest->generator = NULL; | 181 | dest->generator = NULL; |
182 | } | 182 | } |
183 | 183 | ||
184 | if (!BN_copy(&dest->order, &src->order)) | 184 | if (!bn_copy(&dest->order, &src->order)) |
185 | return 0; | 185 | return 0; |
186 | if (!BN_copy(&dest->cofactor, &src->cofactor)) | 186 | if (!bn_copy(&dest->cofactor, &src->cofactor)) |
187 | return 0; | 187 | return 0; |
188 | 188 | ||
189 | dest->curve_name = src->curve_name; | 189 | dest->curve_name = src->curve_name; |
@@ -279,7 +279,7 @@ ec_guess_cofactor(EC_GROUP *group) | |||
279 | if (!BN_set_bit(q, BN_num_bits(&group->field) - 1)) | 279 | if (!BN_set_bit(q, BN_num_bits(&group->field) - 1)) |
280 | goto err; | 280 | goto err; |
281 | } else { | 281 | } else { |
282 | if (!BN_copy(q, &group->field)) | 282 | if (!bn_copy(q, &group->field)) |
283 | goto err; | 283 | goto err; |
284 | } | 284 | } |
285 | 285 | ||
@@ -357,12 +357,12 @@ EC_GROUP_set_generator(EC_GROUP *group, const EC_POINT *generator, | |||
357 | if (!EC_POINT_copy(group->generator, generator)) | 357 | if (!EC_POINT_copy(group->generator, generator)) |
358 | return 0; | 358 | return 0; |
359 | 359 | ||
360 | if (!BN_copy(&group->order, order)) | 360 | if (!bn_copy(&group->order, order)) |
361 | return 0; | 361 | return 0; |
362 | 362 | ||
363 | /* Either take the provided positive cofactor, or try to compute it. */ | 363 | /* Either take the provided positive cofactor, or try to compute it. */ |
364 | if (cofactor != NULL && !BN_is_zero(cofactor)) { | 364 | if (cofactor != NULL && !BN_is_zero(cofactor)) { |
365 | if (!BN_copy(&group->cofactor, cofactor)) | 365 | if (!bn_copy(&group->cofactor, cofactor)) |
366 | return 0; | 366 | return 0; |
367 | } else if (!ec_guess_cofactor(group)) | 367 | } else if (!ec_guess_cofactor(group)) |
368 | return 0; | 368 | return 0; |
@@ -387,7 +387,7 @@ EC_GROUP_get0_generator(const EC_GROUP *group) | |||
387 | int | 387 | int |
388 | EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) | 388 | EC_GROUP_get_order(const EC_GROUP *group, BIGNUM *order, BN_CTX *ctx) |
389 | { | 389 | { |
390 | if (!BN_copy(order, &group->order)) | 390 | if (!bn_copy(order, &group->order)) |
391 | return 0; | 391 | return 0; |
392 | 392 | ||
393 | return !BN_is_zero(order); | 393 | return !BN_is_zero(order); |
@@ -402,7 +402,7 @@ EC_GROUP_order_bits(const EC_GROUP *group) | |||
402 | int | 402 | int |
403 | EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) | 403 | EC_GROUP_get_cofactor(const EC_GROUP *group, BIGNUM *cofactor, BN_CTX *ctx) |
404 | { | 404 | { |
405 | if (!BN_copy(cofactor, &group->cofactor)) | 405 | if (!bn_copy(cofactor, &group->cofactor)) |
406 | return 0; | 406 | return 0; |
407 | 407 | ||
408 | return !BN_is_zero(&group->cofactor); | 408 | return !BN_is_zero(&group->cofactor); |
diff --git a/src/lib/libcrypto/ec/ecp_mont.c b/src/lib/libcrypto/ec/ecp_mont.c index 8b85bf32fa..915cf15f72 100644 --- a/src/lib/libcrypto/ec/ecp_mont.c +++ b/src/lib/libcrypto/ec/ecp_mont.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_mont.c,v 1.27 2023/03/08 05:45:31 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_mont.c,v 1.28 2023/03/27 10:25:02 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -220,7 +220,7 @@ ec_GFp_mont_field_set_to_one(const EC_GROUP *group, BIGNUM *r, BN_CTX *ctx) | |||
220 | ECerror(EC_R_NOT_INITIALIZED); | 220 | ECerror(EC_R_NOT_INITIALIZED); |
221 | return 0; | 221 | return 0; |
222 | } | 222 | } |
223 | if (!BN_copy(r, group->mont_one)) | 223 | if (!bn_copy(r, group->mont_one)) |
224 | return 0; | 224 | return 0; |
225 | return 1; | 225 | return 1; |
226 | } | 226 | } |
diff --git a/src/lib/libcrypto/ec/ecp_smpl.c b/src/lib/libcrypto/ec/ecp_smpl.c index 9af6034601..90330652e4 100644 --- a/src/lib/libcrypto/ec/ecp_smpl.c +++ b/src/lib/libcrypto/ec/ecp_smpl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_smpl.c,v 1.42 2023/03/08 05:45:31 jsing Exp $ */ | 1 | /* $OpenBSD: ecp_smpl.c,v 1.43 2023/03/27 10:25:02 tb Exp $ */ |
2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> | 2 | /* Includes code written by Lenka Fibikova <fibikova@exp-math.uni-essen.de> |
3 | * for the OpenSSL project. | 3 | * for the OpenSSL project. |
4 | * Includes code written by Bodo Moeller for the OpenSSL project. | 4 | * Includes code written by Bodo Moeller for the OpenSSL project. |
@@ -102,11 +102,11 @@ ec_GFp_simple_group_finish(EC_GROUP *group) | |||
102 | int | 102 | int |
103 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) | 103 | ec_GFp_simple_group_copy(EC_GROUP *dest, const EC_GROUP *src) |
104 | { | 104 | { |
105 | if (!BN_copy(&dest->field, &src->field)) | 105 | if (!bn_copy(&dest->field, &src->field)) |
106 | return 0; | 106 | return 0; |
107 | if (!BN_copy(&dest->a, &src->a)) | 107 | if (!bn_copy(&dest->a, &src->a)) |
108 | return 0; | 108 | return 0; |
109 | if (!BN_copy(&dest->b, &src->b)) | 109 | if (!bn_copy(&dest->b, &src->b)) |
110 | return 0; | 110 | return 0; |
111 | 111 | ||
112 | dest->a_is_minus3 = src->a_is_minus3; | 112 | dest->a_is_minus3 = src->a_is_minus3; |
@@ -137,7 +137,7 @@ ec_GFp_simple_group_set_curve(EC_GROUP *group, | |||
137 | goto err; | 137 | goto err; |
138 | 138 | ||
139 | /* group->field */ | 139 | /* group->field */ |
140 | if (!BN_copy(&group->field, p)) | 140 | if (!bn_copy(&group->field, p)) |
141 | goto err; | 141 | goto err; |
142 | BN_set_negative(&group->field, 0); | 142 | BN_set_negative(&group->field, 0); |
143 | 143 | ||
@@ -147,7 +147,7 @@ ec_GFp_simple_group_set_curve(EC_GROUP *group, | |||
147 | if (group->meth->field_encode) { | 147 | if (group->meth->field_encode) { |
148 | if (!group->meth->field_encode(group, &group->a, tmp_a, ctx)) | 148 | if (!group->meth->field_encode(group, &group->a, tmp_a, ctx)) |
149 | goto err; | 149 | goto err; |
150 | } else if (!BN_copy(&group->a, tmp_a)) | 150 | } else if (!bn_copy(&group->a, tmp_a)) |
151 | goto err; | 151 | goto err; |
152 | 152 | ||
153 | /* group->b */ | 153 | /* group->b */ |
@@ -177,7 +177,7 @@ ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNU | |||
177 | BN_CTX *new_ctx = NULL; | 177 | BN_CTX *new_ctx = NULL; |
178 | 178 | ||
179 | if (p != NULL) { | 179 | if (p != NULL) { |
180 | if (!BN_copy(p, &group->field)) | 180 | if (!bn_copy(p, &group->field)) |
181 | return 0; | 181 | return 0; |
182 | } | 182 | } |
183 | if (a != NULL || b != NULL) { | 183 | if (a != NULL || b != NULL) { |
@@ -197,11 +197,11 @@ ec_GFp_simple_group_get_curve(const EC_GROUP *group, BIGNUM *p, BIGNUM *a, BIGNU | |||
197 | } | 197 | } |
198 | } else { | 198 | } else { |
199 | if (a != NULL) { | 199 | if (a != NULL) { |
200 | if (!BN_copy(a, &group->a)) | 200 | if (!bn_copy(a, &group->a)) |
201 | goto err; | 201 | goto err; |
202 | } | 202 | } |
203 | if (b != NULL) { | 203 | if (b != NULL) { |
204 | if (!BN_copy(b, &group->b)) | 204 | if (!bn_copy(b, &group->b)) |
205 | goto err; | 205 | goto err; |
206 | } | 206 | } |
207 | } | 207 | } |
@@ -252,9 +252,9 @@ ec_GFp_simple_group_check_discriminant(const EC_GROUP *group, BN_CTX *ctx) | |||
252 | if (!group->meth->field_decode(group, b, &group->b, ctx)) | 252 | if (!group->meth->field_decode(group, b, &group->b, ctx)) |
253 | goto err; | 253 | goto err; |
254 | } else { | 254 | } else { |
255 | if (!BN_copy(a, &group->a)) | 255 | if (!bn_copy(a, &group->a)) |
256 | goto err; | 256 | goto err; |
257 | if (!BN_copy(b, &group->b)) | 257 | if (!bn_copy(b, &group->b)) |
258 | goto err; | 258 | goto err; |
259 | } | 259 | } |
260 | 260 | ||
@@ -317,11 +317,11 @@ ec_GFp_simple_point_finish(EC_POINT *point) | |||
317 | int | 317 | int |
318 | ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) | 318 | ec_GFp_simple_point_copy(EC_POINT *dest, const EC_POINT *src) |
319 | { | 319 | { |
320 | if (!BN_copy(&dest->X, &src->X)) | 320 | if (!bn_copy(&dest->X, &src->X)) |
321 | return 0; | 321 | return 0; |
322 | if (!BN_copy(&dest->Y, &src->Y)) | 322 | if (!bn_copy(&dest->Y, &src->Y)) |
323 | return 0; | 323 | return 0; |
324 | if (!BN_copy(&dest->Z, &src->Z)) | 324 | if (!bn_copy(&dest->Z, &src->Z)) |
325 | return 0; | 325 | return 0; |
326 | dest->Z_is_one = src->Z_is_one; | 326 | dest->Z_is_one = src->Z_is_one; |
327 | 327 | ||
@@ -416,15 +416,15 @@ ec_GFp_simple_get_Jprojective_coordinates(const EC_GROUP *group, | |||
416 | } | 416 | } |
417 | } else { | 417 | } else { |
418 | if (x != NULL) { | 418 | if (x != NULL) { |
419 | if (!BN_copy(x, &point->X)) | 419 | if (!bn_copy(x, &point->X)) |
420 | goto err; | 420 | goto err; |
421 | } | 421 | } |
422 | if (y != NULL) { | 422 | if (y != NULL) { |
423 | if (!BN_copy(y, &point->Y)) | 423 | if (!bn_copy(y, &point->Y)) |
424 | goto err; | 424 | goto err; |
425 | } | 425 | } |
426 | if (z != NULL) { | 426 | if (z != NULL) { |
427 | if (!BN_copy(z, &point->Z)) | 427 | if (!bn_copy(z, &point->Z)) |
428 | goto err; | 428 | goto err; |
429 | } | 429 | } |
430 | } | 430 | } |
@@ -499,11 +499,11 @@ ec_GFp_simple_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT | |||
499 | } | 499 | } |
500 | } else { | 500 | } else { |
501 | if (x != NULL) { | 501 | if (x != NULL) { |
502 | if (!BN_copy(x, &point->X)) | 502 | if (!bn_copy(x, &point->X)) |
503 | goto err; | 503 | goto err; |
504 | } | 504 | } |
505 | if (y != NULL) { | 505 | if (y != NULL) { |
506 | if (!BN_copy(y, &point->Y)) | 506 | if (!bn_copy(y, &point->Y)) |
507 | goto err; | 507 | goto err; |
508 | } | 508 | } |
509 | } | 509 | } |
@@ -606,9 +606,9 @@ ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const E | |||
606 | 606 | ||
607 | /* n1, n2 */ | 607 | /* n1, n2 */ |
608 | if (b->Z_is_one) { | 608 | if (b->Z_is_one) { |
609 | if (!BN_copy(n1, &a->X)) | 609 | if (!bn_copy(n1, &a->X)) |
610 | goto end; | 610 | goto end; |
611 | if (!BN_copy(n2, &a->Y)) | 611 | if (!bn_copy(n2, &a->Y)) |
612 | goto end; | 612 | goto end; |
613 | /* n1 = X_a */ | 613 | /* n1 = X_a */ |
614 | /* n2 = Y_a */ | 614 | /* n2 = Y_a */ |
@@ -628,9 +628,9 @@ ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const E | |||
628 | 628 | ||
629 | /* n3, n4 */ | 629 | /* n3, n4 */ |
630 | if (a->Z_is_one) { | 630 | if (a->Z_is_one) { |
631 | if (!BN_copy(n3, &b->X)) | 631 | if (!bn_copy(n3, &b->X)) |
632 | goto end; | 632 | goto end; |
633 | if (!BN_copy(n4, &b->Y)) | 633 | if (!bn_copy(n4, &b->Y)) |
634 | goto end; | 634 | goto end; |
635 | /* n3 = X_b */ | 635 | /* n3 = X_b */ |
636 | /* n4 = Y_b */ | 636 | /* n4 = Y_b */ |
@@ -681,14 +681,14 @@ ec_GFp_simple_add(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, const E | |||
681 | 681 | ||
682 | /* Z_r */ | 682 | /* Z_r */ |
683 | if (a->Z_is_one && b->Z_is_one) { | 683 | if (a->Z_is_one && b->Z_is_one) { |
684 | if (!BN_copy(&r->Z, n5)) | 684 | if (!bn_copy(&r->Z, n5)) |
685 | goto end; | 685 | goto end; |
686 | } else { | 686 | } else { |
687 | if (a->Z_is_one) { | 687 | if (a->Z_is_one) { |
688 | if (!BN_copy(n0, &b->Z)) | 688 | if (!bn_copy(n0, &b->Z)) |
689 | goto end; | 689 | goto end; |
690 | } else if (b->Z_is_one) { | 690 | } else if (b->Z_is_one) { |
691 | if (!BN_copy(n0, &a->Z)) | 691 | if (!bn_copy(n0, &a->Z)) |
692 | goto end; | 692 | goto end; |
693 | } else { | 693 | } else { |
694 | if (!field_mul(group, n0, &a->Z, &b->Z, ctx)) | 694 | if (!field_mul(group, n0, &a->Z, &b->Z, ctx)) |
@@ -832,7 +832,7 @@ ec_GFp_simple_dbl(const EC_GROUP *group, EC_POINT *r, const EC_POINT *a, BN_CTX | |||
832 | 832 | ||
833 | /* Z_r */ | 833 | /* Z_r */ |
834 | if (a->Z_is_one) { | 834 | if (a->Z_is_one) { |
835 | if (!BN_copy(n0, &a->Y)) | 835 | if (!bn_copy(n0, &a->Y)) |
836 | goto err; | 836 | goto err; |
837 | } else { | 837 | } else { |
838 | if (!field_mul(group, n0, &a->Y, &a->Z, ctx)) | 838 | if (!field_mul(group, n0, &a->Y, &a->Z, ctx)) |
@@ -1214,11 +1214,11 @@ ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *po | |||
1214 | 1214 | ||
1215 | if (heap[2 * i] != NULL) { | 1215 | if (heap[2 * i] != NULL) { |
1216 | if ((heap[2 * i + 1] == NULL) || BN_is_zero(heap[2 * i + 1])) { | 1216 | if ((heap[2 * i + 1] == NULL) || BN_is_zero(heap[2 * i + 1])) { |
1217 | if (!BN_copy(heap[i], heap[2 * i])) | 1217 | if (!bn_copy(heap[i], heap[2 * i])) |
1218 | goto err; | 1218 | goto err; |
1219 | } else { | 1219 | } else { |
1220 | if (BN_is_zero(heap[2 * i])) { | 1220 | if (BN_is_zero(heap[2 * i])) { |
1221 | if (!BN_copy(heap[i], heap[2 * i + 1])) | 1221 | if (!bn_copy(heap[i], heap[2 * i + 1])) |
1222 | goto err; | 1222 | goto err; |
1223 | } else { | 1223 | } else { |
1224 | if (!group->meth->field_mul(group, heap[i], | 1224 | if (!group->meth->field_mul(group, heap[i], |
@@ -1256,12 +1256,12 @@ ec_GFp_simple_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT *po | |||
1256 | goto err; | 1256 | goto err; |
1257 | if (!group->meth->field_mul(group, tmp1, heap[i / 2], heap[i], ctx)) | 1257 | if (!group->meth->field_mul(group, tmp1, heap[i / 2], heap[i], ctx)) |
1258 | goto err; | 1258 | goto err; |
1259 | if (!BN_copy(heap[i], tmp0)) | 1259 | if (!bn_copy(heap[i], tmp0)) |
1260 | goto err; | 1260 | goto err; |
1261 | if (!BN_copy(heap[i + 1], tmp1)) | 1261 | if (!bn_copy(heap[i + 1], tmp1)) |
1262 | goto err; | 1262 | goto err; |
1263 | } else { | 1263 | } else { |
1264 | if (!BN_copy(heap[i], heap[i / 2])) | 1264 | if (!bn_copy(heap[i], heap[i / 2])) |
1265 | goto err; | 1265 | goto err; |
1266 | } | 1266 | } |
1267 | } | 1267 | } |
@@ -1473,7 +1473,7 @@ ec_GFp_simple_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
1473 | !bn_wexpand(lambda, group_top + 2)) | 1473 | !bn_wexpand(lambda, group_top + 2)) |
1474 | goto err; | 1474 | goto err; |
1475 | 1475 | ||
1476 | if (!BN_copy(k, scalar)) | 1476 | if (!bn_copy(k, scalar)) |
1477 | goto err; | 1477 | goto err; |
1478 | 1478 | ||
1479 | BN_set_flags(k, BN_FLG_CONSTTIME); | 1479 | BN_set_flags(k, BN_FLG_CONSTTIME); |