diff options
| author | deraadt <> | 2023-04-25 04:42:26 +0000 |
|---|---|---|
| committer | deraadt <> | 2023-04-25 04:42:26 +0000 |
| commit | e2118101444d3cf3cab87297b363cecd5357ae89 (patch) | |
| tree | b4ae043f669d9d718f1fecb4ca705a0cf2d2ddc7 /src/lib/libcrypto/bn | |
| parent | c6490b97c04798e5cd36a489e3ba5ffc4a66550b (diff) | |
| download | openbsd-e2118101444d3cf3cab87297b363cecd5357ae89.tar.gz openbsd-e2118101444d3cf3cab87297b363cecd5357ae89.tar.bz2 openbsd-e2118101444d3cf3cab87297b363cecd5357ae89.zip | |
Add endbr64 where needed by inspection. Passes regresson tests.
ok jsing, and kind of tb an earlier version
Diffstat (limited to 'src/lib/libcrypto/bn')
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_add.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/arch/amd64/word_clz.S | 1 | ||||
| -rw-r--r-- | src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | 5 | ||||
| -rwxr-xr-x | src/lib/libcrypto/bn/asm/x86_64-mont.pl | 3 | ||||
| -rwxr-xr-x | src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 5 |
14 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S index d56fa5e3a8..06298ca69e 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | S2N_BN_SYMBOL(bignum_add): | 51 | S2N_BN_SYMBOL(bignum_add): |
| 52 | endbr64 | ||
| 52 | 53 | ||
| 53 | #if WINDOWS_ABI | 54 | #if WINDOWS_ABI |
| 54 | push rdi | 55 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S index 1dc1e58705..5ad712749f 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S | |||
| @@ -54,6 +54,7 @@ | |||
| 54 | 54 | ||
| 55 | 55 | ||
| 56 | S2N_BN_SYMBOL(bignum_cmadd): | 56 | S2N_BN_SYMBOL(bignum_cmadd): |
| 57 | endbr64 | ||
| 57 | 58 | ||
| 58 | #if WINDOWS_ABI | 59 | #if WINDOWS_ABI |
| 59 | push rdi | 60 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S index c1a23ccea4..9199c8f48b 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | |||
| @@ -51,6 +51,7 @@ | |||
| 51 | 51 | ||
| 52 | 52 | ||
| 53 | S2N_BN_SYMBOL(bignum_cmul): | 53 | S2N_BN_SYMBOL(bignum_cmul): |
| 54 | endbr64 | ||
| 54 | 55 | ||
| 55 | #if WINDOWS_ABI | 56 | #if WINDOWS_ABI |
| 56 | push rdi | 57 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S index 42ac988a19..2d7ed19091 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | |||
| @@ -59,6 +59,7 @@ | |||
| 59 | 59 | ||
| 60 | 60 | ||
| 61 | S2N_BN_SYMBOL(bignum_mul): | 61 | S2N_BN_SYMBOL(bignum_mul): |
| 62 | endbr64 | ||
| 62 | 63 | ||
| 63 | #if WINDOWS_ABI | 64 | #if WINDOWS_ABI |
| 64 | push rdi | 65 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S index 3b7848b285..f02b09b288 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S | |||
| @@ -72,6 +72,7 @@ | |||
| 72 | adc h, rdx | 72 | adc h, rdx |
| 73 | 73 | ||
| 74 | S2N_BN_SYMBOL(bignum_mul_4_8_alt): | 74 | S2N_BN_SYMBOL(bignum_mul_4_8_alt): |
| 75 | endbr64 | ||
| 75 | 76 | ||
| 76 | #if WINDOWS_ABI | 77 | #if WINDOWS_ABI |
| 77 | push rdi | 78 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S index 1be37840df..97be83e1f7 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S | |||
| @@ -72,6 +72,7 @@ | |||
| 72 | adc h, rdx | 72 | adc h, rdx |
| 73 | 73 | ||
| 74 | S2N_BN_SYMBOL(bignum_mul_8_16_alt): | 74 | S2N_BN_SYMBOL(bignum_mul_8_16_alt): |
| 75 | endbr64 | ||
| 75 | 76 | ||
| 76 | #if WINDOWS_ABI | 77 | #if WINDOWS_ABI |
| 77 | push rdi | 78 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S index 2e05b9c179..c4a0cabf35 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | |||
| @@ -62,6 +62,7 @@ | |||
| 62 | #define llshort ebp | 62 | #define llshort ebp |
| 63 | 63 | ||
| 64 | S2N_BN_SYMBOL(bignum_sqr): | 64 | S2N_BN_SYMBOL(bignum_sqr): |
| 65 | endbr64 | ||
| 65 | 66 | ||
| 66 | #if WINDOWS_ABI | 67 | #if WINDOWS_ABI |
| 67 | push rdi | 68 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S index a635177c65..b228414dce 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S | |||
| @@ -71,6 +71,7 @@ | |||
| 71 | adc c, 0 | 71 | adc c, 0 |
| 72 | 72 | ||
| 73 | S2N_BN_SYMBOL(bignum_sqr_4_8_alt): | 73 | S2N_BN_SYMBOL(bignum_sqr_4_8_alt): |
| 74 | endbr64 | ||
| 74 | 75 | ||
| 75 | #if WINDOWS_ABI | 76 | #if WINDOWS_ABI |
| 76 | push rdi | 77 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S index f698202d29..04efeec7e2 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S | |||
| @@ -103,6 +103,7 @@ | |||
| 103 | adc c, 0 | 103 | adc c, 0 |
| 104 | 104 | ||
| 105 | S2N_BN_SYMBOL(bignum_sqr_8_16_alt): | 105 | S2N_BN_SYMBOL(bignum_sqr_8_16_alt): |
| 106 | endbr64 | ||
| 106 | 107 | ||
| 107 | #if WINDOWS_ABI | 108 | #if WINDOWS_ABI |
| 108 | push rdi | 109 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S index f8e1fe35a8..11a9bd7edd 100644 --- a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S +++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | |||
| @@ -49,6 +49,7 @@ | |||
| 49 | 49 | ||
| 50 | 50 | ||
| 51 | S2N_BN_SYMBOL(bignum_sub): | 51 | S2N_BN_SYMBOL(bignum_sub): |
| 52 | endbr64 | ||
| 52 | 53 | ||
| 53 | #if WINDOWS_ABI | 54 | #if WINDOWS_ABI |
| 54 | push rdi | 55 | push rdi |
diff --git a/src/lib/libcrypto/bn/arch/amd64/word_clz.S b/src/lib/libcrypto/bn/arch/amd64/word_clz.S index 025e98f9cb..464a9d90fc 100644 --- a/src/lib/libcrypto/bn/arch/amd64/word_clz.S +++ b/src/lib/libcrypto/bn/arch/amd64/word_clz.S | |||
| @@ -30,6 +30,7 @@ | |||
| 30 | .text | 30 | .text |
| 31 | 31 | ||
| 32 | S2N_BN_SYMBOL(word_clz): | 32 | S2N_BN_SYMBOL(word_clz): |
| 33 | endbr64 | ||
| 33 | 34 | ||
| 34 | #if WINDOWS_ABI | 35 | #if WINDOWS_ABI |
| 35 | push rdi | 36 | push rdi |
diff --git a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl index 2e71a7f03d..af78fff541 100644 --- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl +++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | |||
| @@ -347,6 +347,7 @@ $code.=<<___; | |||
| 347 | .type MULADD_128x512,\@abi-omnipotent | 347 | .type MULADD_128x512,\@abi-omnipotent |
| 348 | .align 16 | 348 | .align 16 |
| 349 | MULADD_128x512: | 349 | MULADD_128x512: |
| 350 | endbr64 | ||
| 350 | ___ | 351 | ___ |
| 351 | &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx"); | 352 | &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx"); |
| 352 | $code.=<<___; | 353 | $code.=<<___; |
| @@ -414,6 +415,7 @@ $code.=<<___; | |||
| 414 | .type mont_reduce,\@abi-omnipotent | 415 | .type mont_reduce,\@abi-omnipotent |
| 415 | .align 16 | 416 | .align 16 |
| 416 | mont_reduce: | 417 | mont_reduce: |
| 418 | endbr64 | ||
| 417 | ___ | 419 | ___ |
| 418 | 420 | ||
| 419 | my $STACK_DEPTH = 8; | 421 | my $STACK_DEPTH = 8; |
| @@ -676,6 +678,7 @@ $code.=<<___; | |||
| 676 | .type mont_mul_a3b,\@abi-omnipotent | 678 | .type mont_mul_a3b,\@abi-omnipotent |
| 677 | .align 16 | 679 | .align 16 |
| 678 | mont_mul_a3b: | 680 | mont_mul_a3b: |
| 681 | endbr64 | ||
| 679 | # | 682 | # |
| 680 | # multiply tmp = src1 * src2 | 683 | # multiply tmp = src1 * src2 |
| 681 | # For multiply: dst = rcx, src1 = rdi, src2 = rsi | 684 | # For multiply: dst = rcx, src1 = rdi, src2 = rsi |
| @@ -1077,6 +1080,7 @@ $code.=<<___; | |||
| 1077 | .type sqr_reduce,\@abi-omnipotent | 1080 | .type sqr_reduce,\@abi-omnipotent |
| 1078 | .align 16 | 1081 | .align 16 |
| 1079 | sqr_reduce: | 1082 | sqr_reduce: |
| 1083 | endbr64 | ||
| 1080 | mov (+$pResult_offset+8)(%rsp), %rcx | 1084 | mov (+$pResult_offset+8)(%rsp), %rcx |
| 1081 | ___ | 1085 | ___ |
| 1082 | &SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi"); | 1086 | &SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi"); |
| @@ -1106,6 +1110,7 @@ $code.=<<___; | |||
| 1106 | .globl mod_exp_512 | 1110 | .globl mod_exp_512 |
| 1107 | .type mod_exp_512,\@function,4 | 1111 | .type mod_exp_512,\@function,4 |
| 1108 | mod_exp_512: | 1112 | mod_exp_512: |
| 1113 | endbr64 | ||
| 1109 | push %rbp | 1114 | push %rbp |
| 1110 | push %rbx | 1115 | push %rbx |
| 1111 | push %r12 | 1116 | push %r12 |
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl index cae7309d5b..6f5ab331e2 100755 --- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl +++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl | |||
| @@ -63,6 +63,7 @@ $code=<<___; | |||
| 63 | .type bn_mul_mont,\@function,6 | 63 | .type bn_mul_mont,\@function,6 |
| 64 | .align 16 | 64 | .align 16 |
| 65 | bn_mul_mont: | 65 | bn_mul_mont: |
| 66 | endbr64 | ||
| 66 | test \$3,${num}d | 67 | test \$3,${num}d |
| 67 | jnz .Lmul_enter | 68 | jnz .Lmul_enter |
| 68 | cmp \$8,${num}d | 69 | cmp \$8,${num}d |
| @@ -278,6 +279,7 @@ $code.=<<___; | |||
| 278 | .align 16 | 279 | .align 16 |
| 279 | bn_mul4x_mont: | 280 | bn_mul4x_mont: |
| 280 | .Lmul4x_enter: | 281 | .Lmul4x_enter: |
| 282 | endbr64 | ||
| 281 | push %rbx | 283 | push %rbx |
| 282 | push %rbp | 284 | push %rbp |
| 283 | push %r12 | 285 | push %r12 |
| @@ -705,6 +707,7 @@ $code.=<<___; | |||
| 705 | .align 16 | 707 | .align 16 |
| 706 | bn_sqr4x_mont: | 708 | bn_sqr4x_mont: |
| 707 | .Lsqr4x_enter: | 709 | .Lsqr4x_enter: |
| 710 | endbr64 | ||
| 708 | push %rbx | 711 | push %rbx |
| 709 | push %rbp | 712 | push %rbp |
| 710 | push %r12 | 713 | push %r12 |
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl index 7b9c6df273..3b3325a6cc 100755 --- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl +++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl | |||
| @@ -57,6 +57,7 @@ $code=<<___; | |||
| 57 | .type bn_mul_mont_gather5,\@function,6 | 57 | .type bn_mul_mont_gather5,\@function,6 |
| 58 | .align 64 | 58 | .align 64 |
| 59 | bn_mul_mont_gather5: | 59 | bn_mul_mont_gather5: |
| 60 | endbr64 | ||
| 60 | test \$3,${num}d | 61 | test \$3,${num}d |
| 61 | jnz .Lmul_enter | 62 | jnz .Lmul_enter |
| 62 | cmp \$8,${num}d | 63 | cmp \$8,${num}d |
| @@ -387,6 +388,7 @@ $code.=<<___; | |||
| 387 | .type bn_mul4x_mont_gather5,\@function,6 | 388 | .type bn_mul4x_mont_gather5,\@function,6 |
| 388 | .align 16 | 389 | .align 16 |
| 389 | bn_mul4x_mont_gather5: | 390 | bn_mul4x_mont_gather5: |
| 391 | endbr64 | ||
| 390 | .Lmul4x_enter: | 392 | .Lmul4x_enter: |
| 391 | mov ${num}d,${num}d | 393 | mov ${num}d,${num}d |
| 392 | movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument | 394 | movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument |
| @@ -925,6 +927,7 @@ $code.=<<___; | |||
| 925 | .type bn_scatter5,\@abi-omnipotent | 927 | .type bn_scatter5,\@abi-omnipotent |
| 926 | .align 16 | 928 | .align 16 |
| 927 | bn_scatter5: | 929 | bn_scatter5: |
| 930 | endbr64 | ||
| 928 | cmp \$0, $num | 931 | cmp \$0, $num |
| 929 | jz .Lscatter_epilogue | 932 | jz .Lscatter_epilogue |
| 930 | lea ($tbl,$idx,8),$tbl | 933 | lea ($tbl,$idx,8),$tbl |
| @@ -943,6 +946,7 @@ bn_scatter5: | |||
| 943 | .type bn_gather5,\@abi-omnipotent | 946 | .type bn_gather5,\@abi-omnipotent |
| 944 | .align 16 | 947 | .align 16 |
| 945 | bn_gather5: | 948 | bn_gather5: |
| 949 | endbr64 | ||
| 946 | .LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases | 950 | .LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases |
| 947 | # I can't trust assembler to use specific encoding:-( | 951 | # I can't trust assembler to use specific encoding:-( |
| 948 | .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10 | 952 | .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10 |
| @@ -1053,6 +1057,7 @@ $code.=<<___; | |||
| 1053 | .type mul_handler,\@abi-omnipotent | 1057 | .type mul_handler,\@abi-omnipotent |
| 1054 | .align 16 | 1058 | .align 16 |
| 1055 | mul_handler: | 1059 | mul_handler: |
| 1060 | endbr64 | ||
| 1056 | push %rsi | 1061 | push %rsi |
| 1057 | push %rdi | 1062 | push %rdi |
| 1058 | push %rbx | 1063 | push %rbx |
