[PATCH v2 0/7] ARM64: crypto: add Crypto Extensions accelerated SHA implementation

Ahmad Fatoum a.fatoum at pengutronix.de
Thu May 25 23:37:39 PDT 2023


This shaves 400ms of a FIT image boot that uses sha256 as digest for
the images referenced by the selected configuration:

  barebox at imx8mn-old:/ time bootm -d kernel-a
  Dryrun. Aborted.
  time: 998ms

  barebox at imx8mn-new:/ time bootm -d kernel-a
  Dryrun. Aborted.
  time: 601ms

We also use SHA256 to verify barebox proper when in high assurance boot,
but that still uses the software implementation.

v1 -> v2:
  - use dedicated CONFIG_ symbols for SHA224/SHA256 selftest (Sascha)
  - check against CONFIG_ symbols for generic algorithm
  - remove #define DEBUG in selftest
  - fix oversight in new <linux/linkage.h> __ALIGN definition,
    which broke build on x86 and PowerPC
  - 

Ahmad Fatoum (7):
  crypto: digest: match driver name if no algo name matches
  test: self: add digest test
  include: sync <linux/linkage.h> with Linux
  ARM: asm: implement CPU_BE/CPU_LE
  ARM: asm: import Linux adr_l/ldr_l assembler.h definitions
  crypto: sha: reorder struct sha*_state into Linux order
  ARM64: crypto: add Crypto Extensions accelerated SHA implementation

 arch/arm/Makefile                |   3 +-
 arch/arm/crypto/Makefile         |   6 +
 arch/arm/crypto/sha1-ce-core.S   | 149 ++++++++++++++
 arch/arm/crypto/sha1-ce-glue.c   |  93 +++++++++
 arch/arm/crypto/sha2-ce-core.S   | 156 +++++++++++++++
 arch/arm/crypto/sha2-ce-glue.c   | 121 ++++++++++++
 arch/arm/include/asm/assembler.h | 230 ++++++++++++++++++++++
 arch/arm/include/asm/neon.h      |   8 +
 commands/digest.c                |   2 +-
 common/Kconfig                   |   6 +
 crypto/Kconfig                   |  21 ++
 crypto/digest.c                  |  11 +-
 include/crypto/sha.h             |  10 +-
 include/crypto/sha1_base.h       | 104 ++++++++++
 include/crypto/sha256_base.h     | 129 +++++++++++++
 include/linux/barebox-wrapper.h  |   1 +
 include/linux/linkage.h          | 321 ++++++++++++++++++++++++++++---
 include/linux/string.h           |  20 ++
 test/self/Kconfig                |   6 +
 test/self/Makefile               |   1 +
 test/self/digest.c               | 213 ++++++++++++++++++++
 21 files changed, 1572 insertions(+), 39 deletions(-)
 create mode 100644 arch/arm/crypto/sha1-ce-core.S
 create mode 100644 arch/arm/crypto/sha1-ce-glue.c
 create mode 100644 arch/arm/crypto/sha2-ce-core.S
 create mode 100644 arch/arm/crypto/sha2-ce-glue.c
 create mode 100644 arch/arm/include/asm/neon.h
 create mode 100644 include/crypto/sha1_base.h
 create mode 100644 include/crypto/sha256_base.h
 create mode 100644 test/self/digest.c

-- 
2.39.2




More information about the barebox mailing list