From: Tommi Hirvola Date: Tue, 19 Feb 2019 15:45:54 +0000 (+0200) Subject: crypto: x86/poly1305 - Clear key material from stack in SSE2 variant X-Git-Tag: v5.1-rc1~177^2~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7748168c66404a3ee732972a3a55b5332245eb25;p=thirdparty%2Fkernel%2Flinux.git crypto: x86/poly1305 - Clear key material from stack in SSE2 variant 1-block SSE2 variant of poly1305 stores variables s1..s4 containing key material on the stack. This commit adds missing zeroing of the stack memory. Benchmarks show negligible performance hit (tested on i7-3770). Signed-off-by: Tommi Hirvola Signed-off-by: Herbert Xu --- diff --git a/arch/x86/crypto/poly1305-sse2-x86_64.S b/arch/x86/crypto/poly1305-sse2-x86_64.S index c88c670cb5fc6..e6add74d78a59 100644 --- a/arch/x86/crypto/poly1305-sse2-x86_64.S +++ b/arch/x86/crypto/poly1305-sse2-x86_64.S @@ -272,6 +272,10 @@ ENTRY(poly1305_block_sse2) dec %rcx jnz .Ldoblock + # Zeroing of key material + mov %rcx,0x00(%rsp) + mov %rcx,0x08(%rsp) + add $0x10,%rsp pop %r12 pop %rbx