summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/bn/asm
diff options
context:
space:
mode:
authortb <>2024-02-24 15:30:14 +0000
committertb <>2024-02-24 15:30:14 +0000
commitc10c5b524e3121f42c9239d737dd7f975638f378 (patch)
tree162dfb371639bf1514d472f64e2a4d1279851907 /src/lib/libcrypto/bn/asm
parent1f31ec76cd83a26559f7a7ee2623bce8b503473d (diff)
downloadopenbsd-c10c5b524e3121f42c9239d737dd7f975638f378.tar.gz
openbsd-c10c5b524e3121f42c9239d737dd7f975638f378.tar.bz2
openbsd-c10c5b524e3121f42c9239d737dd7f975638f378.zip
Replace uses of endbr64 with _CET_ENDBR from cet.h
cet.h is needed for other platforms to emit the relevant .gnu.properties sections that are necessary for them to enable IBT. It also avoids issues with older toolchains on macOS that explode on encountering endbr64. based on a diff by kettenis ok beck kettenis
Diffstat (limited to 'src/lib/libcrypto/bn/asm')
-rw-r--r--src/lib/libcrypto/bn/asm/modexp512-x86_64.pl10
-rwxr-xr-xsrc/lib/libcrypto/bn/asm/x86_64-mont.pl6
-rwxr-xr-xsrc/lib/libcrypto/bn/asm/x86_64-mont5.pl10
3 files changed, 13 insertions, 13 deletions
diff --git a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
index af78fff541..8645d5adcc 100644
--- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
+++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
@@ -347,7 +347,7 @@ $code.=<<___;
347.type MULADD_128x512,\@abi-omnipotent 347.type MULADD_128x512,\@abi-omnipotent
348.align 16 348.align 16
349MULADD_128x512: 349MULADD_128x512:
350 endbr64 350 _CET_ENDBR
351___ 351___
352 &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");
353$code.=<<___; 353$code.=<<___;
@@ -415,7 +415,7 @@ $code.=<<___;
415.type mont_reduce,\@abi-omnipotent 415.type mont_reduce,\@abi-omnipotent
416.align 16 416.align 16
417mont_reduce: 417mont_reduce:
418 endbr64 418 _CET_ENDBR
419___ 419___
420 420
421my $STACK_DEPTH = 8; 421my $STACK_DEPTH = 8;
@@ -678,7 +678,7 @@ $code.=<<___;
678.type mont_mul_a3b,\@abi-omnipotent 678.type mont_mul_a3b,\@abi-omnipotent
679.align 16 679.align 16
680mont_mul_a3b: 680mont_mul_a3b:
681 endbr64 681 _CET_ENDBR
682 # 682 #
683 # multiply tmp = src1 * src2 683 # multiply tmp = src1 * src2
684 # For multiply: dst = rcx, src1 = rdi, src2 = rsi 684 # For multiply: dst = rcx, src1 = rdi, src2 = rsi
@@ -1080,7 +1080,7 @@ $code.=<<___;
1080.type sqr_reduce,\@abi-omnipotent 1080.type sqr_reduce,\@abi-omnipotent
1081.align 16 1081.align 16
1082sqr_reduce: 1082sqr_reduce:
1083 endbr64 1083 _CET_ENDBR
1084 mov (+$pResult_offset+8)(%rsp), %rcx 1084 mov (+$pResult_offset+8)(%rsp), %rcx
1085___ 1085___
1086 &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");
@@ -1110,7 +1110,7 @@ $code.=<<___;
1110.globl mod_exp_512 1110.globl mod_exp_512
1111.type mod_exp_512,\@function,4 1111.type mod_exp_512,\@function,4
1112mod_exp_512: 1112mod_exp_512:
1113 endbr64 1113 _CET_ENDBR
1114 push %rbp 1114 push %rbp
1115 push %rbx 1115 push %rbx
1116 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 6f5ab331e2..30cfab4fce 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
@@ -63,7 +63,7 @@ $code=<<___;
63.type bn_mul_mont,\@function,6 63.type bn_mul_mont,\@function,6
64.align 16 64.align 16
65bn_mul_mont: 65bn_mul_mont:
66 endbr64 66 _CET_ENDBR
67 test \$3,${num}d 67 test \$3,${num}d
68 jnz .Lmul_enter 68 jnz .Lmul_enter
69 cmp \$8,${num}d 69 cmp \$8,${num}d
@@ -279,7 +279,7 @@ $code.=<<___;
279.align 16 279.align 16
280bn_mul4x_mont: 280bn_mul4x_mont:
281.Lmul4x_enter: 281.Lmul4x_enter:
282 endbr64 282 _CET_ENDBR
283 push %rbx 283 push %rbx
284 push %rbp 284 push %rbp
285 push %r12 285 push %r12
@@ -707,7 +707,7 @@ $code.=<<___;
707.align 16 707.align 16
708bn_sqr4x_mont: 708bn_sqr4x_mont:
709.Lsqr4x_enter: 709.Lsqr4x_enter:
710 endbr64 710 _CET_ENDBR
711 push %rbx 711 push %rbx
712 push %rbp 712 push %rbp
713 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 3b3325a6cc..38751ec5de 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
@@ -57,7 +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
59bn_mul_mont_gather5: 59bn_mul_mont_gather5:
60 endbr64 60 _CET_ENDBR
61 test \$3,${num}d 61 test \$3,${num}d
62 jnz .Lmul_enter 62 jnz .Lmul_enter
63 cmp \$8,${num}d 63 cmp \$8,${num}d
@@ -388,7 +388,7 @@ $code.=<<___;
388.type bn_mul4x_mont_gather5,\@function,6 388.type bn_mul4x_mont_gather5,\@function,6
389.align 16 389.align 16
390bn_mul4x_mont_gather5: 390bn_mul4x_mont_gather5:
391 endbr64 391 _CET_ENDBR
392.Lmul4x_enter: 392.Lmul4x_enter:
393 mov ${num}d,${num}d 393 mov ${num}d,${num}d
394 movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument 394 movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument
@@ -927,7 +927,7 @@ $code.=<<___;
927.type bn_scatter5,\@abi-omnipotent 927.type bn_scatter5,\@abi-omnipotent
928.align 16 928.align 16
929bn_scatter5: 929bn_scatter5:
930 endbr64 930 _CET_ENDBR
931 cmp \$0, $num 931 cmp \$0, $num
932 jz .Lscatter_epilogue 932 jz .Lscatter_epilogue
933 lea ($tbl,$idx,8),$tbl 933 lea ($tbl,$idx,8),$tbl
@@ -946,7 +946,7 @@ bn_scatter5:
946.type bn_gather5,\@abi-omnipotent 946.type bn_gather5,\@abi-omnipotent
947.align 16 947.align 16
948bn_gather5: 948bn_gather5:
949 endbr64 949 _CET_ENDBR
950.LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases 950.LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases
951 # I can't trust assembler to use specific encoding:-( 951 # I can't trust assembler to use specific encoding:-(
952 .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10 952 .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10
@@ -1057,7 +1057,7 @@ $code.=<<___;
1057.type mul_handler,\@abi-omnipotent 1057.type mul_handler,\@abi-omnipotent
1058.align 16 1058.align 16
1059mul_handler: 1059mul_handler:
1060 endbr64 1060 _CET_ENDBR
1061 push %rsi 1061 push %rsi
1062 push %rdi 1062 push %rdi
1063 push %rbx 1063 push %rbx