diff options
| author | jsing <> | 2025-01-06 12:35:14 +0000 |
|---|---|---|
| committer | jsing <> | 2025-01-06 12:35:14 +0000 |
| commit | b49ed379be5d4e78d2fe9ffefb79f0ec0ddff691 (patch) | |
| tree | 56bceda3598e917f19ee015bb6e277b5c45d2f85 /src | |
| parent | a22e5a32f47da204cfb322f18fc06bad0b7064a9 (diff) | |
| download | openbsd-b49ed379be5d4e78d2fe9ffefb79f0ec0ddff691.tar.gz openbsd-b49ed379be5d4e78d2fe9ffefb79f0ec0ddff691.tar.bz2 openbsd-b49ed379be5d4e78d2fe9ffefb79f0ec0ddff691.zip | |
Remove indirection for coordinate blinding.
This is usually method specific, so remove the indirection and call the
appropriate blinding function directly.
ok tb@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ec_local.h | 6 | ||||
| -rw-r--r-- | src/lib/libcrypto/ec/ecp_methods.c | 6 |
3 files changed, 4 insertions, 28 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 170bdedc57..b1aad34017 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.96 2025/01/06 11:59:02 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.97 2025/01/06 12:35:14 jsing 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 | */ |
| @@ -766,24 +766,6 @@ EC_GROUP_cmp(const EC_GROUP *group1, const EC_GROUP *group2, BN_CTX *ctx_in) | |||
| 766 | } | 766 | } |
| 767 | LCRYPTO_ALIAS(EC_GROUP_cmp); | 767 | LCRYPTO_ALIAS(EC_GROUP_cmp); |
| 768 | 768 | ||
| 769 | /* | ||
| 770 | * Coordinate blinding for EC_POINT. | ||
| 771 | * | ||
| 772 | * The underlying EC_METHOD can optionally implement this function: | ||
| 773 | * underlying implementations should return 0 on errors, or 1 on success. | ||
| 774 | * | ||
| 775 | * This wrapper returns 1 in case the underlying EC_METHOD does not support | ||
| 776 | * coordinate blinding. | ||
| 777 | */ | ||
| 778 | int | ||
| 779 | ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) | ||
| 780 | { | ||
| 781 | if (group->meth->blind_coordinates == NULL) | ||
| 782 | return 1; | ||
| 783 | |||
| 784 | return group->meth->blind_coordinates(group, p, ctx); | ||
| 785 | } | ||
| 786 | |||
| 787 | EC_POINT * | 769 | EC_POINT * |
| 788 | EC_POINT_new(const EC_GROUP *group) | 770 | EC_POINT_new(const EC_GROUP *group) |
| 789 | { | 771 | { |
diff --git a/src/lib/libcrypto/ec/ec_local.h b/src/lib/libcrypto/ec/ec_local.h index 1b7ca5b645..c74bb05d9a 100644 --- a/src/lib/libcrypto/ec/ec_local.h +++ b/src/lib/libcrypto/ec/ec_local.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ec_local.h,v 1.48 2025/01/06 11:59:02 tb Exp $ */ | 1 | /* $OpenBSD: ec_local.h,v 1.49 2025/01/06 12:35:14 jsing 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 | */ |
| @@ -142,9 +142,6 @@ struct ec_method_st { | |||
| 142 | BN_CTX *); | 142 | BN_CTX *); |
| 143 | int (*field_decode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, | 143 | int (*field_decode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, |
| 144 | BN_CTX *); | 144 | BN_CTX *); |
| 145 | |||
| 146 | int (*blind_coordinates)(const EC_GROUP *group, EC_POINT *p, | ||
| 147 | BN_CTX *ctx); | ||
| 148 | } /* EC_METHOD */; | 145 | } /* EC_METHOD */; |
| 149 | 146 | ||
| 150 | struct ec_group_st { | 147 | struct ec_group_st { |
| @@ -224,7 +221,6 @@ int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, | |||
| 224 | const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); | 221 | const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); |
| 225 | 222 | ||
| 226 | int ec_group_simple_order_bits(const EC_GROUP *group); | 223 | int ec_group_simple_order_bits(const EC_GROUP *group); |
| 227 | int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); | ||
| 228 | 224 | ||
| 229 | /* EC_METHOD definitions */ | 225 | /* EC_METHOD definitions */ |
| 230 | 226 | ||
diff --git a/src/lib/libcrypto/ec/ecp_methods.c b/src/lib/libcrypto/ec/ecp_methods.c index 2297b07175..9ff27cf104 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.20 2025/01/06 11:59:02 tb Exp $ */ | 1 | /* $OpenBSD: ecp_methods.c,v 1.21 2025/01/06 12:35:14 jsing 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. |
| @@ -1327,7 +1327,7 @@ ec_mul_ct(const EC_GROUP *group, EC_POINT *r, const BIGNUM *scalar, | |||
| 1327 | * Apply coordinate blinding for EC_POINT if the underlying EC_METHOD | 1327 | * Apply coordinate blinding for EC_POINT if the underlying EC_METHOD |
| 1328 | * implements it. | 1328 | * implements it. |
| 1329 | */ | 1329 | */ |
| 1330 | if (!ec_point_blind_coordinates(group, s, ctx)) | 1330 | if (!ec_blind_coordinates(group, s, ctx)) |
| 1331 | goto err; | 1331 | goto err; |
| 1332 | 1332 | ||
| 1333 | /* top bit is a 1, in a fixed pos */ | 1333 | /* top bit is a 1, in a fixed pos */ |
| @@ -1577,7 +1577,6 @@ static const EC_METHOD ec_GFp_simple_method = { | |||
| 1577 | .mul_double_nonct = ec_mul_double_nonct, | 1577 | .mul_double_nonct = ec_mul_double_nonct, |
| 1578 | .field_mul = ec_field_mul, | 1578 | .field_mul = ec_field_mul, |
| 1579 | .field_sqr = ec_field_sqr, | 1579 | .field_sqr = ec_field_sqr, |
| 1580 | .blind_coordinates = ec_blind_coordinates, | ||
| 1581 | }; | 1580 | }; |
| 1582 | 1581 | ||
| 1583 | const EC_METHOD * | 1582 | const EC_METHOD * |
| @@ -1612,7 +1611,6 @@ static const EC_METHOD ec_GFp_mont_method = { | |||
| 1612 | .field_sqr = ec_mont_field_sqr, | 1611 | .field_sqr = ec_mont_field_sqr, |
| 1613 | .field_encode = ec_mont_field_encode, | 1612 | .field_encode = ec_mont_field_encode, |
| 1614 | .field_decode = ec_mont_field_decode, | 1613 | .field_decode = ec_mont_field_decode, |
| 1615 | .blind_coordinates = ec_blind_coordinates, | ||
| 1616 | }; | 1614 | }; |
| 1617 | 1615 | ||
| 1618 | const EC_METHOD * | 1616 | const EC_METHOD * |
