summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/arch/amd64
diff options
context:
space:
mode:
authorjsing <>2025-08-30 07:54:27 +0000
committerjsing <>2025-08-30 07:54:27 +0000
commit694b88dc8ad458db9997e90128806a423fec09db (patch)
treeb32cfc481059f60610a60af1e8974af46557ef41 /src/lib/libcrypto/bn/arch/amd64
parent3adccdb355e2f651255227b11a6324730cb85e48 (diff)
downloadopenbsd-694b88dc8ad458db9997e90128806a423fec09db.tar.gz
openbsd-694b88dc8ad458db9997e90128806a423fec09db.tar.bz2
openbsd-694b88dc8ad458db9997e90128806a423fec09db.zip
Rename bn_mul_words()/bn_mul_add_words().
Most bn_.*_words() functions operate on two word arrays, however bn_mul_words() and bn_mul_add_words() operate on one word array and multiply by a single word. Rename these to bn_mulw_words() and bn_mulw_add_words() to reflect this, following naming scheme that we use for primitives. This frees up bn_mul_words() to actually be used for multiplying two word arrays. Rename bn_mul_normal() to bn_mul_words(), which will then become one of the possible assembly integration points. ok tb@
Diffstat (limited to 'src/lib/libcrypto/bn/arch/amd64')
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bn_arch.c10
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bn_arch.h6
2 files changed, 8 insertions, 8 deletions
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.c b/src/lib/libcrypto/bn/arch/amd64/bn_arch.c
index e4fbb4cfc3..ef8eeadec2 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.13 2025/08/30 07:16:06 jsing Exp $ */ 1/* $OpenBSD: bn_arch.c,v 1.14 2025/08/30 07:54:27 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -81,17 +81,17 @@ bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b,
81} 81}
82#endif 82#endif
83 83
84#ifdef HAVE_BN_MUL_ADD_WORDS 84#ifdef HAVE_BN_MULW_ADD_WORDS
85BN_ULONG 85BN_ULONG
86bn_mul_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) 86bn_mulw_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w)
87{ 87{
88 return bignum_cmadd(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); 88 return bignum_cmadd(num, (uint64_t *)rd, w, num, (const uint64_t *)ad);
89} 89}
90#endif 90#endif
91 91
92#ifdef HAVE_BN_MUL_WORDS 92#ifdef HAVE_BN_MULW_WORDS
93BN_ULONG 93BN_ULONG
94bn_mul_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) 94bn_mulw_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w)
95{ 95{
96 return bignum_cmul(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); 96 return bignum_cmul(num, (uint64_t *)rd, w, num, (const uint64_t *)ad);
97} 97}
diff --git a/src/lib/libcrypto/bn/arch/amd64/bn_arch.h b/src/lib/libcrypto/bn/arch/amd64/bn_arch.h
index dd7abd3002..f42c6bc201 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.17 2025/08/30 07:16:06 jsing Exp $ */ 1/* $OpenBSD: bn_arch.h,v 1.18 2025/08/30 07:54:27 jsing Exp $ */
2/* 2/*
3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> 3 * Copyright (c) 2023 Joel Sing <jsing@openbsd.org>
4 * 4 *
@@ -30,11 +30,11 @@
30#define HAVE_BN_MOD_ADD_WORDS 30#define HAVE_BN_MOD_ADD_WORDS
31#define HAVE_BN_MOD_SUB_WORDS 31#define HAVE_BN_MOD_SUB_WORDS
32 32
33#define HAVE_BN_MUL_ADD_WORDS
34#define HAVE_BN_MUL_COMBA4 33#define HAVE_BN_MUL_COMBA4
35#define HAVE_BN_MUL_COMBA6 34#define HAVE_BN_MUL_COMBA6
36#define HAVE_BN_MUL_COMBA8 35#define HAVE_BN_MUL_COMBA8
37#define HAVE_BN_MUL_WORDS 36#define HAVE_BN_MULW_ADD_WORDS
37#define HAVE_BN_MULW_WORDS
38 38
39#define HAVE_BN_SQR_COMBA4 39#define HAVE_BN_SQR_COMBA4
40#define HAVE_BN_SQR_COMBA6 40#define HAVE_BN_SQR_COMBA6