On 2026-07-20T04:13:44, James Hilliard <[email protected]> wrote:
> crypto: allwinner: add sun8i-ce hash driver
>
> The Allwinner sun8i Crypto Engine includes hardware hash methods. Add a
> UCLASS_HASH child for the sun8i-ce parent so FIT hash verification can
> use the accelerator from U-Boot proper and SPL.
>
> Support MD5, SHA1, SHA256, SHA384 and SHA512. Build the final hash padding
> in the driver. Stream directly addressable input through bounded 64 MiB
> zero-copy tasks and word-unaligned input through a fixed 128 KiB repack
> buffer. Feed each intermediate state back through hash input-IV mode,
> keeping heap use independent of input size while word-aligned cacheline
> offsets remain zero-copy.
>
> Map input, padding, optional state and a cacheline-rounded private output
> through the parent's DMA objects. Keep the descriptor output length limited
> to the algorithm state, then submit hash work on the dedicated completion
> channel through the shared task-session API. Keep one session across every
> continuation chunk while retiring each task before releasing its mappings.
> Release mappings in reverse preparation order after the session retires.
>
> H6 and H616 use bit-sized hash task lengths, so keep each submitted chunk
> within the 32-bit task descriptor field. Feed the watchdog from the shared
> CE polling path while waiting for hardware completion.
>
> In SPL, only advertise hash algorithms selected for that phase so
> SRAM-constrained builds do not accept wider algorithms unless requested.
>
> Signed-off-by: James Hilliard <[email protected]>
>
> drivers/crypto/allwinner/sun8i-ce/Kconfig         |  26 ++
>  drivers/crypto/allwinner/sun8i-ce/Makefile        |   1 +
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-core.c |   6 +
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce-hash.c | 343 
> ++++++++++++++++++++++
>  drivers/crypto/allwinner/sun8i-ce/sun8i-ce.h      |   5 +
>  5 files changed, 381 insertions(+)

Reviewed-by: Simon Glass <[email protected]>

Reply via email to