From: Gleb Popov <6yearold@gmail.com> Date: Mon, 24 Nov 2025 13:46:07 +0000 (+0300) Subject: bn: Remove the BN_MUL_COMBA cpp define X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c269853264f3462fe30b7b18483fb5c11e95137;p=thirdparty%2Fopenssl.git bn: Remove the BN_MUL_COMBA cpp define It does not represent a feature that some arch may or may not possess, but instead is entirely dependent on the OPENSSL_SMALL_FOOTPRINT option. Reviewed-by: Frederik Wedel-Heinen Reviewed-by: Tomas Mraz MergeDate: Mon Jan 12 18:44:24 2026 (Merged from https://github.com/openssl/openssl/pull/29204) --- diff --git a/crypto/bn/bn_asm.c b/crypto/bn/bn_asm.c index 0a77f1b070e..d2951c55fce 100644 --- a/crypto/bn/bn_asm.c +++ b/crypto/bn/bn_asm.c @@ -429,7 +429,7 @@ BN_ULONG bn_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, return c; } -#if defined(BN_MUL_COMBA) && !defined(OPENSSL_SMALL_FOOTPRINT) +#ifndef OPENSSL_SMALL_FOOTPRINT /* mul_add_c(a,b,c0,c1,c2) -- c+=a*b for three word number c=(c2,c1,c0) */ /* mul_add_c2(a,b,c0,c1,c2) -- c+=2*a*b for three word number c=(c2,c1,c0) */ @@ -991,7 +991,7 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, #endif /* OPENSSL_BN_ASM_MONT */ #endif -#else /* !BN_MUL_COMBA */ +#else /* OPENSSL_SMALL_FOOTPRINT */ /* hmm... is it faster just to do a multiply? */ void bn_sqr_comba4(BN_ULONG *r, const BN_ULONG *a) @@ -1078,4 +1078,4 @@ int bn_mul_mont(BN_ULONG *rp, const BN_ULONG *ap, const BN_ULONG *bp, #endif /* OPENSSL_BN_ASM_MONT */ #endif -#endif /* !BN_MUL_COMBA */ +#endif /* !OPENSSL_SMALL_FOOTPRINT */ diff --git a/crypto/bn/bn_local.h b/crypto/bn/bn_local.h index 5dcec96c4fc..61f45ecf9a0 100644 --- a/crypto/bn/bn_local.h +++ b/crypto/bn/bn_local.h @@ -53,7 +53,6 @@ #endif #ifndef OPENSSL_SMALL_FOOTPRINT -#define BN_MUL_COMBA #define BN_SQR_COMBA #define BN_RECURSION #endif diff --git a/crypto/bn/bn_mul.c b/crypto/bn/bn_mul.c index ff4bf2ca256..9977479dfcf 100644 --- a/crypto/bn/bn_mul.c +++ b/crypto/bn/bn_mul.c @@ -180,13 +180,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, unsigned int neg, zero; BN_ULONG ln, lo, *p; -#ifdef BN_MUL_COMBA -#if 0 - if (n2 == 4) { - bn_mul_comba4(r, a, b); - return; - } -#endif +#ifndef OPENSSL_SMALL_FOOTPRINT /* * Only call bn_mul_comba 8 if n2 == 8 and the two arrays are complete * [steve] @@ -195,7 +189,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, bn_mul_comba8(r, a, b); return; } -#endif /* BN_MUL_COMBA */ +#endif /* OPENSSL_SMALL_FOOTPRINT */ /* Else do normal multiply */ if (n2 < BN_MUL_RECURSIVE_SIZE_NORMAL) { bn_mul_normal(r, a, n2 + dna, b, n2 + dnb); @@ -240,7 +234,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, break; } -#ifdef BN_MUL_COMBA +#ifndef OPENSSL_SMALL_FOOTPRINT if (n == 4 && dna == 0 && dnb == 0) { /* XXX: bn_mul_comba4 could take * extra args to do this well */ if (!zero) @@ -261,7 +255,7 @@ void bn_mul_recursive(BN_ULONG *r, BN_ULONG *a, BN_ULONG *b, int n2, bn_mul_comba8(r, a, b); bn_mul_comba8(&(r[n2]), &(a[n]), &(b[n])); } else -#endif /* BN_MUL_COMBA */ +#endif /* OPENSSL_SMALL_FOOTPRINT */ { p = &(t[n2 * 2]); if (!zero) @@ -509,7 +503,7 @@ int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) int ret = 0; int top, al, bl; BIGNUM *rr; -#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) +#if !defined(OPENSSL_SMALL_FOOTPRINT) || defined(BN_RECURSION) int i; #endif #ifdef BN_RECURSION @@ -537,10 +531,10 @@ int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) } else rr = r; -#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) +#if !defined(OPENSSL_SMALL_FOOTPRINT) || defined(BN_RECURSION) i = al - bl; #endif -#ifdef BN_MUL_COMBA +#ifndef OPENSSL_SMALL_FOOTPRINT if (i == 0) { #if 0 if (al == 4) { @@ -559,7 +553,7 @@ int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) goto end; } } -#endif /* BN_MUL_COMBA */ +#endif /* OPENSSL_SMALL_FOOTPRINT */ #ifdef BN_RECURSION if ((al >= BN_MULL_SIZE_NORMAL) && (bl >= BN_MULL_SIZE_NORMAL)) { if (i >= -1 && i <= 1) { @@ -604,7 +598,7 @@ int bn_mul_fixed_top(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) rr->top = top; bn_mul_normal(rr->d, a->d, al, b->d, bl); -#if defined(BN_MUL_COMBA) || defined(BN_RECURSION) +#if !defined(OPENSSL_SMALL_FOOTPRINT) || defined(BN_RECURSION) end: #endif rr->neg = a->neg ^ b->neg;