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_LIB_UTILS --source lib/crypto/utils.c --header include/crypto/utils.h Signed-off-by: Vegard Nossum <vegard.nos...@oracle.com> --- crypto/fips140-api.c | 11 +++++++++++ include/crypto/utils.h | 4 +++- lib/crypto/utils.c | 4 ++-- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/crypto/fips140-api.c b/crypto/fips140-api.c index 13148a3d3519..6caef4827a53 100644 --- a/crypto/fips140-api.c +++ b/crypto/fips140-api.c @@ -116,3 +116,14 @@ DEFINE_CRYPTO_API_STUB(hmac_sha512_usingrawkey); #endif +/* + * lib/crypto/utils.c + */ +#if !IS_BUILTIN(CONFIG_CRYPTO_LIB_UTILS) + +#include <crypto/utils.h> + +DEFINE_CRYPTO_API_STUB(__crypto_xor); + +#endif + diff --git a/include/crypto/utils.h b/include/crypto/utils.h index d7c3dae79138..996435707260 100644 --- a/include/crypto/utils.h +++ b/include/crypto/utils.h @@ -12,7 +12,9 @@ #include <linux/compiler_attributes.h> #include <linux/types.h> -void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int size); +DECLARE_CRYPTO_API(__crypto_xor, void, + (u8 *dst, const u8 *src1, const u8 *src2, unsigned int size), + (dst, src1, src2, size)); static inline void crypto_xor(u8 *dst, const u8 *src, unsigned int size) { diff --git a/lib/crypto/utils.c b/lib/crypto/utils.c index dec381d5e906..276519171e1c 100644 --- a/lib/crypto/utils.c +++ b/lib/crypto/utils.c @@ -15,7 +15,7 @@ * (which may alias one of the sources). Don't call this directly; call * crypto_xor() or crypto_xor_cpy() instead. */ -void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len) +void CRYPTO_API(__crypto_xor)(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len) { int relalign = 0; @@ -84,7 +84,7 @@ void __crypto_xor(u8 *dst, const u8 *src1, const u8 *src2, unsigned int len) while (len--) *dst++ = *src1++ ^ *src2++; } -EXPORT_SYMBOL_GPL(__crypto_xor); +DEFINE_CRYPTO_API(__crypto_xor); MODULE_DESCRIPTION("Crypto library utility functions"); MODULE_LICENSE("GPL"); -- 2.39.3