Intel CET patch - also add CFI fixes to sync with upstream

This commit is contained in:
Tomas Mraz 2020-02-17 12:05:57 +01:00
parent b9b156fb97
commit c77593a912
1 changed files with 471 additions and 89 deletions

View File

@ -1,7 +1,6 @@
diff --git a/crypto/aes/asm/aesni-x86_64.pl b/crypto/aes/asm/aesni-x86_64.pl
index 5807f4eff7..2462820f95 100644
--- a/crypto/aes/asm/aesni-x86_64.pl
+++ b/crypto/aes/asm/aesni-x86_64.pl
diff -up openssl-1.1.1d/crypto/aes/asm/aesni-x86_64.pl.intel-cet openssl-1.1.1d/crypto/aes/asm/aesni-x86_64.pl
--- openssl-1.1.1d/crypto/aes/asm/aesni-x86_64.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/aes/asm/aesni-x86_64.pl 2020-02-17 12:00:19.011235601 +0100
@@ -275,6 +275,7 @@ $code.=<<___;
.align 16
${PREFIX}_encrypt:
@ -26,23 +25,41 @@ index 5807f4eff7..2462820f95 100644
___
$code.=<<___ if ($win64);
lea -0x58(%rsp),%rsp
@@ -985,6 +988,7 @@ $code.=<<___;
@@ -984,6 +987,8 @@ $code.=<<___;
.type aesni_ccm64_encrypt_blocks,\@function,6
.align 16
aesni_ccm64_encrypt_blocks:
.cfi_startproc
+.cfi_startproc
+ endbranch
___
$code.=<<___ if ($win64);
lea -0x58(%rsp),%rsp
@@ -1077,6 +1081,7 @@ $code.=<<___;
@@ -1066,6 +1071,7 @@ $code.=<<___ if ($win64);
___
$code.=<<___;
ret
+.cfi_endproc
.size aesni_ccm64_encrypt_blocks,.-aesni_ccm64_encrypt_blocks
___
######################################################################
@@ -1074,6 +1080,8 @@ $code.=<<___;
.type aesni_ccm64_decrypt_blocks,\@function,6
.align 16
aesni_ccm64_decrypt_blocks:
.cfi_startproc
+.cfi_startproc
+ endbranch
___
$code.=<<___ if ($win64);
lea -0x58(%rsp),%rsp
@@ -1203,6 +1208,7 @@ $code.=<<___;
@@ -1173,6 +1181,7 @@ $code.=<<___ if ($win64);
___
$code.=<<___;
ret
+.cfi_endproc
.size aesni_ccm64_decrypt_blocks,.-aesni_ccm64_decrypt_blocks
___
}
@@ -1199,6 +1208,7 @@ $code.=<<___;
.align 16
aesni_ctr32_encrypt_blocks:
.cfi_startproc
@ -50,7 +67,7 @@ index 5807f4eff7..2462820f95 100644
cmp \$1,$len
jne .Lctr32_bulk
@@ -1775,6 +1781,7 @@ $code.=<<___;
@@ -1771,6 +1781,7 @@ $code.=<<___;
.align 16
aesni_xts_encrypt:
.cfi_startproc
@ -58,7 +75,7 @@ index 5807f4eff7..2462820f95 100644
lea (%rsp),%r11 # frame pointer
.cfi_def_cfa_register %r11
push %rbp
@@ -2258,6 +2265,7 @@ $code.=<<___;
@@ -2254,6 +2265,7 @@ $code.=<<___;
.align 16
aesni_xts_decrypt:
.cfi_startproc
@ -66,7 +83,7 @@ index 5807f4eff7..2462820f95 100644
lea (%rsp),%r11 # frame pointer
.cfi_def_cfa_register %r11
push %rbp
@@ -2783,6 +2791,7 @@ $code.=<<___;
@@ -2779,6 +2791,7 @@ $code.=<<___;
.align 32
aesni_ocb_encrypt:
.cfi_startproc
@ -74,7 +91,51 @@ index 5807f4eff7..2462820f95 100644
lea (%rsp),%rax
push %rbx
.cfi_push %rbx
@@ -3249,6 +3258,7 @@ __ocb_encrypt1:
@@ -3031,6 +3044,7 @@ $code.=<<___;
.type __ocb_encrypt6,\@abi-omnipotent
.align 32
__ocb_encrypt6:
+.cfi_startproc
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
movdqu ($L_p,$i1),@offset[1]
movdqa @offset[0],@offset[2]
@@ -3128,11 +3142,13 @@ __ocb_encrypt6:
aesenclast @offset[4],$inout4
aesenclast @offset[5],$inout5
ret
+.cfi_endproc
.size __ocb_encrypt6,.-__ocb_encrypt6
.type __ocb_encrypt4,\@abi-omnipotent
.align 32
__ocb_encrypt4:
+.cfi_startproc
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
movdqu ($L_p,$i1),@offset[1]
movdqa @offset[0],@offset[2]
@@ -3197,11 +3213,13 @@ __ocb_encrypt4:
aesenclast @offset[2],$inout2
aesenclast @offset[3],$inout3
ret
+.cfi_endproc
.size __ocb_encrypt4,.-__ocb_encrypt4
.type __ocb_encrypt1,\@abi-omnipotent
.align 32
__ocb_encrypt1:
+.cfi_startproc
pxor @offset[5],$inout5 # offset_i
pxor $rndkey0l,$inout5 # offset_i ^ round[0]
pxor $inout0,$checksum # accumulate checksum
@@ -3232,6 +3250,7 @@ __ocb_encrypt1:
aesenclast $inout5,$inout0
ret
+.cfi_endproc
.size __ocb_encrypt1,.-__ocb_encrypt1
.globl aesni_ocb_decrypt
@@ -3239,6 +3258,7 @@ __ocb_encrypt1:
.align 32
aesni_ocb_decrypt:
.cfi_startproc
@ -82,7 +143,51 @@ index 5807f4eff7..2462820f95 100644
lea (%rsp),%rax
push %rbx
.cfi_push %rbx
@@ -3737,6 +3747,7 @@ $code.=<<___;
@@ -3513,6 +3533,7 @@ $code.=<<___;
.type __ocb_decrypt6,\@abi-omnipotent
.align 32
__ocb_decrypt6:
+.cfi_startproc
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
movdqu ($L_p,$i1),@offset[1]
movdqa @offset[0],@offset[2]
@@ -3604,11 +3625,13 @@ __ocb_decrypt6:
aesdeclast @offset[4],$inout4
aesdeclast @offset[5],$inout5
ret
+.cfi_endproc
.size __ocb_decrypt6,.-__ocb_decrypt6
.type __ocb_decrypt4,\@abi-omnipotent
.align 32
__ocb_decrypt4:
+.cfi_startproc
pxor $rndkey0l,@offset[5] # offset_i ^ round[0]
movdqu ($L_p,$i1),@offset[1]
movdqa @offset[0],@offset[2]
@@ -3669,11 +3692,13 @@ __ocb_decrypt4:
aesdeclast @offset[2],$inout2
aesdeclast @offset[3],$inout3
ret
+.cfi_endproc
.size __ocb_decrypt4,.-__ocb_decrypt4
.type __ocb_decrypt1,\@abi-omnipotent
.align 32
__ocb_decrypt1:
+.cfi_startproc
pxor @offset[5],$inout5 # offset_i
pxor $rndkey0l,$inout5 # offset_i ^ round[0]
pxor $inout5,$inout0 # input ^ round[0] ^ offset_i
@@ -3703,6 +3728,7 @@ __ocb_decrypt1:
aesdeclast $inout5,$inout0
ret
+.cfi_endproc
.size __ocb_decrypt1,.-__ocb_decrypt1
___
} }}
@@ -3721,6 +3747,7 @@ $code.=<<___;
.align 16
${PREFIX}_cbc_encrypt:
.cfi_startproc
@ -90,10 +195,25 @@ index 5807f4eff7..2462820f95 100644
test $len,$len # check length
jz .Lcbc_ret
diff --git a/crypto/aes/asm/vpaes-x86_64.pl b/crypto/aes/asm/vpaes-x86_64.pl
index 33d293e623..706d9dac14 100644
--- a/crypto/aes/asm/vpaes-x86_64.pl
+++ b/crypto/aes/asm/vpaes-x86_64.pl
@@ -4637,7 +4664,6 @@ __aesni_set_encrypt_key:
add \$8,%rsp
.cfi_adjust_cfa_offset -8
ret
-.cfi_endproc
.LSEH_end_set_encrypt_key:
.align 16
@@ -4708,6 +4734,7 @@ __aesni_set_encrypt_key:
shufps \$0b10101010,%xmm1,%xmm1 # critical path
xorps %xmm1,%xmm2
ret
+.cfi_endproc
.size ${PREFIX}_set_encrypt_key,.-${PREFIX}_set_encrypt_key
.size __aesni_set_encrypt_key,.-__aesni_set_encrypt_key
___
diff -up openssl-1.1.1d/crypto/aes/asm/vpaes-x86_64.pl.intel-cet openssl-1.1.1d/crypto/aes/asm/vpaes-x86_64.pl
--- openssl-1.1.1d/crypto/aes/asm/vpaes-x86_64.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/aes/asm/vpaes-x86_64.pl 2020-02-17 11:55:07.374557249 +0100
@@ -696,6 +696,7 @@ _vpaes_schedule_mangle:
.align 16
${PREFIX}_set_encrypt_key:
@ -134,10 +254,9 @@ index 33d293e623..706d9dac14 100644
xchg $key,$len
___
($len,$key)=($key,$len);
diff --git a/crypto/async/arch/async_posix.c b/crypto/async/arch/async_posix.c
index 95678d4fa6..dfc45bfa05 100644
--- a/crypto/async/arch/async_posix.c
+++ b/crypto/async/arch/async_posix.c
diff -up openssl-1.1.1d/crypto/async/arch/async_posix.c.intel-cet openssl-1.1.1d/crypto/async/arch/async_posix.c
--- openssl-1.1.1d/crypto/async/arch/async_posix.c.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/async/arch/async_posix.c 2020-02-17 11:55:07.374557249 +0100
@@ -34,7 +34,9 @@ void async_local_cleanup(void)
int async_fibre_makecontext(async_fibre *fibre)
@ -148,10 +267,9 @@ index 95678d4fa6..dfc45bfa05 100644
if (getcontext(&fibre->fibre) == 0) {
fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
if (fibre->fibre.uc_stack.ss_sp != NULL) {
diff --git a/crypto/async/arch/async_posix.h b/crypto/async/arch/async_posix.h
index 873c0316dd..db42a01880 100644
--- a/crypto/async/arch/async_posix.h
+++ b/crypto/async/arch/async_posix.h
diff -up openssl-1.1.1d/crypto/async/arch/async_posix.h.intel-cet openssl-1.1.1d/crypto/async/arch/async_posix.h
--- openssl-1.1.1d/crypto/async/arch/async_posix.h.intel-cet 2020-02-17 11:55:06.600570492 +0100
+++ openssl-1.1.1d/crypto/async/arch/async_posix.h 2020-02-17 11:55:07.374557249 +0100
@@ -25,17 +25,33 @@
# define ASYNC_POSIX
# define ASYNC_ARCH
@ -187,7 +305,7 @@ index 873c0316dd..db42a01880 100644
o->env_init = 1;
if (!r || !_setjmp(o->env)) {
@@ -44,6 +60,7 @@ static ossl_inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, i
@@ -44,6 +60,7 @@ static ossl_inline int async_fibre_swapc
else
setcontext(&n->fibre);
}
@ -195,11 +313,10 @@ index 873c0316dd..db42a01880 100644
return 1;
}
diff --git a/crypto/camellia/asm/cmll-x86_64.pl b/crypto/camellia/asm/cmll-x86_64.pl
index ff7bf12f3b..493ef3330d 100644
--- a/crypto/camellia/asm/cmll-x86_64.pl
+++ b/crypto/camellia/asm/cmll-x86_64.pl
@@ -685,6 +685,7 @@ $code.=<<___;
diff -up openssl-1.1.1d/crypto/camellia/asm/cmll-x86_64.pl.intel-cet openssl-1.1.1d/crypto/camellia/asm/cmll-x86_64.pl
--- openssl-1.1.1d/crypto/camellia/asm/cmll-x86_64.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/camellia/asm/cmll-x86_64.pl 2020-02-17 11:55:07.375557232 +0100
@@ -677,6 +677,7 @@ $code.=<<___;
.align 16
Camellia_cbc_encrypt:
.cfi_startproc
@ -207,10 +324,9 @@ index ff7bf12f3b..493ef3330d 100644
cmp \$0,%rdx
je .Lcbc_abort
push %rbx
diff --git a/crypto/modes/asm/ghash-x86_64.pl b/crypto/modes/asm/ghash-x86_64.pl
index 1e5221005d..fb682c3cbc 100644
--- a/crypto/modes/asm/ghash-x86_64.pl
+++ b/crypto/modes/asm/ghash-x86_64.pl
diff -up openssl-1.1.1d/crypto/modes/asm/ghash-x86_64.pl.intel-cet openssl-1.1.1d/crypto/modes/asm/ghash-x86_64.pl
--- openssl-1.1.1d/crypto/modes/asm/ghash-x86_64.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/modes/asm/ghash-x86_64.pl 2020-02-17 11:55:07.375557232 +0100
@@ -239,6 +239,7 @@ $code=<<___;
.align 16
gcm_gmult_4bit:
@ -259,10 +375,9 @@ index 1e5221005d..fb682c3cbc 100644
___
if ($avx) {
my ($Xip,$Htbl,$inp,$len)=@_4args;
diff --git a/crypto/perlasm/cbc.pl b/crypto/perlasm/cbc.pl
index 01bafe457d..17b01d22eb 100644
--- a/crypto/perlasm/cbc.pl
+++ b/crypto/perlasm/cbc.pl
diff -up openssl-1.1.1d/crypto/perlasm/cbc.pl.intel-cet openssl-1.1.1d/crypto/perlasm/cbc.pl
--- openssl-1.1.1d/crypto/perlasm/cbc.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/perlasm/cbc.pl 2020-02-17 11:55:07.375557232 +0100
@@ -165,21 +165,28 @@ sub cbc
&jmp_ptr($count);
@ -292,10 +407,9 @@ index 01bafe457d..17b01d22eb 100644
&movb(&LB("ecx"), &BP(0,$in,"",0));
&set_label("ejend");
diff --git a/crypto/perlasm/x86_64-xlate.pl b/crypto/perlasm/x86_64-xlate.pl
index 29a0eacfd5..7ffba4c450 100755
--- a/crypto/perlasm/x86_64-xlate.pl
+++ b/crypto/perlasm/x86_64-xlate.pl
diff -up openssl-1.1.1d/crypto/perlasm/x86_64-xlate.pl.intel-cet openssl-1.1.1d/crypto/perlasm/x86_64-xlate.pl
--- openssl-1.1.1d/crypto/perlasm/x86_64-xlate.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/perlasm/x86_64-xlate.pl 2020-02-17 11:55:07.375557232 +0100
@@ -101,6 +101,33 @@ elsif (!$gas)
$decor="\$L\$";
}
@ -338,10 +452,9 @@ index 29a0eacfd5..7ffba4c450 100755
print "\n$current_segment\tENDS\n" if ($current_segment && $masm);
print "END\n" if ($masm);
diff --git a/crypto/perlasm/x86gas.pl b/crypto/perlasm/x86gas.pl
index 5c7ea3880e..58ea922256 100644
--- a/crypto/perlasm/x86gas.pl
+++ b/crypto/perlasm/x86gas.pl
diff -up openssl-1.1.1d/crypto/perlasm/x86gas.pl.intel-cet openssl-1.1.1d/crypto/perlasm/x86gas.pl
--- openssl-1.1.1d/crypto/perlasm/x86gas.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/perlasm/x86gas.pl 2020-02-17 11:55:07.376557215 +0100
@@ -124,6 +124,7 @@ sub ::function_begin_B
push(@out,".align\t$align\n");
push(@out,"$func:\n");
@ -377,75 +490,292 @@ index 5c7ea3880e..58ea922256 100644
}
sub ::data_byte { push(@out,".byte\t".join(',',@_)."\n"); }
diff --git a/crypto/poly1305/asm/poly1305-x86_64.pl b/crypto/poly1305/asm/poly1305-x86_64.pl
index c3b7ce3658..92deae2185 100755
--- a/crypto/poly1305/asm/poly1305-x86_64.pl
+++ b/crypto/poly1305/asm/poly1305-x86_64.pl
@@ -2806,6 +2806,7 @@ $code.=<<___;
diff -up openssl-1.1.1d/crypto/poly1305/asm/poly1305-x86_64.pl.intel-cet openssl-1.1.1d/crypto/poly1305/asm/poly1305-x86_64.pl
--- openssl-1.1.1d/crypto/poly1305/asm/poly1305-x86_64.pl.intel-cet 2020-02-17 11:55:07.376557215 +0100
+++ openssl-1.1.1d/crypto/poly1305/asm/poly1305-x86_64.pl 2020-02-17 12:02:12.295308065 +0100
@@ -90,7 +90,7 @@ if (!$avx && $win64 && ($flavour =~ /mas
$avx = ($1>=10) + ($1>=12);
}
-if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([3-9]\.[0-9]+)/) {
+if (!$avx && `$ENV{CC} -v 2>&1` =~ /((?:^clang|LLVM) version|.*based on LLVM) ([0-9]+\.[0-9]+)/) {
$avx = ($2>=3.0) + ($2>3.0);
}
@@ -168,6 +168,7 @@ $code.=<<___;
.type poly1305_init,\@function,3
.align 32
poly1305_init:
+.cfi_startproc
xor %rax,%rax
mov %rax,0($ctx) # initialize hash value
mov %rax,8($ctx)
@@ -219,6 +220,7 @@ $code.=<<___;
mov \$1,%eax
.Lno_key:
ret
+.cfi_endproc
.size poly1305_init,.-poly1305_init
.type poly1305_blocks,\@function,4
@@ -298,6 +300,7 @@ $code.=<<___;
.type poly1305_emit,\@function,3
.align 32
poly1305_emit:
+.cfi_startproc
.Lemit:
mov 0($ctx),%r8 # load hash value
mov 8($ctx),%r9
@@ -318,6 +321,7 @@ poly1305_emit:
mov %rcx,8($mac)
ret
+.cfi_endproc
.size poly1305_emit,.-poly1305_emit
___
if ($avx) {
@@ -342,15 +346,18 @@ $code.=<<___;
.type __poly1305_block,\@abi-omnipotent
.align 32
__poly1305_block:
+.cfi_startproc
___
&poly1305_iteration();
$code.=<<___;
ret
+.cfi_endproc
.size __poly1305_block,.-__poly1305_block
.type __poly1305_init_avx,\@abi-omnipotent
.align 32
__poly1305_init_avx:
+.cfi_startproc
mov $r0,$h0
mov $r1,$h1
xor $h2,$h2
@@ -508,6 +515,7 @@ __poly1305_init_avx:
lea -48-64($ctx),$ctx # size [de-]optimization
ret
+.cfi_endproc
.size __poly1305_init_avx,.-__poly1305_init_avx
.type poly1305_blocks_avx,\@function,4
@@ -1373,6 +1381,7 @@ $code.=<<___;
.type poly1305_emit_avx,\@function,3
.align 32
poly1305_emit_avx:
+.cfi_startproc
cmpl \$0,20($ctx) # is_base2_26?
je .Lemit
@@ -1423,6 +1432,7 @@ poly1305_emit_avx:
mov %rcx,8($mac)
ret
+.cfi_endproc
.size poly1305_emit_avx,.-poly1305_emit_avx
___
@@ -2741,6 +2751,7 @@ $code.=<<___;
.type poly1305_init_base2_44,\@function,3
.align 32
poly1305_init_base2_44:
+.cfi_startproc
xor %rax,%rax
mov %rax,0($ctx) # initialize hash value
mov %rax,8($ctx)
@@ -2782,6 +2793,7 @@ ___
$code.=<<___;
mov \$1,%eax
ret
+.cfi_endproc
.size poly1305_init_base2_44,.-poly1305_init_base2_44
___
{
@@ -2793,6 +2805,8 @@ $code.=<<___;
.type poly1305_blocks_vpmadd52,\@function,4
.align 32
poly1305_blocks_vpmadd52:
.cfi_startproc
+.cfi_startproc
+ endbranch
shr \$4,$len
jz .Lno_data_vpmadd52 # too short
@@ -3739,6 +3740,7 @@ $code.=<<___;
@@ -2899,6 +2913,7 @@ poly1305_blocks_vpmadd52:
.Lno_data_vpmadd52:
ret
+.cfi_endproc
.size poly1305_blocks_vpmadd52,.-poly1305_blocks_vpmadd52
___
}
@@ -2916,6 +2931,7 @@ $code.=<<___;
.type poly1305_blocks_vpmadd52_4x,\@function,4
.align 32
poly1305_blocks_vpmadd52_4x:
+.cfi_startproc
shr \$4,$len
jz .Lno_data_vpmadd52_4x # too short
@@ -3340,6 +3356,7 @@ poly1305_blocks_vpmadd52_4x:
.Lno_data_vpmadd52_4x:
ret
+.cfi_endproc
.size poly1305_blocks_vpmadd52_4x,.-poly1305_blocks_vpmadd52_4x
___
}
@@ -3358,6 +3375,7 @@ $code.=<<___;
.type poly1305_blocks_vpmadd52_8x,\@function,4
.align 32
poly1305_blocks_vpmadd52_8x:
+.cfi_startproc
shr \$4,$len
jz .Lno_data_vpmadd52_8x # too short
@@ -3713,6 +3731,7 @@ $code.=<<___;
.Lno_data_vpmadd52_8x:
ret
+.cfi_endproc
.size poly1305_blocks_vpmadd52_8x,.-poly1305_blocks_vpmadd52_8x
___
}
@@ -3720,6 +3739,8 @@ $code.=<<___;
.type poly1305_emit_base2_44,\@function,3
.align 32
poly1305_emit_base2_44:
.cfi_startproc
+.cfi_startproc
+ endbranch
mov 0($ctx),%r8 # load hash value
mov 8($ctx),%r9
mov 16($ctx),%r10
diff --git a/crypto/rc4/asm/rc4-x86_64.pl b/crypto/rc4/asm/rc4-x86_64.pl
index 32d842c59f..683103a172 100755
--- a/crypto/rc4/asm/rc4-x86_64.pl
+++ b/crypto/rc4/asm/rc4-x86_64.pl
@@ -140,6 +140,7 @@ $code=<<___;
@@ -3750,6 +3771,7 @@ poly1305_emit_base2_44:
mov %rcx,8($mac)
ret
+.cfi_endproc
.size poly1305_emit_base2_44,.-poly1305_emit_base2_44
___
} } }
@@ -3800,6 +3822,7 @@ $code.=<<___;
.type xor128_encrypt_n_pad,\@abi-omnipotent
.align 16
RC4:
.cfi_startproc
xor128_encrypt_n_pad:
+.cfi_startproc
sub $otp,$inp
sub $otp,$out
mov $len,%r10 # put len aside
@@ -3841,12 +3864,14 @@ xor128_encrypt_n_pad:
.Ldone_enc:
mov $otp,%rax
ret
+.cfi_endproc
.size xor128_encrypt_n_pad,.-xor128_encrypt_n_pad
.globl xor128_decrypt_n_pad
.type xor128_decrypt_n_pad,\@abi-omnipotent
.align 16
xor128_decrypt_n_pad:
+.cfi_startproc
sub $otp,$inp
sub $otp,$out
mov $len,%r10 # put len aside
@@ -3892,6 +3917,7 @@ xor128_decrypt_n_pad:
.Ldone_dec:
mov $otp,%rax
ret
+.cfi_endproc
.size xor128_decrypt_n_pad,.-xor128_decrypt_n_pad
___
}
diff -up openssl-1.1.1d/crypto/rc4/asm/rc4-x86_64.pl.intel-cet openssl-1.1.1d/crypto/rc4/asm/rc4-x86_64.pl
--- openssl-1.1.1d/crypto/rc4/asm/rc4-x86_64.pl.intel-cet 2020-02-17 11:55:07.377557198 +0100
+++ openssl-1.1.1d/crypto/rc4/asm/rc4-x86_64.pl 2020-02-17 12:03:09.117341235 +0100
@@ -138,11 +138,13 @@ $code=<<___;
.globl RC4
.type RC4,\@function,4
.align 16
-RC4: or $len,$len
+RC4:
+.cfi_startproc
+ endbranch
or $len,$len
+ or $len,$len
jne .Lentry
ret
@@ -455,6 +456,7 @@ $code.=<<___;
.Lentry:
-.cfi_startproc
push %rbx
.cfi_push %rbx
push %r12
@@ -453,6 +455,8 @@ $code.=<<___;
.type RC4_set_key,\@function,3
.align 16
RC4_set_key:
.cfi_startproc
+.cfi_startproc
+ endbranch
lea 8($dat),$dat
lea ($inp,$len),$inp
neg $len
@@ -529,6 +531,7 @@ RC4_set_key:
@@ -519,12 +523,15 @@ RC4_set_key:
mov %eax,-8($dat)
mov %eax,-4($dat)
ret
+.cfi_endproc
.size RC4_set_key,.-RC4_set_key
.globl RC4_options
.type RC4_options,\@abi-omnipotent
.align 16
RC4_options:
.cfi_startproc
+.cfi_startproc
+ endbranch
lea .Lopts(%rip),%rax
mov OPENSSL_ia32cap_P(%rip),%edx
bt \$20,%edx
diff --git a/crypto/x86_64cpuid.pl b/crypto/x86_64cpuid.pl
index b9d8f73222..0e7e46bea3 100644
--- a/crypto/x86_64cpuid.pl
+++ b/crypto/x86_64cpuid.pl
@@ -40,6 +40,7 @@ print<<___;
@@ -537,6 +544,7 @@ RC4_options:
add \$12,%rax
.Ldone:
ret
+.cfi_endproc
.align 64
.Lopts:
.asciz "rc4(8x,int)"
diff -up openssl-1.1.1d/crypto/x86_64cpuid.pl.intel-cet openssl-1.1.1d/crypto/x86_64cpuid.pl
--- openssl-1.1.1d/crypto/x86_64cpuid.pl.intel-cet 2019-09-10 15:13:07.000000000 +0200
+++ openssl-1.1.1d/crypto/x86_64cpuid.pl 2020-02-17 12:04:04.921391729 +0100
@@ -39,6 +39,8 @@ print<<___;
.type OPENSSL_atomic_add,\@abi-omnipotent
.align 16
OPENSSL_atomic_add:
.cfi_startproc
+.cfi_startproc
+ endbranch
movl ($arg1),%eax
.Lspin: leaq ($arg2,%rax),%r8
.byte 0xf0 # lock
@@ -56,6 +57,7 @@ OPENSSL_atomic_add:
@@ -47,16 +49,20 @@ OPENSSL_atomic_add:
movl %r8d,%eax
.byte 0x48,0x98 # cltq/cdqe
ret
+.cfi_endproc
.size OPENSSL_atomic_add,.-OPENSSL_atomic_add
.globl OPENSSL_rdtsc
.type OPENSSL_rdtsc,\@abi-omnipotent
.align 16
OPENSSL_rdtsc:
.cfi_startproc
+.cfi_startproc
+ endbranch
rdtsc
shl \$32,%rdx
or %rdx,%rax
@@ -68,6 +70,7 @@ OPENSSL_rdtsc:
ret
+.cfi_endproc
.size OPENSSL_rdtsc,.-OPENSSL_rdtsc
.globl OPENSSL_ia32_cpuid
@@ -64,6 +70,7 @@ OPENSSL_rdtsc:
.align 16
OPENSSL_ia32_cpuid:
.cfi_startproc
@ -453,51 +783,103 @@ index b9d8f73222..0e7e46bea3 100644
mov %rbx,%r8 # save %rbx
.cfi_register %rbx,%r8
@@ -237,6 +240,7 @@ OPENSSL_ia32_cpuid:
@@ -232,6 +239,8 @@ OPENSSL_ia32_cpuid:
.type OPENSSL_cleanse,\@abi-omnipotent
.align 16
OPENSSL_cleanse:
.cfi_startproc
+.cfi_startproc
+ endbranch
xor %rax,%rax
cmp \$15,$arg2
jae .Lot
@@ -274,6 +278,7 @@ OPENSSL_cleanse:
@@ -261,12 +270,15 @@ OPENSSL_cleanse:
cmp \$0,$arg2
jne .Little
ret
+.cfi_endproc
.size OPENSSL_cleanse,.-OPENSSL_cleanse
.globl CRYPTO_memcmp
.type CRYPTO_memcmp,\@abi-omnipotent
.align 16
CRYPTO_memcmp:
.cfi_startproc
+.cfi_startproc
+ endbranch
xor %rax,%rax
xor %r10,%r10
cmp \$0,$arg3
@@ -312,6 +317,7 @@ print<<___ if (!$win64);
@@ -295,6 +307,7 @@ CRYPTO_memcmp:
shr \$63,%rax
.Lno_data:
ret
+.cfi_endproc
.size CRYPTO_memcmp,.-CRYPTO_memcmp
___
@@ -303,6 +316,8 @@ print<<___ if (!$win64);
.type OPENSSL_wipe_cpu,\@abi-omnipotent
.align 16
OPENSSL_wipe_cpu:
.cfi_startproc
+.cfi_startproc
+ endbranch
pxor %xmm0,%xmm0
pxor %xmm1,%xmm1
pxor %xmm2,%xmm2
@@ -376,6 +382,7 @@ print<<___;
@@ -329,6 +344,7 @@ OPENSSL_wipe_cpu:
xorq %r11,%r11
leaq 8(%rsp),%rax
ret
+.cfi_endproc
.size OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
___
print<<___ if ($win64);
@@ -365,6 +381,8 @@ print<<___;
.type OPENSSL_instrument_bus,\@abi-omnipotent
.align 16
OPENSSL_instrument_bus:
.cfi_startproc
+.cfi_startproc
+ endbranch
mov $arg1,$out # tribute to Win64
mov $arg2,$cnt
mov $arg2,$max
@@ -410,6 +417,7 @@ OPENSSL_instrument_bus:
@@ -391,12 +409,15 @@ OPENSSL_instrument_bus:
mov $max,%rax
ret
+.cfi_endproc
.size OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
.globl OPENSSL_instrument_bus2
.type OPENSSL_instrument_bus2,\@abi-omnipotent
.align 16
OPENSSL_instrument_bus2:
.cfi_startproc
+.cfi_startproc
+ endbranch
mov $arg1,$out # tribute to Win64
mov $arg2,$cnt
mov $arg3,$max
@@ -465,6 +473,7 @@ print<<___;
@@ -439,6 +460,7 @@ OPENSSL_instrument_bus2:
mov $redzone(%rsp),%rax
sub $cnt,%rax
ret
+.cfi_endproc
.size OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
___
}
@@ -450,6 +472,8 @@ print<<___;
.type OPENSSL_ia32_${rdop}_bytes,\@abi-omnipotent
.align 16
OPENSSL_ia32_${rdop}_bytes:
.cfi_startproc
+.cfi_startproc
+ endbranch
xor %rax, %rax # return value
cmp \$0,$arg2
je .Ldone_${rdop}_bytes
@@ -486,6 +510,7 @@ OPENSSL_ia32_${rdop}_bytes:
.Ldone_${rdop}_bytes:
xor %r10,%r10 # Clear sensitive data from register
ret
+.cfi_endproc
.size OPENSSL_ia32_${rdop}_bytes,.-OPENSSL_ia32_${rdop}_bytes
___
}