Commit 3241cd0c authored by Hannes Reinecke's avatar Hannes Reinecke Committed by Keith Busch
Browse files

crypto,fs: Separate out hkdf_extract() and hkdf_expand()



Separate out the HKDF functions into a separate module to
to make them available to other callers.
And add a testsuite to the module with test vectors
from RFC 5869 (and additional vectors for SHA384 and SHA512)
to ensure the integrity of the algorithm.

Signed-off-by: default avatarHannes Reinecke <hare@kernel.org>
Acked-by: default avatarEric Biggers <ebiggers@kernel.org>
Acked-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: default avatarKeith Busch <kbusch@kernel.org>
parent fc22b34e
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -141,6 +141,12 @@ config CRYPTO_ACOMP
	select CRYPTO_ALGAPI
	select CRYPTO_ACOMP2

config CRYPTO_HKDF
	tristate
	select CRYPTO_SHA256 if !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
	select CRYPTO_SHA512 if !CONFIG_CRYPTO_MANAGER_DISABLE_TESTS
	select CRYPTO_HASH2

config CRYPTO_MANAGER
	tristate "Cryptographic algorithm manager"
	select CRYPTO_MANAGER2
+1 −0
Original line number Diff line number Diff line
@@ -34,6 +34,7 @@ obj-$(CONFIG_CRYPTO_HASH2) += crypto_hash.o
obj-$(CONFIG_CRYPTO_AKCIPHER2) += akcipher.o
obj-$(CONFIG_CRYPTO_SIG2) += sig.o
obj-$(CONFIG_CRYPTO_KPP2) += kpp.o
obj-$(CONFIG_CRYPTO_HKDF) += hkdf.o

dh_generic-y := dh.o
dh_generic-y += dh_helper.o

crypto/hkdf.c

0 → 100644
+573 −0

File added.

Preview size limit exceeded, changes collapsed.

+1 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@ config FS_ENCRYPTION
	bool "FS Encryption (Per-file encryption)"
	select CRYPTO
	select CRYPTO_HASH
	select CRYPTO_HKDF
	select CRYPTO_SKCIPHER
	select CRYPTO_LIB_SHA256
	select KEYS
+15 −70

File changed.

Preview size limit exceeded, changes collapsed.

Loading