diff options
| author | jsing <> | 2025-09-07 03:56:37 +0000 |
|---|---|---|
| committer | jsing <> | 2025-09-07 03:56:37 +0000 |
| commit | 6dd87e766b900133746524ad2d5599160de6f5c8 (patch) | |
| tree | 66f297a67636a88046b52639338d8d38e57fc76a /src | |
| parent | 2d6f277d83020c694493c3a7e59f398d16a2288a (diff) | |
| download | openbsd-6dd87e766b900133746524ad2d5599160de6f5c8.tar.gz openbsd-6dd87e766b900133746524ad2d5599160de6f5c8.tar.bz2 openbsd-6dd87e766b900133746524ad2d5599160de6f5c8.zip | |
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@
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/i386/bn_arch.h | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/mips64/bn_arch.h | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/powerpc/bn_arch.h | 3 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/asm/bn-586.pl | 4 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/asm/mips.pl | 32 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/asm/ppc.pl | 12 |
6 files changed, 27 insertions, 30 deletions
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 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.10 2025/08/30 07:54:27 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.11 2025/09/07 03:56:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -33,7 +33,6 @@ | |||
| 33 | 33 | ||
| 34 | #define HAVE_BN_SQR_COMBA4 | 34 | #define HAVE_BN_SQR_COMBA4 |
| 35 | #define HAVE_BN_SQR_COMBA8 | 35 | #define HAVE_BN_SQR_COMBA8 |
| 36 | #define HAVE_BN_SQR_WORDS | ||
| 37 | 36 | ||
| 38 | #define HAVE_BN_SUB_WORDS | 37 | #define HAVE_BN_SUB_WORDS |
| 39 | 38 | ||
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 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.8 2025/08/30 07:54:27 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.9 2025/09/07 03:56:37 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,7 +32,6 @@ | |||
| 32 | 32 | ||
| 33 | #define HAVE_BN_SQR_COMBA4 | 33 | #define HAVE_BN_SQR_COMBA4 |
| 34 | #define HAVE_BN_SQR_COMBA8 | 34 | #define HAVE_BN_SQR_COMBA8 |
| 35 | #define HAVE_BN_SQR_WORDS | ||
| 36 | 35 | ||
| 37 | #define HAVE_BN_SUB_WORDS | 36 | #define HAVE_BN_SUB_WORDS |
| 38 | 37 | ||
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 @@ | |||
| 1 | /* $OpenBSD: bn_arch.h,v 1.7 2025/08/30 07:54:27 jsing Exp $ */ | 1 | /* $OpenBSD: bn_arch.h,v 1.8 2025/09/07 03:56:37 jsing Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2023 Joel Sing <jsing@openbsd.org> |
| 4 | * | 4 | * |
| @@ -31,7 +31,6 @@ | |||
| 31 | 31 | ||
| 32 | #define HAVE_BN_SQR_COMBA4 | 32 | #define HAVE_BN_SQR_COMBA4 |
| 33 | #define HAVE_BN_SQR_COMBA8 | 33 | #define HAVE_BN_SQR_COMBA8 |
| 34 | #define HAVE_BN_SQR_WORDS | ||
| 35 | 34 | ||
| 36 | #define HAVE_BN_SUB_WORDS | 35 | #define HAVE_BN_SUB_WORDS |
| 37 | 36 | ||
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; | |||
| 12 | 12 | ||
| 13 | &bn_mulw_add_words("bn_mulw_add_words"); | 13 | &bn_mulw_add_words("bn_mulw_add_words"); |
| 14 | &bn_mulw_words("bn_mulw_words"); | 14 | &bn_mulw_words("bn_mulw_words"); |
| 15 | &bn_sqr_words("bn_sqr_words"); | 15 | &bn_sqr_word_wise("bn_sqr_word_wise"); |
| 16 | &bn_div_words("bn_div_words"); | 16 | &bn_div_words("bn_div_words"); |
| 17 | &bn_add_words("bn_add_words"); | 17 | &bn_add_words("bn_add_words"); |
| 18 | &bn_sub_words("bn_sub_words"); | 18 | &bn_sub_words("bn_sub_words"); |
| @@ -318,7 +318,7 @@ sub bn_mulw_words | |||
| 318 | &function_end($name); | 318 | &function_end($name); |
| 319 | } | 319 | } |
| 320 | 320 | ||
| 321 | sub bn_sqr_words | 321 | sub bn_sqr_word_wise |
| 322 | { | 322 | { |
| 323 | local($name)=@_; | 323 | local($name)=@_; |
| 324 | 324 | ||
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.=<<___; | |||
| 397 | .end bn_mulw_words_internal | 397 | .end bn_mulw_words_internal |
| 398 | 398 | ||
| 399 | .align 5 | 399 | .align 5 |
| 400 | .globl bn_sqr_words | 400 | .globl bn_sqr_word_wise |
| 401 | .ent bn_sqr_words | 401 | .ent bn_sqr_word_wise |
| 402 | bn_sqr_words: | 402 | bn_sqr_word_wise: |
| 403 | .set noreorder | 403 | .set noreorder |
| 404 | bgtz $a2,bn_sqr_words_internal | 404 | bgtz $a2,bn_sqr_word_wise_internal |
| 405 | move $v0,$zero | 405 | move $v0,$zero |
| 406 | jr $ra | 406 | jr $ra |
| 407 | move $a0,$v0 | 407 | move $a0,$v0 |
| 408 | .end bn_sqr_words | 408 | .end bn_sqr_word_wise |
| 409 | 409 | ||
| 410 | .align 5 | 410 | .align 5 |
| 411 | .ent bn_sqr_words_internal | 411 | .ent bn_sqr_word_wise_internal |
| 412 | bn_sqr_words_internal: | 412 | bn_sqr_word_wise_internal: |
| 413 | ___ | 413 | ___ |
| 414 | $code.=<<___ if ($flavour =~ /nubi/i); | 414 | $code.=<<___ if ($flavour =~ /nubi/i); |
| 415 | .frame $sp,6*$SZREG,$ra | 415 | .frame $sp,6*$SZREG,$ra |
| @@ -427,9 +427,9 @@ $code.=<<___; | |||
| 427 | .set reorder | 427 | .set reorder |
| 428 | li $minus4,-4 | 428 | li $minus4,-4 |
| 429 | and $ta0,$a2,$minus4 | 429 | and $ta0,$a2,$minus4 |
| 430 | beqz $ta0,.L_bn_sqr_words_tail | 430 | beqz $ta0,.L_bn_sqr_word_wise_tail |
| 431 | 431 | ||
| 432 | .L_bn_sqr_words_loop: | 432 | .L_bn_sqr_word_wise_loop: |
| 433 | $LD $t0,0($a1) | 433 | $LD $t0,0($a1) |
| 434 | $MULTU $t0,$t0 | 434 | $MULTU $t0,$t0 |
| 435 | $LD $t2,$BNSZ($a1) | 435 | $LD $t2,$BNSZ($a1) |
| @@ -463,13 +463,13 @@ $code.=<<___; | |||
| 463 | $ST $ta3,-2*$BNSZ($a0) | 463 | $ST $ta3,-2*$BNSZ($a0) |
| 464 | 464 | ||
| 465 | .set noreorder | 465 | .set noreorder |
| 466 | bgtz $ta0,.L_bn_sqr_words_loop | 466 | bgtz $ta0,.L_bn_sqr_word_wise_loop |
| 467 | $ST $ta2,-$BNSZ($a0) | 467 | $ST $ta2,-$BNSZ($a0) |
| 468 | 468 | ||
| 469 | beqz $a2,.L_bn_sqr_words_return | 469 | beqz $a2,.L_bn_sqr_word_wise_return |
| 470 | nop | 470 | nop |
| 471 | 471 | ||
| 472 | .L_bn_sqr_words_tail: | 472 | .L_bn_sqr_word_wise_tail: |
| 473 | .set reorder | 473 | .set reorder |
| 474 | $LD $t0,0($a1) | 474 | $LD $t0,0($a1) |
| 475 | $MULTU $t0,$t0 | 475 | $MULTU $t0,$t0 |
| @@ -478,7 +478,7 @@ $code.=<<___; | |||
| 478 | mfhi $t0 | 478 | mfhi $t0 |
| 479 | $ST $t1,0($a0) | 479 | $ST $t1,0($a0) |
| 480 | $ST $t0,$BNSZ($a0) | 480 | $ST $t0,$BNSZ($a0) |
| 481 | beqz $a2,.L_bn_sqr_words_return | 481 | beqz $a2,.L_bn_sqr_word_wise_return |
| 482 | 482 | ||
| 483 | $LD $t0,$BNSZ($a1) | 483 | $LD $t0,$BNSZ($a1) |
| 484 | $MULTU $t0,$t0 | 484 | $MULTU $t0,$t0 |
| @@ -487,7 +487,7 @@ $code.=<<___; | |||
| 487 | mfhi $t0 | 487 | mfhi $t0 |
| 488 | $ST $t1,2*$BNSZ($a0) | 488 | $ST $t1,2*$BNSZ($a0) |
| 489 | $ST $t0,3*$BNSZ($a0) | 489 | $ST $t0,3*$BNSZ($a0) |
| 490 | beqz $a2,.L_bn_sqr_words_return | 490 | beqz $a2,.L_bn_sqr_word_wise_return |
| 491 | 491 | ||
| 492 | $LD $t0,2*$BNSZ($a1) | 492 | $LD $t0,2*$BNSZ($a1) |
| 493 | $MULTU $t0,$t0 | 493 | $MULTU $t0,$t0 |
| @@ -496,7 +496,7 @@ $code.=<<___; | |||
| 496 | $ST $t1,4*$BNSZ($a0) | 496 | $ST $t1,4*$BNSZ($a0) |
| 497 | $ST $t0,5*$BNSZ($a0) | 497 | $ST $t0,5*$BNSZ($a0) |
| 498 | 498 | ||
| 499 | .L_bn_sqr_words_return: | 499 | .L_bn_sqr_word_wise_return: |
| 500 | .set noreorder | 500 | .set noreorder |
| 501 | ___ | 501 | ___ |
| 502 | $code.=<<___ if ($flavour =~ /nubi/i); | 502 | $code.=<<___ if ($flavour =~ /nubi/i); |
| @@ -511,7 +511,7 @@ $code.=<<___; | |||
| 511 | jr $ra | 511 | jr $ra |
| 512 | move $a0,$v0 | 512 | move $a0,$v0 |
| 513 | 513 | ||
| 514 | .end bn_sqr_words_internal | 514 | .end bn_sqr_word_wise_internal |
| 515 | 515 | ||
| 516 | .align 5 | 516 | .align 5 |
| 517 | .globl bn_add_words | 517 | .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=<<EOF; | |||
| 204 | # bn_sub_words | 204 | # bn_sub_words |
| 205 | # bn_add_words | 205 | # bn_add_words |
| 206 | # bn_div_words | 206 | # bn_div_words |
| 207 | # bn_sqr_words | 207 | # bn_sqr_word_wise |
| 208 | # bn_mulw_words | 208 | # bn_mulw_words |
| 209 | # bn_mulw_add_words | 209 | # bn_mulw_add_words |
| 210 | # | 210 | # |
| @@ -248,7 +248,7 @@ $data=<<EOF; | |||
| 248 | .globl .bn_sub_words | 248 | .globl .bn_sub_words |
| 249 | .globl .bn_add_words | 249 | .globl .bn_add_words |
| 250 | .globl .bn_div_words | 250 | .globl .bn_div_words |
| 251 | .globl .bn_sqr_words | 251 | .globl .bn_sqr_word_wise |
| 252 | .globl .bn_mulw_words | 252 | .globl .bn_mulw_words |
| 253 | .globl .bn_mulw_add_words | 253 | .globl .bn_mulw_add_words |
| 254 | 254 | ||
| @@ -1702,16 +1702,16 @@ Lppcasm_div9: | |||
| 1702 | 1702 | ||
| 1703 | # | 1703 | # |
| 1704 | # NOTE: The following label name should be changed to | 1704 | # NOTE: The following label name should be changed to |
| 1705 | # "bn_sqr_words" i.e. remove the first dot | 1705 | # "bn_sqr_word_wise" i.e. remove the first dot |
| 1706 | # for the gcc compiler. This should be automatically | 1706 | # for the gcc compiler. This should be automatically |
| 1707 | # done in the build | 1707 | # done in the build |
| 1708 | # | 1708 | # |
| 1709 | .align 4 | 1709 | .align 4 |
| 1710 | .bn_sqr_words: | 1710 | .bn_sqr_word_wise: |
| 1711 | # | 1711 | # |
| 1712 | # Optimized version of bn_sqr_words | 1712 | # Optimized version of bn_sqr_word_wise |
| 1713 | # | 1713 | # |
| 1714 | # void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n) | 1714 | # void bn_sqr_word_wise(BN_ULONG *r, BN_ULONG *a, int n) |
| 1715 | # | 1715 | # |
| 1716 | # r3 = r | 1716 | # r3 = r |
| 1717 | # r4 = a | 1717 | # r4 = a |
