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.

lib/crypto: aes: Drop 'volatile' from aes_sbox and aes_inv_sbox

The volatile keyword is no longer necessary or useful on aes_sbox and
aes_inv_sbox, since the table prefetching is now done using a helper
function that casts to volatile itself and also includes an optimization
barrier. Since it prevents some compiler optimizations, remove it.

Acked-by: Ard Biesheuvel <ardb@kernel.org>
Link: https://lore.kernel.org/r/20260112192035.10427-36-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>

+3 -7
+3 -7
lib/crypto/aes.c
··· 11 11 #include <linux/module.h> 12 12 #include <linux/unaligned.h> 13 13 14 - /* 15 - * Emit the sbox as volatile const to prevent the compiler from doing 16 - * constant folding on sbox references involving fixed indexes. 17 - */ 18 - static volatile const u8 ____cacheline_aligned aes_sbox[] = { 14 + static const u8 ____cacheline_aligned aes_sbox[] = { 19 15 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 20 16 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 21 17 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, ··· 46 50 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16, 47 51 }; 48 52 49 - static volatile const u8 ____cacheline_aligned aes_inv_sbox[] = { 53 + static const u8 ____cacheline_aligned aes_inv_sbox[] = { 50 54 0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 51 55 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 52 56 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, ··· 426 430 w[3] = w3; 427 431 } while (--n); 428 432 429 - aes_prefetch((const void *)aes_inv_sbox, sizeof(aes_inv_sbox)); 433 + aes_prefetch(aes_inv_sbox, sizeof(aes_inv_sbox)); 430 434 put_unaligned_le32(declast_quarterround(w, 0, *rkp++), &out[0]); 431 435 put_unaligned_le32(declast_quarterround(w, 1, *rkp++), &out[4]); 432 436 put_unaligned_le32(declast_quarterround(w, 2, *rkp++), &out[8]);