Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au
Subject: Re: [PATCH v3 28/32] crypto: lib/aes - export sbox and inverse sbox
Date: Thu, 27 Jun 2019 10:52:33 -0700	[thread overview]
Message-ID: <20190627175233.GI686@sol.localdomain> (raw)
In-Reply-To: <20190627102647.2992-29-ard.biesheuvel@linaro.org>

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@linaro.org>
> ---
>  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);
 ^~~~~~~~~~~~~

  reply	other threads:[~2019-06-27 17:52 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-27 10:26 [PATCH v3 00/32] crypto: AES cleanup Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 01/32] crypto: arm/aes-ce - cosmetic/whitespace cleanup Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 02/32] crypto: aes - rename local routines to prevent future clashes Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 03/32] crypto: aes/fixed-time - align key schedule with other implementations Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 04/32] crypto: aes - create AES library based on the fixed time AES code Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 05/32] crypto: x86/aes-ni - switch to generic for fallback and key routines Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 06/32] crypto: x86/aes - drop scalar assembler implementations Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 07/32] crypto: padlock/aes - switch to library version of key expansion routine Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 08/32] crypto: cesa/aes " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 09/32] crypto: safexcel/aes " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 10/32] crypto: arm64/ghash - switch to AES library Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 11/32] crypto: arm/aes-neonbs - switch to library version of key expansion routine Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 12/32] crypto: arm64/aes-ccm - switch to AES library Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 13/32] crypto: arm64/aes-neonbs - switch to library version of key expansion routine Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 14/32] crypto: arm64/aes-ce " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 15/32] crypto: generic/aes - drop key expansion routine in favor of library version Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 16/32] crypto: ctr - add helper for performing a CTR encryption walk Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 17/32] crypto: aes - move sync ctr(aes) to AES library and generic helper Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 18/32] crypto: arm64/aes-ce-cipher - use AES library as fallback Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 19/32] crypto: aes/arm - use native endiannes for key schedule Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 20/32] crypto: arm/aes-ce - provide a synchronous version of ctr(aes) Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 21/32] crypto: arm/aes-neonbs " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 22/32] crypto: arm/ghash - provide a synchronous version Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 23/32] bluetooth: switch to AES library Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 24/32] crypto: amcc/aes - switch to AES library for GCM key derivation Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 25/32] crypto: ccp - move to AES library for CMAC " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 26/32] crypto: chelsio/aes - replace AES cipher calls with library calls Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 27/32] crypto: aes/generic - unexport last-round AES tables Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 28/32] crypto: lib/aes - export sbox and inverse sbox Ard Biesheuvel
2019-06-27 17:52   ` Eric Biggers [this message]
2019-06-28  9:45     ` Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 29/32] crypto: arm64/aes-neon - switch to shared AES Sboxes Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 30/32] crypto: arm/aes-cipher - switch to shared AES inverse Sbox Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 31/32] crypto: arm64/aes-cipher " Ard Biesheuvel
2019-06-27 10:26 ` [PATCH v3 32/32] crypto: arm/aes-scalar - unexport en/decryption routines Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190627175233.GI686@sol.localdomain \
    --to=ebiggers@kernel.org \
    --cc=ard.biesheuvel@linaro.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox