diff --git a/.gitignore b/.gitignore index b061ae67a0..89962ea038 100644 --- a/.gitignore +++ b/.gitignore @@ -59,6 +59,7 @@ openssl.cnf x509v3.cnf # tests +tap-driver.sh test-driver *.log *.trs diff --git a/m4/check-hardening-options.m4 b/m4/check-hardening-options.m4 index 4b5784b627..2cb3083788 100644 --- a/m4/check-hardening-options.m4 +++ b/m4/check-hardening-options.m4 @@ -94,6 +94,11 @@ AC_DEFUN([CHECK_C_HARDENING_OPTIONS], [ AC_SEARCH_LIBS([__stack_chk_guard],[ssp]) ]) ]) + + # Check for control-flow integrity support + AS_IF([test "x$HOST_OS" != "xdarwin"], [ + CHECK_CFLAG([[-fcf-protection=full]]) + ]) ]) # Restore CC, LD 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 8ec94cdeb2..0000000000 --- a/patches/asm/0001-Revert-Add-endbr64-where-needed-by-inspection.-Passe.patch +++ /dev/null @@ -1,1055 +0,0 @@ -From 5f7fafff280e6e17d7fafea20fda99762d74581f Mon Sep 17 00:00:00 2001 -From: Brent Cook -Date: Mon, 30 Oct 2023 21:59:32 -0500 -Subject: [PATCH 1/4] Revert "Add endbr64 where needed by inspection. Passes - regresson tests." - -This reverts commit e2118101444d3cf3cab87297b363cecd5357ae89. ---- - src/lib/libcrypto/aes/asm/aes-x86_64.pl | 13 ------------- - src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 4 ---- - src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 15 --------------- - src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 14 -------------- - src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 14 -------------- - src/lib/libcrypto/bn/arch/amd64/bignum_add.S | 1 - - src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S | 1 - - src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S | 1 - - src/lib/libcrypto/bn/arch/amd64/bignum_mul.S | 1 - - .../libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S | 1 - - .../libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S | 1 - - src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S | 1 - - .../libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S | 1 - - .../libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S | 1 - - src/lib/libcrypto/bn/arch/amd64/bignum_sub.S | 1 - - src/lib/libcrypto/bn/arch/amd64/word_clz.S | 1 - - src/lib/libcrypto/bn/asm/modexp512-x86_64.pl | 5 ----- - src/lib/libcrypto/bn/asm/x86_64-mont.pl | 3 --- - src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 5 ----- - src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 8 -------- - src/lib/libcrypto/md5/asm/md5-x86_64.pl | 1 - - src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 4 ---- - src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl | 6 ++---- - src/lib/libcrypto/rc4/asm/rc4-x86_64.pl | 7 ++----- - src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 4 ---- - src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 1 - - src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 1 - - src/lib/libcrypto/x86_64cpuid.pl | 2 -- - 28 files changed, 4 insertions(+), 114 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..b7399b552 100755 ---- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -@@ -318,7 +318,6 @@ $code.=<<___; - .type _x86_64_AES_encrypt,\@abi-omnipotent - .align 16 - _x86_64_AES_encrypt: -- endbr64 - xor 0($key),$s0 # xor with key - xor 4($key),$s1 - xor 8($key),$s2 -@@ -549,7 +548,6 @@ $code.=<<___; - .type _x86_64_AES_encrypt_compact,\@abi-omnipotent - .align 16 - _x86_64_AES_encrypt_compact: -- endbr64 - lea 128($sbox),$inp # size optimization - mov 0-128($inp),$acc1 # prefetch Te4 - mov 32-128($inp),$acc2 -@@ -595,7 +593,6 @@ $code.=<<___; - .hidden asm_AES_encrypt - asm_AES_encrypt: - AES_encrypt: -- endbr64 - push %rbx - push %rbp - push %r12 -@@ -887,7 +884,6 @@ $code.=<<___; - .type _x86_64_AES_decrypt,\@abi-omnipotent - .align 16 - _x86_64_AES_decrypt: -- endbr64 - xor 0($key),$s0 # xor with key - xor 4($key),$s1 - xor 8($key),$s2 -@@ -1142,7 +1138,6 @@ $code.=<<___; - .type _x86_64_AES_decrypt_compact,\@abi-omnipotent - .align 16 - _x86_64_AES_decrypt_compact: -- endbr64 - lea 128($sbox),$inp # size optimization - mov 0-128($inp),$acc1 # prefetch Td4 - mov 32-128($inp),$acc2 -@@ -1197,7 +1192,6 @@ $code.=<<___; - .hidden asm_AES_decrypt - asm_AES_decrypt: - AES_decrypt: -- endbr64 - push %rbx - push %rbp - push %r12 -@@ -1297,7 +1291,6 @@ $code.=<<___; - .type AES_set_encrypt_key,\@function,3 - .align 16 - AES_set_encrypt_key: -- endbr64 - push %rbx - push %rbp - push %r12 # redundant, but allows to share -@@ -1323,7 +1316,6 @@ AES_set_encrypt_key: - .type _x86_64_AES_set_encrypt_key,\@abi-omnipotent - .align 16 - _x86_64_AES_set_encrypt_key: -- endbr64 - mov %esi,%ecx # %ecx=bits - mov %rdi,%rsi # %rsi=userKey - mov %rdx,%rdi # %rdi=key -@@ -1569,7 +1561,6 @@ $code.=<<___; - .type AES_set_decrypt_key,\@function,3 - .align 16 - AES_set_decrypt_key: -- endbr64 - push %rbx - push %rbp - push %r12 -@@ -1669,7 +1660,6 @@ $code.=<<___; - .hidden asm_AES_cbc_encrypt - asm_AES_cbc_encrypt: - AES_cbc_encrypt: -- endbr64 - cmp \$0,%rdx # check length - je .Lcbc_epilogue - pushfq -@@ -2561,7 +2551,6 @@ $code.=<<___; - .type block_se_handler,\@abi-omnipotent - .align 16 - block_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2620,7 +2609,6 @@ block_se_handler: - .type key_se_handler,\@abi-omnipotent - .align 16 - key_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2678,7 +2666,6 @@ key_se_handler: - .type cbc_se_handler,\@abi-omnipotent - .align 16 - cbc_se_handler: -- endbr64 - 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..bafa906a0 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,6 @@ $code.=<<___; - .type aesni_cbc_sha1_enc,\@abi-omnipotent - .align 16 - aesni_cbc_sha1_enc: -- endbr64 - # 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 +132,6 @@ $code.=<<___; - .type aesni_cbc_sha1_enc_ssse3,\@function,6 - .align 16 - aesni_cbc_sha1_enc_ssse3: -- endbr64 - mov `($win64?56:8)`(%rsp),$inp # load 7th argument - #shr \$6,$len # debugging artefact - #jz .Lepilogue_ssse3 # debugging artefact -@@ -652,7 +650,6 @@ $code.=<<___; - .type aesni_cbc_sha1_enc_avx,\@function,6 - .align 16 - aesni_cbc_sha1_enc_avx: -- endbr64 - mov `($win64?56:8)`(%rsp),$inp # load 7th argument - #shr \$6,$len # debugging artefact - #jz .Lepilogue_avx # debugging artefact -@@ -1103,7 +1100,6 @@ $code.=<<___; - .type ssse3_handler,\@abi-omnipotent - .align 16 - ssse3_handler: -- endbr64 - 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..e662fbc7c 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -@@ -242,7 +242,6 @@ $code.=<<___; - .type ${PREFIX}_encrypt,\@abi-omnipotent - .align 16 - ${PREFIX}_encrypt: -- endbr64 - movups ($inp),$inout0 # load input - mov 240($key),$rounds # key->rounds - ___ -@@ -256,7 +255,6 @@ $code.=<<___; - .type ${PREFIX}_decrypt,\@abi-omnipotent - .align 16 - ${PREFIX}_decrypt: -- endbr64 - movups ($inp),$inout0 # load input - mov 240($key),$rounds # key->rounds - ___ -@@ -286,7 +284,6 @@ $code.=<<___; - .type _aesni_${dir}rypt3,\@abi-omnipotent - .align 16 - _aesni_${dir}rypt3: -- endbr64 - $movkey ($key),$rndkey0 - shr \$1,$rounds - $movkey 16($key),$rndkey1 -@@ -331,7 +328,6 @@ $code.=<<___; - .type _aesni_${dir}rypt4,\@abi-omnipotent - .align 16 - _aesni_${dir}rypt4: -- endbr64 - $movkey ($key),$rndkey0 - shr \$1,$rounds - $movkey 16($key),$rndkey1 -@@ -377,7 +373,6 @@ $code.=<<___; - .type _aesni_${dir}rypt6,\@abi-omnipotent - .align 16 - _aesni_${dir}rypt6: -- endbr64 - $movkey ($key),$rndkey0 - shr \$1,$rounds - $movkey 16($key),$rndkey1 -@@ -442,7 +437,6 @@ $code.=<<___; - .type _aesni_${dir}rypt8,\@abi-omnipotent - .align 16 - _aesni_${dir}rypt8: -- endbr64 - $movkey ($key),$rndkey0 - shr \$1,$rounds - $movkey 16($key),$rndkey1 -@@ -531,7 +525,6 @@ $code.=<<___; - .type aesni_ecb_encrypt,\@function,5 - .align 16 - aesni_ecb_encrypt: -- endbr64 - and \$-16,$len - jz .Lecb_ret - -@@ -837,7 +830,6 @@ $code.=<<___; - .type aesni_ccm64_encrypt_blocks,\@function,6 - .align 16 - aesni_ccm64_encrypt_blocks: -- endbr64 - ___ - $code.=<<___ if ($win64); - lea -0x58(%rsp),%rsp -@@ -2487,7 +2479,6 @@ $code.=<<___; - .type ${PREFIX}_set_decrypt_key,\@abi-omnipotent - .align 16 - ${PREFIX}_set_decrypt_key: -- endbr64 - sub \$8,%rsp - call __aesni_set_encrypt_key - shl \$4,$bits # rounds-1 after _aesni_set_encrypt_key -@@ -2538,7 +2529,6 @@ $code.=<<___; - .type ${PREFIX}_set_encrypt_key,\@abi-omnipotent - .align 16 - ${PREFIX}_set_encrypt_key: -- endbr64 - __aesni_set_encrypt_key: - sub \$8,%rsp - mov \$-1,%rax -@@ -2760,7 +2750,6 @@ $code.=<<___ if ($PREFIX eq "aesni"); - .type ecb_se_handler,\@abi-omnipotent - .align 16 - ecb_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2780,7 +2769,6 @@ ecb_se_handler: - .type ccm64_se_handler,\@abi-omnipotent - .align 16 - ccm64_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2822,7 +2810,6 @@ ccm64_se_handler: - .type ctr32_se_handler,\@abi-omnipotent - .align 16 - ctr32_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2858,7 +2845,6 @@ ctr32_se_handler: - .type xts_se_handler,\@abi-omnipotent - .align 16 - xts_se_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -@@ -2900,7 +2886,6 @@ $code.=<<___; - .type cbc_se_handler,\@abi-omnipotent - .align 16 - cbc_se_handler: -- endbr64 - 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..20e9e1f71 100644 ---- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -@@ -813,7 +813,6 @@ $code.=<<___; - .type _bsaes_encrypt8,\@abi-omnipotent - .align 64 - _bsaes_encrypt8: -- endbr64 - lea .LBS0(%rip), $const # constants table - - movdqa ($key), @XMM[9] # round 0 key -@@ -878,7 +877,6 @@ $code.=<<___; - .type _bsaes_decrypt8,\@abi-omnipotent - .align 64 - _bsaes_decrypt8: -- endbr64 - lea .LBS0(%rip), $const # constants table - - movdqa ($key), @XMM[9] # round 0 key -@@ -970,7 +968,6 @@ $code.=<<___; - .type _bsaes_key_convert,\@abi-omnipotent - .align 16 - _bsaes_key_convert: -- endbr64 - lea .Lmasks(%rip), $const - movdqu ($inp), %xmm7 # load round 0 key - lea 0x10($inp), $inp -@@ -1060,7 +1057,6 @@ $code.=<<___; - .type bsaes_enc_key_convert,\@function,2 - .align 16 - bsaes_enc_key_convert: -- endbr64 - mov 240($inp),%r10d # pass rounds - mov $inp,%rcx # pass key - mov $out,%rax # pass key schedule -@@ -1075,7 +1071,6 @@ bsaes_enc_key_convert: - .align 16 - bsaes_encrypt_128: - .Lenc128_loop: -- endbr64 - movdqu 0x00($inp), @XMM[0] # load input - movdqu 0x10($inp), @XMM[1] - movdqu 0x20($inp), @XMM[2] -@@ -1108,7 +1103,6 @@ bsaes_encrypt_128: - .type bsaes_dec_key_convert,\@function,2 - .align 16 - bsaes_dec_key_convert: -- endbr64 - mov 240($inp),%r10d # pass rounds - mov $inp,%rcx # pass key - mov $out,%rax # pass key schedule -@@ -1123,7 +1117,6 @@ bsaes_dec_key_convert: - .type bsaes_decrypt_128,\@function,4 - .align 16 - bsaes_decrypt_128: -- endbr64 - .Ldec128_loop: - movdqu 0x00($inp), @XMM[0] # load input - movdqu 0x10($inp), @XMM[1] -@@ -1169,7 +1162,6 @@ $code.=<<___; - .type bsaes_ecb_encrypt_blocks,\@abi-omnipotent - .align 16 - bsaes_ecb_encrypt_blocks: -- endbr64 - mov %rsp, %rax - .Lecb_enc_prologue: - push %rbp -@@ -1371,7 +1363,6 @@ $code.=<<___; - .type bsaes_ecb_decrypt_blocks,\@abi-omnipotent - .align 16 - bsaes_ecb_decrypt_blocks: -- endbr64 - mov %rsp, %rax - .Lecb_dec_prologue: - push %rbp -@@ -1577,7 +1568,6 @@ $code.=<<___; - .type bsaes_cbc_encrypt,\@abi-omnipotent - .align 16 - bsaes_cbc_encrypt: -- endbr64 - ___ - $code.=<<___ if ($win64); - mov 48(%rsp),$arg6 # pull direction flag -@@ -1865,7 +1855,6 @@ $code.=<<___; - .type bsaes_ctr32_encrypt_blocks,\@abi-omnipotent - .align 16 - bsaes_ctr32_encrypt_blocks: -- endbr64 - mov %rsp, %rax - .Lctr_enc_prologue: - push %rbp -@@ -2107,7 +2096,6 @@ $code.=<<___; - .type bsaes_xts_encrypt,\@abi-omnipotent - .align 16 - bsaes_xts_encrypt: -- endbr64 - mov %rsp, %rax - .Lxts_enc_prologue: - push %rbp -@@ -2489,7 +2477,6 @@ $code.=<<___; - .type bsaes_xts_decrypt,\@abi-omnipotent - .align 16 - bsaes_xts_decrypt: -- endbr64 - mov %rsp, %rax - .Lxts_dec_prologue: - push %rbp -@@ -2966,7 +2953,6 @@ $code.=<<___; - .type se_handler,\@abi-omnipotent - .align 16 - se_handler: -- endbr64 - 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..3ffb1a303 100644 ---- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -@@ -82,7 +82,6 @@ $code.=<<___; - .type _vpaes_encrypt_core,\@abi-omnipotent - .align 16 - _vpaes_encrypt_core: -- endbr64 - mov %rdx, %r9 - mov \$16, %r11 - mov 240(%rdx),%eax -@@ -173,7 +172,6 @@ _vpaes_encrypt_core: - .type _vpaes_decrypt_core,\@abi-omnipotent - .align 16 - _vpaes_decrypt_core: -- endbr64 - mov %rdx, %r9 # load key - mov 240(%rdx),%eax - movdqa %xmm9, %xmm1 -@@ -281,7 +279,6 @@ _vpaes_decrypt_core: - .type _vpaes_schedule_core,\@abi-omnipotent - .align 16 - _vpaes_schedule_core: -- endbr64 - # rdi = key - # rsi = size in bits - # rdx = buffer -@@ -467,7 +464,6 @@ _vpaes_schedule_core: - .type _vpaes_schedule_192_smear,\@abi-omnipotent - .align 16 - _vpaes_schedule_192_smear: -- endbr64 - 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 +495,6 @@ _vpaes_schedule_192_smear: - .type _vpaes_schedule_round,\@abi-omnipotent - .align 16 - _vpaes_schedule_round: -- endbr64 - # extract rcon from xmm8 - pxor %xmm1, %xmm1 - palignr \$15, %xmm8, %xmm1 -@@ -567,7 +562,6 @@ _vpaes_schedule_low_round: - .type _vpaes_schedule_transform,\@abi-omnipotent - .align 16 - _vpaes_schedule_transform: -- endbr64 - movdqa %xmm9, %xmm1 - pandn %xmm0, %xmm1 - psrld \$4, %xmm1 -@@ -606,7 +600,6 @@ _vpaes_schedule_transform: - .type _vpaes_schedule_mangle,\@abi-omnipotent - .align 16 - _vpaes_schedule_mangle: -- endbr64 - movdqa %xmm0, %xmm4 # save xmm0 for later - movdqa .Lk_mc_forward(%rip),%xmm5 - test %rcx, %rcx -@@ -680,7 +673,6 @@ _vpaes_schedule_mangle: - .type ${PREFIX}_set_encrypt_key,\@function,3 - .align 16 - ${PREFIX}_set_encrypt_key: -- endbr64 - ___ - $code.=<<___ if ($win64); - lea -0xb8(%rsp),%rsp -@@ -729,7 +721,6 @@ $code.=<<___; - .type ${PREFIX}_set_decrypt_key,\@function,3 - .align 16 - ${PREFIX}_set_decrypt_key: -- endbr64 - ___ - $code.=<<___ if ($win64); - lea -0xb8(%rsp),%rsp -@@ -783,7 +774,6 @@ $code.=<<___; - .type ${PREFIX}_encrypt,\@function,3 - .align 16 - ${PREFIX}_encrypt: -- endbr64 - ___ - $code.=<<___ if ($win64); - lea -0xb8(%rsp),%rsp -@@ -827,7 +817,6 @@ $code.=<<___; - .type ${PREFIX}_decrypt,\@function,3 - .align 16 - ${PREFIX}_decrypt: -- endbr64 - ___ - $code.=<<___ if ($win64); - lea -0xb8(%rsp),%rsp -@@ -877,7 +866,6 @@ $code.=<<___; - .type ${PREFIX}_cbc_encrypt,\@function,6 - .align 16 - ${PREFIX}_cbc_encrypt: -- endbr64 - xchg $key,$len - ___ - ($len,$key)=($key,$len); -@@ -961,7 +949,6 @@ $code.=<<___; - .type _vpaes_preheat,\@abi-omnipotent - .align 16 - _vpaes_preheat: -- endbr64 - lea .Lk_s0F(%rip), %r10 - movdqa -0x20(%r10), %xmm10 # .Lk_inv - movdqa -0x10(%r10), %xmm11 # .Lk_inv+16 -@@ -1092,7 +1079,6 @@ $code.=<<___; - .type se_handler,\@abi-omnipotent - .align 16 - se_handler: -- endbr64 - 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..d56fa5e3a 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_add.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_add.S -@@ -49,7 +49,6 @@ - - - S2N_BN_SYMBOL(bignum_add): -- endbr64 - - #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..1dc1e5870 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S -@@ -54,7 +54,6 @@ - - - S2N_BN_SYMBOL(bignum_cmadd): -- endbr64 - - #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..c1a23ccea 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S -@@ -51,7 +51,6 @@ - - - S2N_BN_SYMBOL(bignum_cmul): -- endbr64 - - #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..42ac988a1 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S -@@ -59,7 +59,6 @@ - - - S2N_BN_SYMBOL(bignum_mul): -- endbr64 - - #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..3b7848b28 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,6 @@ - adc h, rdx - - S2N_BN_SYMBOL(bignum_mul_4_8_alt): -- endbr64 - - #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..1be37840d 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,6 @@ - adc h, rdx - - S2N_BN_SYMBOL(bignum_mul_8_16_alt): -- endbr64 - - #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..2e05b9c17 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S -@@ -62,7 +62,6 @@ - #define llshort ebp - - S2N_BN_SYMBOL(bignum_sqr): -- endbr64 - - #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..a635177c6 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,6 @@ - adc c, 0 - - S2N_BN_SYMBOL(bignum_sqr_4_8_alt): -- endbr64 - - #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..f698202d2 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,6 @@ - adc c, 0 - - S2N_BN_SYMBOL(bignum_sqr_8_16_alt): -- endbr64 - - #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..f8e1fe35a 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S -+++ b/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S -@@ -49,7 +49,6 @@ - - - S2N_BN_SYMBOL(bignum_sub): -- endbr64 - - #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..025e98f9c 100644 ---- a/src/lib/libcrypto/bn/arch/amd64/word_clz.S -+++ b/src/lib/libcrypto/bn/arch/amd64/word_clz.S -@@ -30,7 +30,6 @@ - .text - - S2N_BN_SYMBOL(word_clz): -- endbr64 - - #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..2e71a7f03 100644 ---- a/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl -+++ b/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl -@@ -347,7 +347,6 @@ $code.=<<___; - .type MULADD_128x512,\@abi-omnipotent - .align 16 - MULADD_128x512: -- endbr64 - ___ - &MULSTEP_512([map("%r$_",(8..15))], "(+8*0)(%rcx)", "%rsi", "%rbp", "%rbx"); - $code.=<<___; -@@ -415,7 +414,6 @@ $code.=<<___; - .type mont_reduce,\@abi-omnipotent - .align 16 - mont_reduce: -- endbr64 - ___ - - my $STACK_DEPTH = 8; -@@ -678,7 +676,6 @@ $code.=<<___; - .type mont_mul_a3b,\@abi-omnipotent - .align 16 - mont_mul_a3b: -- endbr64 - # - # multiply tmp = src1 * src2 - # For multiply: dst = rcx, src1 = rdi, src2 = rsi -@@ -1080,7 +1077,6 @@ $code.=<<___; - .type sqr_reduce,\@abi-omnipotent - .align 16 - sqr_reduce: -- endbr64 - 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 +1106,6 @@ $code.=<<___; - .globl mod_exp_512 - .type mod_exp_512,\@function,4 - mod_exp_512: -- endbr64 - 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..cae7309d5 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl -@@ -63,7 +63,6 @@ $code=<<___; - .type bn_mul_mont,\@function,6 - .align 16 - bn_mul_mont: -- endbr64 - test \$3,${num}d - jnz .Lmul_enter - cmp \$8,${num}d -@@ -279,7 +278,6 @@ $code.=<<___; - .align 16 - bn_mul4x_mont: - .Lmul4x_enter: -- endbr64 - push %rbx - push %rbp - push %r12 -@@ -707,7 +705,6 @@ $code.=<<___; - .align 16 - bn_sqr4x_mont: - .Lsqr4x_enter: -- endbr64 - 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..7b9c6df27 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -@@ -57,7 +57,6 @@ $code=<<___; - .type bn_mul_mont_gather5,\@function,6 - .align 64 - bn_mul_mont_gather5: -- endbr64 - test \$3,${num}d - jnz .Lmul_enter - cmp \$8,${num}d -@@ -388,7 +387,6 @@ $code.=<<___; - .type bn_mul4x_mont_gather5,\@function,6 - .align 16 - bn_mul4x_mont_gather5: -- endbr64 - .Lmul4x_enter: - mov ${num}d,${num}d - movd `($win64?56:8)`(%rsp),%xmm5 # load 7th argument -@@ -927,7 +925,6 @@ $code.=<<___; - .type bn_scatter5,\@abi-omnipotent - .align 16 - bn_scatter5: -- endbr64 - cmp \$0, $num - jz .Lscatter_epilogue - lea ($tbl,$idx,8),$tbl -@@ -946,7 +943,6 @@ bn_scatter5: - .type bn_gather5,\@abi-omnipotent - .align 16 - bn_gather5: -- endbr64 - .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 +1053,6 @@ $code.=<<___; - .type mul_handler,\@abi-omnipotent - .align 16 - mul_handler: -- endbr64 - push %rsi - push %rdi - push %rbx -diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -index 3ceed3e89..586e5d6e9 100644 ---- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -@@ -116,7 +116,6 @@ $code=<<___; - .type Camellia_EncryptBlock,\@abi-omnipotent - .align 16 - Camellia_EncryptBlock: -- endbr64 - movl \$128,%eax - subl $arg0d,%eax - movl \$3,$arg0d -@@ -129,7 +128,6 @@ Camellia_EncryptBlock: - .align 16 - .Lenc_rounds: - Camellia_EncryptBlock_Rounds: -- endbr64 - push %rbx - push %rbp - push %r13 -@@ -178,7 +176,6 @@ Camellia_EncryptBlock_Rounds: - .type _x86_64_Camellia_encrypt,\@abi-omnipotent - .align 16 - _x86_64_Camellia_encrypt: -- endbr64 - xor 0($key),@S[1] - xor 4($key),@S[0] # ^=key[0-3] - xor 8($key),@S[3] -@@ -229,7 +226,6 @@ $code.=<<___; - .type Camellia_DecryptBlock,\@abi-omnipotent - .align 16 - Camellia_DecryptBlock: -- endbr64 - movl \$128,%eax - subl $arg0d,%eax - movl \$3,$arg0d -@@ -242,7 +238,6 @@ Camellia_DecryptBlock: - .align 16 - .Ldec_rounds: - Camellia_DecryptBlock_Rounds: -- endbr64 - push %rbx - push %rbp - push %r13 -@@ -291,7 +286,6 @@ Camellia_DecryptBlock_Rounds: - .type _x86_64_Camellia_decrypt,\@abi-omnipotent - .align 16 - _x86_64_Camellia_decrypt: -- endbr64 - xor 0($key),@S[1] - xor 4($key),@S[0] # ^=key[0-3] - xor 8($key),@S[3] -@@ -406,7 +400,6 @@ $code.=<<___; - .type Camellia_Ekeygen,\@function,3 - .align 16 - Camellia_Ekeygen: -- endbr64 - push %rbx - push %rbp - push %r13 -@@ -637,7 +630,6 @@ $code.=<<___; - .type Camellia_cbc_encrypt,\@function,6 - .align 16 - Camellia_cbc_encrypt: -- endbr64 - 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..c902a1b53 100755 ---- a/src/lib/libcrypto/md5/asm/md5-x86_64.pl -+++ b/src/lib/libcrypto/md5/asm/md5-x86_64.pl -@@ -128,7 +128,6 @@ $code .= < -Date: Mon, 30 Oct 2023 22:00:12 -0500 -Subject: [PATCH 2/4] Revert "Use explicit .text instead of .previous to please - Windows/MinGW on amd64" - -This reverts commit e8192f57c4e5910ce7badced4a24c8827810d567. ---- - src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +- - src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +- - src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +- - src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +- - src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +- - src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++-- - 10 files changed, 11 insertions(+), 11 deletions(-) - -diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -index b7399b552..2986a9fcc 100755 ---- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -@@ -2535,7 +2535,7 @@ $code.=<<___; - .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe - .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0 - .align 64 --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -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 bafa906a0..8a428c9b1 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -@@ -1084,7 +1084,7 @@ K_XX_XX: - .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79 - .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask - .align 64 --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -index e662fbc7c..09612b1f8 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -@@ -2732,7 +2732,7 @@ $code.=<<___; - .Lxts_magic: - .long 0x87,0,1,0 - .align 64 --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -index 20e9e1f71..347f4c302 100644 ---- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -@@ -2937,7 +2937,7 @@ _bsaes_const: - .quad 0x6363636363636363, 0x6363636363636363 - .align 64 - .size _bsaes_const,.-_bsaes_const --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -index 3ffb1a303..ad5fa7522 100644 ---- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -@@ -1063,7 +1063,7 @@ _vpaes_consts: - .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C - .align 64 - .size _vpaes_consts,.-_vpaes_consts --.text -+.previous - ___ - - if ($win64) { -diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -index 7b9c6df27..1c8aa255c 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -@@ -1037,7 +1037,7 @@ $code.=<<___; - .Linc: - .long 0,0, 1,1 - .long 2,2, 2,2 --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -index 586e5d6e9..c16725f5c 100644 ---- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -@@ -625,7 +625,7 @@ $_ivp="40(%rsp)"; - $_rsp="48(%rsp)"; - - $code.=<<___; --.text -+.previous - .globl Camellia_cbc_encrypt - .type Camellia_cbc_encrypt,\@function,6 - .align 16 -diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -index 71d0822ac..bce62947f 100644 ---- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -@@ -670,7 +670,7 @@ $code.=<<___; - .value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE - .value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE - .align 64 --.text -+.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -index 43eee73c4..1ec7f609a 100755 ---- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -@@ -1079,7 +1079,7 @@ K_XX_XX: - .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59 - .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79 - .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask --.text -+.previous - ___ - }}} - $code.=<<___; -diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -index 0517eab66..1a7d9bf2d 100755 ---- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -@@ -289,7 +289,7 @@ $TABLE: - .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3 - .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208 - .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 --.text -+.previous - ___ - } else { - $code.=<<___; -@@ -337,7 +337,7 @@ $TABLE: - .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c - .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a - .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817 --.text -+.previous - ___ - } - --- -2.42.0 - 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 165f2c0ff8..0000000000 --- a/patches/asm/0003-Revert-Use-.section-.rodata-instead-of-a-plain-.roda.patch +++ /dev/null @@ -1,203 +0,0 @@ -From 1407448470aff891f9a9eff550ecda06202ffd29 Mon Sep 17 00:00:00 2001 -From: Brent Cook -Date: Mon, 30 Oct 2023 22:00:49 -0500 -Subject: [PATCH 3/4] Revert "Use .section .rodata instead of a plain .rodata" - -This reverts commit 67afc07de0ed3a0ccc272df42853ba565a8277c6. ---- - src/lib/libcrypto/aes/asm/aes-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 2 +- - src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 2 +- - src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 2 +- - src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 2 +- - src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 2 +- - src/lib/libcrypto/perlasm/x86gas.pl | 2 +- - src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 2 +- - src/lib/libcrypto/sha/asm/sha512-ppc.pl | 2 +- - src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ++-- - src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 2 +- - 13 files changed, 14 insertions(+), 14 deletions(-) - -diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -index 2986a9fcc..d9f501b25 100755 ---- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -@@ -2113,7 +2113,7 @@ ___ - } - - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .LAES_Te: - ___ -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 8a428c9b1..4e83b6ba4 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -@@ -1075,7 +1075,7 @@ $code.=<<___; - ___ - } - $code.=<<___; --.section .rodata -+.rodata - .align 64 - K_XX_XX: - .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 -diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -index 09612b1f8..2ab7106c0 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -@@ -2721,7 +2721,7 @@ ___ - } - - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .Lbswap_mask: - .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 -diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -index 347f4c302..a40f83601 100644 ---- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -@@ -2882,7 +2882,7 @@ $code.=<<___; - ___ - } - $code.=<<___; --.section .rodata -+.rodata - .type _bsaes_const,\@object - .align 64 - _bsaes_const: -diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -index ad5fa7522..63af96c1d 100644 ---- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -@@ -964,7 +964,7 @@ _vpaes_preheat: - ## Constants ## - ## ## - ######################################################## --.section .rodata -+.rodata - .type _vpaes_consts,\@object - .align 64 - _vpaes_consts: -diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -index 1c8aa255c..5d30f210c 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -@@ -1032,7 +1032,7 @@ $code.=<<___; - ___ - } - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .Linc: - .long 0,0, 1,1 -diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -index c16725f5c..90c56d9e5 100644 ---- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -@@ -599,7 +599,7 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i - sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff; $i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); } - - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .LCamellia_SIGMA: - .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858 -diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -index bce62947f..3ae8629cb 100644 ---- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -@@ -622,7 +622,7 @@ ___ - } - - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .Lbswap_mask: - .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 -diff --git a/src/lib/libcrypto/perlasm/x86gas.pl b/src/lib/libcrypto/perlasm/x86gas.pl -index b84e28be9..f28a59054 100644 ---- a/src/lib/libcrypto/perlasm/x86gas.pl -+++ b/src/lib/libcrypto/perlasm/x86gas.pl -@@ -307,7 +307,7 @@ sub ::dataseg - { push(@out,".data\n"); } - - sub ::rodataseg --{ push(@out,".section .rodata\n"); } -+{ push(@out,".rodata\n"); } - - sub ::previous - { push(@out,".previous\n"); } -diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -index 1ec7f609a..0abbbab6b 100755 ---- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -@@ -1071,7 +1071,7 @@ $code.=<<___; - ___ - } - $code.=<<___; --.section .rodata -+.rodata - .align 64 - K_XX_XX: - .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 -diff --git a/src/lib/libcrypto/sha/asm/sha512-ppc.pl b/src/lib/libcrypto/sha/asm/sha512-ppc.pl -index 28bd997cf..1f02cfdd5 100755 ---- a/src/lib/libcrypto/sha/asm/sha512-ppc.pl -+++ b/src/lib/libcrypto/sha/asm/sha512-ppc.pl -@@ -375,7 +375,7 @@ $code.=<<___; - $ST $H,`7*$SZ`($ctx) - bne Lsha2_block_private - blr -- .section .rodata -+ .rodata - Ltable: - ___ - $code.=<<___ if ($SZ==8); -diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -index 1a7d9bf2d..6698b1d40 100755 ---- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -@@ -269,7 +269,7 @@ ___ - - if ($SZ==4) { - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .type $TABLE,\@object - $TABLE: -@@ -293,7 +293,7 @@ $TABLE: - ___ - } else { - $code.=<<___; --.section .rodata -+.rodata - .align 64 - .type $TABLE,\@object - $TABLE: -diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -index de5d3acfb..510a74b91 100644 ---- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -@@ -204,7 +204,7 @@ $code.=<<___; - ret - .size $func,.-$func - --.section .rodata -+.rodata - .align 64 - .type $table,\@object - $table: --- -2.42.0 - 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 1a17540555..0000000000 --- a/patches/asm/0004-Revert-Move-constants-out-of-text-segment-into-rodat.patch +++ /dev/null @@ -1,292 +0,0 @@ -From 87b24a6d5a932061cc88b84a856663b328d1c166 Mon Sep 17 00:00:00 2001 -From: Brent Cook -Date: Mon, 30 Oct 2023 22:01:49 -0500 -Subject: [PATCH 4/4] Revert "Move constants out of text segment into rodata to - prepare for xonly support" - -This reverts commit b5834617204e7520b0209bcff7f1c4a559e05422. ---- - src/lib/libcrypto/aes/asm/aes-x86_64.pl | 3 +-- - src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl | 4 ++-- - src/lib/libcrypto/aes/asm/aesni-x86_64.pl | 4 ++-- - src/lib/libcrypto/aes/asm/bsaes-x86_64.pl | 3 +-- - src/lib/libcrypto/aes/asm/vpaes-x86_64.pl | 3 +-- - src/lib/libcrypto/bn/asm/x86_64-mont.pl | 4 ++++ - src/lib/libcrypto/bn/asm/x86_64-mont5.pl | 3 +-- - src/lib/libcrypto/camellia/asm/cmll-x86_64.pl | 4 ++-- - src/lib/libcrypto/modes/asm/ghash-x86_64.pl | 4 ++-- - src/lib/libcrypto/sha/asm/sha1-x86_64.pl | 3 +-- - src/lib/libcrypto/sha/asm/sha512-x86_64.pl | 4 ---- - src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl | 1 - - 12 files changed, 17 insertions(+), 23 deletions(-) - -diff --git a/src/lib/libcrypto/aes/asm/aes-x86_64.pl b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -index d9f501b25..9072f603a 100755 ---- a/src/lib/libcrypto/aes/asm/aes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aes-x86_64.pl -@@ -2113,7 +2113,6 @@ ___ - } - - $code.=<<___; --.rodata - .align 64 - .LAES_Te: - ___ -@@ -2534,8 +2533,8 @@ ___ - $code.=<<___; - .long 0x80808080, 0x80808080, 0xfefefefe, 0xfefefefe - .long 0x1b1b1b1b, 0x1b1b1b1b, 0, 0 -+.asciz "AES for x86_64, CRYPTOGAMS by " - .align 64 --.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -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 4e83b6ba4..880bcc2d5 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl -@@ -1075,7 +1075,6 @@ $code.=<<___; - ___ - } - $code.=<<___; --.rodata - .align 64 - K_XX_XX: - .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 -@@ -1083,8 +1082,9 @@ K_XX_XX: - .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59 - .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79 - .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask -+ -+.asciz "AESNI-CBC+SHA1 stitch for x86_64, CRYPTOGAMS by " - .align 64 --.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -index 2ab7106c0..96978bd35 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -@@ -2721,7 +2721,6 @@ ___ - } - - $code.=<<___; --.rodata - .align 64 - .Lbswap_mask: - .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 -@@ -2731,8 +2730,9 @@ $code.=<<___; - .long 1,0,0,0 - .Lxts_magic: - .long 0x87,0,1,0 -+ -+.asciz "AES for Intel AES-NI, CRYPTOGAMS by " - .align 64 --.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -index a40f83601..14dc2c02e 100644 ---- a/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl -@@ -2882,7 +2882,6 @@ $code.=<<___; - ___ - } - $code.=<<___; --.rodata - .type _bsaes_const,\@object - .align 64 - _bsaes_const: -@@ -2935,9 +2934,9 @@ _bsaes_const: - .quad 0x02060a0e03070b0f, 0x0004080c0105090d - .L63: - .quad 0x6363636363636363, 0x6363636363636363 -+.asciz "Bit-sliced AES for x86_64/SSSE3, Emilia Käsper, Peter Schwabe, Andy Polyakov" - .align 64 - .size _bsaes_const,.-_bsaes_const --.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -index 63af96c1d..bd7f45b85 100644 ---- a/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl -@@ -964,7 +964,6 @@ _vpaes_preheat: - ## Constants ## - ## ## - ######################################################## --.rodata - .type _vpaes_consts,\@object - .align 64 - _vpaes_consts: -@@ -1061,9 +1060,9 @@ _vpaes_consts: - .Lk_dsbo: # decryption sbox final output - .quad 0x1387EA537EF94000, 0xC7AA6DB9D4943E2D - .quad 0x12D7560F93441D00, 0xCA4B8159D8C58E9C -+.asciz "Vector Permutation AES for x86_64/SSSE3, Mike Hamburg (Stanford University)" - .align 64 - .size _vpaes_consts,.-_vpaes_consts --.previous - ___ - - if ($win64) { -diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont.pl b/src/lib/libcrypto/bn/asm/x86_64-mont.pl -index cae7309d5..c35493e80 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont.pl -@@ -1495,6 +1495,10 @@ $code.=<<___; - .size bn_sqr4x_mont,.-bn_sqr4x_mont - ___ - }}} -+$code.=<<___; -+.asciz "Montgomery Multiplication for x86_64, CRYPTOGAMS by " -+.align 16 -+___ - - print $code; - close STDOUT; -diff --git a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -index 5d30f210c..bb7ad4c4b 100755 ---- a/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -+++ b/src/lib/libcrypto/bn/asm/x86_64-mont5.pl -@@ -1032,12 +1032,11 @@ $code.=<<___; - ___ - } - $code.=<<___; --.rodata - .align 64 - .Linc: - .long 0,0, 1,1 - .long 2,2, 2,2 --.previous -+.asciz "Montgomery Multiplication with scatter/gather for x86_64, CRYPTOGAMS by " - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -index 90c56d9e5..df6bf11a2 100644 ---- a/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -+++ b/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl -@@ -599,7 +599,6 @@ sub S0222 { my $i=shift; $i=@SBOX[$i]; $i=($i<<1|$i>>7)&0xff; $i=$i<<16|$i<<8|$i - sub S3033 { my $i=shift; $i=@SBOX[$i]; $i=($i>>1|$i<<7)&0xff; $i=$i<<24|$i<<8|$i; sprintf("0x%08x",$i); } - - $code.=<<___; --.rodata - .align 64 - .LCamellia_SIGMA: - .long 0x3bcc908b, 0xa09e667f, 0x4caa73b2, 0xb67ae858 -@@ -625,7 +624,6 @@ $_ivp="40(%rsp)"; - $_rsp="48(%rsp)"; - - $code.=<<___; --.previous - .globl Camellia_cbc_encrypt - .type Camellia_cbc_encrypt,\@function,6 - .align 16 -@@ -859,6 +857,8 @@ Camellia_cbc_encrypt: - .Lcbc_abort: - ret - .size Camellia_cbc_encrypt,.-Camellia_cbc_encrypt -+ -+.asciz "Camellia for x86_64 by " - ___ - } - -diff --git a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -index 3ae8629cb..38d779edb 100644 ---- a/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -+++ b/src/lib/libcrypto/modes/asm/ghash-x86_64.pl -@@ -622,7 +622,6 @@ ___ - } - - $code.=<<___; --.rodata - .align 64 - .Lbswap_mask: - .byte 15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0 -@@ -669,8 +668,9 @@ $code.=<<___; - .value 0xA7D0,0xA612,0xA454,0xA596,0xA0D8,0xA11A,0xA35C,0xA29E - .value 0xB5E0,0xB422,0xB664,0xB7A6,0xB2E8,0xB32A,0xB16C,0xB0AE - .value 0xBBF0,0xBA32,0xB874,0xB9B6,0xBCF8,0xBD3A,0xBF7C,0xBEBE -+ -+.asciz "GHASH for x86_64, CRYPTOGAMS by " - .align 64 --.previous - ___ - - # EXCEPTION_DISPOSITION handler (EXCEPTION_RECORD *rec,ULONG64 frame, -diff --git a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -index 0abbbab6b..cc8ef5337 100755 ---- a/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha1-x86_64.pl -@@ -1071,7 +1071,6 @@ $code.=<<___; - ___ - } - $code.=<<___; --.rodata - .align 64 - K_XX_XX: - .long 0x5a827999,0x5a827999,0x5a827999,0x5a827999 # K_00_19 -@@ -1079,10 +1078,10 @@ K_XX_XX: - .long 0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc,0x8f1bbcdc # K_40_59 - .long 0xca62c1d6,0xca62c1d6,0xca62c1d6,0xca62c1d6 # K_60_79 - .long 0x00010203,0x04050607,0x08090a0b,0x0c0d0e0f # pbswap mask --.previous - ___ - }}} - $code.=<<___; -+.asciz "SHA1 block transform for x86_64, CRYPTOGAMS by " - .align 64 - ___ - -diff --git a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -index 6698b1d40..bc4b2e748 100755 ---- a/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -+++ b/src/lib/libcrypto/sha/asm/sha512-x86_64.pl -@@ -269,7 +269,6 @@ ___ - - if ($SZ==4) { - $code.=<<___; --.rodata - .align 64 - .type $TABLE,\@object - $TABLE: -@@ -289,11 +288,9 @@ $TABLE: - .long 0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3 - .long 0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208 - .long 0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2 --.previous - ___ - } else { - $code.=<<___; --.rodata - .align 64 - .type $TABLE,\@object - $TABLE: -@@ -337,7 +334,6 @@ $TABLE: - .quad 0x3c9ebe0a15c9bebc,0x431d67c49c100d4c - .quad 0x4cc5d4becb3e42b6,0x597f299cfc657e2a - .quad 0x5fcb6fab3ad6faec,0x6c44198c4a475817 --.previous - ___ - } - -diff --git a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -index 510a74b91..afadd5d2f 100644 ---- a/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -+++ b/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl -@@ -204,7 +204,6 @@ $code.=<<___; - ret - .size $func,.-$func - --.rodata - .align 64 - .type $table,\@object - $table: --- -2.42.0 - diff --git a/patches/asm/0005-Revert-aesni-endbr64.patch b/patches/asm/0005-Revert-aesni-endbr64.patch deleted file mode 100644 index f2094e6821..0000000000 --- a/patches/asm/0005-Revert-aesni-endbr64.patch +++ /dev/null @@ -1,20 +0,0 @@ -commit ac992937b461479b41f7f65e79646ef0a715f95d -Author: Brent Cook -Date: Thu Nov 9 12:29:33 2023 -0600 - - Revert "aesni_ctr32_encrypt_blocks() is called indirectly from C code, so it" - - This reverts commit 52f96c842e82486510ffc2513e71323b70242f28. - -diff --git a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -index 07d40a84a..c261a3795 100644 ---- a/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -+++ b/src/lib/libcrypto/aes/asm/aesni-x86_64.pl -@@ -1025,7 +1025,6 @@ $code.=<<___; - .type aesni_ctr32_encrypt_blocks,\@function,5 - .align 16 - aesni_ctr32_encrypt_blocks: -- endbr64 - lea (%rsp),%rax - push %rbp - sub \$$frame_size,%rsp diff --git a/patches/asm/endbr64.patch b/patches/asm/endbr64.patch new file mode 100644 index 0000000000..05cf0eb97b --- /dev/null +++ b/patches/asm/endbr64.patch @@ -0,0 +1,1215 @@ +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 tb + +Index: x86_64cpuid.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/x86_64cpuid.pl,v +diff -u -p -r1.15 x86_64cpuid.pl +--- x86_64cpuid.pl 25 Apr 2023 04:42:25 -0000 1.15 ++++ x86_64cpuid.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: aes/asm/aes-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/aes/asm/aes-x86_64.pl,v +diff -u -p -r1.12 aes-x86_64.pl +--- aes/asm/aes-x86_64.pl 25 Apr 2023 04:42:25 -0000 1.12 ++++ aes/asm/aes-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: aes/asm/aesni-sha1-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/aes/asm/aesni-sha1-x86_64.pl,v +diff -u -p -r1.8 aesni-sha1-x86_64.pl +--- aes/asm/aesni-sha1-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.8 ++++ aes/asm/aesni-sha1-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: aes/asm/aesni-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/aes/asm/aesni-x86_64.pl,v +diff -u -p -r1.12 aesni-x86_64.pl +--- aes/asm/aesni-x86_64.pl 18 Sep 2023 22:38:16 -0000 1.12 ++++ aes/asm/aesni-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: aes/asm/bsaes-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/aes/asm/bsaes-x86_64.pl,v +diff -u -p -r1.6 bsaes-x86_64.pl +--- aes/asm/bsaes-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.6 ++++ aes/asm/bsaes-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: aes/asm/vpaes-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/aes/asm/vpaes-x86_64.pl,v +diff -u -p -r1.5 vpaes-x86_64.pl +--- aes/asm/vpaes-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.5 ++++ aes/asm/vpaes-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: bn/s2n_bignum_internal.h +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/s2n_bignum_internal.h,v +diff -u -p -r1.2 s2n_bignum_internal.h +--- bn/s2n_bignum_internal.h 21 Jan 2023 15:53:54 -0000 1.2 ++++ bn/s2n_bignum_internal.h 3 Dec 2023 20:22:18 -0000 +@@ -18,6 +18,12 @@ + # define S2N_BN_SYMBOL(name) name + #endif + ++#ifdef __CET__ ++# include ++#else ++# define _CET_ENDBR ++#endif ++ + #define S2N_BN_SYM_VISIBILITY_DIRECTIVE(name) .globl S2N_BN_SYMBOL(name) + #ifdef S2N_BN_HIDE_SYMBOLS + # ifdef __APPLE__ +Index: bn/arch/amd64/bignum_add.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_add.S,v +diff -u -p -r1.4 bignum_add.S +--- bn/arch/amd64/bignum_add.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_add.S 3 Dec 2023 20:18:30 -0000 +@@ -49,7 +49,7 @@ + + + S2N_BN_SYMBOL(bignum_add): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_cmadd.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_cmadd.S,v +diff -u -p -r1.4 bignum_cmadd.S +--- bn/arch/amd64/bignum_cmadd.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_cmadd.S 3 Dec 2023 20:18:30 -0000 +@@ -54,7 +54,7 @@ + + + S2N_BN_SYMBOL(bignum_cmadd): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_cmul.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_cmul.S,v +diff -u -p -r1.4 bignum_cmul.S +--- bn/arch/amd64/bignum_cmul.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_cmul.S 3 Dec 2023 20:18:30 -0000 +@@ -51,7 +51,7 @@ + + + S2N_BN_SYMBOL(bignum_cmul): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_mul.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul.S,v +diff -u -p -r1.4 bignum_mul.S +--- bn/arch/amd64/bignum_mul.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_mul.S 3 Dec 2023 20:18:30 -0000 +@@ -59,7 +59,7 @@ + + + S2N_BN_SYMBOL(bignum_mul): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_mul_4_8_alt.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul_4_8_alt.S,v +diff -u -p -r1.4 bignum_mul_4_8_alt.S +--- bn/arch/amd64/bignum_mul_4_8_alt.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_mul_4_8_alt.S 3 Dec 2023 20:18:30 -0000 +@@ -72,7 +72,7 @@ + adc h, rdx + + S2N_BN_SYMBOL(bignum_mul_4_8_alt): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_mul_8_16_alt.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_mul_8_16_alt.S,v +diff -u -p -r1.4 bignum_mul_8_16_alt.S +--- bn/arch/amd64/bignum_mul_8_16_alt.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_mul_8_16_alt.S 3 Dec 2023 20:18:30 -0000 +@@ -72,7 +72,7 @@ + adc h, rdx + + S2N_BN_SYMBOL(bignum_mul_8_16_alt): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_sqr.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr.S,v +diff -u -p -r1.4 bignum_sqr.S +--- bn/arch/amd64/bignum_sqr.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_sqr.S 3 Dec 2023 20:18:30 -0000 +@@ -62,7 +62,7 @@ + #define llshort ebp + + S2N_BN_SYMBOL(bignum_sqr): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_sqr_4_8_alt.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_4_8_alt.S,v +diff -u -p -r1.4 bignum_sqr_4_8_alt.S +--- bn/arch/amd64/bignum_sqr_4_8_alt.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_sqr_4_8_alt.S 3 Dec 2023 20:18:30 -0000 +@@ -71,7 +71,7 @@ + adc c, 0 + + S2N_BN_SYMBOL(bignum_sqr_4_8_alt): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_sqr_8_16_alt.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sqr_8_16_alt.S,v +diff -u -p -r1.4 bignum_sqr_8_16_alt.S +--- bn/arch/amd64/bignum_sqr_8_16_alt.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_sqr_8_16_alt.S 3 Dec 2023 20:18:30 -0000 +@@ -103,7 +103,7 @@ + adc c, 0 + + S2N_BN_SYMBOL(bignum_sqr_8_16_alt): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/bignum_sub.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/bignum_sub.S,v +diff -u -p -r1.4 bignum_sub.S +--- bn/arch/amd64/bignum_sub.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/bignum_sub.S 3 Dec 2023 20:18:30 -0000 +@@ -49,7 +49,7 @@ + + + S2N_BN_SYMBOL(bignum_sub): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/arch/amd64/word_clz.S +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/arch/amd64/word_clz.S,v +diff -u -p -r1.4 word_clz.S +--- bn/arch/amd64/word_clz.S 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/arch/amd64/word_clz.S 3 Dec 2023 20:18:30 -0000 +@@ -30,7 +30,7 @@ + .text + + S2N_BN_SYMBOL(word_clz): +- endbr64 ++ _CET_ENDBR + + #if WINDOWS_ABI + push rdi +Index: bn/asm/modexp512-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/asm/modexp512-x86_64.pl,v +diff -u -p -r1.4 modexp512-x86_64.pl +--- bn/asm/modexp512-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.4 ++++ bn/asm/modexp512-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: bn/asm/x86_64-mont.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/asm/x86_64-mont.pl,v +diff -u -p -r1.5 x86_64-mont.pl +--- bn/asm/x86_64-mont.pl 25 Apr 2023 04:42:26 -0000 1.5 ++++ bn/asm/x86_64-mont.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: bn/asm/x86_64-mont5.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/bn/asm/x86_64-mont5.pl,v +diff -u -p -r1.8 x86_64-mont5.pl +--- bn/asm/x86_64-mont5.pl 25 Apr 2023 04:42:26 -0000 1.8 ++++ bn/asm/x86_64-mont5.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: camellia/asm/cmll-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/camellia/asm/cmll-x86_64.pl,v +diff -u -p -r1.7 cmll-x86_64.pl +--- camellia/asm/cmll-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7 ++++ camellia/asm/cmll-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: md5/asm/md5-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/md5/asm/md5-x86_64.pl,v +diff -u -p -r1.3 md5-x86_64.pl +--- md5/asm/md5-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.3 ++++ md5/asm/md5-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -128,7 +128,7 @@ $code .= < ++#else ++#define _CET_ENDBR ++#endif ++ ++___ ++} ++ + print "#include \"x86_arch.h\"\n"; + + while($line=<>) { +Index: rc4/asm/rc4-md5-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/rc4/asm/rc4-md5-x86_64.pl,v +diff -u -p -r1.4 rc4-md5-x86_64.pl +--- rc4/asm/rc4-md5-x86_64.pl 28 Jul 2023 10:35:14 -0000 1.4 ++++ rc4/asm/rc4-md5-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: rc4/asm/rc4-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/rc4/asm/rc4-x86_64.pl,v +diff -u -p -r1.16 rc4-x86_64.pl +--- rc4/asm/rc4-x86_64.pl 28 Jul 2023 10:35:14 -0000 1.16 ++++ rc4/asm/rc4-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: sha/asm/sha1-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/sha/asm/sha1-x86_64.pl,v +diff -u -p -r1.7 sha1-x86_64.pl +--- sha/asm/sha1-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7 ++++ sha/asm/sha1-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -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 +Index: sha/asm/sha512-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/sha/asm/sha512-x86_64.pl,v +diff -u -p -r1.7 sha512-x86_64.pl +--- sha/asm/sha512-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.7 ++++ sha/asm/sha512-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -175,7 +175,7 @@ $code=<<___; + .type $func,\@function,4 + .align 16 + $func: +- endbr64 ++ _CET_ENDBR + push %rbx + push %rbp + push %r12 +Index: whrlpool/asm/wp-x86_64.pl +=================================================================== +RCS file: /cvs/src/lib/libcrypto/whrlpool/asm/wp-x86_64.pl,v +diff -u -p -r1.5 wp-x86_64.pl +--- whrlpool/asm/wp-x86_64.pl 25 Apr 2023 04:42:26 -0000 1.5 ++++ whrlpool/asm/wp-x86_64.pl 3 Dec 2023 20:18:30 -0000 +@@ -57,7 +57,7 @@ $code=<<___; + .type $func,\@function,3 + .align 16 + $func: +- endbr64 ++ _CET_ENDBR + push %rbx + push %rbp + push %r12 diff --git a/patches/asm/masm-align-64.patch b/patches/asm/masm-align-64.patch new file mode 100644 index 0000000000..ba41c71024 --- /dev/null +++ b/patches/asm/masm-align-64.patch @@ -0,0 +1,30 @@ +commit 3797e05de28ab07bb522898cbf022bdf67a71c99 +Author: Brent Cook +Date: Sun Feb 4 22:53:59 2024 -0600 + + align read-only sections on masm/windows to 64 bytes + + Avoid conflicts where alignment is specified later in the underlying + assembly. + +diff --git a/src/lib/libcrypto/perlasm/x86_64-xlate.pl b/src/lib/libcrypto/perlasm/x86_64-xlate.pl +index 5dbed2a8c..d8b607b5c 100755 +--- a/src/lib/libcrypto/perlasm/x86_64-xlate.pl ++++ b/src/lib/libcrypto/perlasm/x86_64-xlate.pl +@@ -567,7 +567,15 @@ my %globals; + $v.="$line\tSEGMENT"; + if ($line=~/\.([prx])data/) { + $v.=" READONLY"; +- $v.=" ALIGN(".($1 eq "p" ? 4 : 8).")" if ($masm>=$masmref); ++ if ($masm>=$masmref) { ++ if ($1 eq "r") { ++ $v.=" ALIGN(64)"; ++ } elsif ($1 eq "p") { ++ $v.=" ALIGN(4)"; ++ } else { ++ $v.=" ALIGN(8)"; ++ } ++ } + } elsif ($line=~/\.CRT\$/i) { + $v.=" READONLY "; + $v.=$masm>=$masmref ? "ALIGN(8)" : "DWORD"; diff --git a/tap-driver.sh b/tap-driver.sh deleted file mode 100755 index 1e444b2a6a..0000000000 --- a/tap-driver.sh +++ /dev/null @@ -1,650 +0,0 @@ -#! /bin/sh -# Copyright (C) 2011-2021 Free Software Foundation, Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -# As a special exception to the GNU General Public License, if you -# distribute this file as part of a program that contains a -# configuration script generated by Autoconf, you may include it under -# the same distribution terms that you use for the rest of that program. - -# This file is maintained in Automake, please report -# bugs to or send patches to -# . - -scriptversion=2013-12-23.17; # UTC - -# Make unconditional expansion of undefined variables an error. This -# helps a lot in preventing typo-related bugs. -set -u - -me=tap-driver.sh - -fatal () -{ - echo "$me: fatal: $*" >&2 - exit 1 -} - -usage_error () -{ - echo "$me: $*" >&2 - print_usage >&2 - exit 2 -} - -print_usage () -{ - cat < - trap : 1 3 2 13 15 - if test $merge -gt 0; then - exec 2>&1 - else - exec 2>&3 - fi - "$@" - echo $? - ) | LC_ALL=C ${AM_TAP_AWK-awk} \ - -v me="$me" \ - -v test_script_name="$test_name" \ - -v log_file="$log_file" \ - -v trs_file="$trs_file" \ - -v expect_failure="$expect_failure" \ - -v merge="$merge" \ - -v ignore_exit="$ignore_exit" \ - -v comments="$comments" \ - -v diag_string="$diag_string" \ -' -# TODO: the usages of "cat >&3" below could be optimized when using -# GNU awk, and/on on systems that supports /dev/fd/. - -# Implementation note: in what follows, `result_obj` will be an -# associative array that (partly) simulates a TAP result object -# from the `TAP::Parser` perl module. - -## ----------- ## -## FUNCTIONS ## -## ----------- ## - -function fatal(msg) -{ - print me ": " msg | "cat >&2" - exit 1 -} - -function abort(where) -{ - fatal("internal error " where) -} - -# Convert a boolean to a "yes"/"no" string. -function yn(bool) -{ - return bool ? "yes" : "no"; -} - -function add_test_result(result) -{ - if (!test_results_index) - test_results_index = 0 - test_results_list[test_results_index] = result - test_results_index += 1 - test_results_seen[result] = 1; -} - -# Whether the test script should be re-run by "make recheck". -function must_recheck() -{ - for (k in test_results_seen) - if (k != "XFAIL" && k != "PASS" && k != "SKIP") - return 1 - return 0 -} - -# Whether the content of the log file associated to this test should -# be copied into the "global" test-suite.log. -function copy_in_global_log() -{ - for (k in test_results_seen) - if (k != "PASS") - return 1 - return 0 -} - -function get_global_test_result() -{ - if ("ERROR" in test_results_seen) - return "ERROR" - if ("FAIL" in test_results_seen || "XPASS" in test_results_seen) - return "FAIL" - all_skipped = 1 - for (k in test_results_seen) - if (k != "SKIP") - all_skipped = 0 - if (all_skipped) - return "SKIP" - return "PASS"; -} - -function stringify_result_obj(result_obj) -{ - if (result_obj["is_unplanned"] || result_obj["number"] != testno) - return "ERROR" - - if (plan_seen == LATE_PLAN) - return "ERROR" - - if (result_obj["directive"] == "TODO") - return result_obj["is_ok"] ? "XPASS" : "XFAIL" - - if (result_obj["directive"] == "SKIP") - return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL; - - if (length(result_obj["directive"])) - abort("in function stringify_result_obj()") - - return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL -} - -function decorate_result(result) -{ - color_name = color_for_result[result] - if (color_name) - return color_map[color_name] "" result "" color_map["std"] - # If we are not using colorized output, or if we do not know how - # to colorize the given result, we should return it unchanged. - return result -} - -function report(result, details) -{ - if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/) - { - msg = ": " test_script_name - add_test_result(result) - } - else if (result == "#") - { - msg = " " test_script_name ":" - } - else - { - abort("in function report()") - } - if (length(details)) - msg = msg " " details - # Output on console might be colorized. - print decorate_result(result) msg - # Log the result in the log file too, to help debugging (this is - # especially true when said result is a TAP error or "Bail out!"). - print result msg | "cat >&3"; -} - -function testsuite_error(error_message) -{ - report("ERROR", "- " error_message) -} - -function handle_tap_result() -{ - details = result_obj["number"]; - if (length(result_obj["description"])) - details = details " " result_obj["description"] - - if (plan_seen == LATE_PLAN) - { - details = details " # AFTER LATE PLAN"; - } - else if (result_obj["is_unplanned"]) - { - details = details " # UNPLANNED"; - } - else if (result_obj["number"] != testno) - { - details = sprintf("%s # OUT-OF-ORDER (expecting %d)", - details, testno); - } - else if (result_obj["directive"]) - { - details = details " # " result_obj["directive"]; - if (length(result_obj["explanation"])) - details = details " " result_obj["explanation"] - } - - report(stringify_result_obj(result_obj), details) -} - -# `skip_reason` should be empty whenever planned > 0. -function handle_tap_plan(planned, skip_reason) -{ - planned += 0 # Avoid getting confused if, say, `planned` is "00" - if (length(skip_reason) && planned > 0) - abort("in function handle_tap_plan()") - if (plan_seen) - { - # Error, only one plan per stream is acceptable. - testsuite_error("multiple test plans") - return; - } - planned_tests = planned - # The TAP plan can come before or after *all* the TAP results; we speak - # respectively of an "early" or a "late" plan. If we see the plan line - # after at least one TAP result has been seen, assume we have a late - # plan; in this case, any further test result seen after the plan will - # be flagged as an error. - plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN) - # If testno > 0, we have an error ("too many tests run") that will be - # automatically dealt with later, so do not worry about it here. If - # $plan_seen is true, we have an error due to a repeated plan, and that - # has already been dealt with above. Otherwise, we have a valid "plan - # with SKIP" specification, and should report it as a particular kind - # of SKIP result. - if (planned == 0 && testno == 0) - { - if (length(skip_reason)) - skip_reason = "- " skip_reason; - report("SKIP", skip_reason); - } -} - -function extract_tap_comment(line) -{ - if (index(line, diag_string) == 1) - { - # Strip leading `diag_string` from `line`. - line = substr(line, length(diag_string) + 1) - # And strip any leading and trailing whitespace left. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - # Return what is left (if any). - return line; - } - return ""; -} - -# When this function is called, we know that line is a TAP result line, -# so that it matches the (perl) RE "^(not )?ok\b". -function setup_result_obj(line) -{ - # Get the result, and remove it from the line. - result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0) - sub("^(not )?ok[ \t]*", "", line) - - # If the result has an explicit number, get it and strip it; otherwise, - # automatically assign the next test number to it. - if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/) - { - match(line, "^[0-9]+") - # The final `+ 0` is to normalize numbers with leading zeros. - result_obj["number"] = substr(line, 1, RLENGTH) + 0 - line = substr(line, RLENGTH + 1) - } - else - { - result_obj["number"] = testno - } - - if (plan_seen == LATE_PLAN) - # No further test results are acceptable after a "late" TAP plan - # has been seen. - result_obj["is_unplanned"] = 1 - else if (plan_seen && testno > planned_tests) - result_obj["is_unplanned"] = 1 - else - result_obj["is_unplanned"] = 0 - - # Strip trailing and leading whitespace. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - - # This will have to be corrected if we have a "TODO"/"SKIP" directive. - result_obj["description"] = line - result_obj["directive"] = "" - result_obj["explanation"] = "" - - if (index(line, "#") == 0) - return # No possible directive, nothing more to do. - - # Directives are case-insensitive. - rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*" - - # See whether we have the directive, and if yes, where. - pos = match(line, rx "$") - if (!pos) - pos = match(line, rx "[^a-zA-Z0-9_]") - - # If there was no TAP directive, we have nothing more to do. - if (!pos) - return - - # Let`s now see if the TAP directive has been escaped. For example: - # escaped: ok \# SKIP - # not escaped: ok \\# SKIP - # escaped: ok \\\\\# SKIP - # not escaped: ok \ # SKIP - if (substr(line, pos, 1) == "#") - { - bslash_count = 0 - for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--) - bslash_count += 1 - if (bslash_count % 2) - return # Directive was escaped. - } - - # Strip the directive and its explanation (if any) from the test - # description. - result_obj["description"] = substr(line, 1, pos - 1) - # Now remove the test description from the line, that has been dealt - # with already. - line = substr(line, pos) - # Strip the directive, and save its value (normalized to upper case). - sub("^[ \t]*#[ \t]*", "", line) - result_obj["directive"] = toupper(substr(line, 1, 4)) - line = substr(line, 5) - # Now get the explanation for the directive (if any), with leading - # and trailing whitespace removed. - sub("^[ \t]*", "", line) - sub("[ \t]*$", "", line) - result_obj["explanation"] = line -} - -function get_test_exit_message(status) -{ - if (status == 0) - return "" - if (status !~ /^[1-9][0-9]*$/) - abort("getting exit status") - if (status < 127) - exit_details = "" - else if (status == 127) - exit_details = " (command not found?)" - else if (status >= 128 && status <= 255) - exit_details = sprintf(" (terminated by signal %d?)", status - 128) - else if (status > 256 && status <= 384) - # We used to report an "abnormal termination" here, but some Korn - # shells, when a child process die due to signal number n, can leave - # in $? an exit status of 256+n instead of the more standard 128+n. - # Apparently, both behaviours are allowed by POSIX (2008), so be - # prepared to handle them both. See also Austing Group report ID - # 0000051 - exit_details = sprintf(" (terminated by signal %d?)", status - 256) - else - # Never seen in practice. - exit_details = " (abnormal termination)" - return sprintf("exited with status %d%s", status, exit_details) -} - -function write_test_results() -{ - print ":global-test-result: " get_global_test_result() > trs_file - print ":recheck: " yn(must_recheck()) > trs_file - print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file - for (i = 0; i < test_results_index; i += 1) - print ":test-result: " test_results_list[i] > trs_file - close(trs_file); -} - -BEGIN { - -## ------- ## -## SETUP ## -## ------- ## - -'"$init_colors"' - -# Properly initialized once the TAP plan is seen. -planned_tests = 0 - -COOKED_PASS = expect_failure ? "XPASS": "PASS"; -COOKED_FAIL = expect_failure ? "XFAIL": "FAIL"; - -# Enumeration-like constants to remember which kind of plan (if any) -# has been seen. It is important that NO_PLAN evaluates "false" as -# a boolean. -NO_PLAN = 0 -EARLY_PLAN = 1 -LATE_PLAN = 2 - -testno = 0 # Number of test results seen so far. -bailed_out = 0 # Whether a "Bail out!" directive has been seen. - -# Whether the TAP plan has been seen or not, and if yes, which kind -# it is ("early" is seen before any test result, "late" otherwise). -plan_seen = NO_PLAN - -## --------- ## -## PARSING ## -## --------- ## - -is_first_read = 1 - -while (1) - { - # Involutions required so that we are able to read the exit status - # from the last input line. - st = getline - if (st < 0) # I/O error. - fatal("I/O error while reading from input stream") - else if (st == 0) # End-of-input - { - if (is_first_read) - abort("in input loop: only one input line") - break - } - if (is_first_read) - { - is_first_read = 0 - nextline = $0 - continue - } - else - { - curline = nextline - nextline = $0 - $0 = curline - } - # Copy any input line verbatim into the log file. - print | "cat >&3" - # Parsing of TAP input should stop after a "Bail out!" directive. - if (bailed_out) - continue - - # TAP test result. - if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/) - { - testno += 1 - setup_result_obj($0) - handle_tap_result() - } - # TAP plan (normal or "SKIP" without explanation). - else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/) - { - # The next two lines will put the number of planned tests in $0. - sub("^1\\.\\.", "") - sub("[^0-9]*$", "") - handle_tap_plan($0, "") - continue - } - # TAP "SKIP" plan, with an explanation. - else if ($0 ~ /^1\.\.0+[ \t]*#/) - { - # The next lines will put the skip explanation in $0, stripping - # any leading and trailing whitespace. This is a little more - # tricky in truth, since we want to also strip a potential leading - # "SKIP" string from the message. - sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "") - sub("[ \t]*$", ""); - handle_tap_plan(0, $0) - } - # "Bail out!" magic. - # Older versions of prove and TAP::Harness (e.g., 3.17) did not - # recognize a "Bail out!" directive when preceded by leading - # whitespace, but more modern versions (e.g., 3.23) do. So we - # emulate the latter, "more modern" behaviour. - else if ($0 ~ /^[ \t]*Bail out!/) - { - bailed_out = 1 - # Get the bailout message (if any), with leading and trailing - # whitespace stripped. The message remains stored in `$0`. - sub("^[ \t]*Bail out![ \t]*", ""); - sub("[ \t]*$", ""); - # Format the error message for the - bailout_message = "Bail out!" - if (length($0)) - bailout_message = bailout_message " " $0 - testsuite_error(bailout_message) - } - # Maybe we have too look for dianogtic comments too. - else if (comments != 0) - { - comment = extract_tap_comment($0); - if (length(comment)) - report("#", comment); - } - } - -## -------- ## -## FINISH ## -## -------- ## - -# A "Bail out!" directive should cause us to ignore any following TAP -# error, as well as a non-zero exit status from the TAP producer. -if (!bailed_out) - { - if (!plan_seen) - { - testsuite_error("missing test plan") - } - else if (planned_tests != testno) - { - bad_amount = testno > planned_tests ? "many" : "few" - testsuite_error(sprintf("too %s tests run (expected %d, got %d)", - bad_amount, planned_tests, testno)) - } - if (!ignore_exit) - { - # Fetch exit status from the last line. - exit_message = get_test_exit_message(nextline) - if (exit_message) - testsuite_error(exit_message) - } - } - -write_test_results() - -exit 0 - -} # End of "BEGIN" block. -' - -# TODO: document that we consume the file descriptor 3 :-( -} 3>"$log_file" - -test $? -eq 0 || fatal "I/O or internal error" - -# Local Variables: -# mode: shell-script -# sh-indentation: 2 -# eval: (add-hook 'before-save-hook 'time-stamp) -# time-stamp-start: "scriptversion=" -# time-stamp-format: "%:y-%02m-%02d.%02H" -# time-stamp-time-zone: "UTC0" -# time-stamp-end: "; # UTC" -# End: diff --git a/tests/testenc.bat b/tests/testenc.bat index 93dfc0c8b3..84f48f2a3f 100644 --- a/tests/testenc.bat +++ b/tests/testenc.bat @@ -2,32 +2,35 @@ setlocal enabledelayedexpansion REM testenc.bat -set test=p +set test=P set openssl_bin=%1 set openssl_bin=%openssl_bin:/=\% if not exist %openssl_bin% exit /b 1 +echo copy %srcdir%\openssl.cnf %test% copy %srcdir%\openssl.cnf %test% echo cat -%openssl_bin% enc -in %test% -out %test%.cipher -%openssl_bin% enc -in %test%.cipher -out %test%.clear -fc /b %test% %test%.clear +echo %openssl_bin% enc -in %test% -out %test%.CIPHER +%openssl_bin% enc -in %test% -out %test%.CIPHER +%openssl_bin% enc -in %test%.CIPHER -out %test%.CLEAR +fc /b %test% %test%.CLEAR if !errorlevel! neq 0 ( exit /b 1 ) else ( - del %test%.cipher %test%.clear + del %test%.CIPHER %test%.CLEAR ) echo base64 -%openssl_bin% enc -a -e -in %test% -out %test%.cipher -%openssl_bin% enc -a -d -in %test%.cipher -out %test%.clear -fc /b %test% %test%.clear +%openssl_bin% enc -a -e -in %test% -out %test%.CIPHER +%openssl_bin% enc -a -d -in %test%.CIPHER -out %test%.CLEAR +dir +fc /b %test% %test%.CLEAR if !errorlevel! neq 0 ( exit /b 1 ) else ( - del %test%.cipher %test%.clear + del %test%.CIPHER %test%.CLEAR ) for %%i in ( @@ -45,23 +48,23 @@ for %%i in ( rc4 rc4-40 ) do ( echo %%i - %openssl_bin% %%i -e -k test -in %test% -out %test%.%%i.cipher - %openssl_bin% %%i -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear - fc /b %test% %test%.%%i.clear + %openssl_bin% %%i -e -k test -in %test% -out %test%.%%i.CIPHER + %openssl_bin% %%i -d -k test -in %test%.%%i.CIPHER -out %test%.%%i.CLEAR + fc /b %test% %test%.%%i.CLEAR if !errorlevel! neq 0 ( exit /b 1 ) else ( - del %test%.%%i.cipher %test%.%%i.clear + del %test%.%%i.CIPHER %test%.%%i.CLEAR ) echo %%i base64 - %openssl_bin% %%i -a -e -k test -in %test% -out %test%.%%i.cipher - %openssl_bin% %%i -a -d -k test -in %test%.%%i.cipher -out %test%.%%i.clear - fc /b %test% %test%.%%i.clear + %openssl_bin% %%i -a -e -k test -in %test% -out %test%.%%i.CIPHER + %openssl_bin% %%i -a -d -k test -in %test%.%%i.CIPHER -out %test%.%%i.CLEAR + fc /b %test% %test%.%%i.CLEAR if !errorlevel! neq 0 ( exit /b 1 ) else ( - del %test%.%%i.cipher %test%.%%i.clear + del %test%.%%i.CIPHER %test%.%%i.CLEAR ) ) diff --git a/update.sh b/update.sh index 1f2d78b529..70a6ee6873 100755 --- a/update.sh +++ b/update.sh @@ -197,18 +197,6 @@ fixup_masm() { # generate assembly crypto algorithms asm_src=$CWD/asm -setup_asm_generator() { - rm -fr $asm_src - cp -a $libcrypto_src $asm_src -} - -setup_asm_generator_patched() { - setup_asm_generator - for i in `ls -1 patches/asm/*.patch | sort -n`; do - patch -d $asm_src -p 4 < $i 1> /dev/null 2>/dev/null ; - done -} - gen_asm_stdout() { CC=true perl $asm_src/$2 $1 > crypto/$3.tmp [ $1 = "elf" ] && cat <<-EOF >> crypto/$3.tmp @@ -249,6 +237,13 @@ gen_asm() { fi } +setup_asm_generator() { + rm -fr $asm_src + cp -a $libcrypto_src $asm_src + patch -d $asm_src -p0 < patches/asm/endbr64.patch + patch -d $asm_src -p4 < patches/asm/masm-align-64.patch +} + setup_asm_generator echo generating mips ASM source for elf @@ -281,13 +276,6 @@ $CP $libcrypto_src/arch/arm/arm_arch.h crypto for abi in elf macosx masm mingw64; do echo generating x86_64 ASM source for $abi - # use patched generators for non-elf targets - if [ $abi = "elf" ]; then - setup_asm_generator - else - setup_asm_generator_patched - fi - gen_asm_stdout $abi aes/asm/aes-x86_64.pl aes/aes-$abi-x86_64.S gen_asm_stdout $abi aes/asm/vpaes-x86_64.pl aes/vpaes-$abi-x86_64.S gen_asm_stdout $abi aes/asm/bsaes-x86_64.pl aes/bsaes-$abi-x86_64.S