From 77be0425db31d4d64737addd3431590a9b4e59bb Mon Sep 17 00:00:00 2001 From: Jake Massimo Date: Wed, 5 Feb 2025 10:40:33 -0800 Subject: [PATCH] Revert "attempt delocator fix" This reverts commit 3ba67cb28fa63653c388a1e49a783880e0eacf0c. --- crypto/fipsmodule/ec/p384.c | 26 +++----------------------- crypto/fipsmodule/ec/p521.c | 27 +++------------------------ 2 files changed, 6 insertions(+), 47 deletions(-) diff --git a/crypto/fipsmodule/ec/p384.c b/crypto/fipsmodule/ec/p384.c index ba5d780a79..707cd16c4c 100644 --- a/crypto/fipsmodule/ec/p384.c +++ b/crypto/fipsmodule/ec/p384.c @@ -83,26 +83,6 @@ static p384_limb_t p384_felem_nz(const p384_limb_t in1[P384_NLIMBS]) { #endif // EC_NISTP_USE_S2N_BIGNUM -// The wrapper functions are needed for FIPS static build. -// Otherwise, initializing ec_nistp_meth with pointers to s2n-bignum -// functions directly generates :got: references that are also thought -// to be local_target by the delocator. -static inline void p384_felem_add_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a, - const ec_nistp_felem_limb *b) { - p384_felem_add(c, a, b); -} - -static inline void p384_felem_sub_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a, - const ec_nistp_felem_limb *b) { - p384_felem_sub(c, a, b); -} - -static inline void p384_felem_neg_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a) { - p384_felem_opp(c, a); -} static void p384_from_generic(p384_felem out, const EC_FELEM *in) { #ifdef OPENSSL_BIG_ENDIAN @@ -293,11 +273,11 @@ static void p384_point_add(p384_felem x3, p384_felem y3, p384_felem z3, DEFINE_METHOD_FUNCTION(ec_nistp_meth, p384_methods) { out->felem_num_limbs = P384_NLIMBS; out->felem_num_bits = 384; - out->felem_add = p384_felem_add_wrapper; - out->felem_sub = p384_felem_sub_wrapper; + out->felem_add = bignum_add_p384; + out->felem_sub = bignum_sub_p384; out->felem_mul = bignum_montmul_p384_selector; out->felem_sqr = bignum_montsqr_p384_selector; - out->felem_neg = p384_felem_neg_wrapper; + out->felem_neg = bignum_neg_p384; out->felem_nz = p384_felem_nz; out->felem_one = p384_felem_one; out->point_dbl = p384_point_double; diff --git a/crypto/fipsmodule/ec/p521.c b/crypto/fipsmodule/ec/p521.c index db45e51850..6364794cb5 100644 --- a/crypto/fipsmodule/ec/p521.c +++ b/crypto/fipsmodule/ec/p521.c @@ -126,27 +126,6 @@ static const p521_limb_t p521_felem_p[P521_NLIMBS] = { #endif // EC_NISTP_USE_S2N_BIGNUM -// The wrapper functions are needed for FIPS static build. -// Otherwise, initializing ec_nistp_meth with pointers to s2n-bignum -// functions directly generates :got: references that are also thought -// to be local_target by the delocator. -static inline void p521_felem_add_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a, - const ec_nistp_felem_limb *b) { - p521_felem_add(c, a, b); -} - -static inline void p521_felem_sub_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a, - const ec_nistp_felem_limb *b) { - p521_felem_sub(c, a, b); -} - -static inline void p521_felem_neg_wrapper(ec_nistp_felem_limb *c, - const ec_nistp_felem_limb *a) { - p521_felem_opp(c, a); -} - static p521_limb_t p521_felem_nz(const p521_limb_t in1[P521_NLIMBS]) { p521_limb_t is_not_zero = 0; for (int i = 0; i < P521_NLIMBS; i++) { @@ -310,11 +289,11 @@ static void p521_point_add(p521_felem x3, p521_felem y3, p521_felem z3, DEFINE_METHOD_FUNCTION(ec_nistp_meth, p521_methods) { out->felem_num_limbs = P521_NLIMBS; out->felem_num_bits = 521; - out->felem_add = p521_felem_add_wrapper; - out->felem_sub = p521_felem_sub_wrapper; + out->felem_add = bignum_add_p521; + out->felem_sub = bignum_sub_p521; out->felem_mul = bignum_mul_p521_selector; out->felem_sqr = bignum_sqr_p521_selector; - out->felem_neg = p521_felem_neg_wrapper; + out->felem_neg = bignum_neg_p521; out->felem_nz = p521_felem_nz; out->felem_one = p521_felem_one; out->point_dbl = p521_point_double;