diff options
| author | jsing <> | 2025-08-14 15:22:54 +0000 |
|---|---|---|
| committer | jsing <> | 2025-08-14 15:22:54 +0000 |
| commit | 409f4a640898671720faa6bd2e7a6111335968c8 (patch) | |
| tree | fe2037c6fc74f107be057ad9b0727e2792aaa4d9 /src | |
| parent | 278945f44c7c245ab97c000f622ed5ad243818a1 (diff) | |
| download | openbsd-409f4a640898671720faa6bd2e7a6111335968c8.tar.gz openbsd-409f4a640898671720faa6bd2e7a6111335968c8.tar.bz2 openbsd-409f4a640898671720faa6bd2e7a6111335968c8.zip | |
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@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bn_arch.c | 20 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bn_arch.h | 4 |
2 files changed, 22 insertions, 2 deletions
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 @@ | |||
| 1 | /* $OpenBSD: bn_arch.c,v 1.10 2025/08/14 15:17:19 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.c,v 1.11 2025/08/14 15:22:54 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -105,6 +105,15 @@ bn_mul_comba4(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) | |||
| 105 | } | 105 | } |
| 106 | #endif | 106 | #endif |
| 107 | 107 | ||
| 108 | #ifdef HAVE_BN_MUL_COMBA6 | ||
| 109 | void | ||
| 110 | bn_mul_comba6(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) | ||
| 111 | { | ||
| 112 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | ||
| 113 | bignum_mul_6_12_alt((uint64_t *)rd, (const uint64_t *)ad, (const uint64_t *)bd); | ||
| 114 | } | ||
| 115 | #endif | ||
| 116 | |||
| 108 | #ifdef HAVE_BN_MUL_COMBA8 | 117 | #ifdef HAVE_BN_MUL_COMBA8 |
| 109 | void | 118 | void |
| 110 | bn_mul_comba8(BN_ULONG *rd, const BN_ULONG *ad, const BN_ULONG *bd) | 119 | 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) | |||
| 133 | } | 142 | } |
| 134 | #endif | 143 | #endif |
| 135 | 144 | ||
| 145 | #ifdef HAVE_BN_SQR_COMBA6 | ||
| 146 | void | ||
| 147 | bn_sqr_comba6(BN_ULONG *rd, const BN_ULONG *ad) | ||
| 148 | { | ||
| 149 | /* XXX - consider using non-alt on CPUs that have the ADX extension. */ | ||
| 150 | bignum_sqr_6_12_alt((uint64_t *)rd, (const uint64_t *)ad); | ||
| 151 | } | ||
| 152 | #endif | ||
| 153 | |||
| 136 | #ifdef HAVE_BN_SQR_COMBA8 | 154 | #ifdef HAVE_BN_SQR_COMBA8 |
| 137 | void | 155 | void |
| 138 | bn_sqr_comba8(BN_ULONG *rd, const BN_ULONG *ad) | 156 | 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 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.15 2025/08/14 15:17:19 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.16 2025/08/14 15:22:54 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -32,11 +32,13 @@ | |||
| 32 | 32 | ||
| 33 | #define HAVE_BN_MUL_ADD_WORDS | 33 | #define HAVE_BN_MUL_ADD_WORDS |
| 34 | #define HAVE_BN_MUL_COMBA4 | 34 | #define HAVE_BN_MUL_COMBA4 |
| 35 | #define HAVE_BN_MUL_COMBA6 | ||
| 35 | #define HAVE_BN_MUL_COMBA8 | 36 | #define HAVE_BN_MUL_COMBA8 |
| 36 | #define HAVE_BN_MUL_WORDS | 37 | #define HAVE_BN_MUL_WORDS |
| 37 | 38 | ||
| 38 | #define HAVE_BN_SQR | 39 | #define HAVE_BN_SQR |
| 39 | #define HAVE_BN_SQR_COMBA4 | 40 | #define HAVE_BN_SQR_COMBA4 |
| 41 | #define HAVE_BN_SQR_COMBA6 | ||
| 40 | #define HAVE_BN_SQR_COMBA8 | 42 | #define HAVE_BN_SQR_COMBA8 |
| 41 | 43 | ||
| 42 | #define HAVE_BN_SUB | 44 | #define HAVE_BN_SUB |
