Blame SOURCES/openssl-1.1.1-intel-cet.patch

0bf02d
diff -up openssl-1.1.1e/crypto/aes/asm/aesni-x86_64.pl.intel-cet openssl-1.1.1e/crypto/aes/asm/aesni-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/aes/asm/aesni-x86_64.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/aes/asm/aesni-x86_64.pl	2020-03-19 17:07:02.626522694 +0100
0bf02d
@@ -275,6 +275,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	movups	($inp),$inout0		# load input
0bf02d
 	mov	240($key),$rounds	# key->rounds
0bf02d
 ___
0bf02d
@@ -293,6 +294,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_decrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	movups	($inp),$inout0		# load input
0bf02d
 	mov	240($key),$rounds	# key->rounds
0bf02d
 ___
0bf02d
@@ -613,6 +615,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_ecb_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0x58(%rsp),%rsp
0bf02d
@@ -985,6 +988,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_ccm64_encrypt_blocks:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0x58(%rsp),%rsp
0bf02d
@@ -1077,6 +1081,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_ccm64_decrypt_blocks:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0x58(%rsp),%rsp
0bf02d
@@ -1203,6 +1208,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_ctr32_encrypt_blocks:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	cmp	\$1,$len
0bf02d
 	jne	.Lctr32_bulk
0bf02d
 
0bf02d
@@ -1775,6 +1781,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_xts_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	(%rsp),%r11			# frame pointer
0bf02d
 .cfi_def_cfa_register	%r11
0bf02d
 	push	%rbp
0bf02d
@@ -2258,6 +2265,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 aesni_xts_decrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	(%rsp),%r11			# frame pointer
0bf02d
 .cfi_def_cfa_register	%r11
0bf02d
 	push	%rbp
0bf02d
@@ -2783,6 +2791,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 aesni_ocb_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	(%rsp),%rax
0bf02d
 	push	%rbx
0bf02d
 .cfi_push	%rbx
0bf02d
@@ -3249,6 +3258,7 @@ __ocb_encrypt1:
0bf02d
 .align	32
0bf02d
 aesni_ocb_decrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	(%rsp),%rax
0bf02d
 	push	%rbx
0bf02d
 .cfi_push	%rbx
0bf02d
@@ -3737,6 +3747,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_cbc_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	test	$len,$len		# check length
0bf02d
 	jz	.Lcbc_ret
0bf02d
 
0bf02d
diff -up openssl-1.1.1e/crypto/aes/asm/vpaes-x86_64.pl.intel-cet openssl-1.1.1e/crypto/aes/asm/vpaes-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/aes/asm/vpaes-x86_64.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/aes/asm/vpaes-x86_64.pl	2020-03-19 17:00:15.974621757 +0100
0bf02d
@@ -696,6 +696,7 @@ _vpaes_schedule_mangle:
0bf02d
 .align	16
0bf02d
 ${PREFIX}_set_encrypt_key:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0xb8(%rsp),%rsp
0bf02d
@@ -746,6 +747,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_set_decrypt_key:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0xb8(%rsp),%rsp
0bf02d
@@ -801,6 +803,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0xb8(%rsp),%rsp
0bf02d
@@ -846,6 +849,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_decrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
 	lea	-0xb8(%rsp),%rsp
0bf02d
@@ -897,6 +901,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 ${PREFIX}_cbc_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	xchg	$key,$len
0bf02d
 ___
0bf02d
 ($len,$key)=($key,$len);
0bf02d
diff -up openssl-1.1.1e/crypto/async/arch/async_posix.c.intel-cet openssl-1.1.1e/crypto/async/arch/async_posix.c
0bf02d
--- openssl-1.1.1e/crypto/async/arch/async_posix.c.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/async/arch/async_posix.c	2020-03-19 17:00:15.974621757 +0100
0bf02d
@@ -34,7 +34,9 @@ void async_local_cleanup(void)
0bf02d
 
0bf02d
 int async_fibre_makecontext(async_fibre *fibre)
0bf02d
 {
0bf02d
+#ifndef USE_SWAPCONTEXT
0bf02d
     fibre->env_init = 0;
0bf02d
+#endif
0bf02d
     if (getcontext(&fibre->fibre) == 0) {
0bf02d
         fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE);
0bf02d
         if (fibre->fibre.uc_stack.ss_sp != NULL) {
0bf02d
diff -up openssl-1.1.1e/crypto/async/arch/async_posix.h.intel-cet openssl-1.1.1e/crypto/async/arch/async_posix.h
0bf02d
--- openssl-1.1.1e/crypto/async/arch/async_posix.h.intel-cet	2020-03-19 17:00:15.435631166 +0100
0bf02d
+++ openssl-1.1.1e/crypto/async/arch/async_posix.h	2020-03-19 17:00:15.975621739 +0100
0bf02d
@@ -25,17 +25,33 @@
0bf02d
 #  define ASYNC_POSIX
0bf02d
 #  define ASYNC_ARCH
0bf02d
 
0bf02d
+#  ifdef __CET__
0bf02d
+/*
0bf02d
+ * When Intel CET is enabled, makecontext will create a different
0bf02d
+ * shadow stack for each context.  async_fibre_swapcontext cannot
0bf02d
+ * use _longjmp.  It must call swapcontext to swap shadow stack as
0bf02d
+ * well as normal stack.
0bf02d
+ */
0bf02d
+#   define USE_SWAPCONTEXT
0bf02d
+#  endif
0bf02d
 #  include <ucontext.h>
0bf02d
-#  include <setjmp.h>
0bf02d
+#  ifndef USE_SWAPCONTEXT
0bf02d
+#   include <setjmp.h>
0bf02d
+#  endif
0bf02d
 
0bf02d
 typedef struct async_fibre_st {
0bf02d
     ucontext_t fibre;
0bf02d
+#  ifndef USE_SWAPCONTEXT
0bf02d
     jmp_buf env;
0bf02d
     int env_init;
0bf02d
+#  endif
0bf02d
 } async_fibre;
0bf02d
 
0bf02d
 static ossl_inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r)
0bf02d
 {
0bf02d
+#  ifdef USE_SWAPCONTEXT
0bf02d
+    swapcontext(&o->fibre, &n->fibre);
0bf02d
+#  else
0bf02d
     o->env_init = 1;
0bf02d
 
0bf02d
     if (!r || !_setjmp(o->env)) {
0bf02d
@@ -44,6 +60,7 @@ static ossl_inline int async_fibre_swapc
0bf02d
         else
0bf02d
             setcontext(&n->fibre);
0bf02d
     }
0bf02d
+#  endif
0bf02d
 
0bf02d
     return 1;
0bf02d
 }
0bf02d
diff -up openssl-1.1.1e/crypto/camellia/asm/cmll-x86_64.pl.intel-cet openssl-1.1.1e/crypto/camellia/asm/cmll-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/camellia/asm/cmll-x86_64.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/camellia/asm/cmll-x86_64.pl	2020-03-19 17:00:15.975621739 +0100
0bf02d
@@ -685,6 +685,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 Camellia_cbc_encrypt:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	cmp	\$0,%rdx
0bf02d
 	je	.Lcbc_abort
0bf02d
 	push	%rbx
0bf02d
diff -up openssl-1.1.1e/crypto/modes/asm/ghash-x86_64.pl.intel-cet openssl-1.1.1e/crypto/modes/asm/ghash-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/modes/asm/ghash-x86_64.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/modes/asm/ghash-x86_64.pl	2020-03-19 17:00:15.975621739 +0100
0bf02d
@@ -239,6 +239,7 @@ $code=<<___;
0bf02d
 .align	16
0bf02d
 gcm_gmult_4bit:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	push	%rbx
0bf02d
 .cfi_push	%rbx
0bf02d
 	push	%rbp		# %rbp and others are pushed exclusively in
0bf02d
@@ -286,6 +287,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 gcm_ghash_4bit:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	push	%rbx
0bf02d
 .cfi_push	%rbx
0bf02d
 	push	%rbp
0bf02d
@@ -612,6 +614,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 gcm_gmult_clmul:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 .L_gmult_clmul:
0bf02d
 	movdqu		($Xip),$Xi
0bf02d
 	movdqa		.Lbswap_mask(%rip),$T3
0bf02d
@@ -663,6 +666,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 gcm_ghash_clmul:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 .L_ghash_clmul:
0bf02d
 ___
0bf02d
 $code.=<<___ if ($win64);
0bf02d
@@ -1166,6 +1170,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 gcm_gmult_avx:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	jmp	.L_gmult_clmul
0bf02d
 .cfi_endproc
0bf02d
 .size	gcm_gmult_avx,.-gcm_gmult_avx
0bf02d
@@ -1177,6 +1182,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 gcm_ghash_avx:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 ___
0bf02d
 if ($avx) {
0bf02d
 my ($Xip,$Htbl,$inp,$len)=@_4args;
0bf02d
diff -up openssl-1.1.1e/crypto/perlasm/cbc.pl.intel-cet openssl-1.1.1e/crypto/perlasm/cbc.pl
0bf02d
--- openssl-1.1.1e/crypto/perlasm/cbc.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/perlasm/cbc.pl	2020-03-19 17:00:15.976621722 +0100
0bf02d
@@ -165,21 +165,28 @@ sub cbc
0bf02d
 	&jmp_ptr($count);
0bf02d
 
0bf02d
 &set_label("ej7");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&HB("edx"),	&BP(6,$in,"",0));
0bf02d
 	&shl("edx",8);
0bf02d
 &set_label("ej6");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&HB("edx"),	&BP(5,$in,"",0));
0bf02d
 &set_label("ej5");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&LB("edx"),	&BP(4,$in,"",0));
0bf02d
 &set_label("ej4");
0bf02d
+	&endbranch()
0bf02d
 	&mov("ecx",		&DWP(0,$in,"",0));
0bf02d
 	&jmp(&label("ejend"));
0bf02d
 &set_label("ej3");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&HB("ecx"),	&BP(2,$in,"",0));
0bf02d
 	&shl("ecx",8);
0bf02d
 &set_label("ej2");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&HB("ecx"),	&BP(1,$in,"",0));
0bf02d
 &set_label("ej1");
0bf02d
+	&endbranch()
0bf02d
 	&movb(&LB("ecx"),	&BP(0,$in,"",0));
0bf02d
 &set_label("ejend");
0bf02d
 
0bf02d
diff -up openssl-1.1.1e/crypto/perlasm/x86_64-xlate.pl.intel-cet openssl-1.1.1e/crypto/perlasm/x86_64-xlate.pl
0bf02d
--- openssl-1.1.1e/crypto/perlasm/x86_64-xlate.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/perlasm/x86_64-xlate.pl	2020-03-19 17:00:15.984621582 +0100
0bf02d
@@ -101,6 +101,33 @@ elsif (!$gas)
0bf02d
     $decor="\$L\$";
0bf02d
 }
0bf02d
 
0bf02d
+my $cet_property;
0bf02d
+if ($flavour =~ /elf/) {
0bf02d
+	# Always generate .note.gnu.property section for ELF outputs to
0bf02d
+	# mark Intel CET support since all input files must be marked
0bf02d
+	# with Intel CET support in order for linker to mark output with
0bf02d
+	# Intel CET support.
0bf02d
+	my $p2align=3; $p2align=2 if ($flavour eq "elf32");
0bf02d
+	$cet_property = <<_____;
0bf02d
+	.section ".note.gnu.property", "a"
0bf02d
+	.p2align $p2align
0bf02d
+	.long 1f - 0f
0bf02d
+	.long 4f - 1f
0bf02d
+	.long 5
0bf02d
+0:
0bf02d
+	.asciz "GNU"
0bf02d
+1:
0bf02d
+	.p2align $p2align
0bf02d
+	.long 0xc0000002
0bf02d
+	.long 3f - 2f
0bf02d
+2:
0bf02d
+	.long 3
0bf02d
+3:
0bf02d
+	.p2align $p2align
0bf02d
+4:
0bf02d
+_____
0bf02d
+}
0bf02d
+
0bf02d
 my $current_segment;
0bf02d
 my $current_function;
0bf02d
 my %globals;
0bf02d
@@ -1213,6 +1240,7 @@ while(defined(my $line=<>)) {
0bf02d
     print $line,"\n";
0bf02d
 }
0bf02d
 
0bf02d
+print "$cet_property"			if ($cet_property);
0bf02d
 print "\n$current_segment\tENDS\n"	if ($current_segment && $masm);
0bf02d
 print "END\n"				if ($masm);
0bf02d
 
0bf02d
diff -up openssl-1.1.1e/crypto/perlasm/x86gas.pl.intel-cet openssl-1.1.1e/crypto/perlasm/x86gas.pl
0bf02d
--- openssl-1.1.1e/crypto/perlasm/x86gas.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/perlasm/x86gas.pl	2020-03-19 17:00:15.985621565 +0100
0bf02d
@@ -124,6 +124,7 @@ sub ::function_begin_B
0bf02d
     push(@out,".align\t$align\n");
0bf02d
     push(@out,"$func:\n");
0bf02d
     push(@out,"$begin:\n")		if ($global);
0bf02d
+    &::endbranch();
0bf02d
     $::stack=4;
0bf02d
 }
0bf02d
 
0bf02d
@@ -172,6 +173,26 @@ sub ::file_end
0bf02d
 	else		{ push (@out,"$tmp\n"); }
0bf02d
     }
0bf02d
     push(@out,$initseg) if ($initseg);
0bf02d
+    if ($::elf) {
0bf02d
+	push(@out,"
0bf02d
+	.section \".note.gnu.property\", \"a\"
0bf02d
+	.p2align 2
0bf02d
+	.long 1f - 0f
0bf02d
+	.long 4f - 1f
0bf02d
+	.long 5
0bf02d
+0:
0bf02d
+	.asciz \"GNU\"
0bf02d
+1:
0bf02d
+	.p2align 2
0bf02d
+	.long 0xc0000002
0bf02d
+	.long 3f - 2f
0bf02d
+2:
0bf02d
+	.long 3
0bf02d
+3:
0bf02d
+	.p2align 2
0bf02d
+4:
0bf02d
+");
0bf02d
+    }
0bf02d
 }
0bf02d
 
0bf02d
 sub ::data_byte	{   push(@out,".byte\t".join(',',@_)."\n");   }
0bf02d
diff -up openssl-1.1.1e/crypto/poly1305/asm/poly1305-x86_64.pl.intel-cet openssl-1.1.1e/crypto/poly1305/asm/poly1305-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/poly1305/asm/poly1305-x86_64.pl.intel-cet	2020-03-19 17:00:38.185234015 +0100
0bf02d
+++ openssl-1.1.1e/crypto/poly1305/asm/poly1305-x86_64.pl	2020-03-19 17:05:46.575850341 +0100
0bf02d
@@ -2806,6 +2806,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 poly1305_blocks_vpmadd52:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	shr	\$4,$len
0bf02d
 	jz	.Lno_data_vpmadd52		# too short
0bf02d
 
0bf02d
@@ -3739,6 +3740,7 @@ $code.=<<___;
0bf02d
 .align	32
0bf02d
 poly1305_emit_base2_44:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	mov	0($ctx),%r8	# load hash value
0bf02d
 	mov	8($ctx),%r9
0bf02d
 	mov	16($ctx),%r10
0bf02d
diff -up openssl-1.1.1e/crypto/rc4/asm/rc4-x86_64.pl.intel-cet openssl-1.1.1e/crypto/rc4/asm/rc4-x86_64.pl
0bf02d
--- openssl-1.1.1e/crypto/rc4/asm/rc4-x86_64.pl.intel-cet	2020-03-19 17:00:38.190233928 +0100
0bf02d
+++ openssl-1.1.1e/crypto/rc4/asm/rc4-x86_64.pl	2020-03-19 17:05:02.598618064 +0100
0bf02d
@@ -140,6 +140,7 @@ $code=<<___;
0bf02d
 .align	16
0bf02d
 RC4:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	or	$len,$len
0bf02d
 	jne	.Lentry
0bf02d
 	ret
0bf02d
@@ -455,6 +456,7 @@ $code.=<<___;
0bf02d
 .align	16
0bf02d
 RC4_set_key:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	8($dat),$dat
0bf02d
 	lea	($inp,$len),$inp
0bf02d
 	neg	$len
0bf02d
@@ -529,6 +531,7 @@ RC4_set_key:
0bf02d
 .align	16
0bf02d
 RC4_options:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	lea	.Lopts(%rip),%rax
0bf02d
 	mov	OPENSSL_ia32cap_P(%rip),%edx
0bf02d
 	bt	\$20,%edx
0bf02d
diff -up openssl-1.1.1e/crypto/x86_64cpuid.pl.intel-cet openssl-1.1.1e/crypto/x86_64cpuid.pl
0bf02d
--- openssl-1.1.1e/crypto/x86_64cpuid.pl.intel-cet	2020-03-17 15:31:17.000000000 +0100
0bf02d
+++ openssl-1.1.1e/crypto/x86_64cpuid.pl	2020-03-19 17:03:58.172742775 +0100
0bf02d
@@ -40,6 +40,7 @@ print<<___;
0bf02d
 .align	16
0bf02d
 OPENSSL_atomic_add:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	movl	($arg1),%eax
0bf02d
 .Lspin:	leaq	($arg2,%rax),%r8
0bf02d
 	.byte	0xf0		# lock
0bf02d
@@ -56,6 +57,7 @@ OPENSSL_atomic_add:
0bf02d
 .align	16
0bf02d
 OPENSSL_rdtsc:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	rdtsc
0bf02d
 	shl	\$32,%rdx
0bf02d
 	or	%rdx,%rax
0bf02d
@@ -68,6 +70,7 @@ OPENSSL_rdtsc:
0bf02d
 .align	16
0bf02d
 OPENSSL_ia32_cpuid:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	mov	%rbx,%r8		# save %rbx
0bf02d
 .cfi_register	%rbx,%r8
0bf02d
 
0bf02d
@@ -237,6 +240,7 @@ OPENSSL_ia32_cpuid:
0bf02d
 .align  16
0bf02d
 OPENSSL_cleanse:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	xor	%rax,%rax
0bf02d
 	cmp	\$15,$arg2
0bf02d
 	jae	.Lot
0bf02d
@@ -274,6 +278,7 @@ OPENSSL_cleanse:
0bf02d
 .align  16
0bf02d
 CRYPTO_memcmp:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	xor	%rax,%rax
0bf02d
 	xor	%r10,%r10
0bf02d
 	cmp	\$0,$arg3
0bf02d
@@ -312,6 +317,7 @@ print<<___ if (!$win64);
0bf02d
 .align	16
0bf02d
 OPENSSL_wipe_cpu:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	pxor	%xmm0,%xmm0
0bf02d
 	pxor	%xmm1,%xmm1
0bf02d
 	pxor	%xmm2,%xmm2
0bf02d
@@ -346,6 +352,8 @@ print<<___ if ($win64);
0bf02d
 .type	OPENSSL_wipe_cpu,\@abi-omnipotent
0bf02d
 .align	16
0bf02d
 OPENSSL_wipe_cpu:
0bf02d
+.cfi_startproc
0bf02d
+	endbranch
0bf02d
 	pxor	%xmm0,%xmm0
0bf02d
 	pxor	%xmm1,%xmm1
0bf02d
 	pxor	%xmm2,%xmm2
0bf02d
@@ -376,6 +384,7 @@ print<<___;
0bf02d
 .align	16
0bf02d
 OPENSSL_instrument_bus:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	mov	$arg1,$out	# tribute to Win64
0bf02d
 	mov	$arg2,$cnt
0bf02d
 	mov	$arg2,$max
0bf02d
@@ -410,6 +419,7 @@ OPENSSL_instrument_bus:
0bf02d
 .align	16
0bf02d
 OPENSSL_instrument_bus2:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	mov	$arg1,$out	# tribute to Win64
0bf02d
 	mov	$arg2,$cnt
0bf02d
 	mov	$arg3,$max
0bf02d
@@ -465,6 +475,7 @@ print<<___;
0bf02d
 .align	16
0bf02d
 OPENSSL_ia32_${rdop}_bytes:
0bf02d
 .cfi_startproc
0bf02d
+	endbranch
0bf02d
 	xor	%rax, %rax	# return value
0bf02d
 	cmp	\$0,$arg2
0bf02d
 	je	.Ldone_${rdop}_bytes