From 026a733e66592e743a0905c7fd6b5d3bf89b2d7e Mon Sep 17 00:00:00 2001 From: Stephan Müller Date: Fri, 19 Nov 2021 07:55:58 +0100 Subject: crypto: kdf - add SP800-108 counter key derivation function SP800-108 defines three KDFs - this patch provides the counter KDF implementation. The KDF is implemented as a service function where the caller has to maintain the hash / HMAC state. Apart from this hash/HMAC state, no additional state is required to be maintained by either the caller or the KDF implementation. The key for the KDF is set with the crypto_kdf108_setkey function which is intended to be invoked before the caller requests a key derivation operation via crypto_kdf108_ctr_generate. SP800-108 allows the use of either a HMAC or a hash as crypto primitive for the KDF. When a HMAC primtive is intended to be used, crypto_kdf108_setkey must be used to set the HMAC key. Otherwise, for a hash crypto primitve crypto_kdf108_ctr_generate can be used immediately after allocating the hash handle. Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu --- crypto/Kconfig | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'crypto/Kconfig') diff --git a/crypto/Kconfig b/crypto/Kconfig index 285f82647d2b..01b9ca0836a5 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1845,6 +1845,10 @@ config CRYPTO_JITTERENTROPY random numbers. This Jitterentropy RNG registers with the kernel crypto API and can be used by any caller. +config CRYPTO_KDF800108_CTR + tristate + select CRYPTO_HASH + config CRYPTO_USER_API tristate -- cgit v1.2.3 From 304b4acee2f023a67f122d15a37b40ce460244d9 Mon Sep 17 00:00:00 2001 From: Stephan Müller Date: Tue, 21 Dec 2021 20:31:42 +0100 Subject: crypto: kdf - select SHA-256 required for self-test The self test of the KDF is based on SHA-256. Thus, this algorithm must be present as otherwise a warning is issued. Reported-by: kernel test robot Signed-off-by: Stephan Mueller Signed-off-by: Herbert Xu --- crypto/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crypto/Kconfig') diff --git a/crypto/Kconfig b/crypto/Kconfig index 01b9ca0836a5..649ee1df05c6 100644 --- a/crypto/Kconfig +++ b/crypto/Kconfig @@ -1847,7 +1847,7 @@ config CRYPTO_JITTERENTROPY config CRYPTO_KDF800108_CTR tristate - select CRYPTO_HASH + select CRYPTO_SHA256 config CRYPTO_USER_API tristate -- cgit v1.2.3