mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-12-27 11:06:41 -05:00
crypto: x86/cast - stop using the SIMD helper
Stop wrapping skcipher and aead algorithms with the crypto SIMD helper (crypto/simd.c). The only purpose of doing so was to work around x86 not always supporting kernel-mode FPU in softirqs. Specifically, if a hardirq interrupted a task context kernel-mode FPU section and then a softirqs were run at the end of that hardirq, those softirqs could not use kernel-mode FPU. This has now been fixed. In combination with the fact that the skcipher and aead APIs only support task and softirq contexts, these can now just use kernel-mode FPU unconditionally on x86. This simplifies the code and improves performance. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
@@ -88,7 +88,6 @@ config CRYPTO_CAST5_AVX_X86_64
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_CAST5
|
||||
select CRYPTO_CAST_COMMON
|
||||
select CRYPTO_SIMD
|
||||
imply CRYPTO_CTR
|
||||
help
|
||||
Length-preserving ciphers: CAST5 (CAST-128) cipher algorithm
|
||||
@@ -105,7 +104,6 @@ config CRYPTO_CAST6_AVX_X86_64
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_CAST6
|
||||
select CRYPTO_CAST_COMMON
|
||||
select CRYPTO_SIMD
|
||||
imply CRYPTO_XTS
|
||||
imply CRYPTO_CTR
|
||||
help
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/cast5.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/module.h>
|
||||
@@ -64,10 +63,9 @@ static int cbc_decrypt(struct skcipher_request *req)
|
||||
|
||||
static struct skcipher_alg cast5_algs[] = {
|
||||
{
|
||||
.base.cra_name = "__ecb(cast5)",
|
||||
.base.cra_driver_name = "__ecb-cast5-avx",
|
||||
.base.cra_name = "ecb(cast5)",
|
||||
.base.cra_driver_name = "ecb-cast5-avx",
|
||||
.base.cra_priority = 200,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = CAST5_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct cast5_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -77,10 +75,9 @@ static struct skcipher_alg cast5_algs[] = {
|
||||
.encrypt = ecb_encrypt,
|
||||
.decrypt = ecb_decrypt,
|
||||
}, {
|
||||
.base.cra_name = "__cbc(cast5)",
|
||||
.base.cra_driver_name = "__cbc-cast5-avx",
|
||||
.base.cra_name = "cbc(cast5)",
|
||||
.base.cra_driver_name = "cbc-cast5-avx",
|
||||
.base.cra_priority = 200,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = CAST5_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct cast5_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -93,8 +90,6 @@ static struct skcipher_alg cast5_algs[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct simd_skcipher_alg *cast5_simd_algs[ARRAY_SIZE(cast5_algs)];
|
||||
|
||||
static int __init cast5_init(void)
|
||||
{
|
||||
const char *feature_name;
|
||||
@@ -105,15 +100,13 @@ static int __init cast5_init(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return simd_register_skciphers_compat(cast5_algs,
|
||||
ARRAY_SIZE(cast5_algs),
|
||||
cast5_simd_algs);
|
||||
return crypto_register_skciphers(cast5_algs,
|
||||
ARRAY_SIZE(cast5_algs));
|
||||
}
|
||||
|
||||
static void __exit cast5_exit(void)
|
||||
{
|
||||
simd_unregister_skciphers(cast5_algs, ARRAY_SIZE(cast5_algs),
|
||||
cast5_simd_algs);
|
||||
crypto_unregister_skciphers(cast5_algs, ARRAY_SIZE(cast5_algs));
|
||||
}
|
||||
|
||||
module_init(cast5_init);
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
#include <linux/err.h>
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/cast6.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
|
||||
#include "ecb_cbc_helpers.h"
|
||||
|
||||
@@ -64,10 +63,9 @@ static int cbc_decrypt(struct skcipher_request *req)
|
||||
|
||||
static struct skcipher_alg cast6_algs[] = {
|
||||
{
|
||||
.base.cra_name = "__ecb(cast6)",
|
||||
.base.cra_driver_name = "__ecb-cast6-avx",
|
||||
.base.cra_name = "ecb(cast6)",
|
||||
.base.cra_driver_name = "ecb-cast6-avx",
|
||||
.base.cra_priority = 200,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = CAST6_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct cast6_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -77,10 +75,9 @@ static struct skcipher_alg cast6_algs[] = {
|
||||
.encrypt = ecb_encrypt,
|
||||
.decrypt = ecb_decrypt,
|
||||
}, {
|
||||
.base.cra_name = "__cbc(cast6)",
|
||||
.base.cra_driver_name = "__cbc-cast6-avx",
|
||||
.base.cra_name = "cbc(cast6)",
|
||||
.base.cra_driver_name = "cbc-cast6-avx",
|
||||
.base.cra_priority = 200,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = CAST6_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct cast6_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -93,8 +90,6 @@ static struct skcipher_alg cast6_algs[] = {
|
||||
},
|
||||
};
|
||||
|
||||
static struct simd_skcipher_alg *cast6_simd_algs[ARRAY_SIZE(cast6_algs)];
|
||||
|
||||
static int __init cast6_init(void)
|
||||
{
|
||||
const char *feature_name;
|
||||
@@ -105,15 +100,12 @@ static int __init cast6_init(void)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
return simd_register_skciphers_compat(cast6_algs,
|
||||
ARRAY_SIZE(cast6_algs),
|
||||
cast6_simd_algs);
|
||||
return crypto_register_skciphers(cast6_algs, ARRAY_SIZE(cast6_algs));
|
||||
}
|
||||
|
||||
static void __exit cast6_exit(void)
|
||||
{
|
||||
simd_unregister_skciphers(cast6_algs, ARRAY_SIZE(cast6_algs),
|
||||
cast6_simd_algs);
|
||||
crypto_unregister_skciphers(cast6_algs, ARRAY_SIZE(cast6_algs));
|
||||
}
|
||||
|
||||
module_init(cast6_init);
|
||||
|
||||
Reference in New Issue
Block a user