aboutsummaryrefslogtreecommitdiff
path: root/patches
diff options
context:
space:
mode:
authorBrent Cook <busterb@gmail.com>2024-01-07 18:29:10 -0600
committerBrent Cook <busterb@gmail.com>2024-02-12 03:14:54 -0600
commitcc78bdf3dd7ed883412bd22c2638214fe0ca3619 (patch)
tree76875b844e33bd3ed233973fcfe9d85c6f22789f /patches
parentdb3ab1675bbf8b821ef2fa26e7af14a8b4d38bfe (diff)
downloadportable-cc78bdf3dd7ed883412bd22c2638214fe0ca3619.tar.gz
portable-cc78bdf3dd7ed883412bd22c2638214fe0ca3619.tar.bz2
portable-cc78bdf3dd7ed883412bd22c2638214fe0ca3619.zip
integrate new upstream endbr64 test code, remove os-specific reverts
Diffstat (limited to 'patches')
-rw-r--r--patches/asm/0001-Revert-Add-endbr64-where-needed-by-inspection.-Passe.patch1055
-rw-r--r--patches/asm/0002-Revert-Use-explicit-.text-instead-of-.previous-to-pl.patch162
-rw-r--r--patches/asm/0003-Revert-Use-.section-.rodata-instead-of-a-plain-.roda.patch203
-rw-r--r--patches/asm/0004-Revert-Move-constants-out-of-text-segment-into-rodat.patch292
-rw-r--r--patches/asm/0005-Revert-aesni-endbr64.patch20
-rw-r--r--patches/asm/endbr64.patch1215
6 files changed, 1215 insertions, 1732 deletions
diff --git a/patches/asm/0001-Revert-Add-endbr64-where-needed-by-inspection.-Passe.patch b/patches/asm/0001-Revert-Add-endbr64-where-needed-by-inspection.-Passe.patch
deleted file mode 100644
index 8ec94cd..0000000
--- a/patches/asm/0001-Revert-Add-endbr64-where-needed-by-inspection.-Passe.patch
+++ /dev/null
@@ -1,1055 +0,0 @@
1From 5f7fafff280e6e17d7fafea20fda99762d74581f Mon Sep 17 00:00:00 2001
2From: Brent Cook <busterb@gmail.com>
3Date: Mon, 30 Oct 2023 21:59:32 -0500
4Subject: [PATCH 1/4] Revert "Add endbr64 where needed by inspection. Passes
5 regresson tests."
6
7This reverts commit e2118101444d3cf3cab87297b363cecd5357ae89.
8---
9 src/lib/libcrypto/aes/asm/aes-x86_64.pl | 13 -------------
10 src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 4 ----
11 src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 15 ---------------
12 src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 14 --------------
13 src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 14 --------------
14 src/lib/libcrypto/bn/arch/amd64/bignum_add.S | 1 -
15 src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S | 1 -
16 src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | 1 -
17 src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | 1 -
18 .../libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S | 1 -
19 .../libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S | 1 -
20 src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | 1 -
21 .../libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S | 1 -
22 .../libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S | 1 -
23 src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | 1 -
24 src/lib/libcrypto/bn/arch/amd64/word_clz.S | 1 -
25 src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | 5 -----
26 src/lib/libcrypto/bn/asm/x86_64-mont.pl | 3 ---
27 src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 5 -----
28 src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 8 --------
29 src/lib/libcrypto/md5/asm/md5-x86_64.pl | 1 -
30 src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 4 ----
31 src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl | 6 ++----
32 src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 7 ++-----
33 src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 4 ----
34 src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 1 -
35 src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 1 -
36 src/lib/libcrypto/x86_64cpuid.pl | 2 --
37 28 files changed, 4 insertions(+), 114 deletions(-)
38
39diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
40index 78ba20ca5..b7399b552 100755
41--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
42+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
43@@ -318,7 +318,6 @@ $code.=<<___;
44 .type _x86_64_AES_encrypt,\@abi-omnipotent
45 .align 16
46 _x86_64_AES_encrypt:
47- endbr64
48 xor 0($key),$s0 # xor with key
49 xor 4($key),$s1
50 xor 8($key),$s2
51@@ -549,7 +548,6 @@ $code.=<<___;
52 .type _x86_64_AES_encrypt_compact,\@abi-omnipotent
53 .align 16
54 _x86_64_AES_encrypt_compact:
55- endbr64
56 lea 128($sbox),$inp # size optimization
57 mov 0-128($inp),$acc1 # prefetch Te4
58 mov 32-128($inp),$acc2
59@@ -595,7 +593,6 @@ $code.=<<___;
60 .hidden asm_AES_encrypt
61 asm_AES_encrypt:
62 AES_encrypt:
63- endbr64
64 push %rbx
65 push %rbp
66 push %r12
67@@ -887,7 +884,6 @@ $code.=<<___;
68 .type _x86_64_AES_decrypt,\@abi-omnipotent
69 .align 16
70 _x86_64_AES_decrypt:
71- endbr64
72 xor 0($key),$s0 # xor with key
73 xor 4($key),$s1
74 xor 8($key),$s2
75@@ -1142,7 +1138,6 @@ $code.=<<___;
76 .type _x86_64_AES_decrypt_compact,\@abi-omnipotent
77 .align 16
78 _x86_64_AES_decrypt_compact:
79- endbr64
80 lea 128($sbox),$inp # size optimization
81 mov 0-128($inp),$acc1 # prefetch Td4
82 mov 32-128($inp),$acc2
83@@ -1197,7 +1192,6 @@ $code.=<<___;
84 .hidden asm_AES_decrypt
85 asm_AES_decrypt:
86 AES_decrypt:
87- endbr64
88 push %rbx
89 push %rbp
90 push %r12
91@@ -1297,7 +1291,6 @@ $code.=<<___;
92 .type AES_set_encrypt_key,\@function,3
93 .align 16
94 AES_set_encrypt_key:
95- endbr64
96 push %rbx
97 push %rbp
98 push %r12 # redundant, but allows to share
99@@ -1323,7 +1316,6 @@ AES_set_encrypt_key:
100 .type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
101 .align 16
102 _x86_64_AES_set_encrypt_key:
103- endbr64
104 mov %esi,%ecx # %ecx=bits
105 mov %rdi,%rsi # %rsi=userKey
106 mov %rdx,%rdi # %rdi=key
107@@ -1569,7 +1561,6 @@ $code.=<<___;
108 .type AES_set_decrypt_key,\@function,3
109 .align 16
110 AES_set_decrypt_key:
111- endbr64
112 push %rbx
113 push %rbp
114 push %r12
115@@ -1669,7 +1660,6 @@ $code.=<<___;
116 .hidden asm_AES_cbc_encrypt
117 asm_AES_cbc_encrypt:
118 AES_cbc_encrypt:
119- endbr64
120 cmp \$0,%rdx # check length
121 je .Lcbc_epilogue
122 pushfq
123@@ -2561,7 +2551,6 @@ $code.=<<___;
124 .type block_se_handler,\@abi-omnipotent
125 .align 16
126 block_se_handler:
127- endbr64
128 push %rsi
129 push %rdi
130 push %rbx
131@@ -2620,7 +2609,6 @@ block_se_handler:
132 .type key_se_handler,\@abi-omnipotent
133 .align 16
134 key_se_handler:
135- endbr64
136 push %rsi
137 push %rdi
138 push %rbx
139@@ -2678,7 +2666,6 @@ key_se_handler:
140 .type cbc_se_handler,\@abi-omnipotent
141 .align 16
142 cbc_se_handler:
143- endbr64
144 push %rsi
145 push %rdi
146 push %rbx
147diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
148index 879d16793..bafa906a0 100644
149--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
150+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
151@@ -89,7 +89,6 @@ $code.=<<___;
152 .type aesni_cbc_sha1_enc,\@abi-omnipotent
153 .align 16
154 aesni_cbc_sha1_enc:
155- endbr64
156 # caller should check for SSSE3 and AES-NI bits
157 mov OPENSSL_ia32cap_P+0(%rip),%r10d
158 mov OPENSSL_ia32cap_P+4(%rip),%r11d
159@@ -133,7 +132,6 @@ $code.=<<___;
160 .type aesni_cbc_sha1_enc_ssse3,\@function,6
161 .align 16
162 aesni_cbc_sha1_enc_ssse3:
163- endbr64
164 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
165 #shr \$6,$len # debugging artefact
166 #jz .Lepilogue_ssse3 # debugging artefact
167@@ -652,7 +650,6 @@ $code.=<<___;
168 .type aesni_cbc_sha1_enc_avx,\@function,6
169 .align 16
170 aesni_cbc_sha1_enc_avx:
171- endbr64
172 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
173 #shr \$6,$len # debugging artefact
174 #jz .Lepilogue_avx # debugging artefact
175@@ -1103,7 +1100,6 @@ $code.=<<___;
176 .type ssse3_handler,\@abi-omnipotent
177 .align 16
178 ssse3_handler:
179- endbr64
180 push %rsi
181 push %rdi
182 push %rbx
183diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
184index 07d40a84a..e662fbc7c 100644
185--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
186+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
187@@ -242,7 +242,6 @@ $code.=<<___;
188 .type ${PREFIX}_encrypt,\@abi-omnipotent
189 .align 16
190 ${PREFIX}_encrypt:
191- endbr64
192 movups ($inp),$inout0 # load input
193 mov 240($key),$rounds # key->rounds
194 ___
195@@ -256,7 +255,6 @@ $code.=<<___;
196 .type ${PREFIX}_decrypt,\@abi-omnipotent
197 .align 16
198 ${PREFIX}_decrypt:
199- endbr64
200 movups ($inp),$inout0 # load input
201 mov 240($key),$rounds # key->rounds
202 ___
203@@ -286,7 +284,6 @@ $code.=<<___;
204 .type _aesni_${dir}rypt3,\@abi-omnipotent
205 .align 16
206 _aesni_${dir}rypt3:
207- endbr64
208 $movkey ($key),$rndkey0
209 shr \$1,$rounds
210 $movkey 16($key),$rndkey1
211@@ -331,7 +328,6 @@ $code.=<<___;
212 .type _aesni_${dir}rypt4,\@abi-omnipotent
213 .align 16
214 _aesni_${dir}rypt4:
215- endbr64
216 $movkey ($key),$rndkey0
217 shr \$1,$rounds
218 $movkey 16($key),$rndkey1
219@@ -377,7 +373,6 @@ $code.=<<___;
220 .type _aesni_${dir}rypt6,\@abi-omnipotent
221 .align 16
222 _aesni_${dir}rypt6:
223- endbr64
224 $movkey ($key),$rndkey0
225 shr \$1,$rounds
226 $movkey 16($key),$rndkey1
227@@ -442,7 +437,6 @@ $code.=<<___;
228 .type _aesni_${dir}rypt8,\@abi-omnipotent
229 .align 16
230 _aesni_${dir}rypt8:
231- endbr64
232 $movkey ($key),$rndkey0
233 shr \$1,$rounds
234 $movkey 16($key),$rndkey1
235@@ -531,7 +525,6 @@ $code.=<<___;
236 .type aesni_ecb_encrypt,\@function,5
237 .align 16
238 aesni_ecb_encrypt:
239- endbr64
240 and \$-16,$len
241 jz .Lecb_ret
242
243@@ -837,7 +830,6 @@ $code.=<<___;
244 .type aesni_ccm64_encrypt_blocks,\@function,6
245 .align 16
246 aesni_ccm64_encrypt_blocks:
247- endbr64
248 ___
249 $code.=<<___ if ($win64);
250 lea -0x58(%rsp),%rsp
251@@ -2487,7 +2479,6 @@ $code.=<<___;
252 .type ${PREFIX}_set_decrypt_key,\@abi-omnipotent
253 .align 16
254 ${PREFIX}_set_decrypt_key:
255- endbr64
256 sub \$8,%rsp
257 call __aesni_set_encrypt_key
258 shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key
259@@ -2538,7 +2529,6 @@ $code.=<<___;
260 .type ${PREFIX}_set_encrypt_key,\@abi-omnipotent
261 .align 16
262 ${PREFIX}_set_encrypt_key:
263- endbr64
264 __aesni_set_encrypt_key:
265 sub \$8,%rsp
266 mov \$-1,%rax
267@@ -2760,7 +2750,6 @@ $code.=<<___ if ($PREFIX eq "aesni");
268 .type ecb_se_handler,\@abi-omnipotent
269 .align 16
270 ecb_se_handler:
271- endbr64
272 push %rsi
273 push %rdi
274 push %rbx
275@@ -2780,7 +2769,6 @@ ecb_se_handler:
276 .type ccm64_se_handler,\@abi-omnipotent
277 .align 16
278 ccm64_se_handler:
279- endbr64
280 push %rsi
281 push %rdi
282 push %rbx
283@@ -2822,7 +2810,6 @@ ccm64_se_handler:
284 .type ctr32_se_handler,\@abi-omnipotent
285 .align 16
286 ctr32_se_handler:
287- endbr64
288 push %rsi
289 push %rdi
290 push %rbx
291@@ -2858,7 +2845,6 @@ ctr32_se_handler:
292 .type xts_se_handler,\@abi-omnipotent
293 .align 16
294 xts_se_handler:
295- endbr64
296 push %rsi
297 push %rdi
298 push %rbx
299@@ -2900,7 +2886,6 @@ $code.=<<___;
300 .type cbc_se_handler,\@abi-omnipotent
301 .align 16
302 cbc_se_handler:
303- endbr64
304 push %rsi
305 push %rdi
306 push %rbx
307diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
308index 7098ba27f..20e9e1f71 100644
309--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
310+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
311@@ -813,7 +813,6 @@ $code.=<<___;
312 .type _bsaes_encrypt8,\@abi-omnipotent
313 .align 64
314 _bsaes_encrypt8:
315- endbr64
316 lea .LBS0(%rip), $const # constants table
317
318 movdqa ($key), @XMM[9] # round 0 key
319@@ -878,7 +877,6 @@ $code.=<<___;
320 .type _bsaes_decrypt8,\@abi-omnipotent
321 .align 64
322 _bsaes_decrypt8:
323- endbr64
324 lea .LBS0(%rip), $const # constants table
325
326 movdqa ($key), @XMM[9] # round 0 key
327@@ -970,7 +968,6 @@ $code.=<<___;
328 .type _bsaes_key_convert,\@abi-omnipotent
329 .align 16
330 _bsaes_key_convert:
331- endbr64
332 lea .Lmasks(%rip), $const
333 movdqu ($inp), %xmm7 # load round 0 key
334 lea 0x10($inp), $inp
335@@ -1060,7 +1057,6 @@ $code.=<<___;
336 .type bsaes_enc_key_convert,\@function,2
337 .align 16
338 bsaes_enc_key_convert:
339- endbr64
340 mov 240($inp),%r10d # pass rounds
341 mov $inp,%rcx # pass key
342 mov $out,%rax # pass key schedule
343@@ -1075,7 +1071,6 @@ bsaes_enc_key_convert:
344 .align 16
345 bsaes_encrypt_128:
346 .Lenc128_loop:
347- endbr64
348 movdqu 0x00($inp), @XMM[0] # load input
349 movdqu 0x10($inp), @XMM[1]
350 movdqu 0x20($inp), @XMM[2]
351@@ -1108,7 +1103,6 @@ bsaes_encrypt_128:
352 .type bsaes_dec_key_convert,\@function,2
353 .align 16
354 bsaes_dec_key_convert:
355- endbr64
356 mov 240($inp),%r10d # pass rounds
357 mov $inp,%rcx # pass key
358 mov $out,%rax # pass key schedule
359@@ -1123,7 +1117,6 @@ bsaes_dec_key_convert:
360 .type bsaes_decrypt_128,\@function,4
361 .align 16
362 bsaes_decrypt_128:
363- endbr64
364 .Ldec128_loop:
365 movdqu 0x00($inp), @XMM[0] # load input
366 movdqu 0x10($inp), @XMM[1]
367@@ -1169,7 +1162,6 @@ $code.=<<___;
368 .type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
369 .align 16
370 bsaes_ecb_encrypt_blocks:
371- endbr64
372 mov %rsp, %rax
373 .Lecb_enc_prologue:
374 push %rbp
375@@ -1371,7 +1363,6 @@ $code.=<<___;
376 .type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
377 .align 16
378 bsaes_ecb_decrypt_blocks:
379- endbr64
380 mov %rsp, %rax
381 .Lecb_dec_prologue:
382 push %rbp
383@@ -1577,7 +1568,6 @@ $code.=<<___;
384 .type bsaes_cbc_encrypt,\@abi-omnipotent
385 .align 16
386 bsaes_cbc_encrypt:
387- endbr64
388 ___
389 $code.=<<___ if ($win64);
390 mov 48(%rsp),$arg6 # pull direction flag
391@@ -1865,7 +1855,6 @@ $code.=<<___;
392 .type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
393 .align 16
394 bsaes_ctr32_encrypt_blocks:
395- endbr64
396 mov %rsp, %rax
397 .Lctr_enc_prologue:
398 push %rbp
399@@ -2107,7 +2096,6 @@ $code.=<<___;
400 .type bsaes_xts_encrypt,\@abi-omnipotent
401 .align 16
402 bsaes_xts_encrypt:
403- endbr64
404 mov %rsp, %rax
405 .Lxts_enc_prologue:
406 push %rbp
407@@ -2489,7 +2477,6 @@ $code.=<<___;
408 .type bsaes_xts_decrypt,\@abi-omnipotent
409 .align 16
410 bsaes_xts_decrypt:
411- endbr64
412 mov %rsp, %rax
413 .Lxts_dec_prologue:
414 push %rbp
415@@ -2966,7 +2953,6 @@ $code.=<<___;
416 .type se_handler,\@abi-omnipotent
417 .align 16
418 se_handler:
419- endbr64
420 push %rsi
421 push %rdi
422 push %rbx
423diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
424index 8ff8d8602..3ffb1a303 100644
425--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
426+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
427@@ -82,7 +82,6 @@ $code.=<<___;
428 .type _vpaes_encrypt_core,\@abi-omnipotent
429 .align 16
430 _vpaes_encrypt_core:
431- endbr64
432 mov %rdx, %r9
433 mov \$16, %r11
434 mov 240(%rdx),%eax
435@@ -173,7 +172,6 @@ _vpaes_encrypt_core:
436 .type _vpaes_decrypt_core,\@abi-omnipotent
437 .align 16
438 _vpaes_decrypt_core:
439- endbr64
440 mov %rdx, %r9 # load key
441 mov 240(%rdx),%eax
442 movdqa %xmm9, %xmm1
443@@ -281,7 +279,6 @@ _vpaes_decrypt_core:
444 .type _vpaes_schedule_core,\@abi-omnipotent
445 .align 16
446 _vpaes_schedule_core:
447- endbr64
448 # rdi = key
449 # rsi = size in bits
450 # rdx = buffer
451@@ -467,7 +464,6 @@ _vpaes_schedule_core:
452 .type _vpaes_schedule_192_smear,\@abi-omnipotent
453 .align 16
454 _vpaes_schedule_192_smear:
455- endbr64
456 pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
457 pxor %xmm0, %xmm6 # -> c+d c 0 0
458 pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
459@@ -499,7 +495,6 @@ _vpaes_schedule_192_smear:
460 .type _vpaes_schedule_round,\@abi-omnipotent
461 .align 16
462 _vpaes_schedule_round:
463- endbr64
464 # extract rcon from xmm8
465 pxor %xmm1, %xmm1
466 palignr \$15, %xmm8, %xmm1
467@@ -567,7 +562,6 @@ _vpaes_schedule_low_round:
468 .type _vpaes_schedule_transform,\@abi-omnipotent
469 .align 16
470 _vpaes_schedule_transform:
471- endbr64
472 movdqa %xmm9, %xmm1
473 pandn %xmm0, %xmm1
474 psrld \$4, %xmm1
475@@ -606,7 +600,6 @@ _vpaes_schedule_transform:
476 .type _vpaes_schedule_mangle,\@abi-omnipotent
477 .align 16
478 _vpaes_schedule_mangle:
479- endbr64
480 movdqa %xmm0, %xmm4 # save xmm0 for later
481 movdqa .Lk_mc_forward(%rip),%xmm5
482 test %rcx, %rcx
483@@ -680,7 +673,6 @@ _vpaes_schedule_mangle:
484 .type ${PREFIX}_set_encrypt_key,\@function,3
485 .align 16
486 ${PREFIX}_set_encrypt_key:
487- endbr64
488 ___
489 $code.=<<___ if ($win64);
490 lea -0xb8(%rsp),%rsp
491@@ -729,7 +721,6 @@ $code.=<<___;
492 .type ${PREFIX}_set_decrypt_key,\@function,3
493 .align 16
494 ${PREFIX}_set_decrypt_key:
495- endbr64
496 ___
497 $code.=<<___ if ($win64);
498 lea -0xb8(%rsp),%rsp
499@@ -783,7 +774,6 @@ $code.=<<___;
500 .type ${PREFIX}_encrypt,\@function,3
501 .align 16
502 ${PREFIX}_encrypt:
503- endbr64
504 ___
505 $code.=<<___ if ($win64);
506 lea -0xb8(%rsp),%rsp
507@@ -827,7 +817,6 @@ $code.=<<___;
508 .type ${PREFIX}_decrypt,\@function,3
509 .align 16
510 ${PREFIX}_decrypt:
511- endbr64
512 ___
513 $code.=<<___ if ($win64);
514 lea -0xb8(%rsp),%rsp
515@@ -877,7 +866,6 @@ $code.=<<___;
516 .type ${PREFIX}_cbc_encrypt,\@function,6
517 .align 16
518 ${PREFIX}_cbc_encrypt:
519- endbr64
520 xchg $key,$len
521 ___
522 ($len,$key)=($key,$len);
523@@ -961,7 +949,6 @@ $code.=<<___;
524 .type _vpaes_preheat,\@abi-omnipotent
525 .align 16
526 _vpaes_preheat:
527- endbr64
528 lea .Lk_s0F(%rip), %r10
529 movdqa -0x20(%r10), %xmm10 # .Lk_inv
530 movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
531@@ -1092,7 +1079,6 @@ $code.=<<___;
532 .type se_handler,\@abi-omnipotent
533 .align 16
534 se_handler:
535- endbr64
536 push %rsi
537 push %rdi
538 push %rbx
539diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
540index 06298ca69..d56fa5e3a 100644
541--- a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
542+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
543@@ -49,7 +49,6 @@
544
545
546 S2N_BN_SYMBOL(bignum_add):
547- endbr64
548
549 #if WINDOWS_ABI
550 push rdi
551diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
552index 5ad712749..1dc1e5870 100644
553--- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
554+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
555@@ -54,7 +54,6 @@
556
557
558 S2N_BN_SYMBOL(bignum_cmadd):
559- endbr64
560
561 #if WINDOWS_ABI
562 push rdi
563diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
564index 9199c8f48..c1a23ccea 100644
565--- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
566+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
567@@ -51,7 +51,6 @@
568
569
570 S2N_BN_SYMBOL(bignum_cmul):
571- endbr64
572
573 #if WINDOWS_ABI
574 push rdi
575diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
576index 2d7ed1909..42ac988a1 100644
577--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
578+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
579@@ -59,7 +59,6 @@
580
581
582 S2N_BN_SYMBOL(bignum_mul):
583- endbr64
584
585 #if WINDOWS_ABI
586 push rdi
587diff --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
588index f02b09b28..3b7848b28 100644
589--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S
590+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S
591@@ -72,7 +72,6 @@
592 adc h, rdx
593
594 S2N_BN_SYMBOL(bignum_mul_4_8_alt):
595- endbr64
596
597 #if WINDOWS_ABI
598 push rdi
599diff --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
600index 97be83e1f..1be37840d 100644
601--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S
602+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S
603@@ -72,7 +72,6 @@
604 adc h, rdx
605
606 S2N_BN_SYMBOL(bignum_mul_8_16_alt):
607- endbr64
608
609 #if WINDOWS_ABI
610 push rdi
611diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
612index c4a0cabf3..2e05b9c17 100644
613--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
614+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
615@@ -62,7 +62,6 @@
616 #define llshort ebp
617
618 S2N_BN_SYMBOL(bignum_sqr):
619- endbr64
620
621 #if WINDOWS_ABI
622 push rdi
623diff --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
624index b228414dc..a635177c6 100644
625--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S
626+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S
627@@ -71,7 +71,6 @@
628 adc c, 0
629
630 S2N_BN_SYMBOL(bignum_sqr_4_8_alt):
631- endbr64
632
633 #if WINDOWS_ABI
634 push rdi
635diff --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
636index 04efeec7e..f698202d2 100644
637--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S
638+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S
639@@ -103,7 +103,6 @@
640 adc c, 0
641
642 S2N_BN_SYMBOL(bignum_sqr_8_16_alt):
643- endbr64
644
645 #if WINDOWS_ABI
646 push rdi
647diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
648index 11a9bd7ed..f8e1fe35a 100644
649--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
650+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
651@@ -49,7 +49,6 @@
652
653
654 S2N_BN_SYMBOL(bignum_sub):
655- endbr64
656
657 #if WINDOWS_ABI
658 push rdi
659diff --git a/src/lib/libcrypto/bn/arch/amd64/word_clz.S b/src/lib/libcrypto/bn/arch/amd64/word_clz.S
660index 464a9d90f..025e98f9c 100644
661--- a/src/lib/libcrypto/bn/arch/amd64/word_clz.S
662+++ b/src/lib/libcrypto/bn/arch/amd64/word_clz.S
663@@ -30,7 +30,6 @@
664 .text
665
666 S2N_BN_SYMBOL(word_clz):
667- endbr64
668
669 #if WINDOWS_ABI
670 push rdi
671diff --git a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
672index af78fff54..2e71a7f03 100644
673--- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
674+++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
675@@ -347,7 +347,6 @@ $code.=<<___;
676 .type MULADD_128x512,\@abi-omnipotent
677 .align 16
678 MULADD_128x512:
679- endbr64
680 ___
681 &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx");
682 $code.=<<___;
683@@ -415,7 +414,6 @@ $code.=<<___;
684 .type mont_reduce,\@abi-omnipotent
685 .align 16
686 mont_reduce:
687- endbr64
688 ___
689
690 my $STACK_DEPTH = 8;
691@@ -678,7 +676,6 @@ $code.=<<___;
692 .type mont_mul_a3b,\@abi-omnipotent
693 .align 16
694 mont_mul_a3b:
695- endbr64
696 #
697 # multiply tmp = src1 * src2
698 # For multiply: dst = rcx, src1 = rdi, src2 = rsi
699@@ -1080,7 +1077,6 @@ $code.=<<___;
700 .type sqr_reduce,\@abi-omnipotent
701 .align 16
702 sqr_reduce:
703- endbr64
704 mov (+$pResult_offset+8)(%rsp), %rcx
705 ___
706 &SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi");
707@@ -1110,7 +1106,6 @@ $code.=<<___;
708 .globl mod_exp_512
709 .type mod_exp_512,\@function,4
710 mod_exp_512:
711- endbr64
712 push %rbp
713 push %rbx
714 push %r12
715diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
716index 6f5ab331e..cae7309d5 100755
717--- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl
718+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
719@@ -63,7 +63,6 @@ $code=<<___;
720 .type bn_mul_mont,\@function,6
721 .align 16
722 bn_mul_mont:
723- endbr64
724 test \$3,${num}d
725 jnz .Lmul_enter
726 cmp \$8,${num}d
727@@ -279,7 +278,6 @@ $code.=<<___;
728 .align 16
729 bn_mul4x_mont:
730 .Lmul4x_enter:
731- endbr64
732 push %rbx
733 push %rbp
734 push %r12
735@@ -707,7 +705,6 @@ $code.=<<___;
736 .align 16
737 bn_sqr4x_mont:
738 .Lsqr4x_enter:
739- endbr64
740 push %rbx
741 push %rbp
742 push %r12
743diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
744index 3b3325a6c..7b9c6df27 100755
745--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
746+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
747@@ -57,7 +57,6 @@ $code=<<___;
748 .type bn_mul_mont_gather5,\@function,6
749 .align 64
750 bn_mul_mont_gather5:
751- endbr64
752 test \$3,${num}d
753 jnz .Lmul_enter
754 cmp \$8,${num}d
755@@ -388,7 +387,6 @@ $code.=<<___;
756 .type bn_mul4x_mont_gather5,\@function,6
757 .align 16
758 bn_mul4x_mont_gather5:
759- endbr64
760 .Lmul4x_enter:
761 mov ${num}d,${num}d
762 movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument
763@@ -927,7 +925,6 @@ $code.=<<___;
764 .type bn_scatter5,\@abi-omnipotent
765 .align 16
766 bn_scatter5:
767- endbr64
768 cmp \$0, $num
769 jz .Lscatter_epilogue
770 lea ($tbl,$idx,8),$tbl
771@@ -946,7 +943,6 @@ bn_scatter5:
772 .type bn_gather5,\@abi-omnipotent
773 .align 16
774 bn_gather5:
775- endbr64
776 .LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases
777 # I can't trust assembler to use specific encoding:-(
778 .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10
779@@ -1057,7 +1053,6 @@ $code.=<<___;
780 .type mul_handler,\@abi-omnipotent
781 .align 16
782 mul_handler:
783- endbr64
784 push %rsi
785 push %rdi
786 push %rbx
787diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
788index 3ceed3e89..586e5d6e9 100644
789--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
790+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
791@@ -116,7 +116,6 @@ $code=<<___;
792 .type Camellia_EncryptBlock,\@abi-omnipotent
793 .align 16
794 Camellia_EncryptBlock:
795- endbr64
796 movl \$128,%eax
797 subl $arg0d,%eax
798 movl \$3,$arg0d
799@@ -129,7 +128,6 @@ Camellia_EncryptBlock:
800 .align 16
801 .Lenc_rounds:
802 Camellia_EncryptBlock_Rounds:
803- endbr64
804 push %rbx
805 push %rbp
806 push %r13
807@@ -178,7 +176,6 @@ Camellia_EncryptBlock_Rounds:
808 .type _x86_64_Camellia_encrypt,\@abi-omnipotent
809 .align 16
810 _x86_64_Camellia_encrypt:
811- endbr64
812 xor 0($key),@S[1]
813 xor 4($key),@S[0] # ^=key[0-3]
814 xor 8($key),@S[3]
815@@ -229,7 +226,6 @@ $code.=<<___;
816 .type Camellia_DecryptBlock,\@abi-omnipotent
817 .align 16
818 Camellia_DecryptBlock:
819- endbr64
820 movl \$128,%eax
821 subl $arg0d,%eax
822 movl \$3,$arg0d
823@@ -242,7 +238,6 @@ Camellia_DecryptBlock:
824 .align 16
825 .Ldec_rounds:
826 Camellia_DecryptBlock_Rounds:
827- endbr64
828 push %rbx
829 push %rbp
830 push %r13
831@@ -291,7 +286,6 @@ Camellia_DecryptBlock_Rounds:
832 .type _x86_64_Camellia_decrypt,\@abi-omnipotent
833 .align 16
834 _x86_64_Camellia_decrypt:
835- endbr64
836 xor 0($key),@S[1]
837 xor 4($key),@S[0] # ^=key[0-3]
838 xor 8($key),@S[3]
839@@ -406,7 +400,6 @@ $code.=<<___;
840 .type Camellia_Ekeygen,\@function,3
841 .align 16
842 Camellia_Ekeygen:
843- endbr64
844 push %rbx
845 push %rbp
846 push %r13
847@@ -637,7 +630,6 @@ $code.=<<___;
848 .type Camellia_cbc_encrypt,\@function,6
849 .align 16
850 Camellia_cbc_encrypt:
851- endbr64
852 cmp \$0,%rdx
853 je .Lcbc_abort
854 push %rbx
855diff --git a/src/lib/libcrypto/md5/asm/md5-x86_64.pl b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
856index 06d69094f..c902a1b53 100755
857--- a/src/lib/libcrypto/md5/asm/md5-x86_64.pl
858+++ b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
859@@ -128,7 +128,6 @@ $code .= <<EOF;
860 .globl md5_block_asm_data_order
861 .type md5_block_asm_data_order,\@function,3
862 md5_block_asm_data_order:
863- endbr64
864 push %rbp
865 push %rbx
866 push %r12
867diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
868index 9ce0c3814..71d0822ac 100644
869--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
870+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
871@@ -412,7 +412,6 @@ $code.=<<___;
872 .type gcm_init_clmul,\@abi-omnipotent
873 .align 16
874 gcm_init_clmul:
875- endbr64
876 movdqu ($Xip),$Hkey
877 pshufd \$0b01001110,$Hkey,$Hkey # dword swap
878
879@@ -450,7 +449,6 @@ $code.=<<___;
880 .type gcm_gmult_clmul,\@abi-omnipotent
881 .align 16
882 gcm_gmult_clmul:
883- endbr64
884 movdqu ($Xip),$Xi
885 movdqa .Lbswap_mask(%rip),$T3
886 movdqu ($Htbl),$Hkey
887@@ -478,7 +476,6 @@ $code.=<<___;
888 .type gcm_ghash_clmul,\@abi-omnipotent
889 .align 16
890 gcm_ghash_clmul:
891- endbr64
892 ___
893 $code.=<<___ if ($win64);
894 .LSEH_begin_gcm_ghash_clmul:
895@@ -689,7 +686,6 @@ $code.=<<___;
896 .type se_handler,\@abi-omnipotent
897 .align 16
898 se_handler:
899- endbr64
900 push %rsi
901 push %rdi
902 push %rbx
903diff --git a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
904index 3190e6a8e..c65a2c751 100644
905--- a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
906+++ b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
907@@ -38,7 +38,7 @@ my ($rc4,$md5)=(1,1); # what to generate?
908 my $D="#" if (!$md5); # if set to "#", MD5 is stitched into RC4(),
909 # but its result is discarded. Idea here is
910 # to be able to use 'openssl speed rc4' for
911- # benchmarking the stitched subroutine...
912+ # benchmarking the stitched subroutine...
913
914 my $flavour = shift;
915 my $output = shift;
916@@ -109,7 +109,6 @@ $code.=<<___;
917 .globl $func
918 .type $func,\@function,$nargs
919 $func:
920- endbr64
921 cmp \$0,$len
922 je .Labort
923 push %rbx
924@@ -405,7 +404,7 @@ $code.=<<___ if ($rc4 && (!$md5 || $D));
925 and \$63,$len # remaining bytes
926 jnz .Loop1
927 jmp .Ldone
928-
929+
930 .align 16
931 .Loop1:
932 add $TX[0]#b,$YY#b
933@@ -454,7 +453,6 @@ $code.=<<___;
934 .type RC4_set_key,\@function,3
935 .align 16
936 RC4_set_key:
937- endbr64
938 lea 8($dat),$dat
939 lea ($inp,$len),$inp
940 neg $len
941diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
942index 0472acce8..f678daaac 100755
943--- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
944+++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
945@@ -41,7 +41,7 @@
946
947 # April 2005
948 #
949-# P4 EM64T core appears to be "allergic" to 64-bit inc/dec. Replacing
950+# P4 EM64T core appears to be "allergic" to 64-bit inc/dec. Replacing
951 # those with add/sub results in 50% performance improvement of folded
952 # loop...
953
954@@ -127,9 +127,7 @@ $code=<<___;
955 .globl RC4
956 .type RC4,\@function,4
957 .align 16
958-RC4:
959- endbr64
960- or $len,$len
961+RC4: or $len,$len
962 jne .Lentry
963 ret
964 .Lentry:
965@@ -435,7 +433,6 @@ $code.=<<___;
966 .type RC4_set_key,\@function,3
967 .align 16
968 RC4_set_key:
969- endbr64
970 lea 8($dat),$dat
971 lea ($inp,$len),$inp
972 neg $len
973diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
974index e15ff47f8..43eee73c4 100755
975--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
976+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
977@@ -222,7 +222,6 @@ $code.=<<___;
978 .type sha1_block_data_order,\@function,3
979 .align 16
980 sha1_block_data_order:
981- endbr64
982 mov OPENSSL_ia32cap_P+0(%rip),%r9d
983 mov OPENSSL_ia32cap_P+4(%rip),%r8d
984 test \$IA32CAP_MASK1_SSSE3,%r8d # check SSSE3 bit
985@@ -310,7 +309,6 @@ $code.=<<___;
986 .align 16
987 sha1_block_data_order_ssse3:
988 _ssse3_shortcut:
989- endbr64
990 push %rbx
991 push %rbp
992 push %r12
993@@ -731,7 +729,6 @@ $code.=<<___;
994 .align 16
995 sha1_block_data_order_avx:
996 _avx_shortcut:
997- endbr64
998 push %rbx
999 push %rbp
1000 push %r12
1001@@ -1102,7 +1099,6 @@ $code.=<<___;
1002 .type se_handler,\@abi-omnipotent
1003 .align 16
1004 se_handler:
1005- endbr64
1006 push %rsi
1007 push %rdi
1008 push %rbx
1009diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
1010index 120693fee..0517eab66 100755
1011--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
1012+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
1013@@ -175,7 +175,6 @@ $code=<<___;
1014 .type $func,\@function,4
1015 .align 16
1016 $func:
1017- endbr64
1018 push %rbx
1019 push %rbp
1020 push %r12
1021diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
1022index 7958f6d28..de5d3acfb 100644
1023--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
1024+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
1025@@ -57,7 +57,6 @@ $code=<<___;
1026 .type $func,\@function,3
1027 .align 16
1028 $func:
1029- endbr64
1030 push %rbx
1031 push %rbp
1032 push %r12
1033diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl
1034index dc56732a2..1b67d1110 100644
1035--- a/src/lib/libcrypto/x86_64cpuid.pl
1036+++ b/src/lib/libcrypto/x86_64cpuid.pl
1037@@ -18,7 +18,6 @@ print<<___;
1038 .extern OPENSSL_cpuid_setup
1039 .hidden OPENSSL_cpuid_setup
1040 .section .init
1041- endbr64
1042 call OPENSSL_cpuid_setup
1043
1044 .extern OPENSSL_ia32cap_P
1045@@ -30,7 +29,6 @@ print<<___;
1046 .type OPENSSL_ia32_cpuid,\@abi-omnipotent
1047 .align 16
1048 OPENSSL_ia32_cpuid:
1049- endbr64
1050 mov %rbx,%r8 # save %rbx
1051
1052 xor %eax,%eax
1053--
10542.42.0
1055
diff --git a/patches/asm/0002-Revert-Use-explicit-.text-instead-of-.previous-to-pl.patch b/patches/asm/0002-Revert-Use-explicit-.text-instead-of-.previous-to-pl.patch
deleted file mode 100644
index 58568f5..0000000
--- a/patches/asm/0002-Revert-Use-explicit-.text-instead-of-.previous-to-pl.patch
+++ /dev/null
@@ -1,162 +0,0 @@
1From 8861777e025998cc80bb9e39e88a332e8aec2f26 Mon Sep 17 00:00:00 2001
2From: Brent Cook <busterb@gmail.com>
3Date: Mon, 30 Oct 2023 22:00:12 -0500
4Subject: [PATCH 2/4] Revert "Use explicit .text instead of .previous to please
5 Windows/MinGW on amd64"
6
7This reverts commit e8192f57c4e5910ce7badced4a24c8827810d567.
8---
9 src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +-
10 src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +-
11 src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +-
12 src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +-
13 src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +-
14 src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +-
15 src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +-
16 src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +-
17 src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +-
18 src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++--
19 10 files changed, 11 insertions(+), 11 deletions(-)
20
21diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
22index b7399b552..2986a9fcc 100755
23--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
24+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
25@@ -2535,7 +2535,7 @@ $code.=<<___;
26 .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
27 .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
28 .align 64
29-.text
30+.previous
31 ___
32
33 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
34diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
35index bafa906a0..8a428c9b1 100644
36--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
37+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
38@@ -1084,7 +1084,7 @@ K_XX_XX:
39 .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
40 .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
41 .align 64
42-.text
43+.previous
44 ___
45
46 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
47diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
48index e662fbc7c..09612b1f8 100644
49--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
50+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
51@@ -2732,7 +2732,7 @@ $code.=<<___;
52 .Lxts_magic:
53 .long 0x87,0,1,0
54 .align 64
55-.text
56+.previous
57 ___
58
59 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
60diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
61index 20e9e1f71..347f4c302 100644
62--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
63+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
64@@ -2937,7 +2937,7 @@ _bsaes_const:
65 .quad 0x6363636363636363, 0x6363636363636363
66 .align 64
67 .size _bsaes_const,.-_bsaes_const
68-.text
69+.previous
70 ___
71
72 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
73diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
74index 3ffb1a303..ad5fa7522 100644
75--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
76+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
77@@ -1063,7 +1063,7 @@ _vpaes_consts:
78 .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
79 .align 64
80 .size _vpaes_consts,.-_vpaes_consts
81-.text
82+.previous
83 ___
84
85 if ($win64) {
86diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
87index 7b9c6df27..1c8aa255c 100755
88--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
89+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
90@@ -1037,7 +1037,7 @@ $code.=<<___;
91 .Linc:
92 .long 0,0, 1,1
93 .long 2,2, 2,2
94-.text
95+.previous
96 ___
97
98 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
99diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
100index 586e5d6e9..c16725f5c 100644
101--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
102+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
103@@ -625,7 +625,7 @@ $_ivp="40(%rsp)";
104 $_rsp="48(%rsp)";
105
106 $code.=<<___;
107-.text
108+.previous
109 .globl Camellia_cbc_encrypt
110 .type Camellia_cbc_encrypt,\@function,6
111 .align 16
112diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
113index 71d0822ac..bce62947f 100644
114--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
115+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
116@@ -670,7 +670,7 @@ $code.=<<___;
117 .value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
118 .value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
119 .align 64
120-.text
121+.previous
122 ___
123
124 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
125diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
126index 43eee73c4..1ec7f609a 100755
127--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
128+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
129@@ -1079,7 +1079,7 @@ K_XX_XX:
130 .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
131 .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
132 .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
133-.text
134+.previous
135 ___
136 }}}
137 $code.=<<___;
138diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
139index 0517eab66..1a7d9bf2d 100755
140--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
141+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
142@@ -289,7 +289,7 @@ $TABLE:
143 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
144 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
145 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
146-.text
147+.previous
148 ___
149 } else {
150 $code.=<<___;
151@@ -337,7 +337,7 @@ $TABLE:
152 .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
153 .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
154 .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
155-.text
156+.previous
157 ___
158 }
159
160--
1612.42.0
162
diff --git a/patches/asm/0003-Revert-Use-.section-.rodata-instead-of-a-plain-.roda.patch b/patches/asm/0003-Revert-Use-.section-.rodata-instead-of-a-plain-.roda.patch
deleted file mode 100644
index 165f2c0..0000000
--- a/patches/asm/0003-Revert-Use-.section-.rodata-instead-of-a-plain-.roda.patch
+++ /dev/null
@@ -1,203 +0,0 @@
1From 1407448470aff891f9a9eff550ecda06202ffd29 Mon Sep 17 00:00:00 2001
2From: Brent Cook <busterb@gmail.com>
3Date: Mon, 30 Oct 2023 22:00:49 -0500
4Subject: [PATCH 3/4] Revert "Use .section .rodata instead of a plain .rodata"
5
6This reverts commit 67afc07de0ed3a0ccc272df42853ba565a8277c6.
7---
8 src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +-
9 src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +-
10 src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +-
11 src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +-
12 src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +-
13 src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +-
14 src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +-
15 src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +-
16 src/lib/libcrypto/perlasm/x86gas.pl | 2 +-
17 src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +-
18 src/lib/libcrypto/sha/asm/sha512-ppc.pl | 2 +-
19 src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++--
20 src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 2 +-
21 13 files changed, 14 insertions(+), 14 deletions(-)
22
23diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
24index 2986a9fcc..d9f501b25 100755
25--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
26+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
27@@ -2113,7 +2113,7 @@ ___
28 }
29
30 $code.=<<___;
31-.section .rodata
32+.rodata
33 .align 64
34 .LAES_Te:
35 ___
36diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
37index 8a428c9b1..4e83b6ba4 100644
38--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
39+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
40@@ -1075,7 +1075,7 @@ $code.=<<___;
41 ___
42 }
43 $code.=<<___;
44-.section .rodata
45+.rodata
46 .align 64
47 K_XX_XX:
48 .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
49diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
50index 09612b1f8..2ab7106c0 100644
51--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
52+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
53@@ -2721,7 +2721,7 @@ ___
54 }
55
56 $code.=<<___;
57-.section .rodata
58+.rodata
59 .align 64
60 .Lbswap_mask:
61 .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
62diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
63index 347f4c302..a40f83601 100644
64--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
65+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
66@@ -2882,7 +2882,7 @@ $code.=<<___;
67 ___
68 }
69 $code.=<<___;
70-.section .rodata
71+.rodata
72 .type _bsaes_const,\@object
73 .align 64
74 _bsaes_const:
75diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
76index ad5fa7522..63af96c1d 100644
77--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
78+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
79@@ -964,7 +964,7 @@ _vpaes_preheat:
80 ## Constants ##
81 ## ##
82 ########################################################
83-.section .rodata
84+.rodata
85 .type _vpaes_consts,\@object
86 .align 64
87 _vpaes_consts:
88diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
89index 1c8aa255c..5d30f210c 100755
90--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
91+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
92@@ -1032,7 +1032,7 @@ $code.=<<___;
93 ___
94 }
95 $code.=<<___;
96-.section .rodata
97+.rodata
98 .align 64
99 .Linc:
100 .long 0,0, 1,1
101diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
102index c16725f5c..90c56d9e5 100644
103--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
104+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
105@@ -599,7 +599,7 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i
106 sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff; $i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); }
107
108 $code.=<<___;
109-.section .rodata
110+.rodata
111 .align 64
112 .LCamellia_SIGMA:
113 .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
114diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
115index bce62947f..3ae8629cb 100644
116--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
117+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
118@@ -622,7 +622,7 @@ ___
119 }
120
121 $code.=<<___;
122-.section .rodata
123+.rodata
124 .align 64
125 .Lbswap_mask:
126 .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
127diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl
128index b84e28be9..f28a59054 100644
129--- a/src/lib/libcrypto/perlasm/x86gas.pl
130+++ b/src/lib/libcrypto/perlasm/x86gas.pl
131@@ -307,7 +307,7 @@ sub ::dataseg
132 { push(@out,".data\n"); }
133
134 sub ::rodataseg
135-{ push(@out,".section .rodata\n"); }
136+{ push(@out,".rodata\n"); }
137
138 sub ::previous
139 { push(@out,".previous\n"); }
140diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
141index 1ec7f609a..0abbbab6b 100755
142--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
143+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
144@@ -1071,7 +1071,7 @@ $code.=<<___;
145 ___
146 }
147 $code.=<<___;
148-.section .rodata
149+.rodata
150 .align 64
151 K_XX_XX:
152 .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
153diff --git a/src/lib/libcrypto/sha/asm/sha512-ppc.pl b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
154index 28bd997cf..1f02cfdd5 100755
155--- a/src/lib/libcrypto/sha/asm/sha512-ppc.pl
156+++ b/src/lib/libcrypto/sha/asm/sha512-ppc.pl
157@@ -375,7 +375,7 @@ $code.=<<___;
158 $ST $H,`7*$SZ`($ctx)
159 bne Lsha2_block_private
160 blr
161- .section .rodata
162+ .rodata
163 Ltable:
164 ___
165 $code.=<<___ if ($SZ==8);
166diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
167index 1a7d9bf2d..6698b1d40 100755
168--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
169+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
170@@ -269,7 +269,7 @@ ___
171
172 if ($SZ==4) {
173 $code.=<<___;
174-.section .rodata
175+.rodata
176 .align 64
177 .type $TABLE,\@object
178 $TABLE:
179@@ -293,7 +293,7 @@ $TABLE:
180 ___
181 } else {
182 $code.=<<___;
183-.section .rodata
184+.rodata
185 .align 64
186 .type $TABLE,\@object
187 $TABLE:
188diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
189index de5d3acfb..510a74b91 100644
190--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
191+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
192@@ -204,7 +204,7 @@ $code.=<<___;
193 ret
194 .size $func,.-$func
195
196-.section .rodata
197+.rodata
198 .align 64
199 .type $table,\@object
200 $table:
201--
2022.42.0
203
diff --git a/patches/asm/0004-Revert-Move-constants-out-of-text-segment-into-rodat.patch b/patches/asm/0004-Revert-Move-constants-out-of-text-segment-into-rodat.patch
deleted file mode 100644
index 1a17540..0000000
--- a/patches/asm/0004-Revert-Move-constants-out-of-text-segment-into-rodat.patch
+++ /dev/null
@@ -1,292 +0,0 @@
1From 87b24a6d5a932061cc88b84a856663b328d1c166 Mon Sep 17 00:00:00 2001
2From: Brent Cook <busterb@gmail.com>
3Date: Mon, 30 Oct 2023 22:01:49 -0500
4Subject: [PATCH 4/4] Revert "Move constants out of text segment into rodata to
5 prepare for xonly support"
6
7This reverts commit b5834617204e7520b0209bcff7f1c4a559e05422.
8---
9 src/lib/libcrypto/aes/asm/aes-x86_64.pl | 3 +--
10 src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 4 ++--
11 src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 4 ++--
12 src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 3 +--
13 src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 3 +--
14 src/lib/libcrypto/bn/asm/x86_64-mont.pl | 4 ++++
15 src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 3 +--
16 src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 4 ++--
17 src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 4 ++--
18 src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 3 +--
19 src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ----
20 src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 1 -
21 12 files changed, 17 insertions(+), 23 deletions(-)
22
23diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
24index d9f501b25..9072f603a 100755
25--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
26+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
27@@ -2113,7 +2113,6 @@ ___
28 }
29
30 $code.=<<___;
31-.rodata
32 .align 64
33 .LAES_Te:
34 ___
35@@ -2534,8 +2533,8 @@ ___
36 $code.=<<___;
37 .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe
38 .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0
39+.asciz "AES for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
40 .align 64
41-.previous
42 ___
43
44 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
45diff --git a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
46index 4e83b6ba4..880bcc2d5 100644
47--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
48+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
49@@ -1075,7 +1075,6 @@ $code.=<<___;
50 ___
51 }
52 $code.=<<___;
53-.rodata
54 .align 64
55 K_XX_XX:
56 .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
57@@ -1083,8 +1082,9 @@ K_XX_XX:
58 .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
59 .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
60 .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
61+
62+.asciz "AESNI-CBC+SHA1 stitch for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
63 .align 64
64-.previous
65 ___
66
67 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
68diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
69index 2ab7106c0..96978bd35 100644
70--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
71+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
72@@ -2721,7 +2721,6 @@ ___
73 }
74
75 $code.=<<___;
76-.rodata
77 .align 64
78 .Lbswap_mask:
79 .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
80@@ -2731,8 +2730,9 @@ $code.=<<___;
81 .long 1,0,0,0
82 .Lxts_magic:
83 .long 0x87,0,1,0
84+
85+.asciz "AES for Intel AES-NI, CRYPTOGAMS by <appro\@openssl.org>"
86 .align 64
87-.previous
88 ___
89
90 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
91diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
92index a40f83601..14dc2c02e 100644
93--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
94+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
95@@ -2882,7 +2882,6 @@ $code.=<<___;
96 ___
97 }
98 $code.=<<___;
99-.rodata
100 .type _bsaes_const,\@object
101 .align 64
102 _bsaes_const:
103@@ -2935,9 +2934,9 @@ _bsaes_const:
104 .quad 0x02060a0e03070b0f, 0x0004080c0105090d
105 .L63:
106 .quad 0x6363636363636363, 0x6363636363636363
107+.asciz "Bit-sliced AES for x86_64/SSSE3, Emilia Käsper, Peter Schwabe, Andy Polyakov"
108 .align 64
109 .size _bsaes_const,.-_bsaes_const
110-.previous
111 ___
112
113 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
114diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
115index 63af96c1d..bd7f45b85 100644
116--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
117+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
118@@ -964,7 +964,6 @@ _vpaes_preheat:
119 ## Constants ##
120 ## ##
121 ########################################################
122-.rodata
123 .type _vpaes_consts,\@object
124 .align 64
125 _vpaes_consts:
126@@ -1061,9 +1060,9 @@ _vpaes_consts:
127 .Lk_dsbo: # decryption sbox final output
128 .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D
129 .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C
130+.asciz "Vector Permutation AES for x86_64/SSSE3, Mike Hamburg (Stanford University)"
131 .align 64
132 .size _vpaes_consts,.-_vpaes_consts
133-.previous
134 ___
135
136 if ($win64) {
137diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
138index cae7309d5..c35493e80 100755
139--- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl
140+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
141@@ -1495,6 +1495,10 @@ $code.=<<___;
142 .size bn_sqr4x_mont,.-bn_sqr4x_mont
143 ___
144 }}}
145+$code.=<<___;
146+.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
147+.align 16
148+___
149
150 print $code;
151 close STDOUT;
152diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
153index 5d30f210c..bb7ad4c4b 100755
154--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
155+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
156@@ -1032,12 +1032,11 @@ $code.=<<___;
157 ___
158 }
159 $code.=<<___;
160-.rodata
161 .align 64
162 .Linc:
163 .long 0,0, 1,1
164 .long 2,2, 2,2
165-.previous
166+.asciz "Montgomery Multiplication with scatter/gather for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
167 ___
168
169 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
170diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
171index 90c56d9e5..df6bf11a2 100644
172--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
173+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
174@@ -599,7 +599,6 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i
175 sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff; $i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); }
176
177 $code.=<<___;
178-.rodata
179 .align 64
180 .LCamellia_SIGMA:
181 .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858
182@@ -625,7 +624,6 @@ $_ivp="40(%rsp)";
183 $_rsp="48(%rsp)";
184
185 $code.=<<___;
186-.previous
187 .globl Camellia_cbc_encrypt
188 .type Camellia_cbc_encrypt,\@function,6
189 .align 16
190@@ -859,6 +857,8 @@ Camellia_cbc_encrypt:
191 .Lcbc_abort:
192 ret
193 .size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt
194+
195+.asciz "Camellia for x86_64 by <appro\@openssl.org>"
196 ___
197 }
198
199diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
200index 3ae8629cb..38d779edb 100644
201--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
202+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
203@@ -622,7 +622,6 @@ ___
204 }
205
206 $code.=<<___;
207-.rodata
208 .align 64
209 .Lbswap_mask:
210 .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0
211@@ -669,8 +668,9 @@ $code.=<<___;
212 .value 0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E
213 .value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE
214 .value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE
215+
216+.asciz "GHASH for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
217 .align 64
218-.previous
219 ___
220
221 # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame,
222diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
223index 0abbbab6b..cc8ef5337 100755
224--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
225+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
226@@ -1071,7 +1071,6 @@ $code.=<<___;
227 ___
228 }
229 $code.=<<___;
230-.rodata
231 .align 64
232 K_XX_XX:
233 .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19
234@@ -1079,10 +1078,10 @@ K_XX_XX:
235 .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59
236 .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79
237 .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask
238-.previous
239 ___
240 }}}
241 $code.=<<___;
242+.asciz "SHA1 block transform for x86_64, CRYPTOGAMS by <appro\@openssl.org>"
243 .align 64
244 ___
245
246diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
247index 6698b1d40..bc4b2e748 100755
248--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
249+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
250@@ -269,7 +269,6 @@ ___
251
252 if ($SZ==4) {
253 $code.=<<___;
254-.rodata
255 .align 64
256 .type $TABLE,\@object
257 $TABLE:
258@@ -289,11 +288,9 @@ $TABLE:
259 .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3
260 .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208
261 .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
262-.previous
263 ___
264 } else {
265 $code.=<<___;
266-.rodata
267 .align 64
268 .type $TABLE,\@object
269 $TABLE:
270@@ -337,7 +334,6 @@ $TABLE:
271 .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c
272 .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a
273 .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817
274-.previous
275 ___
276 }
277
278diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
279index 510a74b91..afadd5d2f 100644
280--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
281+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
282@@ -204,7 +204,6 @@ $code.=<<___;
283 ret
284 .size $func,.-$func
285
286-.rodata
287 .align 64
288 .type $table,\@object
289 $table:
290--
2912.42.0
292
diff --git a/patches/asm/0005-Revert-aesni-endbr64.patch b/patches/asm/0005-Revert-aesni-endbr64.patch
deleted file mode 100644
index f2094e6..0000000
--- a/patches/asm/0005-Revert-aesni-endbr64.patch
+++ /dev/null
@@ -1,20 +0,0 @@
1commit ac992937b461479b41f7f65e79646ef0a715f95d
2Author: Brent Cook <busterb@gmail.com>
3Date: Thu Nov 9 12:29:33 2023 -0600
4
5 Revert "aesni_ctr32_encrypt_blocks() is called indirectly from C code, so it"
6
7 This reverts commit 52f96c842e82486510ffc2513e71323b70242f28.
8
9diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
10index 07d40a84a..c261a3795 100644
11--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
12+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
13@@ -1025,7 +1025,6 @@ $code.=<<___;
14 .type aesni_ctr32_encrypt_blocks,\@function,5
15 .align 16
16 aesni_ctr32_encrypt_blocks:
17- endbr64
18 lea (%rsp),%rax
19 push %rbp
20 sub \$$frame_size,%rsp
diff --git a/patches/asm/endbr64.patch b/patches/asm/endbr64.patch
new file mode 100644
index 0000000..05cf0eb
--- /dev/null
+++ b/patches/asm/endbr64.patch
@@ -0,0 +1,1215 @@
1Replace uses of endbr64 with _CET_ENDBR from cet.h
2
3cet.h is needed for other platforms to emit the relevant .gnu.properties
4sections that are necessary for them to enable IBT. It also avoids issues
5with older toolchains on macOS that explode on encountering endbr64.
6
7based on a diff by kettenis
8ok beck kettenis tb
9
10Index: x86_64cpuid.pl
11===================================================================
12RCS file: /cvs/src/lib/libcrypto/x86_64cpuid.pl,v
13diff -u -p -r1.15 x86_64cpuid.pl
14--- x86_64cpuid.pl 25 Apr 2023 04:42:25 -0000 1.15
15+++ x86_64cpuid.pl 3 Dec 2023 20:18:30 -0000
16@@ -18,7 +18,7 @@ print<<___;
17 .extern OPENSSL_cpuid_setup
18 .hidden OPENSSL_cpuid_setup
19 .section .init
20- endbr64
21+ _CET_ENDBR
22 call OPENSSL_cpuid_setup
23
24 .extern OPENSSL_ia32cap_P
25@@ -30,7 +30,7 @@ print<<___;
26 .type OPENSSL_ia32_cpuid,\@abi-omnipotent
27 .align 16
28 OPENSSL_ia32_cpuid:
29- endbr64
30+ _CET_ENDBR
31 mov %rbx,%r8 # save %rbx
32
33 xor %eax,%eax
34Index: aes/asm/aes-x86_64.pl
35===================================================================
36RCS file: /cvs/src/lib/libcrypto/aes/asm/aes-x86_64.pl,v
37diff -u -p -r1.12 aes-x86_64.pl
38--- aes/asm/aes-x86_64.pl 25 Apr 2023 04:42:25 -0000 1.12
39+++ aes/asm/aes-x86_64.pl 3 Dec 2023 20:18:30 -0000
40@@ -318,7 +318,7 @@ $code.=<<___;
41 .type _x86_64_AES_encrypt,\@abi-omnipotent
42 .align 16
43 _x86_64_AES_encrypt:
44- endbr64
45+ _CET_ENDBR
46 xor 0($key),$s0 # xor with key
47 xor 4($key),$s1
48 xor 8($key),$s2
49@@ -549,7 +549,7 @@ $code.=<<___;
50 .type _x86_64_AES_encrypt_compact,\@abi-omnipotent
51 .align 16
52 _x86_64_AES_encrypt_compact:
53- endbr64
54+ _CET_ENDBR
55 lea 128($sbox),$inp # size optimization
56 mov 0-128($inp),$acc1 # prefetch Te4
57 mov 32-128($inp),$acc2
58@@ -595,7 +595,7 @@ $code.=<<___;
59 .hidden asm_AES_encrypt
60 asm_AES_encrypt:
61 AES_encrypt:
62- endbr64
63+ _CET_ENDBR
64 push %rbx
65 push %rbp
66 push %r12
67@@ -887,7 +887,7 @@ $code.=<<___;
68 .type _x86_64_AES_decrypt,\@abi-omnipotent
69 .align 16
70 _x86_64_AES_decrypt:
71- endbr64
72+ _CET_ENDBR
73 xor 0($key),$s0 # xor with key
74 xor 4($key),$s1
75 xor 8($key),$s2
76@@ -1142,7 +1142,7 @@ $code.=<<___;
77 .type _x86_64_AES_decrypt_compact,\@abi-omnipotent
78 .align 16
79 _x86_64_AES_decrypt_compact:
80- endbr64
81+ _CET_ENDBR
82 lea 128($sbox),$inp # size optimization
83 mov 0-128($inp),$acc1 # prefetch Td4
84 mov 32-128($inp),$acc2
85@@ -1197,7 +1197,7 @@ $code.=<<___;
86 .hidden asm_AES_decrypt
87 asm_AES_decrypt:
88 AES_decrypt:
89- endbr64
90+ _CET_ENDBR
91 push %rbx
92 push %rbp
93 push %r12
94@@ -1297,7 +1297,7 @@ $code.=<<___;
95 .type AES_set_encrypt_key,\@function,3
96 .align 16
97 AES_set_encrypt_key:
98- endbr64
99+ _CET_ENDBR
100 push %rbx
101 push %rbp
102 push %r12 # redundant, but allows to share
103@@ -1323,7 +1323,7 @@ AES_set_encrypt_key:
104 .type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
105 .align 16
106 _x86_64_AES_set_encrypt_key:
107- endbr64
108+ _CET_ENDBR
109 mov %esi,%ecx # %ecx=bits
110 mov %rdi,%rsi # %rsi=userKey
111 mov %rdx,%rdi # %rdi=key
112@@ -1569,7 +1569,7 @@ $code.=<<___;
113 .type AES_set_decrypt_key,\@function,3
114 .align 16
115 AES_set_decrypt_key:
116- endbr64
117+ _CET_ENDBR
118 push %rbx
119 push %rbp
120 push %r12
121@@ -1669,7 +1669,7 @@ $code.=<<___;
122 .hidden asm_AES_cbc_encrypt
123 asm_AES_cbc_encrypt:
124 AES_cbc_encrypt:
125- endbr64
126+ _CET_ENDBR
127 cmp \$0,%rdx # check length
128 je .Lcbc_epilogue
129 pushfq
130@@ -2561,7 +2561,7 @@ $code.=<<___;
131 .type block_se_handler,\@abi-omnipotent
132 .align 16
133 block_se_handler:
134- endbr64
135+ _CET_ENDBR
136 push %rsi
137 push %rdi
138 push %rbx
139@@ -2620,7 +2620,7 @@ block_se_handler:
140 .type key_se_handler,\@abi-omnipotent
141 .align 16
142 key_se_handler:
143- endbr64
144+ _CET_ENDBR
145 push %rsi
146 push %rdi
147 push %rbx
148@@ -2678,7 +2678,7 @@ key_se_handler:
149 .type cbc_se_handler,\@abi-omnipotent
150 .align 16
151 cbc_se_handler:
152- endbr64
153+ _CET_ENDBR
154 push %rsi
155 push %rdi
156 push %rbx
157Index: aes/asm/aesni-sha1-x86_64.pl
158===================================================================
159RCS file: /cvs/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl,v
160diff -u -p -r1.8 aesni-sha1-x86_64.pl
161--- aes/asm/aesni-sha1-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.8
162+++ aes/asm/aesni-sha1-x86_64.pl 3 Dec 2023 20:18:30 -0000
163@@ -89,7 +89,7 @@ $code.=<<___;
164 .type aesni_cbc_sha1_enc,\@abi-omnipotent
165 .align 16
166 aesni_cbc_sha1_enc:
167- endbr64
168+ _CET_ENDBR
169 # caller should check for SSSE3 and AES-NI bits
170 mov OPENSSL_ia32cap_P+0(%rip),%r10d
171 mov OPENSSL_ia32cap_P+4(%rip),%r11d
172@@ -133,7 +133,7 @@ $code.=<<___;
173 .type aesni_cbc_sha1_enc_ssse3,\@function,6
174 .align 16
175 aesni_cbc_sha1_enc_ssse3:
176- endbr64
177+ _CET_ENDBR
178 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
179 #shr \$6,$len # debugging artefact
180 #jz .Lepilogue_ssse3 # debugging artefact
181@@ -652,7 +652,7 @@ $code.=<<___;
182 .type aesni_cbc_sha1_enc_avx,\@function,6
183 .align 16
184 aesni_cbc_sha1_enc_avx:
185- endbr64
186+ _CET_ENDBR
187 mov `($win64?56:8)`(%rsp),$inp # load 7th argument
188 #shr \$6,$len # debugging artefact
189 #jz .Lepilogue_avx # debugging artefact
190@@ -1103,7 +1103,7 @@ $code.=<<___;
191 .type ssse3_handler,\@abi-omnipotent
192 .align 16
193 ssse3_handler:
194- endbr64
195+ _CET_ENDBR
196 push %rsi
197 push %rdi
198 push %rbx
199Index: aes/asm/aesni-x86_64.pl
200===================================================================
201RCS file: /cvs/src/lib/libcrypto/aes/asm/aesni-x86_64.pl,v
202diff -u -p -r1.12 aesni-x86_64.pl
203--- aes/asm/aesni-x86_64.pl 18 Sep 2023 22:38:16 -0000 1.12
204+++ aes/asm/aesni-x86_64.pl 3 Dec 2023 20:18:30 -0000
205@@ -242,7 +242,7 @@ $code.=<<___;
206 .type ${PREFIX}_encrypt,\@abi-omnipotent
207 .align 16
208 ${PREFIX}_encrypt:
209- endbr64
210+ _CET_ENDBR
211 movups ($inp),$inout0 # load input
212 mov 240($key),$rounds # key->rounds
213 ___
214@@ -256,7 +256,7 @@ $code.=<<___;
215 .type ${PREFIX}_decrypt,\@abi-omnipotent
216 .align 16
217 ${PREFIX}_decrypt:
218- endbr64
219+ _CET_ENDBR
220 movups ($inp),$inout0 # load input
221 mov 240($key),$rounds # key->rounds
222 ___
223@@ -286,7 +286,7 @@ $code.=<<___;
224 .type _aesni_${dir}rypt3,\@abi-omnipotent
225 .align 16
226 _aesni_${dir}rypt3:
227- endbr64
228+ _CET_ENDBR
229 $movkey ($key),$rndkey0
230 shr \$1,$rounds
231 $movkey 16($key),$rndkey1
232@@ -331,7 +331,7 @@ $code.=<<___;
233 .type _aesni_${dir}rypt4,\@abi-omnipotent
234 .align 16
235 _aesni_${dir}rypt4:
236- endbr64
237+ _CET_ENDBR
238 $movkey ($key),$rndkey0
239 shr \$1,$rounds
240 $movkey 16($key),$rndkey1
241@@ -377,7 +377,7 @@ $code.=<<___;
242 .type _aesni_${dir}rypt6,\@abi-omnipotent
243 .align 16
244 _aesni_${dir}rypt6:
245- endbr64
246+ _CET_ENDBR
247 $movkey ($key),$rndkey0
248 shr \$1,$rounds
249 $movkey 16($key),$rndkey1
250@@ -442,7 +442,7 @@ $code.=<<___;
251 .type _aesni_${dir}rypt8,\@abi-omnipotent
252 .align 16
253 _aesni_${dir}rypt8:
254- endbr64
255+ _CET_ENDBR
256 $movkey ($key),$rndkey0
257 shr \$1,$rounds
258 $movkey 16($key),$rndkey1
259@@ -531,7 +531,7 @@ $code.=<<___;
260 .type aesni_ecb_encrypt,\@function,5
261 .align 16
262 aesni_ecb_encrypt:
263- endbr64
264+ _CET_ENDBR
265 and \$-16,$len
266 jz .Lecb_ret
267
268@@ -837,7 +837,7 @@ $code.=<<___;
269 .type aesni_ccm64_encrypt_blocks,\@function,6
270 .align 16
271 aesni_ccm64_encrypt_blocks:
272- endbr64
273+ _CET_ENDBR
274 ___
275 $code.=<<___ if ($win64);
276 lea -0x58(%rsp),%rsp
277@@ -1025,7 +1025,7 @@ $code.=<<___;
278 .type aesni_ctr32_encrypt_blocks,\@function,5
279 .align 16
280 aesni_ctr32_encrypt_blocks:
281- endbr64
282+ _CET_ENDBR
283 lea (%rsp),%rax
284 push %rbp
285 sub \$$frame_size,%rsp
286@@ -2487,7 +2487,7 @@ $code.=<<___;
287 .type ${PREFIX}_set_decrypt_key,\@abi-omnipotent
288 .align 16
289 ${PREFIX}_set_decrypt_key:
290- endbr64
291+ _CET_ENDBR
292 sub \$8,%rsp
293 call __aesni_set_encrypt_key
294 shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key
295@@ -2538,7 +2538,7 @@ $code.=<<___;
296 .type ${PREFIX}_set_encrypt_key,\@abi-omnipotent
297 .align 16
298 ${PREFIX}_set_encrypt_key:
299- endbr64
300+ _CET_ENDBR
301 __aesni_set_encrypt_key:
302 sub \$8,%rsp
303 mov \$-1,%rax
304@@ -2760,7 +2760,7 @@ $code.=<<___ if ($PREFIX eq "aesni");
305 .type ecb_se_handler,\@abi-omnipotent
306 .align 16
307 ecb_se_handler:
308- endbr64
309+ _CET_ENDBR
310 push %rsi
311 push %rdi
312 push %rbx
313@@ -2780,7 +2780,7 @@ ecb_se_handler:
314 .type ccm64_se_handler,\@abi-omnipotent
315 .align 16
316 ccm64_se_handler:
317- endbr64
318+ _CET_ENDBR
319 push %rsi
320 push %rdi
321 push %rbx
322@@ -2822,7 +2822,7 @@ ccm64_se_handler:
323 .type ctr32_se_handler,\@abi-omnipotent
324 .align 16
325 ctr32_se_handler:
326- endbr64
327+ _CET_ENDBR
328 push %rsi
329 push %rdi
330 push %rbx
331@@ -2858,7 +2858,7 @@ ctr32_se_handler:
332 .type xts_se_handler,\@abi-omnipotent
333 .align 16
334 xts_se_handler:
335- endbr64
336+ _CET_ENDBR
337 push %rsi
338 push %rdi
339 push %rbx
340@@ -2900,7 +2900,7 @@ $code.=<<___;
341 .type cbc_se_handler,\@abi-omnipotent
342 .align 16
343 cbc_se_handler:
344- endbr64
345+ _CET_ENDBR
346 push %rsi
347 push %rdi
348 push %rbx
349Index: aes/asm/bsaes-x86_64.pl
350===================================================================
351RCS file: /cvs/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl,v
352diff -u -p -r1.6 bsaes-x86_64.pl
353--- aes/asm/bsaes-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.6
354+++ aes/asm/bsaes-x86_64.pl 3 Dec 2023 20:18:30 -0000
355@@ -813,7 +813,7 @@ $code.=<<___;
356 .type _bsaes_encrypt8,\@abi-omnipotent
357 .align 64
358 _bsaes_encrypt8:
359- endbr64
360+ _CET_ENDBR
361 lea .LBS0(%rip), $const # constants table
362
363 movdqa ($key), @XMM[9] # round 0 key
364@@ -878,7 +878,7 @@ $code.=<<___;
365 .type _bsaes_decrypt8,\@abi-omnipotent
366 .align 64
367 _bsaes_decrypt8:
368- endbr64
369+ _CET_ENDBR
370 lea .LBS0(%rip), $const # constants table
371
372 movdqa ($key), @XMM[9] # round 0 key
373@@ -970,7 +970,7 @@ $code.=<<___;
374 .type _bsaes_key_convert,\@abi-omnipotent
375 .align 16
376 _bsaes_key_convert:
377- endbr64
378+ _CET_ENDBR
379 lea .Lmasks(%rip), $const
380 movdqu ($inp), %xmm7 # load round 0 key
381 lea 0x10($inp), $inp
382@@ -1060,7 +1060,7 @@ $code.=<<___;
383 .type bsaes_enc_key_convert,\@function,2
384 .align 16
385 bsaes_enc_key_convert:
386- endbr64
387+ _CET_ENDBR
388 mov 240($inp),%r10d # pass rounds
389 mov $inp,%rcx # pass key
390 mov $out,%rax # pass key schedule
391@@ -1075,7 +1075,7 @@ bsaes_enc_key_convert:
392 .align 16
393 bsaes_encrypt_128:
394 .Lenc128_loop:
395- endbr64
396+ _CET_ENDBR
397 movdqu 0x00($inp), @XMM[0] # load input
398 movdqu 0x10($inp), @XMM[1]
399 movdqu 0x20($inp), @XMM[2]
400@@ -1108,7 +1108,7 @@ bsaes_encrypt_128:
401 .type bsaes_dec_key_convert,\@function,2
402 .align 16
403 bsaes_dec_key_convert:
404- endbr64
405+ _CET_ENDBR
406 mov 240($inp),%r10d # pass rounds
407 mov $inp,%rcx # pass key
408 mov $out,%rax # pass key schedule
409@@ -1123,7 +1123,7 @@ bsaes_dec_key_convert:
410 .type bsaes_decrypt_128,\@function,4
411 .align 16
412 bsaes_decrypt_128:
413- endbr64
414+ _CET_ENDBR
415 .Ldec128_loop:
416 movdqu 0x00($inp), @XMM[0] # load input
417 movdqu 0x10($inp), @XMM[1]
418@@ -1169,7 +1169,7 @@ $code.=<<___;
419 .type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
420 .align 16
421 bsaes_ecb_encrypt_blocks:
422- endbr64
423+ _CET_ENDBR
424 mov %rsp, %rax
425 .Lecb_enc_prologue:
426 push %rbp
427@@ -1371,7 +1371,7 @@ $code.=<<___;
428 .type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
429 .align 16
430 bsaes_ecb_decrypt_blocks:
431- endbr64
432+ _CET_ENDBR
433 mov %rsp, %rax
434 .Lecb_dec_prologue:
435 push %rbp
436@@ -1577,7 +1577,7 @@ $code.=<<___;
437 .type bsaes_cbc_encrypt,\@abi-omnipotent
438 .align 16
439 bsaes_cbc_encrypt:
440- endbr64
441+ _CET_ENDBR
442 ___
443 $code.=<<___ if ($win64);
444 mov 48(%rsp),$arg6 # pull direction flag
445@@ -1865,7 +1865,7 @@ $code.=<<___;
446 .type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
447 .align 16
448 bsaes_ctr32_encrypt_blocks:
449- endbr64
450+ _CET_ENDBR
451 mov %rsp, %rax
452 .Lctr_enc_prologue:
453 push %rbp
454@@ -2107,7 +2107,7 @@ $code.=<<___;
455 .type bsaes_xts_encrypt,\@abi-omnipotent
456 .align 16
457 bsaes_xts_encrypt:
458- endbr64
459+ _CET_ENDBR
460 mov %rsp, %rax
461 .Lxts_enc_prologue:
462 push %rbp
463@@ -2489,7 +2489,7 @@ $code.=<<___;
464 .type bsaes_xts_decrypt,\@abi-omnipotent
465 .align 16
466 bsaes_xts_decrypt:
467- endbr64
468+ _CET_ENDBR
469 mov %rsp, %rax
470 .Lxts_dec_prologue:
471 push %rbp
472@@ -2966,7 +2966,7 @@ $code.=<<___;
473 .type se_handler,\@abi-omnipotent
474 .align 16
475 se_handler:
476- endbr64
477+ _CET_ENDBR
478 push %rsi
479 push %rdi
480 push %rbx
481Index: aes/asm/vpaes-x86_64.pl
482===================================================================
483RCS file: /cvs/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl,v
484diff -u -p -r1.5 vpaes-x86_64.pl
485--- aes/asm/vpaes-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.5
486+++ aes/asm/vpaes-x86_64.pl 3 Dec 2023 20:18:30 -0000
487@@ -82,7 +82,7 @@ $code.=<<___;
488 .type _vpaes_encrypt_core,\@abi-omnipotent
489 .align 16
490 _vpaes_encrypt_core:
491- endbr64
492+ _CET_ENDBR
493 mov %rdx, %r9
494 mov \$16, %r11
495 mov 240(%rdx),%eax
496@@ -173,7 +173,7 @@ _vpaes_encrypt_core:
497 .type _vpaes_decrypt_core,\@abi-omnipotent
498 .align 16
499 _vpaes_decrypt_core:
500- endbr64
501+ _CET_ENDBR
502 mov %rdx, %r9 # load key
503 mov 240(%rdx),%eax
504 movdqa %xmm9, %xmm1
505@@ -281,7 +281,7 @@ _vpaes_decrypt_core:
506 .type _vpaes_schedule_core,\@abi-omnipotent
507 .align 16
508 _vpaes_schedule_core:
509- endbr64
510+ _CET_ENDBR
511 # rdi = key
512 # rsi = size in bits
513 # rdx = buffer
514@@ -467,7 +467,7 @@ _vpaes_schedule_core:
515 .type _vpaes_schedule_192_smear,\@abi-omnipotent
516 .align 16
517 _vpaes_schedule_192_smear:
518- endbr64
519+ _CET_ENDBR
520 pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
521 pxor %xmm0, %xmm6 # -> c+d c 0 0
522 pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
523@@ -499,7 +499,7 @@ _vpaes_schedule_192_smear:
524 .type _vpaes_schedule_round,\@abi-omnipotent
525 .align 16
526 _vpaes_schedule_round:
527- endbr64
528+ _CET_ENDBR
529 # extract rcon from xmm8
530 pxor %xmm1, %xmm1
531 palignr \$15, %xmm8, %xmm1
532@@ -567,7 +567,7 @@ _vpaes_schedule_low_round:
533 .type _vpaes_schedule_transform,\@abi-omnipotent
534 .align 16
535 _vpaes_schedule_transform:
536- endbr64
537+ _CET_ENDBR
538 movdqa %xmm9, %xmm1
539 pandn %xmm0, %xmm1
540 psrld \$4, %xmm1
541@@ -606,7 +606,7 @@ _vpaes_schedule_transform:
542 .type _vpaes_schedule_mangle,\@abi-omnipotent
543 .align 16
544 _vpaes_schedule_mangle:
545- endbr64
546+ _CET_ENDBR
547 movdqa %xmm0, %xmm4 # save xmm0 for later
548 movdqa .Lk_mc_forward(%rip),%xmm5
549 test %rcx, %rcx
550@@ -680,7 +680,7 @@ _vpaes_schedule_mangle:
551 .type ${PREFIX}_set_encrypt_key,\@function,3
552 .align 16
553 ${PREFIX}_set_encrypt_key:
554- endbr64
555+ _CET_ENDBR
556 ___
557 $code.=<<___ if ($win64);
558 lea -0xb8(%rsp),%rsp
559@@ -729,7 +729,7 @@ $code.=<<___;
560 .type ${PREFIX}_set_decrypt_key,\@function,3
561 .align 16
562 ${PREFIX}_set_decrypt_key:
563- endbr64
564+ _CET_ENDBR
565 ___
566 $code.=<<___ if ($win64);
567 lea -0xb8(%rsp),%rsp
568@@ -783,7 +783,7 @@ $code.=<<___;
569 .type ${PREFIX}_encrypt,\@function,3
570 .align 16
571 ${PREFIX}_encrypt:
572- endbr64
573+ _CET_ENDBR
574 ___
575 $code.=<<___ if ($win64);
576 lea -0xb8(%rsp),%rsp
577@@ -827,7 +827,7 @@ $code.=<<___;
578 .type ${PREFIX}_decrypt,\@function,3
579 .align 16
580 ${PREFIX}_decrypt:
581- endbr64
582+ _CET_ENDBR
583 ___
584 $code.=<<___ if ($win64);
585 lea -0xb8(%rsp),%rsp
586@@ -877,7 +877,7 @@ $code.=<<___;
587 .type ${PREFIX}_cbc_encrypt,\@function,6
588 .align 16
589 ${PREFIX}_cbc_encrypt:
590- endbr64
591+ _CET_ENDBR
592 xchg $key,$len
593 ___
594 ($len,$key)=($key,$len);
595@@ -961,7 +961,7 @@ $code.=<<___;
596 .type _vpaes_preheat,\@abi-omnipotent
597 .align 16
598 _vpaes_preheat:
599- endbr64
600+ _CET_ENDBR
601 lea .Lk_s0F(%rip), %r10
602 movdqa -0x20(%r10), %xmm10 # .Lk_inv
603 movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
604@@ -1092,7 +1092,7 @@ $code.=<<___;
605 .type se_handler,\@abi-omnipotent
606 .align 16
607 se_handler:
608- endbr64
609+ _CET_ENDBR
610 push %rsi
611 push %rdi
612 push %rbx
613Index: bn/s2n_bignum_internal.h
614===================================================================
615RCS file: /cvs/src/lib/libcrypto/bn/s2n_bignum_internal.h,v
616diff -u -p -r1.2 s2n_bignum_internal.h
617--- bn/s2n_bignum_internal.h 21 Jan 2023 15:53:54 -0000 1.2
618+++ bn/s2n_bignum_internal.h 3 Dec 2023 20:22:18 -0000
619@@ -18,6 +18,12 @@
620 # define S2N_BN_SYMBOL(name) name
621 #endif
622
623+#ifdef __CET__
624+# include <cet.h>
625+#else
626+# define _CET_ENDBR
627+#endif
628+
629 #define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name)
630 #ifdef S2N_BN_HIDE_SYMBOLS
631 # ifdef __APPLE__
632Index: bn/arch/amd64/bignum_add.S
633===================================================================
634RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_add.S,v
635diff -u -p -r1.4 bignum_add.S
636--- bn/arch/amd64/bignum_add.S 25 Apr 2023 04:42:26 -0000 1.4
637+++ bn/arch/amd64/bignum_add.S 3 Dec 2023 20:18:30 -0000
638@@ -49,7 +49,7 @@
639
640
641 S2N_BN_SYMBOL(bignum_add):
642- endbr64
643+ _CET_ENDBR
644
645 #if WINDOWS_ABI
646 push rdi
647Index: bn/arch/amd64/bignum_cmadd.S
648===================================================================
649RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S,v
650diff -u -p -r1.4 bignum_cmadd.S
651--- bn/arch/amd64/bignum_cmadd.S 25 Apr 2023 04:42:26 -0000 1.4
652+++ bn/arch/amd64/bignum_cmadd.S 3 Dec 2023 20:18:30 -0000
653@@ -54,7 +54,7 @@
654
655
656 S2N_BN_SYMBOL(bignum_cmadd):
657- endbr64
658+ _CET_ENDBR
659
660 #if WINDOWS_ABI
661 push rdi
662Index: bn/arch/amd64/bignum_cmul.S
663===================================================================
664RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S,v
665diff -u -p -r1.4 bignum_cmul.S
666--- bn/arch/amd64/bignum_cmul.S 25 Apr 2023 04:42:26 -0000 1.4
667+++ bn/arch/amd64/bignum_cmul.S 3 Dec 2023 20:18:30 -0000
668@@ -51,7 +51,7 @@
669
670
671 S2N_BN_SYMBOL(bignum_cmul):
672- endbr64
673+ _CET_ENDBR
674
675 #if WINDOWS_ABI
676 push rdi
677Index: bn/arch/amd64/bignum_mul.S
678===================================================================
679RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S,v
680diff -u -p -r1.4 bignum_mul.S
681--- bn/arch/amd64/bignum_mul.S 25 Apr 2023 04:42:26 -0000 1.4
682+++ bn/arch/amd64/bignum_mul.S 3 Dec 2023 20:18:30 -0000
683@@ -59,7 +59,7 @@
684
685
686 S2N_BN_SYMBOL(bignum_mul):
687- endbr64
688+ _CET_ENDBR
689
690 #if WINDOWS_ABI
691 push rdi
692Index: bn/arch/amd64/bignum_mul_4_8_alt.S
693===================================================================
694RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S,v
695diff -u -p -r1.4 bignum_mul_4_8_alt.S
696--- bn/arch/amd64/bignum_mul_4_8_alt.S 25 Apr 2023 04:42:26 -0000 1.4
697+++ bn/arch/amd64/bignum_mul_4_8_alt.S 3 Dec 2023 20:18:30 -0000
698@@ -72,7 +72,7 @@
699 adc h, rdx
700
701 S2N_BN_SYMBOL(bignum_mul_4_8_alt):
702- endbr64
703+ _CET_ENDBR
704
705 #if WINDOWS_ABI
706 push rdi
707Index: bn/arch/amd64/bignum_mul_8_16_alt.S
708===================================================================
709RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S,v
710diff -u -p -r1.4 bignum_mul_8_16_alt.S
711--- bn/arch/amd64/bignum_mul_8_16_alt.S 25 Apr 2023 04:42:26 -0000 1.4
712+++ bn/arch/amd64/bignum_mul_8_16_alt.S 3 Dec 2023 20:18:30 -0000
713@@ -72,7 +72,7 @@
714 adc h, rdx
715
716 S2N_BN_SYMBOL(bignum_mul_8_16_alt):
717- endbr64
718+ _CET_ENDBR
719
720 #if WINDOWS_ABI
721 push rdi
722Index: bn/arch/amd64/bignum_sqr.S
723===================================================================
724RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S,v
725diff -u -p -r1.4 bignum_sqr.S
726--- bn/arch/amd64/bignum_sqr.S 25 Apr 2023 04:42:26 -0000 1.4
727+++ bn/arch/amd64/bignum_sqr.S 3 Dec 2023 20:18:30 -0000
728@@ -62,7 +62,7 @@
729 #define llshort ebp
730
731 S2N_BN_SYMBOL(bignum_sqr):
732- endbr64
733+ _CET_ENDBR
734
735 #if WINDOWS_ABI
736 push rdi
737Index: bn/arch/amd64/bignum_sqr_4_8_alt.S
738===================================================================
739RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S,v
740diff -u -p -r1.4 bignum_sqr_4_8_alt.S
741--- bn/arch/amd64/bignum_sqr_4_8_alt.S 25 Apr 2023 04:42:26 -0000 1.4
742+++ bn/arch/amd64/bignum_sqr_4_8_alt.S 3 Dec 2023 20:18:30 -0000
743@@ -71,7 +71,7 @@
744 adc c, 0
745
746 S2N_BN_SYMBOL(bignum_sqr_4_8_alt):
747- endbr64
748+ _CET_ENDBR
749
750 #if WINDOWS_ABI
751 push rdi
752Index: bn/arch/amd64/bignum_sqr_8_16_alt.S
753===================================================================
754RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S,v
755diff -u -p -r1.4 bignum_sqr_8_16_alt.S
756--- bn/arch/amd64/bignum_sqr_8_16_alt.S 25 Apr 2023 04:42:26 -0000 1.4
757+++ bn/arch/amd64/bignum_sqr_8_16_alt.S 3 Dec 2023 20:18:30 -0000
758@@ -103,7 +103,7 @@
759 adc c, 0
760
761 S2N_BN_SYMBOL(bignum_sqr_8_16_alt):
762- endbr64
763+ _CET_ENDBR
764
765 #if WINDOWS_ABI
766 push rdi
767Index: bn/arch/amd64/bignum_sub.S
768===================================================================
769RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S,v
770diff -u -p -r1.4 bignum_sub.S
771--- bn/arch/amd64/bignum_sub.S 25 Apr 2023 04:42:26 -0000 1.4
772+++ bn/arch/amd64/bignum_sub.S 3 Dec 2023 20:18:30 -0000
773@@ -49,7 +49,7 @@
774
775
776 S2N_BN_SYMBOL(bignum_sub):
777- endbr64
778+ _CET_ENDBR
779
780 #if WINDOWS_ABI
781 push rdi
782Index: bn/arch/amd64/word_clz.S
783===================================================================
784RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/word_clz.S,v
785diff -u -p -r1.4 word_clz.S
786--- bn/arch/amd64/word_clz.S 25 Apr 2023 04:42:26 -0000 1.4
787+++ bn/arch/amd64/word_clz.S 3 Dec 2023 20:18:30 -0000
788@@ -30,7 +30,7 @@
789 .text
790
791 S2N_BN_SYMBOL(word_clz):
792- endbr64
793+ _CET_ENDBR
794
795 #if WINDOWS_ABI
796 push rdi
797Index: bn/asm/modexp512-x86_64.pl
798===================================================================
799RCS file: /cvs/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl,v
800diff -u -p -r1.4 modexp512-x86_64.pl
801--- bn/asm/modexp512-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.4
802+++ bn/asm/modexp512-x86_64.pl 3 Dec 2023 20:18:30 -0000
803@@ -347,7 +347,7 @@ $code.=<<___;
804 .type MULADD_128x512,\@abi-omnipotent
805 .align 16
806 MULADD_128x512:
807- endbr64
808+ _CET_ENDBR
809 ___
810 &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx");
811 $code.=<<___;
812@@ -415,7 +415,7 @@ $code.=<<___;
813 .type mont_reduce,\@abi-omnipotent
814 .align 16
815 mont_reduce:
816- endbr64
817+ _CET_ENDBR
818 ___
819
820 my $STACK_DEPTH = 8;
821@@ -678,7 +678,7 @@ $code.=<<___;
822 .type mont_mul_a3b,\@abi-omnipotent
823 .align 16
824 mont_mul_a3b:
825- endbr64
826+ _CET_ENDBR
827 #
828 # multiply tmp = src1 * src2
829 # For multiply: dst = rcx, src1 = rdi, src2 = rsi
830@@ -1080,7 +1080,7 @@ $code.=<<___;
831 .type sqr_reduce,\@abi-omnipotent
832 .align 16
833 sqr_reduce:
834- endbr64
835+ _CET_ENDBR
836 mov (+$pResult_offset+8)(%rsp), %rcx
837 ___
838 &SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi");
839@@ -1110,7 +1110,7 @@ $code.=<<___;
840 .globl mod_exp_512
841 .type mod_exp_512,\@function,4
842 mod_exp_512:
843- endbr64
844+ _CET_ENDBR
845 push %rbp
846 push %rbx
847 push %r12
848Index: bn/asm/x86_64-mont.pl
849===================================================================
850RCS file: /cvs/src/lib/libcrypto/bn/asm/x86_64-mont.pl,v
851diff -u -p -r1.5 x86_64-mont.pl
852--- bn/asm/x86_64-mont.pl 25 Apr 2023 04:42:26 -0000 1.5
853+++ bn/asm/x86_64-mont.pl 3 Dec 2023 20:18:30 -0000
854@@ -63,7 +63,7 @@ $code=<<___;
855 .type bn_mul_mont,\@function,6
856 .align 16
857 bn_mul_mont:
858- endbr64
859+ _CET_ENDBR
860 test \$3,${num}d
861 jnz .Lmul_enter
862 cmp \$8,${num}d
863@@ -279,7 +279,7 @@ $code.=<<___;
864 .align 16
865 bn_mul4x_mont:
866 .Lmul4x_enter:
867- endbr64
868+ _CET_ENDBR
869 push %rbx
870 push %rbp
871 push %r12
872@@ -707,7 +707,7 @@ $code.=<<___;
873 .align 16
874 bn_sqr4x_mont:
875 .Lsqr4x_enter:
876- endbr64
877+ _CET_ENDBR
878 push %rbx
879 push %rbp
880 push %r12
881Index: bn/asm/x86_64-mont5.pl
882===================================================================
883RCS file: /cvs/src/lib/libcrypto/bn/asm/x86_64-mont5.pl,v
884diff -u -p -r1.8 x86_64-mont5.pl
885--- bn/asm/x86_64-mont5.pl 25 Apr 2023 04:42:26 -0000 1.8
886+++ bn/asm/x86_64-mont5.pl 3 Dec 2023 20:18:30 -0000
887@@ -57,7 +57,7 @@ $code=<<___;
888 .type bn_mul_mont_gather5,\@function,6
889 .align 64
890 bn_mul_mont_gather5:
891- endbr64
892+ _CET_ENDBR
893 test \$3,${num}d
894 jnz .Lmul_enter
895 cmp \$8,${num}d
896@@ -388,7 +388,7 @@ $code.=<<___;
897 .type bn_mul4x_mont_gather5,\@function,6
898 .align 16
899 bn_mul4x_mont_gather5:
900- endbr64
901+ _CET_ENDBR
902 .Lmul4x_enter:
903 mov ${num}d,${num}d
904 movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument
905@@ -927,7 +927,7 @@ $code.=<<___;
906 .type bn_scatter5,\@abi-omnipotent
907 .align 16
908 bn_scatter5:
909- endbr64
910+ _CET_ENDBR
911 cmp \$0, $num
912 jz .Lscatter_epilogue
913 lea ($tbl,$idx,8),$tbl
914@@ -946,7 +946,7 @@ bn_scatter5:
915 .type bn_gather5,\@abi-omnipotent
916 .align 16
917 bn_gather5:
918- endbr64
919+ _CET_ENDBR
920 .LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases
921 # I can't trust assembler to use specific encoding:-(
922 .byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10
923@@ -1057,7 +1057,7 @@ $code.=<<___;
924 .type mul_handler,\@abi-omnipotent
925 .align 16
926 mul_handler:
927- endbr64
928+ _CET_ENDBR
929 push %rsi
930 push %rdi
931 push %rbx
932Index: camellia/asm/cmll-x86_64.pl
933===================================================================
934RCS file: /cvs/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl,v
935diff -u -p -r1.7 cmll-x86_64.pl
936--- camellia/asm/cmll-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7
937+++ camellia/asm/cmll-x86_64.pl 3 Dec 2023 20:18:30 -0000
938@@ -116,7 +116,7 @@ $code=<<___;
939 .type Camellia_EncryptBlock,\@abi-omnipotent
940 .align 16
941 Camellia_EncryptBlock:
942- endbr64
943+ _CET_ENDBR
944 movl \$128,%eax
945 subl $arg0d,%eax
946 movl \$3,$arg0d
947@@ -129,7 +129,7 @@ Camellia_EncryptBlock:
948 .align 16
949 .Lenc_rounds:
950 Camellia_EncryptBlock_Rounds:
951- endbr64
952+ _CET_ENDBR
953 push %rbx
954 push %rbp
955 push %r13
956@@ -178,7 +178,7 @@ Camellia_EncryptBlock_Rounds:
957 .type _x86_64_Camellia_encrypt,\@abi-omnipotent
958 .align 16
959 _x86_64_Camellia_encrypt:
960- endbr64
961+ _CET_ENDBR
962 xor 0($key),@S[1]
963 xor 4($key),@S[0] # ^=key[0-3]
964 xor 8($key),@S[3]
965@@ -229,7 +229,7 @@ $code.=<<___;
966 .type Camellia_DecryptBlock,\@abi-omnipotent
967 .align 16
968 Camellia_DecryptBlock:
969- endbr64
970+ _CET_ENDBR
971 movl \$128,%eax
972 subl $arg0d,%eax
973 movl \$3,$arg0d
974@@ -242,7 +242,7 @@ Camellia_DecryptBlock:
975 .align 16
976 .Ldec_rounds:
977 Camellia_DecryptBlock_Rounds:
978- endbr64
979+ _CET_ENDBR
980 push %rbx
981 push %rbp
982 push %r13
983@@ -291,7 +291,7 @@ Camellia_DecryptBlock_Rounds:
984 .type _x86_64_Camellia_decrypt,\@abi-omnipotent
985 .align 16
986 _x86_64_Camellia_decrypt:
987- endbr64
988+ _CET_ENDBR
989 xor 0($key),@S[1]
990 xor 4($key),@S[0] # ^=key[0-3]
991 xor 8($key),@S[3]
992@@ -406,7 +406,7 @@ $code.=<<___;
993 .type Camellia_Ekeygen,\@function,3
994 .align 16
995 Camellia_Ekeygen:
996- endbr64
997+ _CET_ENDBR
998 push %rbx
999 push %rbp
1000 push %r13
1001@@ -637,7 +637,7 @@ $code.=<<___;
1002 .type Camellia_cbc_encrypt,\@function,6
1003 .align 16
1004 Camellia_cbc_encrypt:
1005- endbr64
1006+ _CET_ENDBR
1007 cmp \$0,%rdx
1008 je .Lcbc_abort
1009 push %rbx
1010Index: md5/asm/md5-x86_64.pl
1011===================================================================
1012RCS file: /cvs/src/lib/libcrypto/md5/asm/md5-x86_64.pl,v
1013diff -u -p -r1.3 md5-x86_64.pl
1014--- md5/asm/md5-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.3
1015+++ md5/asm/md5-x86_64.pl 3 Dec 2023 20:18:30 -0000
1016@@ -128,7 +128,7 @@ $code .= <<EOF;
1017 .globl md5_block_asm_data_order
1018 .type md5_block_asm_data_order,\@function,3
1019 md5_block_asm_data_order:
1020- endbr64
1021+ _CET_ENDBR
1022 push %rbp
1023 push %rbx
1024 push %r12
1025Index: modes/asm/ghash-x86_64.pl
1026===================================================================
1027RCS file: /cvs/src/lib/libcrypto/modes/asm/ghash-x86_64.pl,v
1028diff -u -p -r1.5 ghash-x86_64.pl
1029--- modes/asm/ghash-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.5
1030+++ modes/asm/ghash-x86_64.pl 3 Dec 2023 20:18:30 -0000
1031@@ -412,7 +412,7 @@ $code.=<<___;
1032 .type gcm_init_clmul,\@abi-omnipotent
1033 .align 16
1034 gcm_init_clmul:
1035- endbr64
1036+ _CET_ENDBR
1037 movdqu ($Xip),$Hkey
1038 pshufd \$0b01001110,$Hkey,$Hkey # dword swap
1039
1040@@ -450,7 +450,7 @@ $code.=<<___;
1041 .type gcm_gmult_clmul,\@abi-omnipotent
1042 .align 16
1043 gcm_gmult_clmul:
1044- endbr64
1045+ _CET_ENDBR
1046 movdqu ($Xip),$Xi
1047 movdqa .Lbswap_mask(%rip),$T3
1048 movdqu ($Htbl),$Hkey
1049@@ -478,7 +478,7 @@ $code.=<<___;
1050 .type gcm_ghash_clmul,\@abi-omnipotent
1051 .align 16
1052 gcm_ghash_clmul:
1053- endbr64
1054+ _CET_ENDBR
1055 ___
1056 $code.=<<___ if ($win64);
1057 .LSEH_begin_gcm_ghash_clmul:
1058@@ -689,7 +689,7 @@ $code.=<<___;
1059 .type se_handler,\@abi-omnipotent
1060 .align 16
1061 se_handler:
1062- endbr64
1063+ _CET_ENDBR
1064 push %rsi
1065 push %rdi
1066 push %rbx
1067Index: perlasm/x86_64-xlate.pl
1068===================================================================
1069RCS file: /cvs/src/lib/libcrypto/perlasm/x86_64-xlate.pl,v
1070diff -u -p -r1.16 x86_64-xlate.pl
1071--- perlasm/x86_64-xlate.pl 23 Feb 2023 08:49:02 -0000 1.16
1072+++ perlasm/x86_64-xlate.pl 3 Dec 2023 20:17:16 -0000
1073@@ -781,6 +781,22 @@ ___
1074 OPTION DOTNAME
1075 ___
1076 }
1077+
1078+if ($nasm) {
1079+ print <<___;
1080+\%define _CET_ENDBR
1081+___
1082+} else {
1083+ print <<___;
1084+#if defined(__CET__)
1085+#include <cet.h>
1086+#else
1087+#define _CET_ENDBR
1088+#endif
1089+
1090+___
1091+}
1092+
1093 print "#include \"x86_arch.h\"\n";
1094
1095 while($line=<>) {
1096Index: rc4/asm/rc4-md5-x86_64.pl
1097===================================================================
1098RCS file: /cvs/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl,v
1099diff -u -p -r1.4 rc4-md5-x86_64.pl
1100--- rc4/asm/rc4-md5-x86_64.pl 28 Jul 2023 10:35:14 -0000 1.4
1101+++ rc4/asm/rc4-md5-x86_64.pl 3 Dec 2023 20:18:30 -0000
1102@@ -109,7 +109,7 @@ $code.=<<___;
1103 .globl $func
1104 .type $func,\@function,$nargs
1105 $func:
1106- endbr64
1107+ _CET_ENDBR
1108 cmp \$0,$len
1109 je .Labort
1110 push %rbx
1111@@ -454,7 +454,7 @@ $code.=<<___;
1112 .type RC4_set_key,\@function,3
1113 .align 16
1114 RC4_set_key:
1115- endbr64
1116+ _CET_ENDBR
1117 lea 8($dat),$dat
1118 lea ($inp,$len),$inp
1119 neg $len
1120Index: rc4/asm/rc4-x86_64.pl
1121===================================================================
1122RCS file: /cvs/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl,v
1123diff -u -p -r1.16 rc4-x86_64.pl
1124--- rc4/asm/rc4-x86_64.pl 28 Jul 2023 10:35:14 -0000 1.16
1125+++ rc4/asm/rc4-x86_64.pl 3 Dec 2023 20:18:30 -0000
1126@@ -128,7 +128,7 @@ $code=<<___;
1127 .type RC4,\@function,4
1128 .align 16
1129 RC4:
1130- endbr64
1131+ _CET_ENDBR
1132 or $len,$len
1133 jne .Lentry
1134 ret
1135@@ -435,7 +435,7 @@ $code.=<<___;
1136 .type RC4_set_key,\@function,3
1137 .align 16
1138 RC4_set_key:
1139- endbr64
1140+ _CET_ENDBR
1141 lea 8($dat),$dat
1142 lea ($inp,$len),$inp
1143 neg $len
1144Index: sha/asm/sha1-x86_64.pl
1145===================================================================
1146RCS file: /cvs/src/lib/libcrypto/sha/asm/sha1-x86_64.pl,v
1147diff -u -p -r1.7 sha1-x86_64.pl
1148--- sha/asm/sha1-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7
1149+++ sha/asm/sha1-x86_64.pl 3 Dec 2023 20:18:30 -0000
1150@@ -222,7 +222,7 @@ $code.=<<___;
1151 .type sha1_block_data_order,\@function,3
1152 .align 16
1153 sha1_block_data_order:
1154- endbr64
1155+ _CET_ENDBR
1156 mov OPENSSL_ia32cap_P+0(%rip),%r9d
1157 mov OPENSSL_ia32cap_P+4(%rip),%r8d
1158 test \$IA32CAP_MASK1_SSSE3,%r8d # check SSSE3 bit
1159@@ -310,7 +310,7 @@ $code.=<<___;
1160 .align 16
1161 sha1_block_data_order_ssse3:
1162 _ssse3_shortcut:
1163- endbr64
1164+ _CET_ENDBR
1165 push %rbx
1166 push %rbp
1167 push %r12
1168@@ -731,7 +731,7 @@ $code.=<<___;
1169 .align 16
1170 sha1_block_data_order_avx:
1171 _avx_shortcut:
1172- endbr64
1173+ _CET_ENDBR
1174 push %rbx
1175 push %rbp
1176 push %r12
1177@@ -1102,7 +1102,7 @@ $code.=<<___;
1178 .type se_handler,\@abi-omnipotent
1179 .align 16
1180 se_handler:
1181- endbr64
1182+ _CET_ENDBR
1183 push %rsi
1184 push %rdi
1185 push %rbx
1186Index: sha/asm/sha512-x86_64.pl
1187===================================================================
1188RCS file: /cvs/src/lib/libcrypto/sha/asm/sha512-x86_64.pl,v
1189diff -u -p -r1.7 sha512-x86_64.pl
1190--- sha/asm/sha512-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7
1191+++ sha/asm/sha512-x86_64.pl 3 Dec 2023 20:18:30 -0000
1192@@ -175,7 +175,7 @@ $code=<<___;
1193 .type $func,\@function,4
1194 .align 16
1195 $func:
1196- endbr64
1197+ _CET_ENDBR
1198 push %rbx
1199 push %rbp
1200 push %r12
1201Index: whrlpool/asm/wp-x86_64.pl
1202===================================================================
1203RCS file: /cvs/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl,v
1204diff -u -p -r1.5 wp-x86_64.pl
1205--- whrlpool/asm/wp-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.5
1206+++ whrlpool/asm/wp-x86_64.pl 3 Dec 2023 20:18:30 -0000
1207@@ -57,7 +57,7 @@ $code=<<___;
1208 .type $func,\@function,3
1209 .align 16
1210 $func:
1211- endbr64
1212+ _CET_ENDBR
1213 push %rbx
1214 push %rbp
1215 push %r12