]> git.ipfire.org Git - thirdparty/linux.git/commit
lib/crypto: nh: Add NH library
authorEric Biggers <ebiggers@kernel.org>
Thu, 11 Dec 2025 01:18:33 +0000 (17:18 -0800)
committerEric Biggers <ebiggers@kernel.org>
Mon, 12 Jan 2026 19:07:49 +0000 (11:07 -0800)
commit14e15c71d7bb591fd08f527669717694810d3973
treee687ed8b599f5baf2c24dc966b60dbdb64d638de
parented894faccb8de55cd755e093c4b0971f190d384d
lib/crypto: nh: Add NH library

Add support for the NH "almost-universal hash function" to lib/crypto/,
specifically the variant of NH used in Adiantum.

This will replace the need for the "nhpoly1305" crypto_shash algorithm.
All the implementations of "nhpoly1305" use architecture-optimized code
only for the NH stage; they just use the generic C Poly1305 code for the
Poly1305 stage.  We can achieve the same result in a simpler way using
an (architecture-optimized) nh() function combined with code in
crypto/adiantum.c that passes the results to the Poly1305 library.

This commit begins this cleanup by adding the nh() function.  The code
is derived from crypto/nhpoly1305.c and include/crypto/nhpoly1305.h.

Link: https://lore.kernel.org/r/20251211011846.8179-2-ebiggers@kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
include/crypto/nh.h [new file with mode: 0644]
lib/crypto/Kconfig
lib/crypto/Makefile
lib/crypto/nh.c [new file with mode: 0644]