summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/aes
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/lib/libcrypto/aes
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/lib/libcrypto/aes')
-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
5 files changed, 60 insertions, 0 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