From 77b7e6331165e28d60b30e5067f5e8b2b8831f78 Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Fri, 20 Jun 2014 12:00:00 -0700 Subject: [PATCH] Adjust stack pointer in AES-NI CBC decryption. This change adjusts the stack pointer during CBC decryption. The code was previously using the red zone across function calls and valgrind thinks that the "unused" stack is undefined after a function call. --- crypto/aes/asm/aesni-x86_64.pl | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/crypto/aes/asm/aesni-x86_64.pl b/crypto/aes/asm/aesni-x86_64.pl index 0dbb194b..6ca517d4 100644 --- a/crypto/aes/asm/aesni-x86_64.pl +++ b/crypto/aes/asm/aesni-x86_64.pl @@ -2186,6 +2186,14 @@ $code.=<<___ if ($win64); movaps %xmm9,0x30(%rsp) .Lcbc_decrypt_body: ___ + +if (!$win64) { + $code.=<<___; + subq \$24,%rsp +___ + $reserved=0; +} + $code.=<<___; movups ($ivp),$iv mov $rnds_,$rounds @@ -2446,6 +2454,14 @@ $code.=<<___ if ($win64); movaps 0x30(%rsp),%xmm9 lea 0x58(%rsp),%rsp ___ + +if (!$win64) { + $code.=<<___; + addq \$24,%rsp +___ + $reserved=-24 +} + $code.=<<___; .Lcbc_ret: ret