crypto: aesni - prevent misaligned buffers on the stack
authorArd Biesheuvel <ardb@kernel.org>
Mon, 4 Jan 2021 15:55:46 +0000 (16:55 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 14 Jan 2021 06:10:25 +0000 (17:10 +1100)
commita13ed1d15b07a04b1f74b2df61ff7a5e47f45dd8
treecb0af3857dbbfa32d0ec670588501f07ecac29e5
parent4f1a02e75a2eedfddd10222c0fe61d2a04d80099
crypto: aesni - prevent misaligned buffers on the stack

The GCM mode driver uses 16 byte aligned buffers on the stack to pass
the IV to the asm helpers, but unfortunately, the x86 port does not
guarantee that the stack pointer is 16 byte aligned upon entry in the
first place. Since the compiler is not aware of this, it will not emit
the additional stack realignment sequence that is needed, and so the
alignment is not guaranteed to be more than 8 bytes.

So instead, allocate some padding on the stack, and realign the IV
pointer by hand.

Cc: <stable@vger.kernel.org>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aesni-intel_glue.c