[PATCH 2/2] camellia/gfni/avx512: add missing register clearing on function exits

Jussi Kivilinna jussi.kivilinna at iki.fi
Tue Jun 28 11:20:15 CEST 2022


* cipher/camellia-gfni-avx512-amd64.S: Add clear_regs() at externally
visible function epilogues.
---

Signed-off-by: Jussi Kivilinna <jussi.kivilinna at iki.fi>
---
 cipher/camellia-gfni-avx512-amd64.S | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/cipher/camellia-gfni-avx512-amd64.S b/cipher/camellia-gfni-avx512-amd64.S
index 70e10460..eb9c01f2 100644
--- a/cipher/camellia-gfni-avx512-amd64.S
+++ b/cipher/camellia-gfni-avx512-amd64.S
@@ -972,6 +972,8 @@ _gcry_camellia_gfni_avx512_ctr_enc:
 		     %zmm15, %zmm14, %zmm13, %zmm12, %zmm11, %zmm10, %zmm9,
 		     %zmm8, %rsi);
 
+	clear_regs();
+
 	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size _gcry_camellia_gfni_avx512_ctr_enc,.-_gcry_camellia_gfni_avx512_ctr_enc;)
@@ -1032,6 +1034,8 @@ _gcry_camellia_gfni_avx512_cbc_dec:
 	/* store new IV */
 	vmovdqu64 %xmm16, (0)(%r9);
 
+	clear_regs();
+
 	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size _gcry_camellia_gfni_avx512_cbc_dec,.-_gcry_camellia_gfni_avx512_cbc_dec;)
@@ -1103,6 +1107,8 @@ _gcry_camellia_gfni_avx512_cfb_dec:
 		     %zmm15, %zmm14, %zmm13, %zmm12, %zmm11, %zmm10, %zmm9,
 		     %zmm8, %rsi);
 
+	clear_regs();
+
 	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size _gcry_camellia_gfni_avx512_cfb_dec,.-_gcry_camellia_gfni_avx512_cfb_dec;)
@@ -1254,6 +1260,8 @@ _gcry_camellia_gfni_avx512_ocb_enc:
 		     %zmm15, %zmm14, %zmm13, %zmm12, %zmm11, %zmm10, %zmm9,
 		     %zmm8, %rsi);
 
+	clear_regs();
+
 	popq %rbx;
 	CFI_RESTORE(%rbx);
 	popq %r15;
@@ -1264,6 +1272,7 @@ _gcry_camellia_gfni_avx512_ocb_enc:
 	CFI_RESTORE(%r12);
 	popq %r12;
 	CFI_RESTORE(%r13);
+
 	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size _gcry_camellia_gfni_avx512_ocb_enc,.-_gcry_camellia_gfni_avx512_ocb_enc;)
@@ -1420,6 +1429,8 @@ _gcry_camellia_gfni_avx512_ocb_dec:
 	vpternlogq $0x96, (%r8), %xmm0, %xmm8;
 	vmovdqu64 %xmm8, (%r8);
 
+	clear_regs();
+
 	popq %rbx;
 	CFI_RESTORE(%rbx);
 	popq %r15;
@@ -1430,6 +1441,7 @@ _gcry_camellia_gfni_avx512_ocb_dec:
 	CFI_RESTORE(%r12);
 	popq %r12;
 	CFI_RESTORE(%r13);
+
 	ret_spec_stop;
 	CFI_ENDPROC();
 ELF(.size _gcry_camellia_gfni_avx512_ocb_dec,.-_gcry_camellia_gfni_avx512_ocb_dec;)
-- 
2.34.1




More information about the Gcrypt-devel mailing list