From 040f047180525bbee39de311cf3ae17a898c86dc Mon Sep 17 00:00:00 2001 From: jsing <> Date: Mon, 6 Jan 2025 12:35:14 +0000 Subject: Remove indirection for coordinate blinding. This is usually method specific, so remove the indirection and call the appropriate blinding function directly. ok tb@ --- src/lib/libcrypto/ec/ec_lib.c | 20 +------------------- src/lib/libcrypto/ec/ec_local.h | 6 +----- src/lib/libcrypto/ec/ecp_methods.c | 6 ++---- 3 files changed, 4 insertions(+), 28 deletions(-) (limited to 'src/lib') 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 @@ -/* $OpenBSD: ec_lib.c,v 1.96 2025/01/06 11:59:02 tb Exp $ */ +/* $OpenBSD: ec_lib.c,v 1.97 2025/01/06 12:35:14 jsing Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -766,24 +766,6 @@ EC_GROUP_cmp(const EC_GROUP *group1, const EC_GROUP *group2, BN_CTX *ctx_in) } LCRYPTO_ALIAS(EC_GROUP_cmp); -/* - * Coordinate blinding for EC_POINT. - * - * The underlying EC_METHOD can optionally implement this function: - * underlying implementations should return 0 on errors, or 1 on success. - * - * This wrapper returns 1 in case the underlying EC_METHOD does not support - * coordinate blinding. - */ -int -ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx) -{ - if (group->meth->blind_coordinates == NULL) - return 1; - - return group->meth->blind_coordinates(group, p, ctx); -} - EC_POINT * EC_POINT_new(const EC_GROUP *group) { 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 @@ -/* $OpenBSD: ec_local.h,v 1.48 2025/01/06 11:59:02 tb Exp $ */ +/* $OpenBSD: ec_local.h,v 1.49 2025/01/06 12:35:14 jsing Exp $ */ /* * Originally written by Bodo Moeller for the OpenSSL project. */ @@ -142,9 +142,6 @@ struct ec_method_st { BN_CTX *); int (*field_decode)(const EC_GROUP *, BIGNUM *r, const BIGNUM *a, BN_CTX *); - - int (*blind_coordinates)(const EC_GROUP *group, EC_POINT *p, - BN_CTX *ctx); } /* EC_METHOD */; struct ec_group_st { @@ -224,7 +221,6 @@ int ec_wnaf_mul(const EC_GROUP *group, EC_POINT *r, const BIGNUM *m, const EC_POINT *point, const BIGNUM *n, BN_CTX *ctx); int ec_group_simple_order_bits(const EC_GROUP *group); -int ec_point_blind_coordinates(const EC_GROUP *group, EC_POINT *p, BN_CTX *ctx); /* EC_METHOD definitions */ 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 @@ -/* $OpenBSD: ecp_methods.c,v 1.20 2025/01/06 11:59:02 tb Exp $ */ +/* $OpenBSD: ecp_methods.c,v 1.21 2025/01/06 12:35:14 jsing Exp $ */ /* Includes code written by Lenka Fibikova * for the OpenSSL project. * 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, * Apply coordinate blinding for EC_POINT if the underlying EC_METHOD * implements it. */ - if (!ec_point_blind_coordinates(group, s, ctx)) + if (!ec_blind_coordinates(group, s, ctx)) goto err; /* top bit is a 1, in a fixed pos */ @@ -1577,7 +1577,6 @@ static const EC_METHOD ec_GFp_simple_method = { .mul_double_nonct = ec_mul_double_nonct, .field_mul = ec_field_mul, .field_sqr = ec_field_sqr, - .blind_coordinates = ec_blind_coordinates, }; const EC_METHOD * @@ -1612,7 +1611,6 @@ static const EC_METHOD ec_GFp_mont_method = { .field_sqr = ec_mont_field_sqr, .field_encode = ec_mont_field_encode, .field_decode = ec_mont_field_decode, - .blind_coordinates = ec_blind_coordinates, }; const EC_METHOD * -- cgit v1.2.3-55-g6feb