linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/7] crypto: aes - allow generic AES to be omitted
@ 2017-03-26 18:49 Ard Biesheuvel
  2017-03-26 18:49 ` [PATCH 1/7] drivers/crypto/Kconfig: drop bogus CRYPTO_AES dependencies Ard Biesheuvel
                   ` (8 more replies)
  0 siblings, 9 replies; 14+ messages in thread
From: Ard Biesheuvel @ 2017-03-26 18:49 UTC (permalink / raw)
  To: linux-crypto, herbert; +Cc: nico, ebiggers3, Ard Biesheuvel

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.

Ard Biesheuvel (7):
  drivers/crypto/Kconfig: drop bogus CRYPTO_AES dependencies
  crypto: aes - add new Kconfig symbol for soft dependency on AES
  crypto: aes/x86 - eliminate set_key() handling for IRQ context
  crypto: aes/arm64 - eliminate dependency on crypto_aes_set_key()
  crypto: aes - move crypto_aes_expand_key() to fixed-time AES driver
  crypto: aes - split off shared AES tables and key expansion routines
  crypto: aes - allow alternative AES drivers to fulfil AES dependency

 arch/arm/crypto/Kconfig                      |    5 +-
 arch/arm64/crypto/Kconfig                    |    5 +-
 arch/arm64/crypto/aes-glue.c                 |   12 +-
 arch/x86/crypto/aesni-intel_glue.c           |   14 +-
 crypto/Kconfig                               |   25 +-
 crypto/Makefile                              |    1 +
 crypto/aes_core.c                            | 1302 ++++++++++++++++++++
 crypto/aes_generic.c                         | 1239 -------------------
 crypto/aes_ti.c                              |    7 +-
 drivers/block/Kconfig                        |    2 +-
 drivers/crypto/Kconfig                       |   21 +-
 drivers/net/Kconfig                          |    2 +-
 drivers/net/wireless/cisco/Kconfig           |    2 +-
 drivers/net/wireless/intel/ipw2x00/Kconfig   |    2 +-
 drivers/net/wireless/intersil/hostap/Kconfig |    2 +-
 drivers/staging/rtl8192e/Kconfig             |    2 +-
 drivers/usb/wusbcore/Kconfig                 |    2 +-
 fs/ceph/Kconfig                              |    2 +-
 fs/cifs/Kconfig                              |    2 +-
 fs/crypto/Kconfig                            |    2 +-
 net/Kconfig                                  |    2 +-
 net/bluetooth/Kconfig                        |    2 +-
 net/ceph/Kconfig                             |    2 +-
 net/mac80211/Kconfig                         |    2 +-
 net/mac802154/Kconfig                        |    2 +-
 net/sunrpc/Kconfig                           |    3 +-
 security/keys/Kconfig                        |    4 +-
 27 files changed, 1377 insertions(+), 1291 deletions(-)
 create mode 100644 crypto/aes_core.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2017-03-28 17:55 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-03-28  8:51   ` Ard Biesheuvel
2017-03-28 17:55     ` Eric Biggers

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).