Use CRYPTO_API() etc. from include/crypto/api.h in preparation for compilation as part of support for FIPS 140 standalone modules. Generated using: ./fipsify.py --config CONFIG_CRYPTO_MANAGER2 --source crypto/testmgr.c --header crypto/internal.h Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx> --- crypto/fips140-api.c | 11 +++++++++++ crypto/internal.h | 4 +++- crypto/testmgr.c | 6 +++--- 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/crypto/fips140-api.c b/crypto/fips140-api.c index 115a0fc99e31..5599cfa963d8 100644 --- a/crypto/fips140-api.c +++ b/crypto/fips140-api.c @@ -609,3 +609,14 @@ DEFINE_CRYPTO_API_STUB(skcipher_alloc_instance_simple); #endif +/* + * crypto/testmgr.c + */ +#if !IS_BUILTIN(CONFIG_CRYPTO_MANAGER2) + +#include <crypto/internal.h> + +DEFINE_CRYPTO_API_STUB(alg_test); + +#endif + diff --git a/crypto/internal.h b/crypto/internal.h index 700280457bf6..f4b12863d922 100644 --- a/crypto/internal.h +++ b/crypto/internal.h @@ -66,7 +66,9 @@ extern struct list_head crypto_alg_list; extern struct rw_semaphore crypto_alg_sem; extern struct blocking_notifier_head crypto_chain; -int alg_test(struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask); +DECLARE_CRYPTO_API(alg_test, int, + (struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask), + (alg, driver, name, type, mask)); #if !IS_BUILTIN(CONFIG_CRYPTO_ALGAPI) || !IS_ENABLED(CONFIG_CRYPTO_SELFTESTS) static inline bool crypto_boot_test_finished(void) diff --git a/crypto/testmgr.c b/crypto/testmgr.c index 35626ae18c60..54560f3431ca 100644 --- a/crypto/testmgr.c +++ b/crypto/testmgr.c @@ -61,7 +61,7 @@ MODULE_PARM_DESC(fuzz_iterations, "number of fuzz test iterations"); #ifndef CONFIG_CRYPTO_SELFTESTS /* a perfect nop */ -int alg_test(struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask) +int CRYPTO_API(alg_test)(struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask) { return 0; } @@ -5864,7 +5864,7 @@ static int alg_test_fips_disabled(const struct crypto_alg *alg, const struct alg return !(desc->fips_allowed & FIPS_NON_CRYPTOGRAPHIC); } -int alg_test(struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask) +int CRYPTO_API(alg_test)(struct crypto_alg *alg, const char *driver, const char *name, u32 type, u32 mask) { int i; int j; @@ -5967,4 +5967,4 @@ int alg_test(struct crypto_alg *alg, const char *driver, const char *name, u32 t #endif /* CONFIG_CRYPTO_SELFTESTS */ -EXPORT_SYMBOL_GPL(alg_test); +DEFINE_CRYPTO_API(alg_test); -- 2.39.3