Re: [PATCH 2/6] crypto: kdf - SP800-108 Key Derivation Function

From: Eric Biggers
Date: Sat Jan 12 2019 - 00:28:06 EST


On Fri, Jan 11, 2019 at 08:10:02PM +0100, Stephan Müller wrote:
> The SP800-108 compliant Key Derivation Function is implemented as a
> random number generator considering that it behaves like a deterministic
> RNG.
>
> All three KDF types specified in SP800-108 are implemented.
>
> The code comments provide details about how to invoke the different KDF
> types.
>
> Signed-off-by: Stephan Mueller <smueller@xxxxxxxxxx>
> ---
> crypto/Kconfig | 7 +
> crypto/Makefile | 1 +
> crypto/kdf.c | 492 ++++++++++++++++++++++++++++++++++++++++++++++++
> 3 files changed, 500 insertions(+)
> create mode 100644 crypto/kdf.c
>
> diff --git a/crypto/Kconfig b/crypto/Kconfig
> index 86960aa53e0f..cc80d89e0cf5 100644
> --- a/crypto/Kconfig
> +++ b/crypto/Kconfig
> @@ -561,6 +561,13 @@ config CRYPTO_HMAC
> HMAC: Keyed-Hashing for Message Authentication (RFC2104).
> This is required for IPSec.
>
> +config CRYPTO_KDF
> + tristate "Key Derivation Function (SP800-108)"
> + select CRYPTO_RNG
> + help
> + Support for KDF compliant to SP800-108. All three types of
> + KDF specified in SP800-108 are implemented.
> +
> config CRYPTO_XCBC
> tristate "XCBC support"
> select CRYPTO_HASH
> diff --git a/crypto/Makefile b/crypto/Makefile
> index 799ed5e94606..69a0bb64b0ac 100644
> --- a/crypto/Makefile
> +++ b/crypto/Makefile
> @@ -58,6 +58,7 @@ crypto_user-y := crypto_user_base.o
> crypto_user-$(CONFIG_CRYPTO_STATS) += crypto_user_stat.o
> obj-$(CONFIG_CRYPTO_CMAC) += cmac.o
> obj-$(CONFIG_CRYPTO_HMAC) += hmac.o
> +obj-$(CONFIG_CRYPTO_KDF) += kdf.o

This naming is too generic. CONFIG_CRYPTO_KDF and kdf.c imply that this is
related to all KDFs. But actually it is an implementation of a few specific
KDFs. Can you give it a clearer name, like KDF_SP800?

- Eric