Skip to contentSkip to conversation

crypto: x86/aes-gcm-vaes-avx2 - initialize full %rax return register

PATCH Applied Eric Biggers 2 participants 3 messages Nov 2, 2025 – Nov 4, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 crypto: x86/aes-gcm-vaes-avx2 - initialize full %rax return register

Update aes_gcm_dec_final_vaes_avx2() to be consistent with aes_gcm_dec_final_aesni() and aes_gcm_dec_final_vaes_avx512() by initializing the full %rax return register instead of just %al. Technically this is unnecessary, since these functions return bool. But I think it's worth being extra careful with the result of the tag comparison and also keeping the different implementations consistent.

---

This patch is targeting libcrypto-next

 arch/x86/crypto/aes-gcm-vaes-avx2.S | 1 +
 1 file changed, 1 insertion(+)
arch/x86/crypto/aes-gcm-vaes-avx2.S +1 -0
index d9754e683bde..93c9504a488f 100644
@@ -1121,10 +1121,11 @@ SYM_FUNC_END(aes_gcm_aad_update_vaes_avx2)
 	vpxor		(%rax), GHASH_ACC, GHASH_ACC
 	vaesenclast	GHASH_ACC, %xmm0, %xmm0
 	lea		.Lselect_high_bytes_table(%rip), %rax
 	vmovdqu		(%rax, TAGLEN64), %xmm1
 	vpshufb		BSWAP_MASK, %xmm1, %xmm1 // select low bytes, not high
+	xor		%eax, %eax
 	vptest		%xmm1, %xmm0
 	sete		%al
 .endif
 	// No need for vzeroupper here, since only used xmm registers were used.
 	RET

base-commit: 5a2a5e62a5216ba05d4481cf90d915f4de0bfde9

Signature · 1 line
2.51.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Eric Biggers

Update aes_gcm_dec_final_vaes_avx2() to be consistent with aes_gcm_dec_final_aesni() and aes_gcm_dec_final_vaes_avx512() by initializing the full %rax return register instead of just %al. Technically this is unnecessary, since these functions return bool. But I think it's worth being extra careful with the result of the tag comparison and also keeping the different implementations consistent.

Quoted 8 lines

---

This patch is targeting libcrypto-next

 arch/x86/crypto/aes-gcm-vaes-avx2.S | 1 +
 1 file changed, 1 insertion(+)
author Applied
#2 lore raw
In reply to Eric Biggers
Quoted 11 lines · Eric Biggers

Update aes_gcm_dec_final_vaes_avx2() to be consistent with aes_gcm_dec_final_aesni() and aes_gcm_dec_final_vaes_avx512() by initializing the full %rax return register instead of just %al. Technically this is unnecessary, since these functions return bool. But I think it's worth being extra careful with the result of the tag comparison and also keeping the different implementations consistent.

---

This patch is targeting libcrypto-next

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/ebiggers/linux.git/log/?h=libcrypto-next

- Eric