On Thu, Jun 27, 2019 at 12:26:43PM +0200, Ard Biesheuvel wrote: > There are a few copies of the AES S-boxes floating around, so export > the ones from the AES library so that we can reuse them in other > modules. > > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@xxxxxxxxxx> > --- > include/crypto/aes.h | 3 +++ > lib/crypto/aes.c | 6 ++++++ > 2 files changed, 9 insertions(+) > > diff --git a/include/crypto/aes.h b/include/crypto/aes.h > index df8426fd8051..8e0f4cf948e5 100644 > --- a/include/crypto/aes.h > +++ b/include/crypto/aes.h > @@ -67,4 +67,7 @@ void aes_encrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); > */ > void aes_decrypt(const struct crypto_aes_ctx *ctx, u8 *out, const u8 *in); > > +extern const u8 crypto_aes_sbox[]; > +extern const u8 crypto_aes_inv_sbox[]; > + > #endif > diff --git a/lib/crypto/aes.c b/lib/crypto/aes.c > index 9928b23e0a8a..467f0c35a0e0 100644 > --- a/lib/crypto/aes.c > +++ b/lib/crypto/aes.c > @@ -82,6 +82,12 @@ static volatile const u8 __cacheline_aligned aes_inv_sbox[] = { > 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d, > }; > > +extern const u8 crypto_aes_sbox[] __alias(aes_sbox); > +extern const u8 crypto_aes_inv_sbox[] __alias(aes_inv_sbox); > + > +EXPORT_SYMBOL(crypto_aes_sbox); > +EXPORT_SYMBOL(crypto_aes_inv_sbox); I got a compiler warning: In file included from ./include/linux/linkage.h:7, from ./include/linux/kernel.h:8, from ./include/linux/crypto.h:16, from ./include/crypto/aes.h:10, from lib/crypto/aes.c:6: lib/crypto/aes.c:88:15: warning: array ‘crypto_aes_sbox’ assumed to have one element EXPORT_SYMBOL(crypto_aes_sbox); ^~~~~~~~~~~~~~~ ./include/linux/export.h:79:21: note: in definition of macro ‘___EXPORT_SYMBOL’ extern typeof(sym) sym; \ ^~~ lib/crypto/aes.c:88:1: note: in expansion of macro ‘EXPORT_SYMBOL’ EXPORT_SYMBOL(crypto_aes_sbox); ^~~~~~~~~~~~~ lib/crypto/aes.c:89:15: warning: array ‘crypto_aes_inv_sbox’ assumed to have one element EXPORT_SYMBOL(crypto_aes_inv_sbox); ^~~~~~~~~~~~~~~~~~~ ./include/linux/export.h:79:21: note: in definition of macro ‘___EXPORT_SYMBOL’ extern typeof(sym) sym; \ ^~~ lib/crypto/aes.c:89:1: note: in expansion of macro ‘EXPORT_SYMBOL’ EXPORT_SYMBOL(crypto_aes_inv_sbox); ^~~~~~~~~~~~~