diff options
author | tb <> | 2025-01-17 11:11:27 +0000 |
---|---|---|
committer | tb <> | 2025-01-17 11:11:27 +0000 |
commit | 43e4fc1810c2b37f526c64cd274aed4f96eae01e (patch) | |
tree | e2f8bba4179a59420edb05ef72cbd47a11e486b8 | |
parent | 04aa18b250706aa7fe9f86e37e7e3fc7aa6e6ffe (diff) | |
download | openbsd-43e4fc1810c2b37f526c64cd274aed4f96eae01e.tar.gz openbsd-43e4fc1810c2b37f526c64cd274aed4f96eae01e.tar.bz2 openbsd-43e4fc1810c2b37f526c64cd274aed4f96eae01e.zip |
Replace the remaining group->meth->field_{mul,sqr}
These somehow escaped a prior pass.
-rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index 443b382380..718bd4565a 100644 --- a/src/lib/libcrypto/ec/ecp_methods.c +++ b/src/lib/libcrypto/ec/ecp_methods.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecp_methods.c,v 1.38 2025/01/17 10:54:03 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.39 2025/01/17 11:11:27 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. |
@@ -423,7 +423,7 @@ ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | |||
423 | } | 423 | } |
424 | if (group->meth->field_encode == NULL) { | 424 | if (group->meth->field_encode == NULL) { |
425 | /* field_sqr works on standard representation */ | 425 | /* field_sqr works on standard representation */ |
426 | if (!group->meth->field_sqr(group, Z_2, Z_1, ctx)) | 426 | if (!ec_field_sqr(group, Z_2, Z_1, ctx)) |
427 | goto err; | 427 | goto err; |
428 | } else { | 428 | } else { |
429 | if (!BN_mod_sqr(Z_2, Z_1, group->p, ctx)) | 429 | if (!BN_mod_sqr(Z_2, Z_1, group->p, ctx)) |
@@ -435,13 +435,13 @@ ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | |||
435 | * in the Montgomery case, field_mul will cancel out | 435 | * in the Montgomery case, field_mul will cancel out |
436 | * Montgomery factor in X: | 436 | * Montgomery factor in X: |
437 | */ | 437 | */ |
438 | if (!group->meth->field_mul(group, x, point->X, Z_2, ctx)) | 438 | if (!ec_field_mul(group, x, point->X, Z_2, ctx)) |
439 | goto err; | 439 | goto err; |
440 | } | 440 | } |
441 | if (y != NULL) { | 441 | if (y != NULL) { |
442 | if (group->meth->field_encode == NULL) { | 442 | if (group->meth->field_encode == NULL) { |
443 | /* field_mul works on standard representation */ | 443 | /* field_mul works on standard representation */ |
444 | if (!group->meth->field_mul(group, Z_3, Z_2, Z_1, ctx)) | 444 | if (!ec_field_mul(group, Z_3, Z_2, Z_1, ctx)) |
445 | goto err; | 445 | goto err; |
446 | } else { | 446 | } else { |
447 | if (!BN_mod_mul(Z_3, Z_2, Z_1, group->p, ctx)) | 447 | if (!BN_mod_mul(Z_3, Z_2, Z_1, group->p, ctx)) |
@@ -452,7 +452,7 @@ ec_point_get_affine_coordinates(const EC_GROUP *group, const EC_POINT *point, | |||
452 | * in the Montgomery case, field_mul will cancel out | 452 | * in the Montgomery case, field_mul will cancel out |
453 | * Montgomery factor in Y: | 453 | * Montgomery factor in Y: |
454 | */ | 454 | */ |
455 | if (!group->meth->field_mul(group, y, point->Y, Z_3, ctx)) | 455 | if (!ec_field_mul(group, y, point->Y, Z_3, ctx)) |
456 | goto err; | 456 | goto err; |
457 | } | 457 | } |
458 | 458 | ||
@@ -511,7 +511,7 @@ ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT **points, | |||
511 | 511 | ||
512 | for (i = 1; i < num; i++) { | 512 | for (i = 1; i < num; i++) { |
513 | if (!BN_is_zero(points[i]->Z)) { | 513 | if (!BN_is_zero(points[i]->Z)) { |
514 | if (!group->meth->field_mul(group, prod_Z[i], | 514 | if (!ec_field_mul(group, prod_Z[i], |
515 | prod_Z[i - 1], points[i]->Z, ctx)) | 515 | prod_Z[i - 1], points[i]->Z, ctx)) |
516 | goto err; | 516 | goto err; |
517 | } else { | 517 | } else { |
@@ -550,10 +550,10 @@ ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT **points, | |||
550 | continue; | 550 | continue; |
551 | 551 | ||
552 | /* Set tmp_Z to the inverse of points[i]->Z. */ | 552 | /* Set tmp_Z to the inverse of points[i]->Z. */ |
553 | if (!group->meth->field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx)) | 553 | if (!ec_field_mul(group, tmp_Z, prod_Z[i - 1], tmp, ctx)) |
554 | goto err; | 554 | goto err; |
555 | /* Adjust tmp to satisfy loop invariant. */ | 555 | /* Adjust tmp to satisfy loop invariant. */ |
556 | if (!group->meth->field_mul(group, tmp, tmp, points[i]->Z, ctx)) | 556 | if (!ec_field_mul(group, tmp, tmp, points[i]->Z, ctx)) |
557 | goto err; | 557 | goto err; |
558 | /* Replace points[i]->Z by its inverse. */ | 558 | /* Replace points[i]->Z by its inverse. */ |
559 | if (!bn_copy(points[i]->Z, tmp_Z)) | 559 | if (!bn_copy(points[i]->Z, tmp_Z)) |
@@ -575,14 +575,14 @@ ec_points_make_affine(const EC_GROUP *group, size_t num, EC_POINT **points, | |||
575 | 575 | ||
576 | /* turn (X, Y, 1/Z) into (X/Z^2, Y/Z^3, 1) */ | 576 | /* turn (X, Y, 1/Z) into (X/Z^2, Y/Z^3, 1) */ |
577 | 577 | ||
578 | if (!group->meth->field_sqr(group, tmp, p->Z, ctx)) | 578 | if (!ec_field_sqr(group, tmp, p->Z, ctx)) |
579 | goto err; | 579 | goto err; |
580 | if (!group->meth->field_mul(group, p->X, p->X, tmp, ctx)) | 580 | if (!ec_field_mul(group, p->X, p->X, tmp, ctx)) |
581 | goto err; | 581 | goto err; |
582 | 582 | ||
583 | if (!group->meth->field_mul(group, tmp, tmp, p->Z, ctx)) | 583 | if (!ec_field_mul(group, tmp, tmp, p->Z, ctx)) |
584 | goto err; | 584 | goto err; |
585 | if (!group->meth->field_mul(group, p->Y, p->Y, tmp, ctx)) | 585 | if (!ec_field_mul(group, p->Y, p->Y, tmp, ctx)) |
586 | goto err; | 586 | goto err; |
587 | 587 | ||
588 | if (!bn_copy(p->Z, one)) | 588 | if (!bn_copy(p->Z, one)) |
@@ -945,7 +945,7 @@ ec_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | |||
945 | goto err; | 945 | goto err; |
946 | 946 | ||
947 | /* tmp = lambda^2 */ | 947 | /* tmp = lambda^2 */ |
948 | if (!group->meth->field_sqr(group, tmp, lambda, ctx)) | 948 | if (!ec_field_sqr(group, tmp, lambda, ctx)) |
949 | goto err; | 949 | goto err; |
950 | 950 | ||
951 | /* X = lambda^2 * X */ | 951 | /* X = lambda^2 * X */ |