From: Jay Wang <wanjay@amazon.com>
To: Herbert Xu <herbert@gondor.apana.org.au>,
"David S . Miller" <davem@davemloft.net>,
<linux-crypto@vger.kernel.org>
Cc: Jay Wang <jay.wang.upstream@gmail.com>,
Vegard Nossum <vegard.nossum@oracle.com>,
Nicolai Stange <nstange@suse.de>,
Ilia Okomin <ilya.okomin@oracle.com>,
Catalin Marinas <catalin.marinas@arm.com>,
"Will Deacon" <will@kernel.org>,
Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Luis Chamberlain <mcgrof@kernel.org>,
Petr Pavlu <petr.pavlu@suse.com>,
Nathan Chancellor <nathan@kernel.org>,
Nicolas Schier <nsc@kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <x86@kernel.org>,
<linux-kbuild@vger.kernel.org>, <linux-modules@vger.kernel.org>
Subject: [PATCH 19/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64 crypto
Date: Thu, 12 Feb 2026 03:15:17 +0000 [thread overview]
Message-ID: <20260212031521.2124-20-wanjay@amazon.com> (raw)
In-Reply-To: <20260212031521.2124-1-wanjay@amazon.com>
Apply Crypto API wrappers to the exported crypto symbol in
CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64-related crypto to convert them into pluggable
interface.
Signed-off-by: Jay Wang <wanjay@amazon.com>
---
arch/x86/crypto/Makefile | 2 +-
arch/x86/crypto/aria-avx.h | 35 ++++++++++++++++-----------
arch/x86/crypto/aria_aesni_avx_glue.c | 4 +--
arch/x86/crypto/fips140/fips140-api.c | 18 ++++++++++++++
4 files changed, 42 insertions(+), 17 deletions(-)
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 103a49fbbac8..bda4e9cd5e2c 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -62,7 +62,7 @@ sm4-aesni-avx-x86_64-y := sm4-aesni-avx-asm_64.o sm4_aesni_avx_glue.o
crypto-objs-$(CONFIG_CRYPTO_SM4_AESNI_AVX2_X86_64) += sm4-aesni-avx2-x86_64.o
sm4-aesni-avx2-x86_64-y := sm4-aesni-avx2-asm_64.o sm4_aesni_avx2_glue.o
-obj-$(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64) += aria-aesni-avx-x86_64.o
+crypto-objs-$(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64) += aria-aesni-avx-x86_64.o
aria-aesni-avx-x86_64-y := aria-aesni-avx-asm_64.o aria_aesni_avx_glue.o
obj-$(CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64) += aria-aesni-avx2-x86_64.o
diff --git a/arch/x86/crypto/aria-avx.h b/arch/x86/crypto/aria-avx.h
index 6e1b2d8a31ed..e4109e67a640 100644
--- a/arch/x86/crypto/aria-avx.h
+++ b/arch/x86/crypto/aria-avx.h
@@ -2,6 +2,7 @@
#ifndef ASM_X86_ARIA_AVX_H
#define ASM_X86_ARIA_AVX_H
+#include <crypto/api.h>
#include <linux/types.h>
#define ARIA_AESNI_PARALLEL_BLOCKS 16
@@ -13,20 +14,26 @@
#define ARIA_GFNI_AVX512_PARALLEL_BLOCKS 64
#define ARIA_GFNI_AVX512_PARALLEL_BLOCK_SIZE (ARIA_BLOCK_SIZE * ARIA_GFNI_AVX512_PARALLEL_BLOCKS)
-asmlinkage void aria_aesni_avx_encrypt_16way(const void *ctx, u8 *dst,
- const u8 *src);
-asmlinkage void aria_aesni_avx_decrypt_16way(const void *ctx, u8 *dst,
- const u8 *src);
-asmlinkage void aria_aesni_avx_ctr_crypt_16way(const void *ctx, u8 *dst,
- const u8 *src,
- u8 *keystream, u8 *iv);
-asmlinkage void aria_aesni_avx_gfni_encrypt_16way(const void *ctx, u8 *dst,
- const u8 *src);
-asmlinkage void aria_aesni_avx_gfni_decrypt_16way(const void *ctx, u8 *dst,
- const u8 *src);
-asmlinkage void aria_aesni_avx_gfni_ctr_crypt_16way(const void *ctx, u8 *dst,
- const u8 *src,
- u8 *keystream, u8 *iv);
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_encrypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src),
+ (ctx, dst, src));
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_decrypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src),
+ (ctx, dst, src));
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_ctr_crypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src, u8 *keystream, u8 *iv),
+ (ctx, dst, src, keystream, iv));
+#ifdef CONFIG_AS_GFNI
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_gfni_encrypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src),
+ (ctx, dst, src));
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_gfni_decrypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src),
+ (ctx, dst, src));
+DECLARE_CRYPTO_API(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64, aria_aesni_avx_gfni_ctr_crypt_16way, asmlinkage void,
+ (const void *ctx, u8 *dst, const u8 *src, u8 *keystream, u8 *iv),
+ (ctx, dst, src, keystream, iv));
+#endif /* CONFIG_AS_GFNI */
asmlinkage void aria_aesni_avx2_encrypt_32way(const void *ctx, u8 *dst,
const u8 *src);
diff --git a/arch/x86/crypto/aria_aesni_avx_glue.c b/arch/x86/crypto/aria_aesni_avx_glue.c
index e4e3d78915a5..4a0bb385515a 100644
--- a/arch/x86/crypto/aria_aesni_avx_glue.c
+++ b/arch/x86/crypto/aria_aesni_avx_glue.c
@@ -215,8 +215,8 @@ static void __exit aria_avx_exit(void)
crypto_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
}
-module_init(aria_avx_init);
-module_exit(aria_avx_exit);
+crypto_module_init(aria_avx_init);
+crypto_module_exit(aria_avx_exit);
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Taehee Yoo <ap420073@gmail.com>");
diff --git a/arch/x86/crypto/fips140/fips140-api.c b/arch/x86/crypto/fips140/fips140-api.c
index 1333b1ce6cdf..ed7a2ad31f24 100644
--- a/arch/x86/crypto/fips140/fips140-api.c
+++ b/arch/x86/crypto/fips140/fips140-api.c
@@ -78,4 +78,22 @@ DEFINE_CRYPTO_API_STUB(sm4_cbc_encrypt);
DEFINE_CRYPTO_API_STUB(sm4_avx_cbc_decrypt);
DEFINE_CRYPTO_API_STUB(sm4_avx_ctr_crypt);
+#endif
+
+/*
+ * arch/x86/crypto/aria_aesni_avx_glue.c
+ */
+#if IS_BUILTIN(CONFIG_CRYPTO_ARIA_AESNI_AVX_X86_64)
+
+#include <arch/x86/crypto/aria-avx.h>
+
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_encrypt_16way);
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_decrypt_16way);
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_ctr_crypt_16way);
+#ifdef CONFIG_AS_GFNI
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_gfni_encrypt_16way);
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_gfni_decrypt_16way);
+DEFINE_CRYPTO_API_STUB(aria_aesni_avx_gfni_ctr_crypt_16way);
+#endif /* CONFIG_AS_GFNI */
+
#endif
\ No newline at end of file
--
2.47.3
next prev parent reply other threads:[~2026-02-12 3:20 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-12 3:14 [PATCH v1 00/21] crypto: Standalone crypto module (Series 3/4): x86_64 crypto Jay Wang
2026-02-12 3:14 ` [PATCH 01/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_CAST5_AVX_X86_64 and CONFIG_CRYPTO_CAST6_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 02/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_TWOFISH_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 03/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_TWOFISH_X86_64_3WAY crypto Jay Wang
2026-02-12 3:15 ` [PATCH 04/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_TWOFISH_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 05/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SERPENT_SSE2_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 06/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SERPENT_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 07/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SERPENT_AVX2_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 08/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_DES3_EDE_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 09/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_CAMELLIA_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 10/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_AES_NI_INTEL crypto Jay Wang
2026-02-12 3:15 ` [PATCH 11/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_CAMELLIA_AESNI_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 12/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_CAMELLIA_AESNI_AVX2_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 13/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_BLOWFISH_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 14/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_AEGIS128_AESNI_SSE2 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 15/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_GHASH_CLMUL_NI_INTEL crypto Jay Wang
2026-02-12 3:15 ` [PATCH 16/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SM3_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 17/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SM4_AESNI_AVX_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 18/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_SM4_AESNI_AVX2_X86_64 crypto Jay Wang
2026-02-12 3:15 ` Jay Wang [this message]
2026-02-12 3:15 ` [PATCH 20/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_ARIA_AESNI_AVX2_X86_64 crypto Jay Wang
2026-02-12 3:15 ` [PATCH 21/21] x86: crypto: convert exported crypto symbol into pluggable interface for CONFIG_CRYPTO_ARIA_GFNI_AVX512_X86_64 crypto Jay Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260212031521.2124-20-wanjay@amazon.com \
--to=wanjay@amazon.com \
--cc=bp@alien8.de \
--cc=catalin.marinas@arm.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=ilya.okomin@oracle.com \
--cc=jay.wang.upstream@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-modules@vger.kernel.org \
--cc=mcgrof@kernel.org \
--cc=mingo@redhat.com \
--cc=nathan@kernel.org \
--cc=nsc@kernel.org \
--cc=nstange@suse.de \
--cc=petr.pavlu@suse.com \
--cc=tglx@kernel.org \
--cc=vegard.nossum@oracle.com \
--cc=will@kernel.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.