Skip to content

Commit 944585a

Browse files
Ard Biesheuvelherbertx
authored andcommitted
crypto: x86/aes-ni - remove special handling of AES in PCBC mode
For historical reasons, the AES-NI based implementation of the PCBC chaining mode uses a special FPU chaining mode wrapper template to amortize the FPU start/stop overhead over multiple blocks. When this FPU wrapper was introduced, it supported widely used chaining modes such as XTS and CTR (as well as LRW), but currently, PCBC is the only remaining user. Since there are no known users of pcbc(aes) in the kernel, let's remove this special driver, and rely on the generic pcbc driver to encapsulate the AES-NI core cipher. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
1 parent 79517e8 commit 944585a

File tree

4 files changed

+2
-243
lines changed

4 files changed

+2
-243
lines changed

arch/x86/crypto/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ ifeq ($(avx2_supported),yes)
103103
morus1280-avx2-y := morus1280-avx2-asm.o morus1280-avx2-glue.o
104104
endif
105105

106-
aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o fpu.o
106+
aesni-intel-y := aesni-intel_asm.o aesni-intel_glue.o
107107
aesni-intel-$(CONFIG_64BIT) += aesni-intel_avx-x86_64.o aes_ctrby8_avx-x86_64.o
108108
ghash-clmulni-intel-y := ghash-clmulni-intel_asm.o ghash-clmulni-intel_glue.o
109109
sha1-ssse3-y := sha1_ssse3_asm.o sha1_ssse3_glue.o

arch/x86/crypto/aesni-intel_glue.c

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,22 +1253,6 @@ static struct skcipher_alg aesni_skciphers[] = {
12531253
static
12541254
struct simd_skcipher_alg *aesni_simd_skciphers[ARRAY_SIZE(aesni_skciphers)];
12551255

1256-
static struct {
1257-
const char *algname;
1258-
const char *drvname;
1259-
const char *basename;
1260-
struct simd_skcipher_alg *simd;
1261-
} aesni_simd_skciphers2[] = {
1262-
#if (defined(MODULE) && IS_ENABLED(CONFIG_CRYPTO_PCBC)) || \
1263-
IS_BUILTIN(CONFIG_CRYPTO_PCBC)
1264-
{
1265-
.algname = "pcbc(aes)",
1266-
.drvname = "pcbc-aes-aesni",
1267-
.basename = "fpu(pcbc(__aes-aesni))",
1268-
},
1269-
#endif
1270-
};
1271-
12721256
#ifdef CONFIG_X86_64
12731257
static int generic_gcmaes_set_key(struct crypto_aead *aead, const u8 *key,
12741258
unsigned int key_len)
@@ -1422,10 +1406,6 @@ static void aesni_free_simds(void)
14221406
for (i = 0; i < ARRAY_SIZE(aesni_simd_skciphers) &&
14231407
aesni_simd_skciphers[i]; i++)
14241408
simd_skcipher_free(aesni_simd_skciphers[i]);
1425-
1426-
for (i = 0; i < ARRAY_SIZE(aesni_simd_skciphers2); i++)
1427-
if (aesni_simd_skciphers2[i].simd)
1428-
simd_skcipher_free(aesni_simd_skciphers2[i].simd);
14291409
}
14301410

14311411
static int __init aesni_init(void)
@@ -1499,18 +1479,6 @@ static int __init aesni_init(void)
14991479
aesni_simd_skciphers[i] = simd;
15001480
}
15011481

1502-
for (i = 0; i < ARRAY_SIZE(aesni_simd_skciphers2); i++) {
1503-
algname = aesni_simd_skciphers2[i].algname;
1504-
drvname = aesni_simd_skciphers2[i].drvname;
1505-
basename = aesni_simd_skciphers2[i].basename;
1506-
simd = simd_skcipher_create_compat(algname, drvname, basename);
1507-
err = PTR_ERR(simd);
1508-
if (IS_ERR(simd))
1509-
continue;
1510-
1511-
aesni_simd_skciphers2[i].simd = simd;
1512-
}
1513-
15141482
return 0;
15151483

15161484
unregister_simds:

arch/x86/crypto/fpu.c

Lines changed: 0 additions & 209 deletions
This file was deleted.

crypto/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ config CRYPTO_AES_NI_INTEL
10831083

10841084
In addition to AES cipher algorithm support, the acceleration
10851085
for some popular block cipher mode is supported too, including
1086-
ECB, CBC, LRW, PCBC, XTS. The 64 bit version has additional
1086+
ECB, CBC, LRW, XTS. The 64 bit version has additional
10871087
acceleration for CTR.
10881088

10891089
config CRYPTO_AES_SPARC64

0 commit comments

Comments
 (0)