1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
|
From c10c5b524e3121f42c9239d737dd7f975638f378 Mon Sep 17 00:00:00 2001
From: tb <>
Date: Sat, 24 Feb 2024 15:30:14 +0000
Subject: [PATCH] Replace uses of endbr64 with _CET_ENDBR from cet.h
cet.h is needed for other platforms to emit the relevant .gnu.properties
sections that are necessary for them to enable IBT. It also avoids issues
with older toolchains on macOS that explode on encountering endbr64.
based on a diff by kettenis
ok beck kettenis
---
src/lib/libcrypto/aes/asm/aes-x86_64.pl | 26 +++++++--------
.../libcrypto/aes/asm/aesni-sha1-x86_64.pl | 8 ++---
src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 32 +++++++++----------
src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 28 ++++++++--------
src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 28 ++++++++--------
src/lib/libcrypto/bn/arch/amd64/bignum_add.S | 2 +-
.../libcrypto/bn/arch/amd64/bignum_cmadd.S | 2 +-
src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | 2 +-
src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | 2 +-
.../bn/arch/amd64/bignum_mul_4_8_alt.S | 2 +-
.../bn/arch/amd64/bignum_mul_8_16_alt.S | 2 +-
src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | 2 +-
.../bn/arch/amd64/bignum_sqr_4_8_alt.S | 2 +-
.../bn/arch/amd64/bignum_sqr_8_16_alt.S | 2 +-
src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | 2 +-
src/lib/libcrypto/bn/arch/amd64/word_clz.S | 2 +-
src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | 10 +++---
src/lib/libcrypto/bn/asm/x86_64-mont.pl | 6 ++--
src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 10 +++---
src/lib/libcrypto/bn/s2n_bignum_internal.h | 6 ++++
src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 16 +++++-----
src/lib/libcrypto/md5/asm/md5-x86_64.pl | 2 +-
src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 8 ++---
src/lib/libcrypto/perlasm/x86_64-xlate.pl | 16 ++++++++++
src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl | 4 +--
src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 4 +--
src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 8 ++---
src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 2 +-
src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 2 +-
src/lib/libcrypto/x86_64cpuid.pl | 4 +--
30 files changed, 132 insertions(+), 110 deletions(-)
diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
index 78ba20ca5..299214800 100755
--- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl
@@ -318,7 +318,7 @@ $code.=<<___;
.type _x86_64_AES_encrypt,\@abi-omnipotent
.align 16
_x86_64_AES_encrypt:
- endbr64
+ _CET_ENDBR
xor 0($key),$s0 # xor with key
xor 4($key),$s1
xor 8($key),$s2
@@ -549,7 +549,7 @@ $code.=<<___;
.type _x86_64_AES_encrypt_compact,\@abi-omnipotent
.align 16
_x86_64_AES_encrypt_compact:
- endbr64
+ _CET_ENDBR
lea 128($sbox),$inp # size optimization
mov 0-128($inp),$acc1 # prefetch Te4
mov 32-128($inp),$acc2
@@ -595,7 +595,7 @@ $code.=<<___;
.hidden asm_AES_encrypt
asm_AES_encrypt:
AES_encrypt:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -887,7 +887,7 @@ $code.=<<___;
.type _x86_64_AES_decrypt,\@abi-omnipotent
.align 16
_x86_64_AES_decrypt:
- endbr64
+ _CET_ENDBR
xor 0($key),$s0 # xor with key
xor 4($key),$s1
xor 8($key),$s2
@@ -1142,7 +1142,7 @@ $code.=<<___;
.type _x86_64_AES_decrypt_compact,\@abi-omnipotent
.align 16
_x86_64_AES_decrypt_compact:
- endbr64
+ _CET_ENDBR
lea 128($sbox),$inp # size optimization
mov 0-128($inp),$acc1 # prefetch Td4
mov 32-128($inp),$acc2
@@ -1197,7 +1197,7 @@ $code.=<<___;
.hidden asm_AES_decrypt
asm_AES_decrypt:
AES_decrypt:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -1297,7 +1297,7 @@ $code.=<<___;
.type AES_set_encrypt_key,\@function,3
.align 16
AES_set_encrypt_key:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12 # redundant, but allows to share
@@ -1323,7 +1323,7 @@ AES_set_encrypt_key:
.type _x86_64_AES_set_encrypt_key,\@abi-omnipotent
.align 16
_x86_64_AES_set_encrypt_key:
- endbr64
+ _CET_ENDBR
mov %esi,%ecx # %ecx=bits
mov %rdi,%rsi # %rsi=userKey
mov %rdx,%rdi # %rdi=key
@@ -1569,7 +1569,7 @@ $code.=<<___;
.type AES_set_decrypt_key,\@function,3
.align 16
AES_set_decrypt_key:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -1669,7 +1669,7 @@ $code.=<<___;
.hidden asm_AES_cbc_encrypt
asm_AES_cbc_encrypt:
AES_cbc_encrypt:
- endbr64
+ _CET_ENDBR
cmp \$0,%rdx # check length
je .Lcbc_epilogue
pushfq
@@ -2561,7 +2561,7 @@ $code.=<<___;
.type block_se_handler,\@abi-omnipotent
.align 16
block_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2620,7 +2620,7 @@ block_se_handler:
.type key_se_handler,\@abi-omnipotent
.align 16
key_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2678,7 +2678,7 @@ key_se_handler:
.type cbc_se_handler,\@abi-omnipotent
.align 16
cbc_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
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 879d16793..5eb5b7bf6 100644
--- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl
@@ -89,7 +89,7 @@ $code.=<<___;
.type aesni_cbc_sha1_enc,\@abi-omnipotent
.align 16
aesni_cbc_sha1_enc:
- endbr64
+ _CET_ENDBR
# caller should check for SSSE3 and AES-NI bits
mov OPENSSL_ia32cap_P+0(%rip),%r10d
mov OPENSSL_ia32cap_P+4(%rip),%r11d
@@ -133,7 +133,7 @@ $code.=<<___;
.type aesni_cbc_sha1_enc_ssse3,\@function,6
.align 16
aesni_cbc_sha1_enc_ssse3:
- endbr64
+ _CET_ENDBR
mov `($win64?56:8)`(%rsp),$inp # load 7th argument
#shr \$6,$len # debugging artefact
#jz .Lepilogue_ssse3 # debugging artefact
@@ -652,7 +652,7 @@ $code.=<<___;
.type aesni_cbc_sha1_enc_avx,\@function,6
.align 16
aesni_cbc_sha1_enc_avx:
- endbr64
+ _CET_ENDBR
mov `($win64?56:8)`(%rsp),$inp # load 7th argument
#shr \$6,$len # debugging artefact
#jz .Lepilogue_avx # debugging artefact
@@ -1103,7 +1103,7 @@ $code.=<<___;
.type ssse3_handler,\@abi-omnipotent
.align 16
ssse3_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
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 07d40a84a..43013a51f 100644
--- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl
@@ -242,7 +242,7 @@ $code.=<<___;
.type ${PREFIX}_encrypt,\@abi-omnipotent
.align 16
${PREFIX}_encrypt:
- endbr64
+ _CET_ENDBR
movups ($inp),$inout0 # load input
mov 240($key),$rounds # key->rounds
___
@@ -256,7 +256,7 @@ $code.=<<___;
.type ${PREFIX}_decrypt,\@abi-omnipotent
.align 16
${PREFIX}_decrypt:
- endbr64
+ _CET_ENDBR
movups ($inp),$inout0 # load input
mov 240($key),$rounds # key->rounds
___
@@ -286,7 +286,7 @@ $code.=<<___;
.type _aesni_${dir}rypt3,\@abi-omnipotent
.align 16
_aesni_${dir}rypt3:
- endbr64
+ _CET_ENDBR
$movkey ($key),$rndkey0
shr \$1,$rounds
$movkey 16($key),$rndkey1
@@ -331,7 +331,7 @@ $code.=<<___;
.type _aesni_${dir}rypt4,\@abi-omnipotent
.align 16
_aesni_${dir}rypt4:
- endbr64
+ _CET_ENDBR
$movkey ($key),$rndkey0
shr \$1,$rounds
$movkey 16($key),$rndkey1
@@ -377,7 +377,7 @@ $code.=<<___;
.type _aesni_${dir}rypt6,\@abi-omnipotent
.align 16
_aesni_${dir}rypt6:
- endbr64
+ _CET_ENDBR
$movkey ($key),$rndkey0
shr \$1,$rounds
$movkey 16($key),$rndkey1
@@ -442,7 +442,7 @@ $code.=<<___;
.type _aesni_${dir}rypt8,\@abi-omnipotent
.align 16
_aesni_${dir}rypt8:
- endbr64
+ _CET_ENDBR
$movkey ($key),$rndkey0
shr \$1,$rounds
$movkey 16($key),$rndkey1
@@ -531,7 +531,7 @@ $code.=<<___;
.type aesni_ecb_encrypt,\@function,5
.align 16
aesni_ecb_encrypt:
- endbr64
+ _CET_ENDBR
and \$-16,$len
jz .Lecb_ret
@@ -837,7 +837,7 @@ $code.=<<___;
.type aesni_ccm64_encrypt_blocks,\@function,6
.align 16
aesni_ccm64_encrypt_blocks:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
lea -0x58(%rsp),%rsp
@@ -1025,7 +1025,7 @@ $code.=<<___;
.type aesni_ctr32_encrypt_blocks,\@function,5
.align 16
aesni_ctr32_encrypt_blocks:
- endbr64
+ _CET_ENDBR
lea (%rsp),%rax
push %rbp
sub \$$frame_size,%rsp
@@ -2487,7 +2487,7 @@ $code.=<<___;
.type ${PREFIX}_set_decrypt_key,\@abi-omnipotent
.align 16
${PREFIX}_set_decrypt_key:
- endbr64
+ _CET_ENDBR
sub \$8,%rsp
call __aesni_set_encrypt_key
shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key
@@ -2538,7 +2538,7 @@ $code.=<<___;
.type ${PREFIX}_set_encrypt_key,\@abi-omnipotent
.align 16
${PREFIX}_set_encrypt_key:
- endbr64
+ _CET_ENDBR
__aesni_set_encrypt_key:
sub \$8,%rsp
mov \$-1,%rax
@@ -2760,7 +2760,7 @@ $code.=<<___ if ($PREFIX eq "aesni");
.type ecb_se_handler,\@abi-omnipotent
.align 16
ecb_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2780,7 +2780,7 @@ ecb_se_handler:
.type ccm64_se_handler,\@abi-omnipotent
.align 16
ccm64_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2822,7 +2822,7 @@ ccm64_se_handler:
.type ctr32_se_handler,\@abi-omnipotent
.align 16
ctr32_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2858,7 +2858,7 @@ ctr32_se_handler:
.type xts_se_handler,\@abi-omnipotent
.align 16
xts_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
@@ -2900,7 +2900,7 @@ $code.=<<___;
.type cbc_se_handler,\@abi-omnipotent
.align 16
cbc_se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
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 7098ba27f..c44a33811 100644
--- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl
@@ -813,7 +813,7 @@ $code.=<<___;
.type _bsaes_encrypt8,\@abi-omnipotent
.align 64
_bsaes_encrypt8:
- endbr64
+ _CET_ENDBR
lea .LBS0(%rip), $const # constants table
movdqa ($key), @XMM[9] # round 0 key
@@ -878,7 +878,7 @@ $code.=<<___;
.type _bsaes_decrypt8,\@abi-omnipotent
.align 64
_bsaes_decrypt8:
- endbr64
+ _CET_ENDBR
lea .LBS0(%rip), $const # constants table
movdqa ($key), @XMM[9] # round 0 key
@@ -970,7 +970,7 @@ $code.=<<___;
.type _bsaes_key_convert,\@abi-omnipotent
.align 16
_bsaes_key_convert:
- endbr64
+ _CET_ENDBR
lea .Lmasks(%rip), $const
movdqu ($inp), %xmm7 # load round 0 key
lea 0x10($inp), $inp
@@ -1060,7 +1060,7 @@ $code.=<<___;
.type bsaes_enc_key_convert,\@function,2
.align 16
bsaes_enc_key_convert:
- endbr64
+ _CET_ENDBR
mov 240($inp),%r10d # pass rounds
mov $inp,%rcx # pass key
mov $out,%rax # pass key schedule
@@ -1075,7 +1075,7 @@ bsaes_enc_key_convert:
.align 16
bsaes_encrypt_128:
.Lenc128_loop:
- endbr64
+ _CET_ENDBR
movdqu 0x00($inp), @XMM[0] # load input
movdqu 0x10($inp), @XMM[1]
movdqu 0x20($inp), @XMM[2]
@@ -1108,7 +1108,7 @@ bsaes_encrypt_128:
.type bsaes_dec_key_convert,\@function,2
.align 16
bsaes_dec_key_convert:
- endbr64
+ _CET_ENDBR
mov 240($inp),%r10d # pass rounds
mov $inp,%rcx # pass key
mov $out,%rax # pass key schedule
@@ -1123,7 +1123,7 @@ bsaes_dec_key_convert:
.type bsaes_decrypt_128,\@function,4
.align 16
bsaes_decrypt_128:
- endbr64
+ _CET_ENDBR
.Ldec128_loop:
movdqu 0x00($inp), @XMM[0] # load input
movdqu 0x10($inp), @XMM[1]
@@ -1169,7 +1169,7 @@ $code.=<<___;
.type bsaes_ecb_encrypt_blocks,\@abi-omnipotent
.align 16
bsaes_ecb_encrypt_blocks:
- endbr64
+ _CET_ENDBR
mov %rsp, %rax
.Lecb_enc_prologue:
push %rbp
@@ -1371,7 +1371,7 @@ $code.=<<___;
.type bsaes_ecb_decrypt_blocks,\@abi-omnipotent
.align 16
bsaes_ecb_decrypt_blocks:
- endbr64
+ _CET_ENDBR
mov %rsp, %rax
.Lecb_dec_prologue:
push %rbp
@@ -1577,7 +1577,7 @@ $code.=<<___;
.type bsaes_cbc_encrypt,\@abi-omnipotent
.align 16
bsaes_cbc_encrypt:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
mov 48(%rsp),$arg6 # pull direction flag
@@ -1865,7 +1865,7 @@ $code.=<<___;
.type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent
.align 16
bsaes_ctr32_encrypt_blocks:
- endbr64
+ _CET_ENDBR
mov %rsp, %rax
.Lctr_enc_prologue:
push %rbp
@@ -2107,7 +2107,7 @@ $code.=<<___;
.type bsaes_xts_encrypt,\@abi-omnipotent
.align 16
bsaes_xts_encrypt:
- endbr64
+ _CET_ENDBR
mov %rsp, %rax
.Lxts_enc_prologue:
push %rbp
@@ -2489,7 +2489,7 @@ $code.=<<___;
.type bsaes_xts_decrypt,\@abi-omnipotent
.align 16
bsaes_xts_decrypt:
- endbr64
+ _CET_ENDBR
mov %rsp, %rax
.Lxts_dec_prologue:
push %rbp
@@ -2966,7 +2966,7 @@ $code.=<<___;
.type se_handler,\@abi-omnipotent
.align 16
se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
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 8ff8d8602..7d92e8d8c 100644
--- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl
@@ -82,7 +82,7 @@ $code.=<<___;
.type _vpaes_encrypt_core,\@abi-omnipotent
.align 16
_vpaes_encrypt_core:
- endbr64
+ _CET_ENDBR
mov %rdx, %r9
mov \$16, %r11
mov 240(%rdx),%eax
@@ -173,7 +173,7 @@ _vpaes_encrypt_core:
.type _vpaes_decrypt_core,\@abi-omnipotent
.align 16
_vpaes_decrypt_core:
- endbr64
+ _CET_ENDBR
mov %rdx, %r9 # load key
mov 240(%rdx),%eax
movdqa %xmm9, %xmm1
@@ -281,7 +281,7 @@ _vpaes_decrypt_core:
.type _vpaes_schedule_core,\@abi-omnipotent
.align 16
_vpaes_schedule_core:
- endbr64
+ _CET_ENDBR
# rdi = key
# rsi = size in bits
# rdx = buffer
@@ -467,7 +467,7 @@ _vpaes_schedule_core:
.type _vpaes_schedule_192_smear,\@abi-omnipotent
.align 16
_vpaes_schedule_192_smear:
- endbr64
+ _CET_ENDBR
pshufd \$0x80, %xmm6, %xmm0 # d c 0 0 -> c 0 0 0
pxor %xmm0, %xmm6 # -> c+d c 0 0
pshufd \$0xFE, %xmm7, %xmm0 # b a _ _ -> b b b a
@@ -499,7 +499,7 @@ _vpaes_schedule_192_smear:
.type _vpaes_schedule_round,\@abi-omnipotent
.align 16
_vpaes_schedule_round:
- endbr64
+ _CET_ENDBR
# extract rcon from xmm8
pxor %xmm1, %xmm1
palignr \$15, %xmm8, %xmm1
@@ -567,7 +567,7 @@ _vpaes_schedule_low_round:
.type _vpaes_schedule_transform,\@abi-omnipotent
.align 16
_vpaes_schedule_transform:
- endbr64
+ _CET_ENDBR
movdqa %xmm9, %xmm1
pandn %xmm0, %xmm1
psrld \$4, %xmm1
@@ -606,7 +606,7 @@ _vpaes_schedule_transform:
.type _vpaes_schedule_mangle,\@abi-omnipotent
.align 16
_vpaes_schedule_mangle:
- endbr64
+ _CET_ENDBR
movdqa %xmm0, %xmm4 # save xmm0 for later
movdqa .Lk_mc_forward(%rip),%xmm5
test %rcx, %rcx
@@ -680,7 +680,7 @@ _vpaes_schedule_mangle:
.type ${PREFIX}_set_encrypt_key,\@function,3
.align 16
${PREFIX}_set_encrypt_key:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
lea -0xb8(%rsp),%rsp
@@ -729,7 +729,7 @@ $code.=<<___;
.type ${PREFIX}_set_decrypt_key,\@function,3
.align 16
${PREFIX}_set_decrypt_key:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
lea -0xb8(%rsp),%rsp
@@ -783,7 +783,7 @@ $code.=<<___;
.type ${PREFIX}_encrypt,\@function,3
.align 16
${PREFIX}_encrypt:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
lea -0xb8(%rsp),%rsp
@@ -827,7 +827,7 @@ $code.=<<___;
.type ${PREFIX}_decrypt,\@function,3
.align 16
${PREFIX}_decrypt:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
lea -0xb8(%rsp),%rsp
@@ -877,7 +877,7 @@ $code.=<<___;
.type ${PREFIX}_cbc_encrypt,\@function,6
.align 16
${PREFIX}_cbc_encrypt:
- endbr64
+ _CET_ENDBR
xchg $key,$len
___
($len,$key)=($key,$len);
@@ -961,7 +961,7 @@ $code.=<<___;
.type _vpaes_preheat,\@abi-omnipotent
.align 16
_vpaes_preheat:
- endbr64
+ _CET_ENDBR
lea .Lk_s0F(%rip), %r10
movdqa -0x20(%r10), %xmm10 # .Lk_inv
movdqa -0x10(%r10), %xmm11 # .Lk_inv+16
@@ -1092,7 +1092,7 @@ $code.=<<___;
.type se_handler,\@abi-omnipotent
.align 16
se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
index 06298ca69..5fe4aae7a 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S
@@ -49,7 +49,7 @@
S2N_BN_SYMBOL(bignum_add):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
index 5ad712749..25ba17bce 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S
@@ -54,7 +54,7 @@
S2N_BN_SYMBOL(bignum_cmadd):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
index 9199c8f48..12f785d63 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S
@@ -51,7 +51,7 @@
S2N_BN_SYMBOL(bignum_cmul):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
index 2d7ed1909..a3552679a 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S
@@ -59,7 +59,7 @@
S2N_BN_SYMBOL(bignum_mul):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S
index f02b09b28..70ff69e37 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S
@@ -72,7 +72,7 @@
adc h, rdx
S2N_BN_SYMBOL(bignum_mul_4_8_alt):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S
index 97be83e1f..066403b07 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S
@@ -72,7 +72,7 @@
adc h, rdx
S2N_BN_SYMBOL(bignum_mul_8_16_alt):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
index c4a0cabf3..54e3f5944 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S
@@ -62,7 +62,7 @@
#define llshort ebp
S2N_BN_SYMBOL(bignum_sqr):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S
index b228414dc..7c534ae90 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S
@@ -71,7 +71,7 @@
adc c, 0
S2N_BN_SYMBOL(bignum_sqr_4_8_alt):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S
index 04efeec7e..ac0b6f96c 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S
@@ -103,7 +103,7 @@
adc c, 0
S2N_BN_SYMBOL(bignum_sqr_8_16_alt):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
index 11a9bd7ed..3ff8a3051 100644
--- a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S
@@ -49,7 +49,7 @@
S2N_BN_SYMBOL(bignum_sub):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/arch/amd64/word_clz.S b/src/lib/libcrypto/bn/arch/amd64/word_clz.S
index 464a9d90f..3926fcd4b 100644
--- a/src/lib/libcrypto/bn/arch/amd64/word_clz.S
+++ b/src/lib/libcrypto/bn/arch/amd64/word_clz.S
@@ -30,7 +30,7 @@
.text
S2N_BN_SYMBOL(word_clz):
- endbr64
+ _CET_ENDBR
#if WINDOWS_ABI
push rdi
diff --git a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
index af78fff54..8645d5adc 100644
--- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
+++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl
@@ -347,7 +347,7 @@ $code.=<<___;
.type MULADD_128x512,\@abi-omnipotent
.align 16
MULADD_128x512:
- endbr64
+ _CET_ENDBR
___
&MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx");
$code.=<<___;
@@ -415,7 +415,7 @@ $code.=<<___;
.type mont_reduce,\@abi-omnipotent
.align 16
mont_reduce:
- endbr64
+ _CET_ENDBR
___
my $STACK_DEPTH = 8;
@@ -678,7 +678,7 @@ $code.=<<___;
.type mont_mul_a3b,\@abi-omnipotent
.align 16
mont_mul_a3b:
- endbr64
+ _CET_ENDBR
#
# multiply tmp = src1 * src2
# For multiply: dst = rcx, src1 = rdi, src2 = rsi
@@ -1080,7 +1080,7 @@ $code.=<<___;
.type sqr_reduce,\@abi-omnipotent
.align 16
sqr_reduce:
- endbr64
+ _CET_ENDBR
mov (+$pResult_offset+8)(%rsp), %rcx
___
&SQR_512("%rsp+$tmp16_offset+8", "%rcx", [map("%r$_",(10..15,8..9))], "%rbx", "%rbp", "%rsi", "%rdi");
@@ -1110,7 +1110,7 @@ $code.=<<___;
.globl mod_exp_512
.type mod_exp_512,\@function,4
mod_exp_512:
- endbr64
+ _CET_ENDBR
push %rbp
push %rbx
push %r12
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
index 6f5ab331e..30cfab4fc 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl
@@ -63,7 +63,7 @@ $code=<<___;
.type bn_mul_mont,\@function,6
.align 16
bn_mul_mont:
- endbr64
+ _CET_ENDBR
test \$3,${num}d
jnz .Lmul_enter
cmp \$8,${num}d
@@ -279,7 +279,7 @@ $code.=<<___;
.align 16
bn_mul4x_mont:
.Lmul4x_enter:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -707,7 +707,7 @@ $code.=<<___;
.align 16
bn_sqr4x_mont:
.Lsqr4x_enter:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
index 3b3325a6c..38751ec5d 100755
--- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl
@@ -57,7 +57,7 @@ $code=<<___;
.type bn_mul_mont_gather5,\@function,6
.align 64
bn_mul_mont_gather5:
- endbr64
+ _CET_ENDBR
test \$3,${num}d
jnz .Lmul_enter
cmp \$8,${num}d
@@ -388,7 +388,7 @@ $code.=<<___;
.type bn_mul4x_mont_gather5,\@function,6
.align 16
bn_mul4x_mont_gather5:
- endbr64
+ _CET_ENDBR
.Lmul4x_enter:
mov ${num}d,${num}d
movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument
@@ -927,7 +927,7 @@ $code.=<<___;
.type bn_scatter5,\@abi-omnipotent
.align 16
bn_scatter5:
- endbr64
+ _CET_ENDBR
cmp \$0, $num
jz .Lscatter_epilogue
lea ($tbl,$idx,8),$tbl
@@ -946,7 +946,7 @@ bn_scatter5:
.type bn_gather5,\@abi-omnipotent
.align 16
bn_gather5:
- endbr64
+ _CET_ENDBR
.LSEH_begin_bn_gather5: # Win64 thing, but harmless in other cases
# I can't trust assembler to use specific encoding:-(
.byte 0x4c,0x8d,0x14,0x24 # lea (%rsp),%r10
@@ -1057,7 +1057,7 @@ $code.=<<___;
.type mul_handler,\@abi-omnipotent
.align 16
mul_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
diff --git a/src/lib/libcrypto/bn/s2n_bignum_internal.h b/src/lib/libcrypto/bn/s2n_bignum_internal.h
index f41368833..b82db7d01 100644
--- a/src/lib/libcrypto/bn/s2n_bignum_internal.h
+++ b/src/lib/libcrypto/bn/s2n_bignum_internal.h
@@ -18,6 +18,12 @@
# define S2N_BN_SYMBOL(name) name
#endif
+#ifdef __CET__
+# include <cet.h>
+#else
+# define _CET_ENDBR
+#endif
+
#define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name)
#ifdef S2N_BN_HIDE_SYMBOLS
# ifdef __APPLE__
diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
index 3ceed3e89..187f0596d 100644
--- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl
@@ -116,7 +116,7 @@ $code=<<___;
.type Camellia_EncryptBlock,\@abi-omnipotent
.align 16
Camellia_EncryptBlock:
- endbr64
+ _CET_ENDBR
movl \$128,%eax
subl $arg0d,%eax
movl \$3,$arg0d
@@ -129,7 +129,7 @@ Camellia_EncryptBlock:
.align 16
.Lenc_rounds:
Camellia_EncryptBlock_Rounds:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r13
@@ -178,7 +178,7 @@ Camellia_EncryptBlock_Rounds:
.type _x86_64_Camellia_encrypt,\@abi-omnipotent
.align 16
_x86_64_Camellia_encrypt:
- endbr64
+ _CET_ENDBR
xor 0($key),@S[1]
xor 4($key),@S[0] # ^=key[0-3]
xor 8($key),@S[3]
@@ -229,7 +229,7 @@ $code.=<<___;
.type Camellia_DecryptBlock,\@abi-omnipotent
.align 16
Camellia_DecryptBlock:
- endbr64
+ _CET_ENDBR
movl \$128,%eax
subl $arg0d,%eax
movl \$3,$arg0d
@@ -242,7 +242,7 @@ Camellia_DecryptBlock:
.align 16
.Ldec_rounds:
Camellia_DecryptBlock_Rounds:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r13
@@ -291,7 +291,7 @@ Camellia_DecryptBlock_Rounds:
.type _x86_64_Camellia_decrypt,\@abi-omnipotent
.align 16
_x86_64_Camellia_decrypt:
- endbr64
+ _CET_ENDBR
xor 0($key),@S[1]
xor 4($key),@S[0] # ^=key[0-3]
xor 8($key),@S[3]
@@ -406,7 +406,7 @@ $code.=<<___;
.type Camellia_Ekeygen,\@function,3
.align 16
Camellia_Ekeygen:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r13
@@ -637,7 +637,7 @@ $code.=<<___;
.type Camellia_cbc_encrypt,\@function,6
.align 16
Camellia_cbc_encrypt:
- endbr64
+ _CET_ENDBR
cmp \$0,%rdx
je .Lcbc_abort
push %rbx
diff --git a/src/lib/libcrypto/md5/asm/md5-x86_64.pl b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
index 06d69094f..5001c3472 100755
--- a/src/lib/libcrypto/md5/asm/md5-x86_64.pl
+++ b/src/lib/libcrypto/md5/asm/md5-x86_64.pl
@@ -128,7 +128,7 @@ $code .= <<EOF;
.globl md5_block_asm_data_order
.type md5_block_asm_data_order,\@function,3
md5_block_asm_data_order:
- endbr64
+ _CET_ENDBR
push %rbp
push %rbx
push %r12
diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
index 4fded507c..f3caac15d 100644
--- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl
@@ -412,7 +412,7 @@ $code.=<<___;
.type gcm_init_clmul,\@abi-omnipotent
.align 16
gcm_init_clmul:
- endbr64
+ _CET_ENDBR
movdqu ($Xip),$Hkey
pshufd \$0b01001110,$Hkey,$Hkey # dword swap
@@ -450,7 +450,7 @@ $code.=<<___;
.type gcm_gmult_clmul,\@abi-omnipotent
.align 16
gcm_gmult_clmul:
- endbr64
+ _CET_ENDBR
movdqu ($Xip),$Xi
movdqa .Lbswap_mask(%rip),$T3
movdqu ($Htbl),$Hkey
@@ -478,7 +478,7 @@ $code.=<<___;
.type gcm_ghash_clmul,\@abi-omnipotent
.align 16
gcm_ghash_clmul:
- endbr64
+ _CET_ENDBR
___
$code.=<<___ if ($win64);
.LSEH_begin_gcm_ghash_clmul:
@@ -689,7 +689,7 @@ $code.=<<___;
.type se_handler,\@abi-omnipotent
.align 16
se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl
index 5dbed2a8c..325e7cf58 100755
--- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl
+++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl
@@ -781,6 +781,22 @@ ___
OPTION DOTNAME
___
}
+
+if ($nasm) {
+ print <<___;
+\%define _CET_ENDBR
+___
+} else {
+ print <<___;
+#if defined(__CET__)
+#include <cet.h>
+#else
+#define _CET_ENDBR
+#endif
+
+___
+}
+
print "#include \"x86_arch.h\"\n";
while($line=<>) {
diff --git a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
index 3190e6a8e..e5e8aa08a 100644
--- a/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl
@@ -109,7 +109,7 @@ $code.=<<___;
.globl $func
.type $func,\@function,$nargs
$func:
- endbr64
+ _CET_ENDBR
cmp \$0,$len
je .Labort
push %rbx
@@ -454,7 +454,7 @@ $code.=<<___;
.type RC4_set_key,\@function,3
.align 16
RC4_set_key:
- endbr64
+ _CET_ENDBR
lea 8($dat),$dat
lea ($inp,$len),$inp
neg $len
diff --git a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
index 0472acce8..a9cf9d1bd 100755
--- a/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
+++ b/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl
@@ -128,7 +128,7 @@ $code=<<___;
.type RC4,\@function,4
.align 16
RC4:
- endbr64
+ _CET_ENDBR
or $len,$len
jne .Lentry
ret
@@ -435,7 +435,7 @@ $code.=<<___;
.type RC4_set_key,\@function,3
.align 16
RC4_set_key:
- endbr64
+ _CET_ENDBR
lea 8($dat),$dat
lea ($inp,$len),$inp
neg $len
diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
index e15ff47f8..e080251df 100755
--- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl
@@ -222,7 +222,7 @@ $code.=<<___;
.type sha1_block_data_order,\@function,3
.align 16
sha1_block_data_order:
- endbr64
+ _CET_ENDBR
mov OPENSSL_ia32cap_P+0(%rip),%r9d
mov OPENSSL_ia32cap_P+4(%rip),%r8d
test \$IA32CAP_MASK1_SSSE3,%r8d # check SSSE3 bit
@@ -310,7 +310,7 @@ $code.=<<___;
.align 16
sha1_block_data_order_ssse3:
_ssse3_shortcut:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -731,7 +731,7 @@ $code.=<<___;
.align 16
sha1_block_data_order_avx:
_avx_shortcut:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
@@ -1102,7 +1102,7 @@ $code.=<<___;
.type se_handler,\@abi-omnipotent
.align 16
se_handler:
- endbr64
+ _CET_ENDBR
push %rsi
push %rdi
push %rbx
diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
index 120693fee..f7a4dad2c 100755
--- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl
@@ -175,7 +175,7 @@ $code=<<___;
.type $func,\@function,4
.align 16
$func:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
index 7958f6d28..2a3902430 100644
--- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl
@@ -57,7 +57,7 @@ $code=<<___;
.type $func,\@function,3
.align 16
$func:
- endbr64
+ _CET_ENDBR
push %rbx
push %rbp
push %r12
diff --git a/src/lib/libcrypto/x86_64cpuid.pl b/src/lib/libcrypto/x86_64cpuid.pl
index dc56732a2..5e85c40c9 100644
--- a/src/lib/libcrypto/x86_64cpuid.pl
+++ b/src/lib/libcrypto/x86_64cpuid.pl
@@ -18,7 +18,7 @@ print<<___;
.extern OPENSSL_cpuid_setup
.hidden OPENSSL_cpuid_setup
.section .init
- endbr64
+ _CET_ENDBR
call OPENSSL_cpuid_setup
.extern OPENSSL_ia32cap_P
@@ -30,7 +30,7 @@ print<<___;
.type OPENSSL_ia32_cpuid,\@abi-omnipotent
.align 16
OPENSSL_ia32_cpuid:
- endbr64
+ _CET_ENDBR
mov %rbx,%r8 # save %rbx
xor %eax,%eax
--
2.43.0
|