lib: Plumb in argon2 library

Add a Kconfig optiion to enable this library and add it to the lib/
Makefile, being careful to avoid a conflict with the existing blake2b
implementation.

Co-developed-by: Claude <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
This commit is contained in:
Simon Glass
2025-11-11 03:38:41 -07:00
parent f1514752a5
commit 7bd184c0c5
4 changed files with 19 additions and 3 deletions

View File

@@ -542,11 +542,12 @@ menu "Hashing Support"
config BLAKE2
bool "Enable BLAKE2 support"
depends on !ARGON2
help
This option enables support of hashing using BLAKE2B algorithm.
The hash is calculated in software.
The BLAKE2 algorithm produces a hash value (digest) between 1 and
64 bytes.
64 bytes. Note: ARGON2 includes its own BLAKE2 implementation.
config SHA1
bool "Enable SHA1 support"
@@ -983,6 +984,17 @@ config JSON
printing functions. JSON is used for structured data representation,
such as LUKS2 metadata.
config ARGON2
bool "Enable Argon2 password hashing"
help
This enables the Argon2 password hashing algorithm, winner of the
Password Hashing Competition (PHC). Argon2 is used for key derivation
in LUKS2 encrypted volumes. It provides better resistance to GPU
cracking attacks compared to PBKDF2.
Note: This option includes its own BLAKE2 implementation and is
mutually exclusive with CONFIG_BLAKE2.
config OF_LIBFDT
bool "Enable the FDT library"
default y if OF_CONTROL

View File

@@ -80,7 +80,10 @@ obj-$(CONFIG_$(PHASE_)ACPI) += acpi/
obj-$(CONFIG_ECDSA) += ecdsa/
obj-$(CONFIG_$(PHASE_)RSA) += rsa/
obj-$(CONFIG_HASH) += hash-checksum.o
# argon2 provides its own blake2b; just build blake2s when ARGON2 is enabled
obj-$(CONFIG_BLAKE2) += blake2/blake2b.o blake2/blake2s.o
obj-$(CONFIG_ARGON2) += blake2/blake2s.o
obj-$(CONFIG_$(PHASE_)MD5_LEGACY) += md5.o
obj-$(CONFIG_$(PHASE_)SHA1_LEGACY) += sha1.o
@@ -89,6 +92,7 @@ obj-$(CONFIG_$(PHASE_)SHA256_LEGACY) += sha256.o
obj-$(CONFIG_$(PHASE_)SHA512_LEGACY) += sha512.o
obj-$(CONFIG_CRYPT_PW) += crypt/
obj-$(CONFIG_ARGON2) += argon2/
obj-$(CONFIG_$(PHASE_)ASN1_DECODER_LEGACY) += asn1_decoder.o
obj-$(CONFIG_$(PHASE_)ZLIB) += zlib/