From 694b88dc8ad458db9997e90128806a423fec09db Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sat, 30 Aug 2025 07:54:27 +0000 Subject: 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@ --- src/lib/libcrypto/bn/arch/amd64/bn_arch.c | 10 ++--- src/lib/libcrypto/bn/arch/amd64/bn_arch.h | 6 +-- src/lib/libcrypto/bn/arch/i386/bn_arch.h | 6 +-- src/lib/libcrypto/bn/arch/mips64/bn_arch.h | 6 +-- src/lib/libcrypto/bn/arch/powerpc/bn_arch.h | 6 +-- src/lib/libcrypto/bn/asm/bn-586.pl | 8 ++-- src/lib/libcrypto/bn/asm/mips.pl | 64 +++++++++++++-------------- src/lib/libcrypto/bn/asm/ppc.pl | 20 ++++----- src/lib/libcrypto/bn/bn_div.c | 4 +- src/lib/libcrypto/bn/bn_local.h | 6 +-- src/lib/libcrypto/bn/bn_mont.c | 4 +- src/lib/libcrypto/bn/bn_mul.c | 67 +++++++++++++---------------- src/lib/libcrypto/bn/bn_sqr.c | 6 +-- src/lib/libcrypto/bn/bn_word.c | 4 +- 14 files changed, 106 insertions(+), 111 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 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 @@ -/* $OpenBSD: bn_arch.c,v 1.13 2025/08/30 07:16:06 jsing Exp $ */ +/* $OpenBSD: bn_arch.c,v 1.14 2025/08/30 07:54:27 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -81,17 +81,17 @@ bn_mod_sub_words(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b, } #endif -#ifdef HAVE_BN_MUL_ADD_WORDS +#ifdef HAVE_BN_MULW_ADD_WORDS BN_ULONG -bn_mul_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) +bn_mulw_add_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) { return bignum_cmadd(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); } #endif -#ifdef HAVE_BN_MUL_WORDS +#ifdef HAVE_BN_MULW_WORDS BN_ULONG -bn_mul_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) +bn_mulw_words(BN_ULONG *rd, const BN_ULONG *ad, int num, BN_ULONG w) { return bignum_cmul(num, (uint64_t *)rd, w, num, (const uint64_t *)ad); } 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 @@ -/* $OpenBSD: bn_arch.h,v 1.17 2025/08/30 07:16:06 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.18 2025/08/30 07:54:27 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -30,11 +30,11 @@ #define HAVE_BN_MOD_ADD_WORDS #define HAVE_BN_MOD_SUB_WORDS -#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_MULW_ADD_WORDS +#define HAVE_BN_MULW_WORDS #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA6 diff --git a/src/lib/libcrypto/bn/arch/i386/bn_arch.h b/src/lib/libcrypto/bn/arch/i386/bn_arch.h index eef519fcc7..79f7345b8b 100644 --- a/src/lib/libcrypto/bn/arch/i386/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/i386/bn_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.h,v 1.9 2023/02/16 10:41:03 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.10 2025/08/30 07:54:27 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -26,10 +26,10 @@ #define HAVE_BN_DIV_WORDS -#define HAVE_BN_MUL_ADD_WORDS #define HAVE_BN_MUL_COMBA4 #define HAVE_BN_MUL_COMBA8 -#define HAVE_BN_MUL_WORDS +#define HAVE_BN_MULW_ADD_WORDS +#define HAVE_BN_MULW_WORDS #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 diff --git a/src/lib/libcrypto/bn/arch/mips64/bn_arch.h b/src/lib/libcrypto/bn/arch/mips64/bn_arch.h index 53771bce1e..b7714c7d72 100644 --- a/src/lib/libcrypto/bn/arch/mips64/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/mips64/bn_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.h,v 1.7 2023/01/23 12:17:58 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.8 2025/08/30 07:54:27 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -25,10 +25,10 @@ #define HAVE_BN_DIV_WORDS #define HAVE_BN_DIV_3_WORDS -#define HAVE_BN_MUL_ADD_WORDS #define HAVE_BN_MUL_COMBA4 #define HAVE_BN_MUL_COMBA8 -#define HAVE_BN_MUL_WORDS +#define HAVE_BN_MULW_ADD_WORDS +#define HAVE_BN_MULW_WORDS #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 diff --git a/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h b/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h index 46e932a2d5..fdddedaf4f 100644 --- a/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h +++ b/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_arch.h,v 1.6 2023/01/23 12:17:58 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.7 2025/08/30 07:54:27 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -24,10 +24,10 @@ #define HAVE_BN_DIV_WORDS -#define HAVE_BN_MUL_ADD_WORDS #define HAVE_BN_MUL_COMBA4 #define HAVE_BN_MUL_COMBA8 -#define HAVE_BN_MUL_WORDS +#define HAVE_BN_MULW_ADD_WORDS +#define HAVE_BN_MULW_WORDS #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 19a1afdbbe..7f550b3b7c 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl @@ -10,8 +10,8 @@ $sse2=1; &external_label("OPENSSL_ia32cap_P") if ($sse2); -&bn_mul_add_words("bn_mul_add_words"); -&bn_mul_words("bn_mul_words"); +&bn_mulw_add_words("bn_mulw_add_words"); +&bn_mulw_words("bn_mulw_words"); &bn_sqr_words("bn_sqr_words"); &bn_div_words("bn_div_words"); &bn_add_words("bn_add_words"); @@ -19,7 +19,7 @@ $sse2=1; &asm_finish(); -sub bn_mul_add_words +sub bn_mulw_add_words { local($name)=@_; @@ -206,7 +206,7 @@ sub bn_mul_add_words &function_end($name); } -sub bn_mul_words +sub bn_mulw_words { local($name)=@_; diff --git a/src/lib/libcrypto/bn/asm/mips.pl b/src/lib/libcrypto/bn/asm/mips.pl index 02d43e15b0..378af371e7 100644 --- a/src/lib/libcrypto/bn/asm/mips.pl +++ b/src/lib/libcrypto/bn/asm/mips.pl @@ -110,19 +110,19 @@ $code.=<<___; .set noat .align 5 -.globl bn_mul_add_words -.ent bn_mul_add_words -bn_mul_add_words: +.globl bn_mulw_add_words +.ent bn_mulw_add_words +bn_mulw_add_words: .set noreorder - bgtz $a2,bn_mul_add_words_internal + bgtz $a2,bn_mulw_add_words_internal move $v0,$zero jr $ra move $a0,$v0 -.end bn_mul_add_words +.end bn_mulw_add_words .align 5 -.ent bn_mul_add_words_internal -bn_mul_add_words_internal: +.ent bn_mulw_add_words_internal +bn_mulw_add_words_internal: ___ $code.=<<___ if ($flavour =~ /nubi/i); .frame $sp,6*$SZREG,$ra @@ -140,9 +140,9 @@ $code.=<<___; .set reorder li $minus4,-4 and $ta0,$a2,$minus4 - beqz $ta0,.L_bn_mul_add_words_tail + beqz $ta0,.L_bn_mulw_add_words_tail -.L_bn_mul_add_words_loop: +.L_bn_mulw_add_words_loop: $LD $t0,0($a1) $MULTU $t0,$a3 $LD $t1,0($a0) @@ -201,13 +201,13 @@ $code.=<<___; sltu $at,$ta3,$at $ST $ta3,-$BNSZ($a0) .set noreorder - bgtz $ta0,.L_bn_mul_add_words_loop + bgtz $ta0,.L_bn_mulw_add_words_loop $ADDU $v0,$at - beqz $a2,.L_bn_mul_add_words_return + beqz $a2,.L_bn_mulw_add_words_return nop -.L_bn_mul_add_words_tail: +.L_bn_mulw_add_words_tail: .set reorder $LD $t0,0($a1) $MULTU $t0,$a3 @@ -222,7 +222,7 @@ $code.=<<___; sltu $at,$t1,$at $ST $t1,0($a0) $ADDU $v0,$at - beqz $a2,.L_bn_mul_add_words_return + beqz $a2,.L_bn_mulw_add_words_return $LD $t0,$BNSZ($a1) $MULTU $t0,$a3 @@ -237,7 +237,7 @@ $code.=<<___; sltu $at,$t1,$at $ST $t1,$BNSZ($a0) $ADDU $v0,$at - beqz $a2,.L_bn_mul_add_words_return + beqz $a2,.L_bn_mulw_add_words_return $LD $t0,2*$BNSZ($a1) $MULTU $t0,$a3 @@ -252,7 +252,7 @@ $code.=<<___; $ST $t1,2*$BNSZ($a0) $ADDU $v0,$at -.L_bn_mul_add_words_return: +.L_bn_mulw_add_words_return: .set noreorder ___ $code.=<<___ if ($flavour =~ /nubi/i); @@ -266,22 +266,22 @@ ___ $code.=<<___; jr $ra move $a0,$v0 -.end bn_mul_add_words_internal +.end bn_mulw_add_words_internal .align 5 -.globl bn_mul_words -.ent bn_mul_words -bn_mul_words: +.globl bn_mulw_words +.ent bn_mulw_words +bn_mulw_words: .set noreorder - bgtz $a2,bn_mul_words_internal + bgtz $a2,bn_mulw_words_internal move $v0,$zero jr $ra move $a0,$v0 -.end bn_mul_words +.end bn_mulw_words .align 5 -.ent bn_mul_words_internal -bn_mul_words_internal: +.ent bn_mulw_words_internal +bn_mulw_words_internal: ___ $code.=<<___ if ($flavour =~ /nubi/i); .frame $sp,6*$SZREG,$ra @@ -299,9 +299,9 @@ $code.=<<___; .set reorder li $minus4,-4 and $ta0,$a2,$minus4 - beqz $ta0,.L_bn_mul_words_tail + beqz $ta0,.L_bn_mulw_words_tail -.L_bn_mul_words_loop: +.L_bn_mulw_words_loop: $LD $t0,0($a1) $MULTU $t0,$a3 $LD $t2,$BNSZ($a1) @@ -341,13 +341,13 @@ $code.=<<___; sltu $ta3,$v0,$at $ST $v0,-$BNSZ($a0) .set noreorder - bgtz $ta0,.L_bn_mul_words_loop + bgtz $ta0,.L_bn_mulw_words_loop $ADDU $v0,$ta3,$ta2 - beqz $a2,.L_bn_mul_words_return + beqz $a2,.L_bn_mulw_words_return nop -.L_bn_mul_words_tail: +.L_bn_mulw_words_tail: .set reorder $LD $t0,0($a1) $MULTU $t0,$a3 @@ -358,7 +358,7 @@ $code.=<<___; sltu $t1,$v0,$at $ST $v0,0($a0) $ADDU $v0,$t1,$t0 - beqz $a2,.L_bn_mul_words_return + beqz $a2,.L_bn_mulw_words_return $LD $t0,$BNSZ($a1) $MULTU $t0,$a3 @@ -369,7 +369,7 @@ $code.=<<___; sltu $t1,$v0,$at $ST $v0,$BNSZ($a0) $ADDU $v0,$t1,$t0 - beqz $a2,.L_bn_mul_words_return + beqz $a2,.L_bn_mulw_words_return $LD $t0,2*$BNSZ($a1) $MULTU $t0,$a3 @@ -380,7 +380,7 @@ $code.=<<___; $ST $v0,2*$BNSZ($a0) $ADDU $v0,$t1,$t0 -.L_bn_mul_words_return: +.L_bn_mulw_words_return: .set noreorder ___ $code.=<<___ if ($flavour =~ /nubi/i); @@ -394,7 +394,7 @@ ___ $code.=<<___; jr $ra move $a0,$v0 -.end bn_mul_words_internal +.end bn_mulw_words_internal .align 5 .globl bn_sqr_words diff --git a/src/lib/libcrypto/bn/asm/ppc.pl b/src/lib/libcrypto/bn/asm/ppc.pl index c9b7f9477d..547baa111c 100644 --- a/src/lib/libcrypto/bn/asm/ppc.pl +++ b/src/lib/libcrypto/bn/asm/ppc.pl @@ -205,8 +205,8 @@ $data=<d, sdiv->d, div_n, q); + l0 = bn_mulw_words(tmp->d, sdiv->d, div_n, q); tmp->d[div_n] = l0; wnum.d--; diff --git a/src/lib/libcrypto/bn/bn_local.h b/src/lib/libcrypto/bn/bn_local.h index 16d270b6a1..f38d841e9a 100644 --- a/src/lib/libcrypto/bn/bn_local.h +++ b/src/lib/libcrypto/bn/bn_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_local.h,v 1.55 2025/08/30 07:16:06 jsing Exp $ */ +/* $OpenBSD: bn_local.h,v 1.56 2025/08/30 07:54:27 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -257,8 +257,8 @@ int bn_expand_bits(BIGNUM *a, size_t bits); int bn_expand_bytes(BIGNUM *a, size_t bytes); int bn_wexpand(BIGNUM *a, int words); -BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); -BN_ULONG bn_mul_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mulw_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); +BN_ULONG bn_mulw_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w); BN_ULONG bn_div_words(BN_ULONG h, BN_ULONG l, BN_ULONG d); void bn_div_rem_words(BN_ULONG h, BN_ULONG l, BN_ULONG d, BN_ULONG *out_q, BN_ULONG *out_r); diff --git a/src/lib/libcrypto/bn/bn_mont.c b/src/lib/libcrypto/bn/bn_mont.c index 8280a8db27..c9e95fb08b 100644 --- a/src/lib/libcrypto/bn/bn_mont.c +++ b/src/lib/libcrypto/bn/bn_mont.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mont.c,v 1.69 2025/08/03 10:33:46 tb Exp $ */ +/* $OpenBSD: bn_mont.c,v 1.70 2025/08/30 07:54:27 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -332,7 +332,7 @@ bn_montgomery_reduce_words(BN_ULONG *r, BN_ULONG *a, const BN_ULONG *n, /* Add multiples of the modulus, so that it becomes divisible by R. */ for (i = 0; i < n_len; i++) { - v = bn_mul_add_words(&a[i], n, n_len, a[i] * n0); + v = bn_mulw_add_words(&a[i], n, n_len, a[i] * n0); bn_addw_addw(v, a[i + n_len], carry, &carry, &a[i + n_len]); } diff --git a/src/lib/libcrypto/bn/bn_mul.c b/src/lib/libcrypto/bn/bn_mul.c index a30d05fb02..6ba05f2eba 100644 --- a/src/lib/libcrypto/bn/bn_mul.c +++ b/src/lib/libcrypto/bn/bn_mul.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_mul.c,v 1.43 2025/08/14 15:15:04 jsing Exp $ */ +/* $OpenBSD: bn_mul.c,v 1.44 2025/08/30 07:54:27 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -256,14 +256,13 @@ bn_mul_comba8(BN_ULONG *r, const BN_ULONG *a, const BN_ULONG *b) #endif /* - * bn_mul_words() computes (carry:r[i]) = a[i] * w + carry, where a is an array - * of words and w is a single word. This should really be called bn_mulw_words() - * since only one input is an array. This is used as a step in the multiplication + * bn_mulw_words() computes (carry:r[i]) = a[i] * w + carry, where a is an array + * of words and w is a single word. This is used as a step in the multiplication * of word arrays. */ -#ifndef HAVE_BN_MUL_WORDS +#ifndef HAVE_BN_MULW_WORDS BN_ULONG -bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) +bn_mulw_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) { BN_ULONG carry = 0; @@ -289,14 +288,13 @@ bn_mul_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) #endif /* - * bn_mul_add_words() computes (carry:r[i]) = a[i] * w + r[i] + carry, where - * a is an array of words and w is a single word. This should really be called - * bn_mulw_add_words() since only one input is an array. This is used as a step - * in the multiplication of word arrays. + * bn_mulw_add_words() computes (carry:r[i]) = a[i] * w + r[i] + carry, where + * a is an array of words and w is a single word. This is used as a step in the + * multiplication of word arrays. */ -#ifndef HAVE_BN_MUL_ADD_WORDS +#ifndef HAVE_BN_MULW_ADD_WORDS BN_ULONG -bn_mul_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) +bn_mulw_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) { BN_ULONG carry = 0; @@ -323,62 +321,59 @@ bn_mul_add_words(BN_ULONG *r, const BN_ULONG *a, int num, BN_ULONG w) } #endif +#ifndef HAVE_BN_MUL_WORDS void -bn_mul_normal(BN_ULONG *r, BN_ULONG *a, int na, BN_ULONG *b, int nb) +bn_mul_words(BN_ULONG *r, BN_ULONG *a, int a_len, BN_ULONG *b, int b_len) { BN_ULONG *rr; - - if (na < nb) { + if (a_len < b_len) { int itmp; BN_ULONG *ltmp; - itmp = na; - na = nb; - nb = itmp; + itmp = a_len; + a_len = b_len; + b_len = itmp; ltmp = a; a = b; b = ltmp; } - rr = &(r[na]); - if (nb <= 0) { - (void)bn_mul_words(r, a, na, 0); + rr = &(r[a_len]); + if (b_len <= 0) { + (void)bn_mulw_words(r, a, a_len, 0); return; } else - rr[0] = bn_mul_words(r, a, na, b[0]); + rr[0] = bn_mulw_words(r, a, a_len, b[0]); for (;;) { - if (--nb <= 0) + if (--b_len <= 0) return; - rr[1] = bn_mul_add_words(&(r[1]), a, na, b[1]); - if (--nb <= 0) + rr[1] = bn_mulw_add_words(&(r[1]), a, a_len, b[1]); + if (--b_len <= 0) return; - rr[2] = bn_mul_add_words(&(r[2]), a, na, b[2]); - if (--nb <= 0) + rr[2] = bn_mulw_add_words(&(r[2]), a, a_len, b[2]); + if (--b_len <= 0) return; - rr[3] = bn_mul_add_words(&(r[3]), a, na, b[3]); - if (--nb <= 0) + rr[3] = bn_mulw_add_words(&(r[3]), a, a_len, b[3]); + if (--b_len <= 0) return; - rr[4] = bn_mul_add_words(&(r[4]), a, na, b[4]); + rr[4] = bn_mulw_add_words(&(r[4]), a, a_len, b[4]); rr += 4; r += 4; b += 4; } } +#endif - -#ifndef HAVE_BN_MUL -int +static int bn_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, int rn, BN_CTX *ctx) { - bn_mul_normal(r->d, a->d, a->top, b->d, b->top); + bn_mul_words(r->d, a->d, a->top, b->d, b->top); return 1; } -#endif /* HAVE_BN_MUL */ - int BN_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx) { diff --git a/src/lib/libcrypto/bn/bn_sqr.c b/src/lib/libcrypto/bn/bn_sqr.c index 3a6eed06c6..64f275f9d4 100644 --- a/src/lib/libcrypto/bn/bn_sqr.c +++ b/src/lib/libcrypto/bn/bn_sqr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_sqr.c,v 1.39 2025/08/30 07:16:06 jsing Exp $ */ +/* $OpenBSD: bn_sqr.c,v 1.40 2025/08/30 07:54:27 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -267,7 +267,7 @@ bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len) /* Compute initial product - r[n:1] = a[n:1] * a[0] */ n = a_len - 1; if (n > 0) { - rp[n] = bn_mul_words(rp, ap, n, w); + rp[n] = bn_mulw_words(rp, ap, n, w); } rp += 2; n--; @@ -277,7 +277,7 @@ bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, int a_len) w = ap[0]; ap++; - rp[n] = bn_mul_add_words(rp, ap, n, w); + rp[n] = bn_mulw_add_words(rp, ap, n, w); rp += 2; n--; } diff --git a/src/lib/libcrypto/bn/bn_word.c b/src/lib/libcrypto/bn/bn_word.c index a82b911e67..e035878cb9 100644 --- a/src/lib/libcrypto/bn/bn_word.c +++ b/src/lib/libcrypto/bn/bn_word.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_word.c,v 1.21 2023/07/08 12:21:58 beck Exp $ */ +/* $OpenBSD: bn_word.c,v 1.22 2025/08/30 07:54:27 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -232,7 +232,7 @@ BN_mul_word(BIGNUM *a, BN_ULONG w) if (w == 0) BN_zero(a); else { - ll = bn_mul_words(a->d, a->d, a->top, w); + ll = bn_mulw_words(a->d, a->d, a->top, w); if (ll) { if (!bn_wexpand(a, a->top + 1)) return (0); -- cgit v1.2.3-55-g6feb