Apply Crypto API wrappers to the exported crypto symbol in
CONFIG_CRYPTO_AES-related crypto to convert them into pluggable
interface.

This patch is partially based on work by Vegard Nossum, with
modifications. Unlike the original, we do not include
DEFINE_CRYPTO_API since only one copy of the crypto symbols is
kept, either in the crypto module or in the main kernel, and we ensure
such wrapper do not have impact on crypto already chosen built as
module.

Co-developed-by: Vegard Nossum <[email protected]>
Signed-off-by: Jay Wang <[email protected]>
---
 crypto/Makefile | 2 +-
 crypto/aes.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/crypto/Makefile b/crypto/Makefile
index 88de6dcbd7c4..da5a7a4aa59b 100644
--- a/crypto/Makefile
+++ b/crypto/Makefile
@@ -134,7 +134,7 @@ obj-$(CONFIG_CRYPTO_TWOFISH) += twofish_generic.o
 obj-$(CONFIG_CRYPTO_TWOFISH_COMMON) += twofish_common.o
 obj-$(CONFIG_CRYPTO_SERPENT) += serpent_generic.o
 CFLAGS_serpent_generic.o := $(call cc-option,-fsched-pressure)  # 
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79149
-obj-$(CONFIG_CRYPTO_AES) += aes.o
+crypto-objs-$(CONFIG_CRYPTO_AES) += aes.o
 obj-$(CONFIG_CRYPTO_SM4) += sm4.o
 obj-$(CONFIG_CRYPTO_SM4_GENERIC) += sm4_generic.o
 obj-$(CONFIG_CRYPTO_CAMELLIA) += camellia_generic.o
diff --git a/crypto/aes.c b/crypto/aes.c
index ae8385df0ce5..bda6a1cba552 100644
--- a/crypto/aes.c
+++ b/crypto/aes.c
@@ -52,13 +52,13 @@ static int __init crypto_aes_mod_init(void)
 {
        return crypto_register_alg(&alg);
 }
-module_init(crypto_aes_mod_init);
+crypto_module_init(crypto_aes_mod_init);
 
 static void __exit crypto_aes_mod_exit(void)
 {
        crypto_unregister_alg(&alg);
 }
-module_exit(crypto_aes_mod_exit);
+crypto_module_exit(crypto_aes_mod_exit);
 
 MODULE_DESCRIPTION("Crypto API support for AES block cipher");
 MODULE_LICENSE("GPL");
-- 
2.47.3


Reply via email to