From: Eric Biggers <ebiggers3@gmail.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: linux-crypto@vger.kernel.org, herbert@gondor.apana.org.au,
nico@linaro.org
Subject: Re: [PATCH 0/7] crypto: aes - allow generic AES to be omitted
Date: Mon, 27 Mar 2017 22:43:49 -0700 [thread overview]
Message-ID: <20170328054349.GA1023@zzz> (raw)
In-Reply-To: <1490554148-10953-1-git-send-email-ard.biesheuvel@linaro.org>
Hi Ard,
On Sun, Mar 26, 2017 at 07:49:01PM +0100, Ard Biesheuvel wrote:
> The generic AES driver uses 16 lookup tables of 1 KB each, and has
> encryption and decryption routines that are fully unrolled. Given how
> the dependencies between this code and other drivers are declared in
> Kconfig files, this code is always pulled into the core kernel, even
> if it is usually superseded at runtime by accelerated drivers that
> exist for many architectures.
>
> This leaves us with 25 KB of dead code in the kernel, which is negligible
> in typical environments, but which is actually a big deal for the IoT
> domain, where every kilobyte counts.
>
> For this reason, this series refactors the way the various AES
> implementations are wired up, to allow the generic version in
> crypto/aes_generic.c to be omitted from the build entirely.
>
> Patch #1 removes some bogus 'select CRYPTO_AES' statement.
>
> Patch #2 introduces CRYPTO_NEED_AES which can be selected by driver that
> require an AES cipher to be available, but don't care how it is implemented.
>
> Patches #3 and #4 make some preparatory changes that allow dependencies on
> crypto_aes_expand_key to be fulfilled by the new (and much smaller) fixed
> time AES driver. (#5)
>
> Patch #6 splits the generic AES driver into a core containing the precomputed
> sub/shift/mix tables and the key expansion routines on the one hand, and the
> encryption/decryption routines and the crypto API registration on the other.
>
> Patch #7 introduces the CRYPTO_HAVE_AES Kconfig symbol, and adds statements to
> various AES implementations that can fulfil the CRYPTO_NEED_AES dependencies
> added in patch #2. The introduced Kconfig logic allows CRYPTO_AES to be
> deselected even if AES dependencies exist, as long as one of these alternatives
> is selected.
Just a thought: how about renaming CRYPTO_AES to CRYPTO_AES_GENERIC, then
renaming what you called CRYPTO_NEED_AES to CRYPTO_AES? Then all the 'select
CRYPTO_AES' can remain as-is, instead of replacing them with the (in my opinion
uglier) 'select CRYPTO_NEED_AES'. And it should still work for people who have
CRYPTO_AES=y or CRYPTO_AES=m in their kernel config, since they'll still get at
least one AES implementation (though they may stop getting the generic one).
Also, in general I think we need better Kconfig help text. As proposed you can
now toggle simply "AES cipher algorithms", and nowhere in the help text is it
mentioned that that is only the generic implementation, which you don't need if
you have enabled some other implementation. Similarly for "Fixed time AES
cipher"; it perhaps should be mentioned that it's only useful if a fixed-time
implementation using special CPU instructions like AES-NI or ARMv8-CE isn't
usable.
- Eric
next prev parent reply other threads:[~2017-03-28 5:43 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-26 18:49 [PATCH 0/7] crypto: aes - allow generic AES to be omitted Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 1/7] drivers/crypto/Kconfig: drop bogus CRYPTO_AES dependencies Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 2/7] crypto: aes - add new Kconfig symbol for soft dependency on AES Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 3/7] crypto: aes/x86 - eliminate set_key() handling for IRQ context Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 4/7] crypto: aes/arm64 - eliminate dependency on crypto_aes_set_key() Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 5/7] crypto: aes - move crypto_aes_expand_key() to fixed-time AES driver Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 6/7] crypto: aes - split off shared AES tables and key expansion routines Ard Biesheuvel
2017-03-26 19:50 ` Nicolas Pitre
2017-03-26 20:11 ` Ard Biesheuvel
2017-03-26 18:49 ` [PATCH 7/7] crypto: aes - allow alternative AES drivers to fulfil AES dependency Ard Biesheuvel
2017-03-26 19:59 ` [PATCH 0/7] crypto: aes - allow generic AES to be omitted Nicolas Pitre
2017-03-28 5:43 ` Eric Biggers [this message]
2017-03-28 8:51 ` Ard Biesheuvel
2017-03-28 17:55 ` Eric Biggers
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=20170328054349.GA1023@zzz \
--to=ebiggers3@gmail.com \
--cc=ard.biesheuvel@linaro.org \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=nico@linaro.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;
as well as URLs for NNTP newsgroup(s).