From 6dd87e766b900133746524ad2d5599160de6f5c8 Mon Sep 17 00:00:00 2001 From: jsing <> Date: Sun, 7 Sep 2025 03:56:37 +0000 Subject: Rename old assembly bn_sqr_words() to bn_sqr_word_wise(). bn_sqr_words() does not actually compute the square of the words, it only computes the square of each individual word - rename it to reflect reality. Discussed with tb@ --- src/lib/libcrypto/bn/arch/i386/bn_arch.h | 3 +-- src/lib/libcrypto/bn/arch/mips64/bn_arch.h | 3 +-- src/lib/libcrypto/bn/arch/powerpc/bn_arch.h | 3 +-- src/lib/libcrypto/bn/asm/bn-586.pl | 4 ++-- src/lib/libcrypto/bn/asm/mips.pl | 32 ++++++++++++++--------------- src/lib/libcrypto/bn/asm/ppc.pl | 12 +++++------ 6 files changed, 27 insertions(+), 30 deletions(-) (limited to 'src/lib') diff --git a/src/lib/libcrypto/bn/arch/i386/bn_arch.h b/src/lib/libcrypto/bn/arch/i386/bn_arch.h index 79f7345b8b..288cbdeaa9 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.10 2025/08/30 07:54:27 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.11 2025/09/07 03:56:37 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -33,7 +33,6 @@ #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 -#define HAVE_BN_SQR_WORDS #define HAVE_BN_SUB_WORDS diff --git a/src/lib/libcrypto/bn/arch/mips64/bn_arch.h b/src/lib/libcrypto/bn/arch/mips64/bn_arch.h index b7714c7d72..562a398f33 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.8 2025/08/30 07:54:27 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.9 2025/09/07 03:56:37 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -32,7 +32,6 @@ #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 -#define HAVE_BN_SQR_WORDS #define HAVE_BN_SUB_WORDS diff --git a/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h b/src/lib/libcrypto/bn/arch/powerpc/bn_arch.h index fdddedaf4f..21bcdf48d3 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.7 2025/08/30 07:54:27 jsing Exp $ */ +/* $OpenBSD: bn_arch.h,v 1.8 2025/09/07 03:56:37 jsing Exp $ */ /* * Copyright (c) 2023 Joel Sing * @@ -31,7 +31,6 @@ #define HAVE_BN_SQR_COMBA4 #define HAVE_BN_SQR_COMBA8 -#define HAVE_BN_SQR_WORDS #define HAVE_BN_SUB_WORDS diff --git a/src/lib/libcrypto/bn/asm/bn-586.pl b/src/lib/libcrypto/bn/asm/bn-586.pl index 7f550b3b7c..9b4b11ad5b 100644 --- a/src/lib/libcrypto/bn/asm/bn-586.pl +++ b/src/lib/libcrypto/bn/asm/bn-586.pl @@ -12,7 +12,7 @@ $sse2=1; &bn_mulw_add_words("bn_mulw_add_words"); &bn_mulw_words("bn_mulw_words"); -&bn_sqr_words("bn_sqr_words"); +&bn_sqr_word_wise("bn_sqr_word_wise"); &bn_div_words("bn_div_words"); &bn_add_words("bn_add_words"); &bn_sub_words("bn_sub_words"); @@ -318,7 +318,7 @@ sub bn_mulw_words &function_end($name); } -sub bn_sqr_words +sub bn_sqr_word_wise { local($name)=@_; diff --git a/src/lib/libcrypto/bn/asm/mips.pl b/src/lib/libcrypto/bn/asm/mips.pl index 378af371e7..aaa0c5d8b0 100644 --- a/src/lib/libcrypto/bn/asm/mips.pl +++ b/src/lib/libcrypto/bn/asm/mips.pl @@ -397,19 +397,19 @@ $code.=<<___; .end bn_mulw_words_internal .align 5 -.globl bn_sqr_words -.ent bn_sqr_words -bn_sqr_words: +.globl bn_sqr_word_wise +.ent bn_sqr_word_wise +bn_sqr_word_wise: .set noreorder - bgtz $a2,bn_sqr_words_internal + bgtz $a2,bn_sqr_word_wise_internal move $v0,$zero jr $ra move $a0,$v0 -.end bn_sqr_words +.end bn_sqr_word_wise .align 5 -.ent bn_sqr_words_internal -bn_sqr_words_internal: +.ent bn_sqr_word_wise_internal +bn_sqr_word_wise_internal: ___ $code.=<<___ if ($flavour =~ /nubi/i); .frame $sp,6*$SZREG,$ra @@ -427,9 +427,9 @@ $code.=<<___; .set reorder li $minus4,-4 and $ta0,$a2,$minus4 - beqz $ta0,.L_bn_sqr_words_tail + beqz $ta0,.L_bn_sqr_word_wise_tail -.L_bn_sqr_words_loop: +.L_bn_sqr_word_wise_loop: $LD $t0,0($a1) $MULTU $t0,$t0 $LD $t2,$BNSZ($a1) @@ -463,13 +463,13 @@ $code.=<<___; $ST $ta3,-2*$BNSZ($a0) .set noreorder - bgtz $ta0,.L_bn_sqr_words_loop + bgtz $ta0,.L_bn_sqr_word_wise_loop $ST $ta2,-$BNSZ($a0) - beqz $a2,.L_bn_sqr_words_return + beqz $a2,.L_bn_sqr_word_wise_return nop -.L_bn_sqr_words_tail: +.L_bn_sqr_word_wise_tail: .set reorder $LD $t0,0($a1) $MULTU $t0,$t0 @@ -478,7 +478,7 @@ $code.=<<___; mfhi $t0 $ST $t1,0($a0) $ST $t0,$BNSZ($a0) - beqz $a2,.L_bn_sqr_words_return + beqz $a2,.L_bn_sqr_word_wise_return $LD $t0,$BNSZ($a1) $MULTU $t0,$t0 @@ -487,7 +487,7 @@ $code.=<<___; mfhi $t0 $ST $t1,2*$BNSZ($a0) $ST $t0,3*$BNSZ($a0) - beqz $a2,.L_bn_sqr_words_return + beqz $a2,.L_bn_sqr_word_wise_return $LD $t0,2*$BNSZ($a1) $MULTU $t0,$t0 @@ -496,7 +496,7 @@ $code.=<<___; $ST $t1,4*$BNSZ($a0) $ST $t0,5*$BNSZ($a0) -.L_bn_sqr_words_return: +.L_bn_sqr_word_wise_return: .set noreorder ___ $code.=<<___ if ($flavour =~ /nubi/i); @@ -511,7 +511,7 @@ $code.=<<___; jr $ra move $a0,$v0 -.end bn_sqr_words_internal +.end bn_sqr_word_wise_internal .align 5 .globl bn_add_words diff --git a/src/lib/libcrypto/bn/asm/ppc.pl b/src/lib/libcrypto/bn/asm/ppc.pl index 547baa111c..9b8dc55bff 100644 --- a/src/lib/libcrypto/bn/asm/ppc.pl +++ b/src/lib/libcrypto/bn/asm/ppc.pl @@ -204,7 +204,7 @@ $data=<