Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

crypto: aesni - fix XTS mode on x86-32, add wrapper function for asmlinkage aesni_enc()

Calling convention for internal functions and 'asmlinkage' functions is
different on x86-32. Therefore do not directly cast aesni_enc as XTS tweak
function, but use wrapper function in between. Fixes crash with "XTS +
aesni_intel + x86-32" combination.

Cc: stable@vger.kernel.org
Reported-by: Krzysztof Kolasa <kkolasa@winsoft.pl>
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@mbnet.fi>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Jussi Kivilinna and committed by
Linus Torvalds
32bec973 43385846

+7 -2
+7 -2
arch/x86/crypto/aesni-intel_glue.c
··· 515 515 } 516 516 517 517 518 + static void aesni_xts_tweak(void *ctx, u8 *out, const u8 *in) 519 + { 520 + aesni_enc(ctx, out, in); 521 + } 522 + 518 523 static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, 519 524 struct scatterlist *src, unsigned int nbytes) 520 525 { ··· 530 525 .tbuflen = sizeof(buf), 531 526 532 527 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), 533 - .tweak_fn = XTS_TWEAK_CAST(aesni_enc), 528 + .tweak_fn = aesni_xts_tweak, 534 529 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), 535 530 .crypt_fn = lrw_xts_encrypt_callback, 536 531 }; ··· 555 550 .tbuflen = sizeof(buf), 556 551 557 552 .tweak_ctx = aes_ctx(ctx->raw_tweak_ctx), 558 - .tweak_fn = XTS_TWEAK_CAST(aesni_enc), 553 + .tweak_fn = aesni_xts_tweak, 559 554 .crypt_ctx = aes_ctx(ctx->raw_crypt_ctx), 560 555 .crypt_fn = lrw_xts_decrypt_callback, 561 556 };