Skip to content

Commit 61abc35

Browse files
Andi Kleenherbertx
authored andcommitted
crypto: aes - Use ___cacheline_aligned for aes data
cacheline_aligned is a special section. It cannot be const at the same time because it's not read-only. It doesn't give any MMU protection. Mark it ____cacheline_aligned to not place it in a special section, but just align it in .rodata Cc: herbert@gondor.apana.org.au Suggested-by: Rasmus Villemoes <linux@rasmusvillemoes.dk> Signed-off-by: Andi Kleen <ak@linux.intel.com> Acked-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 71052dc commit 61abc35

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

‎crypto/aes_generic.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ static inline u8 byte(const u32 x, const unsigned n)
6464
static const u32 rco_tab[10] = { 1, 2, 4, 8, 16, 32, 64, 128, 27, 54 };
6565

6666
/* cacheline-aligned to facilitate prefetching into cache */
67-
__visible const u32 crypto_ft_tab[4][256] __cacheline_aligned = {
67+
__visible const u32 crypto_ft_tab[4][256] ____cacheline_aligned = {
6868
{
6969
0xa56363c6, 0x847c7cf8, 0x997777ee, 0x8d7b7bf6,
7070
0x0df2f2ff, 0xbd6b6bd6, 0xb16f6fde, 0x54c5c591,
@@ -328,7 +328,7 @@ __visible const u32 crypto_ft_tab[4][256] __cacheline_aligned = {
328328
}
329329
};
330330

331-
__visible const u32 crypto_fl_tab[4][256] __cacheline_aligned = {
331+
__visible const u32 crypto_fl_tab[4][256] ____cacheline_aligned = {
332332
{
333333
0x00000063, 0x0000007c, 0x00000077, 0x0000007b,
334334
0x000000f2, 0x0000006b, 0x0000006f, 0x000000c5,
@@ -592,7 +592,7 @@ __visible const u32 crypto_fl_tab[4][256] __cacheline_aligned = {
592592
}
593593
};
594594

595-
__visible const u32 crypto_it_tab[4][256] __cacheline_aligned = {
595+
__visible const u32 crypto_it_tab[4][256] ____cacheline_aligned = {
596596
{
597597
0x50a7f451, 0x5365417e, 0xc3a4171a, 0x965e273a,
598598
0xcb6bab3b, 0xf1459d1f, 0xab58faac, 0x9303e34b,
@@ -856,7 +856,7 @@ __visible const u32 crypto_it_tab[4][256] __cacheline_aligned = {
856856
}
857857
};
858858

859-
__visible const u32 crypto_il_tab[4][256] __cacheline_aligned = {
859+
__visible const u32 crypto_il_tab[4][256] ____cacheline_aligned = {
860860
{
861861
0x00000052, 0x00000009, 0x0000006a, 0x000000d5,
862862
0x00000030, 0x00000036, 0x000000a5, 0x00000038,

‎include/crypto/aes.h‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ struct crypto_aes_ctx {
2828
u32 key_length;
2929
};
3030

31-
extern const u32 crypto_ft_tab[4][256];
32-
extern const u32 crypto_fl_tab[4][256];
33-
extern const u32 crypto_it_tab[4][256];
34-
extern const u32 crypto_il_tab[4][256];
31+
extern const u32 crypto_ft_tab[4][256] ____cacheline_aligned;
32+
extern const u32 crypto_fl_tab[4][256] ____cacheline_aligned;
33+
extern const u32 crypto_it_tab[4][256] ____cacheline_aligned;
34+
extern const u32 crypto_il_tab[4][256] ____cacheline_aligned;
3535

3636
int crypto_aes_set_key(struct crypto_tfm *tfm, const u8 *in_key,
3737
unsigned int key_len);

0 commit comments

Comments
 (0)