Linux cryptographic layer development
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-crypto@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
	"Jason A . Donenfeld" <Jason@zx2c4.com>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	x86@kernel.org, Antonio Quartulli <antonio@mandelbit.com>,
	Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH 11/11] crypto: x86/aesni-intel - Remove empty module
Date: Sun, 29 Nov 2026 12:02:45 -0800	[thread overview]
Message-ID: <20261129200245.146503-12-ebiggers@kernel.org> (raw)
In-Reply-To: <20261129200245.146503-1-ebiggers@kernel.org>

Since all x86 optimized AES code has been migrated into lib/crypto/,
remove the now-empty aesni-intel module.  All its functionality is now
provided by the aes module (CONFIG_CRYPTO_AES) when the mode-specific
kconfigs are enabled (CONFIG_CRYPTO_XTS, etc.).

Make CRYPTO_AES_NI_INTEL a transitional symbol that enables CRYPTO_AES
and CRYPTO_XTS.  This minimizes the chance that systems using LUKS /
dm-crypt with AES-CBC or AES-XTS fail to boot due to enabling
CRYPTO_AES_NI_INTEL only.  (This is a targeted mitigation for an
important case, and thus other options like CRYPTO_GCM intentionally
aren't included in these transitional selections.  CRYPTO_CBC does not
need to be explicitly handled, as DM_CRYPT already selects it.)

Unfortunately, the CRYPTO_AES_NI_INTEL transitional symbol can't just go
in arch/x86/crypto/Kconfig, since transitional symbols can't be enclosed
in 'if'.  Therefore, it has to go in crypto/Kconfig.  Transitional
symbols also can't use 'select'; however, 'select' is nonetheless needed
here, to set CRYPTO_AES and CRYPTO_XTS in existing kconfigs that had
them explicitly set to 'n'.  So the selects go directly on CRYPTO.  It's
a bit ugly, but it can be removed after a few releases.

Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
 Documentation/filesystems/fscrypt.rst |  2 --
 arch/x86/crypto/Kconfig               | 25 ---------------
 arch/x86/crypto/Makefile              |  3 --
 arch/x86/crypto/aesni-intel_glue.c    | 46 ---------------------------
 crypto/Kconfig                        |  9 ++++++
 5 files changed, 9 insertions(+), 76 deletions(-)
 delete mode 100644 arch/x86/crypto/aesni-intel_glue.c

diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst
index 6e2e511a70bb5..8a21973207b8b 100644
--- a/Documentation/filesystems/fscrypt.rst
+++ b/Documentation/filesystems/fscrypt.rst
@@ -447,14 +447,12 @@ API, but the filenames mode still does.
 - AES-256-XTS and AES-256-CBC-CTS
     - Recommended:
         - arm64: CONFIG_CRYPTO_AES_ARM64_CE_BLK
-        - x86: CONFIG_CRYPTO_AES_NI_INTEL
 
 - AES-256-HCTR2
     - Mandatory:
         - CONFIG_CRYPTO_HCTR2
     - Recommended:
         - arm64: CONFIG_CRYPTO_AES_ARM64_CE_BLK
-        - x86: CONFIG_CRYPTO_AES_NI_INTEL
 
 - Adiantum
     - Mandatory:
diff --git a/arch/x86/crypto/Kconfig b/arch/x86/crypto/Kconfig
index 20f5e2a17e45a..ab0c6e6638102 100644
--- a/arch/x86/crypto/Kconfig
+++ b/arch/x86/crypto/Kconfig
@@ -2,31 +2,6 @@
 
 menu "Accelerated Cryptographic Algorithms for CPU (x86)"
 
-config CRYPTO_AES_NI_INTEL
-	tristate "Ciphers: AES, modes: GCM (AES-NI/VAES)"
-	depends on 64BIT
-	select CRYPTO_AEAD
-	select CRYPTO_LIB_AES
-	select CRYPTO_LIB_GF128MUL
-	select CRYPTO_SKCIPHER
-	select CRYPTO_AES
-	select CRYPTO_CBC
-	select CRYPTO_XTS
-	help
-	  AEAD cipher: AES with GCM
-
-	  Architecture: x86_64 using:
-	  - AES-NI (AES new instructions)
-	  - VAES (Vector AES)
-
-	  The module controlled by this option (aesni-intel.ko) no longer
-	  directly provides the accelerated ECB, CBC, CBC-CTS, CTR, XCTR, and
-	  XTS code.  Those are now provided by CRYPTO_AES (aes.ko) when the
-	  corresponding mode option (CRYPTO_XTS, CRYPTO_CBC, etc.) is enabled.
-
-	  To ensure dm-crypt continues to work in kconfigs with only this option
-	  set, this option selects CRYPTO_AES, CRYPTO_CBC, and CRYPTO_XTS.
-
 config CRYPTO_BLOWFISH_X86_64
 	tristate "Ciphers: Blowfish, modes: ECB, CBC"
 	depends on 64BIT
diff --git a/arch/x86/crypto/Makefile b/arch/x86/crypto/Makefile
index 7a443aa3ce4d7..e345342e445d6 100644
--- a/arch/x86/crypto/Makefile
+++ b/arch/x86/crypto/Makefile
@@ -39,9 +39,6 @@ cast6-avx-x86_64-y := cast6-avx-x86_64-asm_64.o cast6_avx_glue.o
 obj-$(CONFIG_CRYPTO_AEGIS128_AESNI_SSE2) += aegis128-aesni.o
 aegis128-aesni-y := aegis128-aesni-asm.o aegis128-aesni-glue.o
 
-obj-$(CONFIG_CRYPTO_AES_NI_INTEL) += aesni-intel.o
-aesni-intel-y := aesni-intel_glue.o
-
 obj-$(CONFIG_CRYPTO_SM4_AESNI_AVX_X86_64) += sm4-aesni-avx-x86_64.o
 sm4-aesni-avx-x86_64-y := sm4-aesni-avx-asm_64.o sm4_aesni_avx_glue.o
 
diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
deleted file mode 100644
index 93718bb95092a..0000000000000
--- a/arch/x86/crypto/aesni-intel_glue.c
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Support for AES-NI and VAES instructions.  This file contains glue code.
- * The real AES implementations are in .S files.
- *
- * Copyright (C) 2008, Intel Corp.
- *    Author: Huang Ying <ying.huang@intel.com>
- *
- * Added RFC4106 AES-GCM support for 128-bit keys under the AEAD
- * interface for 64-bit kernels.
- *    Authors: Adrian Hoban <adrian.hoban@intel.com>
- *             Gabriele Paoloni <gabriele.paoloni@intel.com>
- *             Tadeusz Struk (tadeusz.struk@intel.com)
- *             Aidan O'Mahony (aidan.o.mahony@intel.com)
- *    Copyright (c) 2010, Intel Corporation.
- *
- * Copyright 2024 Google LLC
- */
-
-#include <linux/module.h>
-#include <linux/err.h>
-#include <asm/cpu_device_id.h>
-
-static const struct x86_cpu_id aesni_cpu_id[] = {
-	X86_MATCH_FEATURE(X86_FEATURE_AES, NULL),
-	{}
-};
-MODULE_DEVICE_TABLE(x86cpu, aesni_cpu_id);
-
-static int __init aesni_init(void)
-{
-	if (!x86_match_cpu(aesni_cpu_id))
-		return -ENODEV;
-
-	return 0;
-}
-
-static void __exit aesni_exit(void)
-{
-}
-
-module_init(aesni_init);
-module_exit(aesni_exit);
-
-MODULE_DESCRIPTION("AES-GCM, optimized with AES-NI or VAES instructions");
-MODULE_LICENSE("GPL");
diff --git a/crypto/Kconfig b/crypto/Kconfig
index 981d5dc422d4c..b3ff1b88a5ad1 100644
--- a/crypto/Kconfig
+++ b/crypto/Kconfig
@@ -14,6 +14,8 @@ source "crypto/async_tx/Kconfig"
 menuconfig CRYPTO
 	tristate "Cryptographic API"
 	select CRYPTO_LIB_UTILS
+	select CRYPTO_AES if CRYPTO_AES_NI_INTEL && X86_64
+	select CRYPTO_XTS if CRYPTO_AES_NI_INTEL && X86_64
 	help
 	  This option provides the core Cryptographic API.
 
@@ -1377,3 +1379,10 @@ source "certs/Kconfig"
 source "crypto/krb5/Kconfig"
 
 endif	# if CRYPTO
+
+config CRYPTO_AES_NI_INTEL
+	tristate
+	transitional
+	help
+	  This transitional symbol ensures that kconfigs that had aesni-intel
+	  enabled still get AES-XTS support (via CRYPTO_AES and CRYPTO_XTS).
-- 
2.56.1


      parent reply	other threads:[~2026-11-29 20:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 20:02 [PATCH 00/11] Migrate x86_64 AES-GCM code into library Eric Biggers
2026-11-29 20:02 ` [PATCH 01/11] crypto: aes - Flush dcache in CBC-CTS and XTS linear fast paths Eric Biggers
2026-11-29 20:02 ` [PATCH 02/11] lib/crypto: gf128hash: Link libgf128hash before libaes Eric Biggers
2026-11-29 20:02 ` [PATCH 03/11] lib/crypto: aes-gcm: Add one-shot AES-GCM arch hooks Eric Biggers
2026-11-29 20:02 ` [PATCH 04/11] crypto: aes - Add linear fast path for AES-GCM Eric Biggers
2026-11-29 20:02 ` [PATCH 05/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with PCLMULQDQ and AVX Eric Biggers
2026-11-29 20:02 ` [PATCH 06/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with VPCLMULQDQ and AVX2 Eric Biggers
2026-11-29 20:02 ` [PATCH 07/11] lib/crypto: x86/gf128hash: Optimize GHASH and POLYVAL with VPCLMULQDQ and AVX512 Eric Biggers
2026-11-29 20:02 ` [PATCH 08/11] lib/crypto: x86/aes-gcm: Migrate AES-NI optimized code into library Eric Biggers
2026-11-29 20:02 ` [PATCH 09/11] lib/crypto: x86/aes-gcm: Migrate VAES+AVX2 " Eric Biggers
2026-11-29 20:02 ` [PATCH 10/11] lib/crypto: x86/aes-gcm: Migrate VAES+AVX512 " Eric Biggers
2026-11-29 20:02 ` Eric Biggers [this message]

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=20261129200245.146503-12-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=Jason@zx2c4.com \
    --cc=antonio@mandelbit.com \
    --cc=ardb@kernel.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox