[PATCH v3 00/10] crypto: allwinner: enable sun8i-ce FIT crypto
Andre Przywara
andre.przywara at arm.com
Fri Jul 10 12:05:15 CEST 2026
Hi James,
On 7/10/26 00:46, James Hilliard wrote:
> This series enables Allwinner Crypto Engine backed FIT decryption and
> FIT signature/hash validation for secure-boot flows on H6/H616-class
> boards, covering both SPL and U-Boot proper.
>
> The purpose is to use CE-backed AES for encrypted FIT payloads on H6/H616
> and CE-backed ECDSA validation where the CE ECC engine is available,
> currently H616, instead of relying only on software crypto paths.
May I ask: why? In general those proprietary vendor crypto offload
engines are somewhat frowned upon, and especially in the Allwinner case
I am not even sure if someone has tried to validate the hardware.
So what is wrong with using a reviewable (and reviewed) and tested
software implementation? Do you have data that shows any advantage here?
Just from a high level point of view: the CE uses uncached DMA
operations, and runs at 24 MHz, if I see this correctly. I am pretty
sure the AES instructions in the Cortex-A53 beat this easily, I guess
even a NEON-optimised pure software implementation would be faster.
So what I see here is just a lot of code added, but with little (read:
no) improvement.
In the BROM the rationale is a bit different, so I see why it uses the
CE there, but IIRC there is even a chicken bit in the fuses to not use
the CE, so they might even have a software fallback?
Thoughts?
Cheers,
Andre
> At a high level this adds:
>
> - SPL driver-model crypto plumbing for AES and hash providers.
> - FIT decrypt-to-buffer support and SPL FIT cipher support, so SPL can
> decrypt an encrypted U-Boot proper FIT without allocating another full
> payload buffer.
> - A shared sun8i-ce parent driver with AES and hash children for H6/H616.
> - An H616 ECDSA child for CE-backed FIT signature validation, plus common
> ECDSA curve-size and key-encoding fixes for secp224r1, prime256v1,
> secp384r1 and secp521r1.
>
> The AES child supports software-provided AES-128/192/256 keys in ECB and
> CBC modes. The hash child supports the CE one-shot MD5/SHA1/SHA256/SHA384/
> SHA512 methods used by FIT verification. The ECDSA child exposes the H616
> CE ECC verifier through UCLASS_ECDSA.
>
> Tested flows include:
>
> - SPL loading an encrypted and signed U-Boot proper FIT with CE-backed
> AES decryption, hash verification and ECDSA signature verification.
> - U-Boot proper loading an encrypted and signed FIT with CE-backed AES
> decryption, hash verification and ECDSA signature verification.
> - U-Boot proper AES command paths using the DM AES provider.
> - CE ECDSA verification with secp224r1, prime256v1, secp384r1 and
> secp521r1 FIT signatures.
>
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
> ---
> To: Svyatoslav Ryhel <clamor95 at gmail.com>
> To: Ion Agorria <ion at agorria.com>
> To: u-boot at lists.denx.de
> Cc: Chen-Yu Tsai <wens at kernel.org>
> Cc: Samuel Holland <samuel at sholland.org>
> Cc: Tom Rini <trini at konsulko.com>
> Cc: James Hilliard <james.hilliard1 at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Quentin Schulz <quentin.schulz at cherry.de>
> Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
> Cc: Aristo Chen <aristo.chen at canonical.com>
> Cc: Anton Ivanov <anton at binarly.io>
> Cc: Daniel Golle <daniel at makrotopia.org>
> Cc: Neil Armstrong <neil.armstrong at linaro.org>
> Cc: Wolfgang Wallner <wolfgang.wallner at at.abb.com>
> Cc: Randolph Sapp <rs at ti.com>
> Cc: Heiko Schocher <hs at nabladev.com>
> Cc: Alexey Charkov <alchark at gmail.com>
> Cc: "Kory Maincent (TI.com)" <kory.maincent at bootlin.com>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Cc: Anshul Dalal <anshuld at ti.com>
> Cc: Rasmus Villemoes <rv at rasmusvillemoes.dk>
> Cc: Johan Jonker <jbx6244 at gmail.com>
> Cc: Francesco Valla <francesco at valla.it>
> Cc: Michael Walle <mwalle at kernel.org>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Andre Przywara <andre.przywara at arm.com>
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Michael Trimarchi <michael at amarulasolutions.com>
> Cc: Richard Genoud <richard.genoud at bootlin.com>
> Cc: Marek Vasut <marek.vasut at mailbox.org>
> Cc: E Shattow <e at freeshell.de>
> Cc: Enric Balletbo i Serra <eballetbo at kernel.org>
> Cc: Lucas Dietrich <ld.adecy at gmail.com>
> Cc: David Lechner <dlechner at baylibre.com>
> Cc: Julien Stephan <jstephan at baylibre.com>
> Cc: Kuan-Wei Chiu <visitorckw at gmail.com>
> Cc: Raymond Mao <raymond.mao at riscstar.com>
> Cc: Stefan Roese <stefan.roese at mailbox.org>
> Cc: Thierry Reding <treding at nvidia.com>
> Cc: Francois Berder <fberder at outlook.fr>
> Cc: Jonas Karlman <jonas at kwiboo.se>
> Cc: Jerome Forissier <jerome.forissier at arm.com>
>
> ---
> Changes in v3:
> - Rebase on U-Boot master.
> - Add review tags from Svyatoslav Ryhel and Simon Glass.
> - Simplify the AES decrypt helper guard and validation flow.
> - Document the AES provider in-place CBC decrypt contract.
> - Tighten SPL encrypted-FIT buffer handling and error reporting.
> - Clean up the SPL DM hash fallback and Kconfig help text.
> - Link to v2: https://patch.msgid.link/20260702-submit-ce-series-v2-v2-0-ffda5bed58af@gmail.com
>
> To: Svyatoslav Ryhel <clamor95 at gmail.com>
> To: Ion Agorria <ion at agorria.com>
> To: u-boot at lists.denx.de
> Cc: Tom Rini <trini at konsulko.com>
> Cc: James Hilliard <james.hilliard1 at gmail.com>
> Cc: Simon Glass <sjg at chromium.org>
> Cc: Thierry Reding <treding at nvidia.com>
> Cc: Quentin Schulz <quentin.schulz at cherry.de>
> Cc: Marek Vasut <marek.vasut+renesas at mailbox.org>
> Cc: Rasmus Villemoes <rv at rasmusvillemoes.dk>
> Cc: Aristo Chen <aristo.chen at canonical.com>
> Cc: Anton Ivanov <anton at binarly.io>
> Cc: Daniel Golle <daniel at makrotopia.org>
> Cc: Francois Berder <fberder at outlook.fr>
> Cc: Peng Fan <peng.fan at nxp.com>
> Cc: Neil Armstrong <neil.armstrong at linaro.org>
> Cc: Randolph Sapp <rs at ti.com>
> Cc: Jonas Karlman <jonas at kwiboo.se>
> Cc: Wolfgang Wallner <wolfgang.wallner at at.abb.com>
> Cc: Alexey Charkov <alchark at gmail.com>
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> Cc: Heiko Schocher <hs at nabladev.com>
> Cc: "Kory Maincent (TI.com)" <kory.maincent at bootlin.com>
> Cc: Anshul Dalal <anshuld at ti.com>
> Cc: Johan Jonker <jbx6244 at gmail.com>
> Cc: Francesco Valla <francesco at valla.it>
> Cc: Heinrich Schuchardt <xypron.glpk at gmx.de>
> Cc: Michael Walle <mwalle at kernel.org>
> Cc: Andre Przywara <andre.przywara at arm.com>
> Cc: Lukasz Majewski <lukma at denx.de>
> Cc: Richard Genoud <richard.genoud at bootlin.com>
> Cc: Michael Trimarchi <michael at amarulasolutions.com>
> Cc: Marek Vasut <marek.vasut at mailbox.org>
> Cc: E Shattow <e at freeshell.de>
> Cc: Enric Balletbo i Serra <eballetbo at kernel.org>
> Cc: Mattijs Korpershoek <mkorpershoek at kernel.org>
> Cc: Lucas Dietrich <ld.adecy at gmail.com>
> Cc: David Lechner <dlechner at baylibre.com>
> Cc: Julien Stephan <jstephan at baylibre.com>
> Cc: Kuan-Wei Chiu <visitorckw at gmail.com>
> Cc: Bastien Curutchet <bastien.curutchet at bootlin.com>
> Cc: Raymond Mao <raymond.mao at riscstar.com>
>
> ---
> James Hilliard (10):
> cmd: aes: fix DM operation handling
> crypto: aes: allow DM AES in SPL
> boot: image: add FIT decrypt-to-buffer helper
> spl: fit: support encrypted payloads
> clk: sunxi: add H6/H616 CE gates and reset
> lib: ecdsa: support additional curve sizes
> crypto: allwinner: add sun8i-ce AES driver
> crypto: allwinner: add sun8i-ce ECDSA verifier
> crypto: hash: allow DM hash in SPL
> crypto: allwinner: add sun8i-ce hash driver
>
> MAINTAINERS | 1 +
> boot/Kconfig | 8 +
> boot/image-cipher.c | 38 +-
> boot/image-fit.c | 85 ++--
> cmd/aes.c | 8 +-
> common/spl/spl_fit.c | 75 +++-
> doc/mkimage.1 | 3 +
> doc/usage/fit/signature.rst | 9 +-
> drivers/clk/sunxi/clk_h6.c | 5 +
> drivers/clk/sunxi/clk_h616.c | 5 +
> drivers/crypto/Kconfig | 2 +
> drivers/crypto/Makefile | 1 +
> drivers/crypto/aes/Kconfig | 8 +
> drivers/crypto/aes/aes-sw.c | 6 +
> drivers/crypto/aes/aes-uclass.c | 15 +
> drivers/crypto/allwinner/Kconfig | 3 +
> drivers/crypto/allwinner/Makefile | 3 +
> drivers/crypto/allwinner/sun8i-ce/Kconfig | 158 ++++++++
> drivers/crypto/allwinner/sun8i-ce/Makefile | 6 +
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-aes.c | 413 ++++++++++++++++++++
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c | 408 +++++++++++++++++++
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-ecdsa.c | 434 +++++++++++++++++++++
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 298 ++++++++++++++
> drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h | 72 ++++
> drivers/crypto/hash/Kconfig | 13 +
> drivers/crypto/hash/Makefile | 2 +-
> drivers/crypto/tegra/tegra_aes.c | 7 +
> include/image.h | 39 +-
> include/u-boot/aes.h | 10 +
> include/u-boot/ecdsa.h | 22 ++
> include/u-boot/fdt-libcrypto.h | 6 +-
> include/uboot_aes.h | 40 +-
> lib/Makefile | 2 +-
> lib/aes/aes-decrypt.c | 104 ++++-
> lib/ecdsa/Kconfig | 2 +-
> lib/ecdsa/ecdsa-libcrypto.c | 141 ++++---
> lib/ecdsa/ecdsa-verify.c | 39 +-
> lib/fdt-libcrypto.c | 60 +--
> tools/image-sig-host.c | 7 +
> 39 files changed, 2364 insertions(+), 194 deletions(-)
> ---
> base-commit: 913fedc816570c07bfc7f9c4046dc2a3a55e4099
> change-id: 20260702-submit-ce-series-v2-4a77b170c68c
>
> Best regards,
> --
> James Hilliard <james.hilliard1 at gmail.com>
>
More information about the U-Boot
mailing list