summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorderaadt <>2023-04-25 04:42:26 +0000
committerderaadt <>2023-04-25 04:42:26 +0000
commite2118101444d3cf3cab87297b363cecd5357ae89 (patch)
treeb4ae043f669d9d718f1fecb4ca705a0cf2d2ddc7 /src
parentc6490b97c04798e5cd36a489e3ba5ffc4a66550b (diff)
downloadopenbsd-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')
-rwxr-xr-xsrc/lib/libcrypto/aes/asm/aes-x86_64.pl13
-rw-r--r--src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl4
-rw-r--r--src/lib/libcrypto/aes/asm/aesni-x86_64.pl15
-rw-r--r--src/lib/libcrypto/aes/asm/bsaes-x86_64.pl14
-rw-r--r--src/lib/libcrypto/aes/asm/vpaes-x86_64.pl14
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_add.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_mul.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/bignum_sub.S1
-rw-r--r--src/lib/libcrypto/bn/arch/amd64/word_clz.S1
-rw-r--r--src/lib/libcrypto/bn/asm/modexp512-x86_64.pl5
-rwxr-xr-xsrc/lib/libcrypto/bn/asm/x86_64-mont.pl3
-rwxr-xr-xsrc/lib/libcrypto/bn/asm/x86_64-mont5.pl5
-rw-r--r--src/lib/libcrypto/camellia/asm/cmll-x86_64.pl8
-rwxr-xr-xsrc/lib/libcrypto/md5/asm/md5-x86_64.pl1
-rw-r--r--src/lib/libcrypto/modes/asm/ghash-x86_64.pl4
-rw-r--r--src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl3
-rwxr-xr-xsrc/lib/libcrypto/rc4/asm/rc4-x86_64.pl6
-rwxr-xr-xsrc/lib/libcrypto/sha/asm/sha1-x86_64.pl4
-rwxr-xr-xsrc/lib/libcrypto/sha/asm/sha512-x86_64.pl1
-rw-r--r--src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl1
-rw-r--r--src/lib/libcrypto/x86_64cpuid.pl2
28 files changed, 113 insertions, 1 deletions
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index b7399b552a..78ba20ca59 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -318,6 +318,7 @@ $code.=<<___;
318.type _x86_64_AES_encrypt,\@abi-omnipotent 318.type _x86_64_AES_encrypt,\@abi-omnipotent
319.align 16 319.align 16
320_x86_64_AES_encrypt: 320_x86_64_AES_encrypt:
321 endbr64
321 xor 0($key),$s0 # xor with key 322 xor 0($key),$s0 # xor with key
322 xor 4($key),$s1 323 xor 4($key),$s1
323 xor 8($key),$s2 324 xor 8($key),$s2
@@ -548,6 +549,7 @@ $code.=<<___;
548.type _x86_64_AES_encrypt_compact,\@abi-omnipotent 549.type _x86_64_AES_encrypt_compact,\@abi-omnipotent
549.align 16 550.align 16
550_x86_64_AES_encrypt_compact: 551_x86_64_AES_encrypt_compact:
552 endbr64
551 lea 128($sbox),$inp # size optimization 553 lea 128($sbox),$inp # size optimization
552 mov 0-128($inp),$acc1 # prefetch Te4 554 mov 0-128($inp),$acc1 # prefetch Te4
553 mov 32-128($inp),$acc2 555 mov 32-128($inp),$acc2
@@ -593,6 +595,7 @@ $code.=<<___;
593.hidden asm_AES_encrypt 595.hidden asm_AES_encrypt
594asm_AES_encrypt: 596asm_AES_encrypt:
595AES_encrypt: 597AES_encrypt:
598 endbr64
596 push %rbx 599 push %rbx
597 push %rbp 600 push %rbp
598 push %r12 601 push %r12
@@ -884,6 +887,7 @@ $code.=<<___;
884.type _x86_64_AES_decrypt,\@abi-omnipotent 887.type _x86_64_AES_decrypt,\@abi-omnipotent
885.align 16 888.align 16
886_x86_64_AES_decrypt: 889_x86_64_AES_decrypt:
890 endbr64
887 xor 0($key),$s0 # xor with key 891 xor 0($key),$s0 # xor with key
888 xor 4($key),$s1 892 xor 4($key),$s1
889 xor 8($key),$s2 893 xor 8($key),$s2
@@ -1138,6 +1142,7 @@ $code.=<<___;
1138.type _x86_64_AES_decrypt_compact,\@abi-omnipotent 1142.type _x86_64_AES_decrypt_compact,\@abi-omnipotent
1139.align 16 1143.align 16
1140_x86_64_AES_decrypt_compact: 1144_x86_64_AES_decrypt_compact:
1145 endbr64
1141 lea 128($sbox),$inp # size optimization 1146 lea 128($sbox),$inp # size optimization
1142 mov 0-128($inp),$acc1 # prefetch Td4 1147 mov 0-128($inp),$acc1 # prefetch Td4
1143 mov 32-128($inp),$acc2 1148 mov 32-128($inp),$acc2
@@ -1192,6 +1197,7 @@ $code.=<<___;
1192.hidden asm_AES_decrypt 1197.hidden asm_AES_decrypt
1193asm_AES_decrypt: 1198asm_AES_decrypt:
1194AES_decrypt: 1199AES_decrypt:
1200 endbr64
1195 push %rbx 1201 push %rbx
1196 push %rbp 1202 push %rbp
1197 push %r12 1203 push %r12
@@ -1291,6 +1297,7 @@ $code.=<<___;
1291.type AES_set_encrypt_key,\@function,3 1297.type AES_set_encrypt_key,\@function,3
1292.align 16 1298.align 16
1293AES_set_encrypt_key: 1299AES_set_encrypt_key:
1300 endbr64
1294 push %rbx 1301 push %rbx
1295 push %rbp 1302 push %rbp
1296 push %r12 # redundant, but allows to share 1303 push %r12 # redundant, but allows to share
@@ -1316,6 +1323,7 @@ AES_set_encrypt_key:
1316.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent 1323.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
1317.align 16 1324.align 16
1318_x86_64_AES_set_encrypt_key: 1325_x86_64_AES_set_encrypt_key:
1326 endbr64
1319 mov %esi,%ecx # %ecx=bits 1327 mov %esi,%ecx # %ecx=bits
1320 mov %rdi,%rsi # %rsi=userKey 1328 mov %rdi,%rsi # %rsi=userKey
1321 mov %rdx,%rdi # %rdi=key 1329 mov %rdx,%rdi # %rdi=key
@@ -1561,6 +1569,7 @@ $code.=<<___;
1561.type AES_set_decrypt_key,\@function,3 1569.type AES_set_decrypt_key,\@function,3
1562.align 16 1570.align 16
1563AES_set_decrypt_key: 1571AES_set_decrypt_key:
1572 endbr64
1564 push %rbx 1573 push %rbx
1565 push %rbp 1574 push %rbp
1566 push %r12 1575 push %r12
@@ -1660,6 +1669,7 @@ $code.=<<___;
1660.hidden asm_AES_cbc_encrypt 1669.hidden asm_AES_cbc_encrypt
1661asm_AES_cbc_encrypt: 1670asm_AES_cbc_encrypt:
1662AES_cbc_encrypt: 1671AES_cbc_encrypt:
1672 endbr64
1663 cmp \$0,%rdx # check length 1673 cmp \$0,%rdx # check length
1664 je .Lcbc_epilogue 1674 je .Lcbc_epilogue
1665 pushfq 1675 pushfq
@@ -2551,6 +2561,7 @@ $code.=<<___;
2551.type block_se_handler,\@abi-omnipotent 2561.type block_se_handler,\@abi-omnipotent
2552.align 16 2562.align 16
2553block_se_handler: 2563block_se_handler:
2564 endbr64
2554 push %rsi 2565 push %rsi
2555 push %rdi 2566 push %rdi
2556 push %rbx 2567 push %rbx
@@ -2609,6 +2620,7 @@ block_se_handler:
2609.type key_se_handler,\@abi-omnipotent 2620.type key_se_handler,\@abi-omnipotent
2610.align 16 2621.align 16
2611key_se_handler: 2622key_se_handler:
2623 endbr64
2612 push %rsi 2624 push %rsi
2613 push %rdi 2625 push %rdi
2614 push %rbx 2626 push %rbx
@@ -2666,6 +2678,7 @@ key_se_handler:
2666.type cbc_se_handler,\@abi-omnipotent 2678.type cbc_se_handler,\@abi-omnipotent
2667.align 16 2679.align 16
2668cbc_se_handler: 2680cbc_se_handler:
2681 endbr64
2669 push %rsi 2682 push %rsi
2670 push %rdi 2683 push %rdi
2671 push %rbx 2684 push %rbx
diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
index bafa906a05..879d16793f 100644
--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
@@ -89,6 +89,7 @@ $code.=<<___;
89.type aesni_cbc_sha1_enc,\@abi-omnipotent 89.type aesni_cbc_sha1_enc,\@abi-omnipotent
90.align 16 90.align 16
91aesni_cbc_sha1_enc: 91aesni_cbc_sha1_enc:
92 endbr64
92 # caller should check for SSSE3 and AES-NI bits 93 # caller should check for SSSE3 and AES-NI bits
93 mov OPENSSL_ia32cap_P+0(%rip),%r10d 94 mov OPENSSL_ia32cap_P+0(%rip),%r10d
94 mov OPENSSL_ia32cap_P+4(%rip),%r11d 95 mov OPENSSL_ia32cap_P+4(%rip),%r11d
@@ -132,6 +133,7 @@ $code.=<<___;
132.type aesni_cbc_sha1_enc_ssse3,\@function,6 133.type aesni_cbc_sha1_enc_ssse3,\@function,6
133.align 16 134.align 16
134aesni_cbc_sha1_enc_ssse3: 135aesni_cbc_sha1_enc_ssse3:
136 endbr64
135 mov `($win64?56:8)`(%rsp),$inp # load 7th argument 137 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
136 #shr \$6,$len # debugging artefact 138 #shr \$6,$len # debugging artefact
137 #jz .Lepilogue_ssse3 # debugging artefact 139 #jz .Lepilogue_ssse3 # debugging artefact
@@ -650,6 +652,7 @@ $code.=<<___;
650.type aesni_cbc_sha1_enc_avx,\@function,6 652.type aesni_cbc_sha1_enc_avx,\@function,6
651.align 16 653.align 16
652aesni_cbc_sha1_enc_avx: 654aesni_cbc_sha1_enc_avx:
655 endbr64
653 mov `($win64?56:8)`(%rsp),$inp # load 7th argument 656 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
654 #shr \$6,$len # debugging artefact 657 #shr \$6,$len # debugging artefact
655 #jz .Lepilogue_avx # debugging artefact 658 #jz .Lepilogue_avx # debugging artefact
@@ -1100,6 +1103,7 @@ $code.=<<___;
1100.type ssse3_handler,\@abi-omnipotent 1103.type ssse3_handler,\@abi-omnipotent
1101.align 16 1104.align 16
1102ssse3_handler: 1105ssse3_handler:
1106 endbr64
1103 push %rsi 1107 push %rsi
1104 push %rdi 1108 push %rdi
1105 push %rbx 1109 push %rbx
diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
index d394e6f696..c261a37958 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -242,6 +242,7 @@ $code.=<<___;
242.type ${PREFIX}_encrypt,\@abi-omnipotent 242.type ${PREFIX}_encrypt,\@abi-omnipotent
243.align 16 243.align 16
244${PREFIX}_encrypt: 244${PREFIX}_encrypt:
245 endbr64
245 movups ($inp),$inout0 # load input 246 movups ($inp),$inout0 # load input
246 mov 240($key),$rounds # key->rounds 247 mov 240($key),$rounds # key->rounds
247___ 248___
@@ -255,6 +256,7 @@ $code.=<<___;
255.type ${PREFIX}_decrypt,\@abi-omnipotent 256.type ${PREFIX}_decrypt,\@abi-omnipotent
256.align 16 257.align 16
257${PREFIX}_decrypt: 258${PREFIX}_decrypt:
259 endbr64
258 movups ($inp),$inout0 # load input 260 movups ($inp),$inout0 # load input
259 mov 240($key),$rounds # key->rounds 261 mov 240($key),$rounds # key->rounds
260___ 262___
@@ -284,6 +286,7 @@ $code.=<<___;
284.type _aesni_${dir}rypt3,\@abi-omnipotent 286.type _aesni_${dir}rypt3,\@abi-omnipotent
285.align 16 287.align 16
286_aesni_${dir}rypt3: 288_aesni_${dir}rypt3:
289 endbr64
287 $movkey ($key),$rndkey0 290 $movkey ($key),$rndkey0
288 shr \$1,$rounds 291 shr \$1,$rounds
289 $movkey 16($key),$rndkey1 292 $movkey 16($key),$rndkey1
@@ -328,6 +331,7 @@ $code.=<<___;
328.type _aesni_${dir}rypt4,\@abi-omnipotent 331.type _aesni_${dir}rypt4,\@abi-omnipotent
329.align 16 332.align 16
330_aesni_${dir}rypt4: 333_aesni_${dir}rypt4:
334 endbr64
331 $movkey ($key),$rndkey0 335 $movkey ($key),$rndkey0
332 shr \$1,$rounds 336 shr \$1,$rounds
333 $movkey 16($key),$rndkey1 337 $movkey 16($key),$rndkey1
@@ -373,6 +377,7 @@ $code.=<<___;
373.type _aesni_${dir}rypt6,\@abi-omnipotent 377.type _aesni_${dir}rypt6,\@abi-omnipotent
374.align 16 378.align 16
375_aesni_${dir}rypt6: 379_aesni_${dir}rypt6:
380 endbr64
376 $movkey ($key),$rndkey0 381 $movkey ($key),$rndkey0
377 shr \$1,$rounds 382 shr \$1,$rounds
378 $movkey 16($key),$rndkey1 383 $movkey 16($key),$rndkey1
@@ -437,6 +442,7 @@ $code.=<<___;
437.type _aesni_${dir}rypt8,\@abi-omnipotent 442.type _aesni_${dir}rypt8,\@abi-omnipotent
438.align 16 443.align 16
439_aesni_${dir}rypt8: 444_aesni_${dir}rypt8:
445 endbr64
440 $movkey ($key),$rndkey0 446 $movkey ($key),$rndkey0
441 shr \$1,$rounds 447 shr \$1,$rounds
442 $movkey 16($key),$rndkey1 448 $movkey 16($key),$rndkey1
@@ -525,6 +531,7 @@ $code.=<<___;
525.type aesni_ecb_encrypt,\@function,5 531.type aesni_ecb_encrypt,\@function,5
526.align 16 532.align 16
527aesni_ecb_encrypt: 533aesni_ecb_encrypt:
534 endbr64
528 and \$-16,$len 535 and \$-16,$len
529 jz .Lecb_ret 536 jz .Lecb_ret
530 537
@@ -830,6 +837,7 @@ $code.=<<___;
830.type aesni_ccm64_encrypt_blocks,\@function,6 837.type aesni_ccm64_encrypt_blocks,\@function,6
831.align 16 838.align 16
832aesni_ccm64_encrypt_blocks: 839aesni_ccm64_encrypt_blocks:
840 endbr64
833___ 841___
834$code.=<<___ if ($win64); 842$code.=<<___ if ($win64);
835 lea -0x58(%rsp),%rsp 843 lea -0x58(%rsp),%rsp
@@ -2478,6 +2486,7 @@ $code.=<<___;
2478.type ${PREFIX}_set_decrypt_key,\@abi-omnipotent 2486.type ${PREFIX}_set_decrypt_key,\@abi-omnipotent
2479.align 16 2487.align 16
2480${PREFIX}_set_decrypt_key: 2488${PREFIX}_set_decrypt_key:
2489 endbr64
2481 sub \$8,%rsp 2490 sub \$8,%rsp
2482 call __aesni_set_encrypt_key 2491 call __aesni_set_encrypt_key
2483 shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key 2492 shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key
@@ -2528,6 +2537,7 @@ $code.=<<___;
2528.type ${PREFIX}_set_encrypt_key,\@abi-omnipotent 2537.type ${PREFIX}_set_encrypt_key,\@abi-omnipotent
2529.align 16 2538.align 16
2530${PREFIX}_set_encrypt_key: 2539${PREFIX}_set_encrypt_key:
2540 endbr64
2531__aesni_set_encrypt_key: 2541__aesni_set_encrypt_key:
2532 sub \$8,%rsp 2542 sub \$8,%rsp
2533 mov \$-1,%rax 2543 mov \$-1,%rax
@@ -2749,6 +2759,7 @@ $code.=<<___ if ($PREFIX eq "aesni");
2749.type ecb_se_handler,\@abi-omnipotent 2759.type ecb_se_handler,\@abi-omnipotent
2750.align 16 2760.align 16
2751ecb_se_handler: 2761ecb_se_handler:
2762 endbr64
2752 push %rsi 2763 push %rsi
2753 push %rdi 2764 push %rdi
2754 push %rbx 2765 push %rbx
@@ -2768,6 +2779,7 @@ ecb_se_handler:
2768.type ccm64_se_handler,\@abi-omnipotent 2779.type ccm64_se_handler,\@abi-omnipotent
2769.align 16 2780.align 16
2770ccm64_se_handler: 2781ccm64_se_handler:
2782 endbr64
2771 push %rsi 2783 push %rsi
2772 push %rdi 2784 push %rdi
2773 push %rbx 2785 push %rbx
@@ -2809,6 +2821,7 @@ ccm64_se_handler:
2809.type ctr32_se_handler,\@abi-omnipotent 2821.type ctr32_se_handler,\@abi-omnipotent
2810.align 16 2822.align 16
2811ctr32_se_handler: 2823ctr32_se_handler:
2824 endbr64
2812 push %rsi 2825 push %rsi
2813 push %rdi 2826 push %rdi
2814 push %rbx 2827 push %rbx
@@ -2844,6 +2857,7 @@ ctr32_se_handler:
2844.type xts_se_handler,\@abi-omnipotent 2857.type xts_se_handler,\@abi-omnipotent
2845.align 16 2858.align 16
2846xts_se_handler: 2859xts_se_handler:
2860 endbr64
2847 push %rsi 2861 push %rsi
2848 push %rdi 2862 push %rdi
2849 push %rbx 2863 push %rbx
@@ -2885,6 +2899,7 @@ $code.=<<___;
2885.type cbc_se_handler,\@abi-omnipotent 2899.type cbc_se_handler,\@abi-omnipotent
2886.align 16 2900.align 16
2887cbc_se_handler: 2901cbc_se_handler:
2902 endbr64
2888 push %rsi 2903 push %rsi
2889 push %rdi 2904 push %rdi
2890 push %rbx 2905 push %rbx
diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
index 20e9e1f71f..7098ba27f4 100644
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
@@ -813,6 +813,7 @@ $code.=<<___;
813.type _bsaes_encrypt8,\@abi-omnipotent 813.type _bsaes_encrypt8,\@abi-omnipotent
814.align 64 814.align 64
815_bsaes_encrypt8: 815_bsaes_encrypt8:
816 endbr64
816 lea .LBS0(%rip), $const # constants table 817 lea .LBS0(%rip), $const # constants table
817 818
818 movdqa ($key), @XMM[9] # round 0 key 819 movdqa ($key), @XMM[9] # round 0 key
@@ -877,6 +878,7 @@ $code.=<<___;
877.type _bsaes_decrypt8,\@abi-omnipotent 878.type _bsaes_decrypt8,\@abi-omnipotent
878.align 64 879.align 64
879_bsaes_decrypt8: 880_bsaes_decrypt8:
881 endbr64
880 lea .LBS0(%rip), $const # constants table 882 lea .LBS0(%rip), $const # constants table
881 883
882 movdqa ($key), @XMM[9] # round 0 key 884 movdqa ($key), @XMM[9] # round 0 key
@@ -968,6 +970,7 @@ $code.=<<___;
968.type _bsaes_key_convert,\@abi-omnipotent 970.type _bsaes_key_convert,\@abi-omnipotent
969.align 16 971.align 16
970_bsaes_key_convert: 972_bsaes_key_convert:
973 endbr64
971 lea .Lmasks(%rip), $const 974 lea .Lmasks(%rip), $const
972 movdqu ($inp), %xmm7 # load round 0 key 975 movdqu ($inp), %xmm7 # load round 0 key
973 lea 0x10($inp), $inp 976 lea 0x10($inp), $inp
@@ -1057,6 +1060,7 @@ $code.=<<___;
1057.type bsaes_enc_key_convert,\@function,2 1060.type bsaes_enc_key_convert,\@function,2
1058.align 16 1061.align 16
1059bsaes_enc_key_convert: 1062bsaes_enc_key_convert:
1063 endbr64
1060 mov 240($inp),%r10d # pass rounds 1064 mov 240($inp),%r10d # pass rounds
1061 mov $inp,%rcx # pass key 1065 mov $inp,%rcx # pass key
1062 mov $out,%rax # pass key schedule 1066 mov $out,%rax # pass key schedule
@@ -1071,6 +1075,7 @@ bsaes_enc_key_convert:
1071.align 16 1075.align 16
1072bsaes_encrypt_128: 1076bsaes_encrypt_128:
1073.Lenc128_loop: 1077.Lenc128_loop:
1078 endbr64
1074 movdqu 0x00($inp), @XMM[0] # load input 1079 movdqu 0x00($inp), @XMM[0] # load input
1075 movdqu 0x10($inp), @XMM[1] 1080 movdqu 0x10($inp), @XMM[1]
1076 movdqu 0x20($inp), @XMM[2] 1081 movdqu 0x20($inp), @XMM[2]
@@ -1103,6 +1108,7 @@ bsaes_encrypt_128:
1103.type bsaes_dec_key_convert,\@function,2 1108.type bsaes_dec_key_convert,\@function,2
1104.align 16 1109.align 16
1105bsaes_dec_key_convert: 1110bsaes_dec_key_convert:
1111 endbr64
1106 mov 240($inp),%r10d # pass rounds 1112 mov 240($inp),%r10d # pass rounds
1107 mov $inp,%rcx # pass key 1113 mov $inp,%rcx # pass key
1108 mov $out,%rax # pass key schedule 1114 mov $out,%rax # pass key schedule
@@ -1117,6 +1123,7 @@ bsaes_dec_key_convert:
1117.type bsaes_decrypt_128,\@function,4 1123.type bsaes_decrypt_128,\@function,4
1118.align 16 1124.align 16
1119bsaes_decrypt_128: 1125bsaes_decrypt_128:
1126 endbr64
1120.Ldec128_loop: 1127.Ldec128_loop:
1121 movdqu 0x00($inp), @XMM[0] # load input 1128 movdqu 0x00($inp), @XMM[0] # load input
1122 movdqu 0x10($inp), @XMM[1] 1129 movdqu 0x10($inp), @XMM[1]
@@ -1162,6 +1169,7 @@ $code.=<<___;
1162.type bsaes_ecb_encrypt_blocks,\@abi-omnipotent 1169.type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
1163.align 16 1170.align 16
1164bsaes_ecb_encrypt_blocks: 1171bsaes_ecb_encrypt_blocks:
1172 endbr64
1165 mov %rsp, %rax 1173 mov %rsp, %rax
1166.Lecb_enc_prologue: 1174.Lecb_enc_prologue:
1167 push %rbp 1175 push %rbp
@@ -1363,6 +1371,7 @@ $code.=<<___;
1363.type bsaes_ecb_decrypt_blocks,\@abi-omnipotent 1371.type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
1364.align 16 1372.align 16
1365bsaes_ecb_decrypt_blocks: 1373bsaes_ecb_decrypt_blocks:
1374 endbr64
1366 mov %rsp, %rax 1375 mov %rsp, %rax
1367.Lecb_dec_prologue: 1376.Lecb_dec_prologue:
1368 push %rbp 1377 push %rbp
@@ -1568,6 +1577,7 @@ $code.=<<___;
1568.type bsaes_cbc_encrypt,\@abi-omnipotent 1577.type bsaes_cbc_encrypt,\@abi-omnipotent
1569.align 16 1578.align 16
1570bsaes_cbc_encrypt: 1579bsaes_cbc_encrypt:
1580 endbr64
1571___ 1581___
1572$code.=<<___ if ($win64); 1582$code.=<<___ if ($win64);
1573 mov 48(%rsp),$arg6 # pull direction flag 1583 mov 48(%rsp),$arg6 # pull direction flag
@@ -1855,6 +1865,7 @@ $code.=<<___;
1855.type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent 1865.type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
1856.align 16 1866.align 16
1857bsaes_ctr32_encrypt_blocks: 1867bsaes_ctr32_encrypt_blocks:
1868 endbr64
1858 mov %rsp, %rax 1869 mov %rsp, %rax
1859.Lctr_enc_prologue: 1870.Lctr_enc_prologue:
1860 push %rbp 1871 push %rbp
@@ -2096,6 +2107,7 @@ $code.=<<___;
2096.type bsaes_xts_encrypt,\@abi-omnipotent 2107.type bsaes_xts_encrypt,\@abi-omnipotent
2097.align 16 2108.align 16
2098bsaes_xts_encrypt: 2109bsaes_xts_encrypt:
2110 endbr64
2099 mov %rsp, %rax 2111 mov %rsp, %rax
2100.Lxts_enc_prologue: 2112.Lxts_enc_prologue:
2101 push %rbp 2113 push %rbp
@@ -2477,6 +2489,7 @@ $code.=<<___;
2477.type bsaes_xts_decrypt,\@abi-omnipotent 2489.type bsaes_xts_decrypt,\@abi-omnipotent
2478.align 16 2490.align 16
2479bsaes_xts_decrypt: 2491bsaes_xts_decrypt:
2492 endbr64
2480 mov %rsp, %rax 2493 mov %rsp, %rax
2481.Lxts_dec_prologue: 2494.Lxts_dec_prologue:
2482 push %rbp 2495 push %rbp
@@ -2953,6 +2966,7 @@ $code.=<<___;
2953.type se_handler,\@abi-omnipotent 2966.type se_handler,\@abi-omnipotent
2954.align 16 2967.align 16
2955se_handler: 2968se_handler:
2969 endbr64
2956 push %rsi 2970 push %rsi
2957 push %rdi 2971 push %rdi
2958 push %rbx 2972 push %rbx
diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
index 3ffb1a3038..8ff8d8602b 100644
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
@@ -82,6 +82,7 @@ $code.=<<___;
82.type _vpaes_encrypt_core,\@abi-omnipotent 82.type _vpaes_encrypt_core,\@abi-omnipotent
83.align 16 83.align 16
84_vpaes_encrypt_core: 84_vpaes_encrypt_core:
85 endbr64
85 mov %rdx, %r9 86 mov %rdx, %r9
86 mov \$16, %r11 87 mov \$16, %r11
87 mov 240(%rdx),%eax 88 mov 240(%rdx),%eax
@@ -172,6 +173,7 @@ _vpaes_encrypt_core:
172.type _vpaes_decrypt_core,\@abi-omnipotent 173.type _vpaes_decrypt_core,\@abi-omnipotent
173.align 16 174.align 16
174_vpaes_decrypt_core: 175_vpaes_decrypt_core:
176 endbr64
175 mov %rdx, %r9 # load key 177 mov %rdx, %r9 # load key
176 mov 240(%rdx),%eax 178 mov 240(%rdx),%eax
177 movdqa %xmm9, %xmm1 179 movdqa %xmm9, %xmm1
@@ -279,6 +281,7 @@ _vpaes_decrypt_core:
279.type _vpaes_schedule_core,\@abi-omnipotent 281.type _vpaes_schedule_core,\@abi-omnipotent
280.align 16 282.align 16
281_vpaes_schedule_core: 283_vpaes_schedule_core:
284 endbr64
282 # rdi = key 285 # rdi = key
283 # rsi = size in bits 286 # rsi = size in bits
284 # rdx = buffer 287 # rdx = buffer
@@ -464,6 +467,7 @@ _vpaes_schedule_core:
464.type _vpaes_schedule_192_smear,\@abi-omnipotent 467.type _vpaes_schedule_192_smear,\@abi-omnipotent
465.align 16 468.align 16
466_vpaes_schedule_192_smear: 469_vpaes_schedule_192_smear:
470 endbr64
467 pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0 471 pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
468 pxor %xmm0, %xmm6 # -> c+d c 0 0 472 pxor %xmm0, %xmm6 # -> c+d c 0 0
469 pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a 473 pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
@@ -495,6 +499,7 @@ _vpaes_schedule_192_smear:
495.type _vpaes_schedule_round,\@abi-omnipotent 499.type _vpaes_schedule_round,\@abi-omnipotent
496.align 16 500.align 16
497_vpaes_schedule_round: 501_vpaes_schedule_round:
502 endbr64
498 # extract rcon from xmm8 503 # extract rcon from xmm8
499 pxor %xmm1, %xmm1 504 pxor %xmm1, %xmm1
500 palignr \$15, %xmm8, %xmm1 505 palignr \$15, %xmm8, %xmm1
@@ -562,6 +567,7 @@ _vpaes_schedule_low_round:
562.type _vpaes_schedule_transform,\@abi-omnipotent 567.type _vpaes_schedule_transform,\@abi-omnipotent
563.align 16 568.align 16
564_vpaes_schedule_transform: 569_vpaes_schedule_transform:
570 endbr64
565 movdqa %xmm9, %xmm1 571 movdqa %xmm9, %xmm1
566 pandn %xmm0, %xmm1 572 pandn %xmm0, %xmm1
567 psrld \$4, %xmm1 573 psrld \$4, %xmm1
@@ -600,6 +606,7 @@ _vpaes_schedule_transform:
600.type _vpaes_schedule_mangle,\@abi-omnipotent 606.type _vpaes_schedule_mangle,\@abi-omnipotent
601.align 16 607.align 16
602_vpaes_schedule_mangle: 608_vpaes_schedule_mangle:
609 endbr64
603 movdqa %xmm0, %xmm4 # save xmm0 for later 610 movdqa %xmm0, %xmm4 # save xmm0 for later
604 movdqa .Lk_mc_forward(%rip),%xmm5 611 movdqa .Lk_mc_forward(%rip),%xmm5
605 test %rcx, %rcx 612 test %rcx, %rcx
@@ -673,6 +680,7 @@ _vpaes_schedule_mangle:
673.type ${PREFIX}_set_encrypt_key,\@function,3 680.type ${PREFIX}_set_encrypt_key,\@function,3
674.align 16 681.align 16
675${PREFIX}_set_encrypt_key: 682${PREFIX}_set_encrypt_key:
683 endbr64
676___ 684___
677$code.=<<___ if ($win64); 685$code.=<<___ if ($win64);
678 lea -0xb8(%rsp),%rsp 686 lea -0xb8(%rsp),%rsp
@@ -721,6 +729,7 @@ $code.=<<___;
721.type ${PREFIX}_set_decrypt_key,\@function,3 729.type ${PREFIX}_set_decrypt_key,\@function,3
722.align 16 730.align 16
723${PREFIX}_set_decrypt_key: 731${PREFIX}_set_decrypt_key:
732 endbr64
724___ 733___
725$code.=<<___ if ($win64); 734$code.=<<___ if ($win64);
726 lea -0xb8(%rsp),%rsp 735 lea -0xb8(%rsp),%rsp
@@ -774,6 +783,7 @@ $code.=<<___;
774.type ${PREFIX}_encrypt,\@function,3 783.type ${PREFIX}_encrypt,\@function,3
775.align 16 784.align 16
776${PREFIX}_encrypt: 785${PREFIX}_encrypt:
786 endbr64
777___ 787___
778$code.=<<___ if ($win64); 788$code.=<<___ if ($win64);
779 lea -0xb8(%rsp),%rsp 789 lea -0xb8(%rsp),%rsp
@@ -817,6 +827,7 @@ $code.=<<___;
817.type ${PREFIX}_decrypt,\@function,3 827.type ${PREFIX}_decrypt,\@function,3
818.align 16 828.align 16
819${PREFIX}_decrypt: 829${PREFIX}_decrypt:
830 endbr64
820___ 831___
821$code.=<<___ if ($win64); 832$code.=<<___ if ($win64);
822 lea -0xb8(%rsp),%rsp 833 lea -0xb8(%rsp),%rsp
@@ -866,6 +877,7 @@ $code.=<<___;
866.type ${PREFIX}_cbc_encrypt,\@function,6 877.type ${PREFIX}_cbc_encrypt,\@function,6
867.align 16 878.align 16
868${PREFIX}_cbc_encrypt: 879${PREFIX}_cbc_encrypt:
880 endbr64
869 xchg $key,$len 881 xchg $key,$len
870___ 882___
871($len,$key)=($key,$len); 883($len,$key)=($key,$len);
@@ -949,6 +961,7 @@ $code.=<<___;
949.type _vpaes_preheat,\@abi-omnipotent 961.type _vpaes_preheat,\@abi-omnipotent
950.align 16 962.align 16
951_vpaes_preheat: 963_vpaes_preheat:
964 endbr64
952 lea .Lk_s0F(%rip), %r10 965 lea .Lk_s0F(%rip), %r10
953 movdqa -0x20(%r10), %xmm10 # .Lk_inv 966 movdqa -0x20(%r10), %xmm10 # .Lk_inv
954 movdqa -0x10(%r10), %xmm11 # .Lk_inv+16 967 movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
@@ -1079,6 +1092,7 @@ $code.=<<___;
1079.type se_handler,\@abi-omnipotent 1092.type se_handler,\@abi-omnipotent
1080.align 16 1093.align 16
1081se_handler: 1094se_handler:
1095 endbr64
1082 push %rsi 1096 push %rsi
1083 push %rdi 1097 push %rdi
1084 push %rbx 1098 push %rbx
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
51S2N_BN_SYMBOL(bignum_add): 51S2N_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
56S2N_BN_SYMBOL(bignum_cmadd): 56S2N_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
53S2N_BN_SYMBOL(bignum_cmul): 53S2N_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
61S2N_BN_SYMBOL(bignum_mul): 61S2N_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
74S2N_BN_SYMBOL(bignum_mul_4_8_alt): 74S2N_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
74S2N_BN_SYMBOL(bignum_mul_8_16_alt): 74S2N_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
64S2N_BN_SYMBOL(bignum_sqr): 64S2N_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
73S2N_BN_SYMBOL(bignum_sqr_4_8_alt): 73S2N_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
105S2N_BN_SYMBOL(bignum_sqr_8_16_alt): 105S2N_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
51S2N_BN_SYMBOL(bignum_sub): 51S2N_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
32S2N_BN_SYMBOL(word_clz): 32S2N_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
349MULADD_128x512: 349MULADD_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
416mont_reduce: 417mont_reduce:
418 endbr64
417___ 419___
418 420
419my $STACK_DEPTH = 8; 421my $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
678mont_mul_a3b: 680mont_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
1079sqr_reduce: 1082sqr_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
1108mod_exp_512: 1112mod_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
65bn_mul_mont: 65bn_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
279bn_mul4x_mont: 280bn_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
706bn_sqr4x_mont: 708bn_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
59bn_mul_mont_gather5: 59bn_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
389bn_mul4x_mont_gather5: 390bn_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
927bn_scatter5: 929bn_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
945bn_gather5: 948bn_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
1055mul_handler: 1059mul_handler:
1060 endbr64
1056 push %rsi 1061 push %rsi
1057 push %rdi 1062 push %rdi
1058 push %rbx 1063 push %rbx
diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
index 586e5d6e93..3ceed3e899 100644
--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
@@ -116,6 +116,7 @@ $code=<<___;
116.type Camellia_EncryptBlock,\@abi-omnipotent 116.type Camellia_EncryptBlock,\@abi-omnipotent
117.align 16 117.align 16
118Camellia_EncryptBlock: 118Camellia_EncryptBlock:
119 endbr64
119 movl \$128,%eax 120 movl \$128,%eax
120 subl $arg0d,%eax 121 subl $arg0d,%eax
121 movl \$3,$arg0d 122 movl \$3,$arg0d
@@ -128,6 +129,7 @@ Camellia_EncryptBlock:
128.align 16 129.align 16
129.Lenc_rounds: 130.Lenc_rounds:
130Camellia_EncryptBlock_Rounds: 131Camellia_EncryptBlock_Rounds:
132 endbr64
131 push %rbx 133 push %rbx
132 push %rbp 134 push %rbp
133 push %r13 135 push %r13
@@ -176,6 +178,7 @@ Camellia_EncryptBlock_Rounds:
176.type _x86_64_Camellia_encrypt,\@abi-omnipotent 178.type _x86_64_Camellia_encrypt,\@abi-omnipotent
177.align 16 179.align 16
178_x86_64_Camellia_encrypt: 180_x86_64_Camellia_encrypt:
181 endbr64
179 xor 0($key),@S[1] 182 xor 0($key),@S[1]
180 xor 4($key),@S[0] # ^=key[0-3] 183 xor 4($key),@S[0] # ^=key[0-3]
181 xor 8($key),@S[3] 184 xor 8($key),@S[3]
@@ -226,6 +229,7 @@ $code.=<<___;
226.type Camellia_DecryptBlock,\@abi-omnipotent 229.type Camellia_DecryptBlock,\@abi-omnipotent
227.align 16 230.align 16
228Camellia_DecryptBlock: 231Camellia_DecryptBlock:
232 endbr64
229 movl \$128,%eax 233 movl \$128,%eax
230 subl $arg0d,%eax 234 subl $arg0d,%eax
231 movl \$3,$arg0d 235 movl \$3,$arg0d
@@ -238,6 +242,7 @@ Camellia_DecryptBlock:
238.align 16 242.align 16
239.Ldec_rounds: 243.Ldec_rounds:
240Camellia_DecryptBlock_Rounds: 244Camellia_DecryptBlock_Rounds:
245 endbr64
241 push %rbx 246 push %rbx
242 push %rbp 247 push %rbp
243 push %r13 248 push %r13
@@ -286,6 +291,7 @@ Camellia_DecryptBlock_Rounds:
286.type _x86_64_Camellia_decrypt,\@abi-omnipotent 291.type _x86_64_Camellia_decrypt,\@abi-omnipotent
287.align 16 292.align 16
288_x86_64_Camellia_decrypt: 293_x86_64_Camellia_decrypt:
294 endbr64
289 xor 0($key),@S[1] 295 xor 0($key),@S[1]
290 xor 4($key),@S[0] # ^=key[0-3] 296 xor 4($key),@S[0] # ^=key[0-3]
291 xor 8($key),@S[3] 297 xor 8($key),@S[3]
@@ -400,6 +406,7 @@ $code.=<<___;
400.type Camellia_Ekeygen,\@function,3 406.type Camellia_Ekeygen,\@function,3
401.align 16 407.align 16
402Camellia_Ekeygen: 408Camellia_Ekeygen:
409 endbr64
403 push %rbx 410 push %rbx
404 push %rbp 411 push %rbp
405 push %r13 412 push %r13
@@ -630,6 +637,7 @@ $code.=<<___;
630.type Camellia_cbc_encrypt,\@function,6 637.type Camellia_cbc_encrypt,\@function,6
631.align 16 638.align 16
632Camellia_cbc_encrypt: 639Camellia_cbc_encrypt:
640 endbr64
633 cmp \$0,%rdx 641 cmp \$0,%rdx
634 je .Lcbc_abort 642 je .Lcbc_abort
635 push %rbx 643 push %rbx
diff --git a/src/lib/libcrypto/md5/asm/md5-x86_64.pl b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
index c902a1b532..06d69094f4 100755
--- a/src/lib/libcrypto/md5/asm/md5-x86_64.pl
+++ b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
@@ -128,6 +128,7 @@ $code .= <<EOF;
128.globl md5_block_asm_data_order 128.globl md5_block_asm_data_order
129.type md5_block_asm_data_order,\@function,3 129.type md5_block_asm_data_order,\@function,3
130md5_block_asm_data_order: 130md5_block_asm_data_order:
131 endbr64
131 push %rbp 132 push %rbp
132 push %rbx 133 push %rbx
133 push %r12 134 push %r12
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
index 71d0822ac9..9ce0c38141 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
@@ -412,6 +412,7 @@ $code.=<<___;
412.type gcm_init_clmul,\@abi-omnipotent 412.type gcm_init_clmul,\@abi-omnipotent
413.align 16 413.align 16
414gcm_init_clmul: 414gcm_init_clmul:
415 endbr64
415 movdqu ($Xip),$Hkey 416 movdqu ($Xip),$Hkey
416 pshufd \$0b01001110,$Hkey,$Hkey # dword swap 417 pshufd \$0b01001110,$Hkey,$Hkey # dword swap
417 418
@@ -449,6 +450,7 @@ $code.=<<___;
449.type gcm_gmult_clmul,\@abi-omnipotent 450.type gcm_gmult_clmul,\@abi-omnipotent
450.align 16 451.align 16
451gcm_gmult_clmul: 452gcm_gmult_clmul:
453 endbr64
452 movdqu ($Xip),$Xi 454 movdqu ($Xip),$Xi
453 movdqa .Lbswap_mask(%rip),$T3 455 movdqa .Lbswap_mask(%rip),$T3
454 movdqu ($Htbl),$Hkey 456 movdqu ($Htbl),$Hkey
@@ -476,6 +478,7 @@ $code.=<<___;
476.type gcm_ghash_clmul,\@abi-omnipotent 478.type gcm_ghash_clmul,\@abi-omnipotent
477.align 16 479.align 16
478gcm_ghash_clmul: 480gcm_ghash_clmul:
481 endbr64
479___ 482___
480$code.=<<___ if ($win64); 483$code.=<<___ if ($win64);
481.LSEH_begin_gcm_ghash_clmul: 484.LSEH_begin_gcm_ghash_clmul:
@@ -686,6 +689,7 @@ $code.=<<___;
686.type se_handler,\@abi-omnipotent 689.type se_handler,\@abi-omnipotent
687.align 16 690.align 16
688se_handler: 691se_handler:
692 endbr64
689 push %rsi 693 push %rsi
690 push %rdi 694 push %rdi
691 push %rbx 695 push %rbx
diff --git a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
index 501d9e936b..6d058bd9d4 100644
--- a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
@@ -109,6 +109,7 @@ $code.=<<___;
109.globl $func 109.globl $func
110.type $func,\@function,$nargs 110.type $func,\@function,$nargs
111$func: 111$func:
112 endbr64
112 cmp \$0,$len 113 cmp \$0,$len
113 je .Labort 114 je .Labort
114 push %rbx 115 push %rbx
@@ -453,6 +454,7 @@ $code.=<<___;
453.type RC4_set_key,\@function,3 454.type RC4_set_key,\@function,3
454.align 16 455.align 16
455RC4_set_key: 456RC4_set_key:
457 endbr64
456 lea 8($dat),$dat 458 lea 8($dat),$dat
457 lea ($inp,$len),$inp 459 lea ($inp,$len),$inp
458 neg $len 460 neg $len
@@ -494,6 +496,7 @@ RC4_set_key:
494.type RC4_options,\@abi-omnipotent 496.type RC4_options,\@abi-omnipotent
495.align 16 497.align 16
496RC4_options: 498RC4_options:
499 endbr64
497 lea .Lopts(%rip),%rax 500 lea .Lopts(%rip),%rax
498 ret 501 ret
499.align 64 502.align 64
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
index 8de869489f..2bac7d744d 100755
--- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
@@ -127,7 +127,9 @@ $code=<<___;
127.globl RC4 127.globl RC4
128.type RC4,\@function,4 128.type RC4,\@function,4
129.align 16 129.align 16
130RC4: or $len,$len 130RC4:
131 endbr64
132 or $len,$len
131 jne .Lentry 133 jne .Lentry
132 ret 134 ret
133.Lentry: 135.Lentry:
@@ -433,6 +435,7 @@ $code.=<<___;
433.type RC4_set_key,\@function,3 435.type RC4_set_key,\@function,3
434.align 16 436.align 16
435RC4_set_key: 437RC4_set_key:
438 endbr64
436 lea 8($dat),$dat 439 lea 8($dat),$dat
437 lea ($inp,$len),$inp 440 lea ($inp,$len),$inp
438 neg $len 441 neg $len
@@ -505,6 +508,7 @@ RC4_set_key:
505.type RC4_options,\@abi-omnipotent 508.type RC4_options,\@abi-omnipotent
506.align 16 509.align 16
507RC4_options: 510RC4_options:
511 endbr64
508 lea .Lopts(%rip),%rax 512 lea .Lopts(%rip),%rax
509 mov OPENSSL_ia32cap_P(%rip),%edx 513 mov OPENSSL_ia32cap_P(%rip),%edx
510 bt \$IA32CAP_BIT0_INTELP4,%edx 514 bt \$IA32CAP_BIT0_INTELP4,%edx
diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
index 43eee73c4a..e15ff47f88 100755
--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
@@ -222,6 +222,7 @@ $code.=<<___;
222.type sha1_block_data_order,\@function,3 222.type sha1_block_data_order,\@function,3
223.align 16 223.align 16
224sha1_block_data_order: 224sha1_block_data_order:
225 endbr64
225 mov OPENSSL_ia32cap_P+0(%rip),%r9d 226 mov OPENSSL_ia32cap_P+0(%rip),%r9d
226 mov OPENSSL_ia32cap_P+4(%rip),%r8d 227 mov OPENSSL_ia32cap_P+4(%rip),%r8d
227 test \$IA32CAP_MASK1_SSSE3,%r8d # check SSSE3 bit 228 test \$IA32CAP_MASK1_SSSE3,%r8d # check SSSE3 bit
@@ -309,6 +310,7 @@ $code.=<<___;
309.align 16 310.align 16
310sha1_block_data_order_ssse3: 311sha1_block_data_order_ssse3:
311_ssse3_shortcut: 312_ssse3_shortcut:
313 endbr64
312 push %rbx 314 push %rbx
313 push %rbp 315 push %rbp
314 push %r12 316 push %r12
@@ -729,6 +731,7 @@ $code.=<<___;
729.align 16 731.align 16
730sha1_block_data_order_avx: 732sha1_block_data_order_avx:
731_avx_shortcut: 733_avx_shortcut:
734 endbr64
732 push %rbx 735 push %rbx
733 push %rbp 736 push %rbp
734 push %r12 737 push %r12
@@ -1099,6 +1102,7 @@ $code.=<<___;
1099.type se_handler,\@abi-omnipotent 1102.type se_handler,\@abi-omnipotent
1100.align 16 1103.align 16
1101se_handler: 1104se_handler:
1105 endbr64
1102 push %rsi 1106 push %rsi
1103 push %rdi 1107 push %rdi
1104 push %rbx 1108 push %rbx
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 0517eab660..120693feeb 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -175,6 +175,7 @@ $code=<<___;
175.type $func,\@function,4 175.type $func,\@function,4
176.align 16 176.align 16
177$func: 177$func:
178 endbr64
178 push %rbx 179 push %rbx
179 push %rbp 180 push %rbp
180 push %r12 181 push %r12
diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
index de5d3acfb4..7958f6d289 100644
--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
@@ -57,6 +57,7 @@ $code=<<___;
57.type $func,\@function,3 57.type $func,\@function,3
58.align 16 58.align 16
59$func: 59$func:
60 endbr64
60 push %rbx 61 push %rbx
61 push %rbp 62 push %rbp
62 push %r12 63 push %r12
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl
index 1b67d1110f..dc56732a28 100644
--- a/src/lib/libcrypto/x86_64cpuid.pl
+++ b/src/lib/libcrypto/x86_64cpuid.pl
@@ -18,6 +18,7 @@ print<<___;
18.extern OPENSSL_cpuid_setup 18.extern OPENSSL_cpuid_setup
19.hidden OPENSSL_cpuid_setup 19.hidden OPENSSL_cpuid_setup
20.section .init 20.section .init
21 endbr64
21 call OPENSSL_cpuid_setup 22 call OPENSSL_cpuid_setup
22 23
23.extern OPENSSL_ia32cap_P 24.extern OPENSSL_ia32cap_P
@@ -29,6 +30,7 @@ print<<___;
29.type OPENSSL_ia32_cpuid,\@abi-omnipotent 30.type OPENSSL_ia32_cpuid,\@abi-omnipotent
30.align 16 31.align 16
31OPENSSL_ia32_cpuid: 32OPENSSL_ia32_cpuid:
33 endbr64
32 mov %rbx,%r8 # save %rbx 34 mov %rbx,%r8 # save %rbx
33 35
34 xor %eax,%eax 36 xor %eax,%eax