Apply Crypto API wrappers to the exported crypto symbol in CONFIG_CRYPTO_KDF800108_CTR-related crypto to convert them into pluggable interface.
Signed-off-by: Jay Wang <[email protected]> --- crypto/Makefile | 2 +- crypto/fips140/fips140-api.c | 11 +++++++++++ crypto/kdf_sp800108.c | 4 ++-- include/crypto/kdf_sp800108.h | 14 ++++++++------ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/crypto/Makefile b/crypto/Makefile index 29e674c1f2ad..c1088b10f49a 100644 --- a/crypto/Makefile +++ b/crypto/Makefile @@ -205,7 +205,7 @@ obj-$(CONFIG_CRYPTO_SIMD) += crypto_simd.o # # Key derivation function # -obj-$(CONFIG_CRYPTO_KDF800108_CTR) += kdf_sp800108.o +crypto-objs-$(CONFIG_CRYPTO_KDF800108_CTR) += kdf_sp800108.o obj-$(CONFIG_CRYPTO_DF80090A) += df_sp80090a.o diff --git a/crypto/fips140/fips140-api.c b/crypto/fips140/fips140-api.c index 7159c796d87f..0ed89baa3865 100644 --- a/crypto/fips140/fips140-api.c +++ b/crypto/fips140/fips140-api.c @@ -853,6 +853,17 @@ DEFINE_CRYPTO_API_STUB(async_syndrome_val); DEFINE_CRYPTO_API_STUB(async_raid6_2data_recov); DEFINE_CRYPTO_API_STUB(async_raid6_datap_recov); +#endif +/* + * crypto/kdf_sp800108.c + */ +#if IS_BUILTIN(CONFIG_CRYPTO_KDF800108_CTR) + +#include <crypto/kdf_sp800108.h> + +DEFINE_CRYPTO_API_STUB(crypto_kdf108_ctr_generate); +DEFINE_CRYPTO_API_STUB(crypto_kdf108_setkey); + #endif /* * crypto/ecdh_helper.c diff --git a/crypto/kdf_sp800108.c b/crypto/kdf_sp800108.c index b7a6bf9da773..bf23a39bb657 100644 --- a/crypto/kdf_sp800108.c +++ b/crypto/kdf_sp800108.c @@ -149,8 +149,8 @@ static int __init crypto_kdf108_init(void) static void __exit crypto_kdf108_exit(void) { } -module_init(crypto_kdf108_init); -module_exit(crypto_kdf108_exit); +crypto_module_init(crypto_kdf108_init); +crypto_module_exit(crypto_kdf108_exit); MODULE_LICENSE("GPL v2"); MODULE_AUTHOR("Stephan Mueller <[email protected]>"); diff --git a/include/crypto/kdf_sp800108.h b/include/crypto/kdf_sp800108.h index b7b20a778fb7..33cc2e75b014 100644 --- a/include/crypto/kdf_sp800108.h +++ b/include/crypto/kdf_sp800108.h @@ -7,6 +7,8 @@ #ifndef _CRYPTO_KDF108_H #define _CRYPTO_KDF108_H +#include <crypto/api.h> + #include <crypto/hash.h> #include <linux/uio.h> @@ -28,9 +30,9 @@ * * @return 0 on success, < 0 on error */ -int crypto_kdf108_ctr_generate(struct crypto_shash *kmd, - const struct kvec *info, unsigned int info_nvec, - u8 *dst, unsigned int dlen); +DECLARE_CRYPTO_API(CONFIG_CRYPTO_KDF800108_CTR, crypto_kdf108_ctr_generate, int, + (struct crypto_shash *kmd, const struct kvec *info, unsigned int info_nvec, u8 *dst, unsigned int dlen), + (kmd, info, info_nvec, dst, dlen)); /** * Counter KDF setkey operation @@ -54,8 +56,8 @@ int crypto_kdf108_ctr_generate(struct crypto_shash *kmd, * * @return 0 on success, < 0 on error */ -int crypto_kdf108_setkey(struct crypto_shash *kmd, - const u8 *key, size_t keylen, - const u8 *ikm, size_t ikmlen); +DECLARE_CRYPTO_API(CONFIG_CRYPTO_KDF800108_CTR, crypto_kdf108_setkey, int, + (struct crypto_shash *kmd, const u8 *key, size_t keylen, const u8 *ikm, size_t ikmlen), + (kmd, key, keylen, ikm, ikmlen)); #endif /* _CRYPTO_KDF108_H */ -- 2.47.3
