From 409f4a640898671720faa6bd2e7a6111335968c8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Thu, 14 Aug 2025 15:22:54 +0000 Subject: Provide amd64 specific versions of bn_mul_comba6() and bn_sqr_comba6(). These use s2n-bignum's bignum_mul_6_12_alt() and bignum_sqr_6_12_alt() functions. ok tb@ --- src/lib/libcrypto/bn/arch/amd64/bn_arch.c | 20 +++++++++++++++++++- src/lib/libcrypto/bn/arch/amd64/bn_arch.h | 4 +++- 2 files changed, 22 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c index 97dc7b90c7..b8ddae6e52 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.c,v 1.10 2025/08/14 15:17:19 jsing Exp $ */ +/* $OpenBSD: bn_arch.c,v 1.11 2025/08/14 15:22:54 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -105,6 +105,15 @@ bn_mul_comba4(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) } #endif +#ifdef HAVE_BN_MUL_COMBA6 +void +bn_mul_comba6(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) +{ + /* XXX - consider using non-alt on CPUs that have the ADX extension. */ + bignum_mul_6_12_alt((uint64_t *)rd, (const uint64_t *)ad, (const uint64_t *)bd); +} +#endif + #ifdef HAVE_BN_MUL_COMBA8 void bn_mul_comba8(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) @@ -133,6 +142,15 @@ bn_sqr_comba4(BN_ULONG *rd, const BN_ULONG *ad) } #endif +#ifdef HAVE_BN_SQR_COMBA6 +void +bn_sqr_comba6(BN_ULONG *rd, const BN_ULONG *ad) +{ + /* XXX - consider using non-alt on CPUs that have the ADX extension. */ + bignum_sqr_6_12_alt((uint64_t *)rd, (const uint64_t *)ad); +} +#endif + #ifdef HAVE_BN_SQR_COMBA8 void bn_sqr_comba8(BN_ULONG *rd, const BN_ULONG *ad) diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h index d07a898b80..7359f993a7 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.h,v 1.15 2025/08/14 15:17:19 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.16 2025/08/14 15:22:54 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -32,11 +32,13 @@ #define HAVE_BN_MUL_ADD_WORDS #define HAVE_BN_MUL_COMBA4 +#define HAVE_BN_MUL_COMBA6 #define HAVE_BN_MUL_COMBA8 #define HAVE_BN_MUL_WORDS #define HAVE_BN_SQR #define HAVE_BN_SQR_COMBA4 +#define HAVE_BN_SQR_COMBA6 #define HAVE_BN_SQR_COMBA8 #define HAVE_BN_SUB -- cgit v1.2.3-55-g6feb