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/aria - 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:
@@ -296,7 +296,6 @@ config CRYPTO_ARIA_AESNI_AVX_X86_64
|
||||
tristate "Ciphers: ARIA with modes: ECB, CTR (AES-NI/AVX/GFNI)"
|
||||
depends on X86 && 64BIT
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_SIMD
|
||||
select CRYPTO_ALGAPI
|
||||
select CRYPTO_ARIA
|
||||
help
|
||||
@@ -314,7 +313,6 @@ config CRYPTO_ARIA_AESNI_AVX2_X86_64
|
||||
tristate "Ciphers: ARIA with modes: ECB, CTR (AES-NI/AVX2/GFNI)"
|
||||
depends on X86 && 64BIT
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_SIMD
|
||||
select CRYPTO_ALGAPI
|
||||
select CRYPTO_ARIA
|
||||
select CRYPTO_ARIA_AESNI_AVX_X86_64
|
||||
@@ -333,7 +331,6 @@ config CRYPTO_ARIA_GFNI_AVX512_X86_64
|
||||
tristate "Ciphers: ARIA with modes: ECB, CTR (AVX512/GFNI)"
|
||||
depends on X86 && 64BIT && AS_AVX512 && AS_GFNI
|
||||
select CRYPTO_SKCIPHER
|
||||
select CRYPTO_SIMD
|
||||
select CRYPTO_ALGAPI
|
||||
select CRYPTO_ARIA
|
||||
select CRYPTO_ARIA_AESNI_AVX_X86_64
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <crypto/aria.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/err.h>
|
||||
@@ -165,10 +164,9 @@ static int aria_avx2_init_tfm(struct crypto_skcipher *tfm)
|
||||
|
||||
static struct skcipher_alg aria_algs[] = {
|
||||
{
|
||||
.base.cra_name = "__ecb(aria)",
|
||||
.base.cra_driver_name = "__ecb-aria-avx2",
|
||||
.base.cra_name = "ecb(aria)",
|
||||
.base.cra_driver_name = "ecb-aria-avx2",
|
||||
.base.cra_priority = 500,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = ARIA_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -178,11 +176,10 @@ static struct skcipher_alg aria_algs[] = {
|
||||
.encrypt = aria_avx2_ecb_encrypt,
|
||||
.decrypt = aria_avx2_ecb_decrypt,
|
||||
}, {
|
||||
.base.cra_name = "__ctr(aria)",
|
||||
.base.cra_driver_name = "__ctr-aria-avx2",
|
||||
.base.cra_name = "ctr(aria)",
|
||||
.base.cra_driver_name = "ctr-aria-avx2",
|
||||
.base.cra_priority = 500,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL |
|
||||
CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE,
|
||||
.base.cra_flags = CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE,
|
||||
.base.cra_blocksize = 1,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -197,8 +194,6 @@ static struct skcipher_alg aria_algs[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct simd_skcipher_alg *aria_simd_algs[ARRAY_SIZE(aria_algs)];
|
||||
|
||||
static int __init aria_avx2_init(void)
|
||||
{
|
||||
const char *feature_name;
|
||||
@@ -233,15 +228,12 @@ static int __init aria_avx2_init(void)
|
||||
aria_ops.aria_ctr_crypt_32way = aria_aesni_avx2_ctr_crypt_32way;
|
||||
}
|
||||
|
||||
return simd_register_skciphers_compat(aria_algs,
|
||||
ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
return crypto_register_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
static void __exit aria_avx2_exit(void)
|
||||
{
|
||||
simd_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
crypto_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
module_init(aria_avx2_init);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <crypto/aria.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/err.h>
|
||||
@@ -152,10 +151,9 @@ static int aria_avx_init_tfm(struct crypto_skcipher *tfm)
|
||||
|
||||
static struct skcipher_alg aria_algs[] = {
|
||||
{
|
||||
.base.cra_name = "__ecb(aria)",
|
||||
.base.cra_driver_name = "__ecb-aria-avx",
|
||||
.base.cra_name = "ecb(aria)",
|
||||
.base.cra_driver_name = "ecb-aria-avx",
|
||||
.base.cra_priority = 400,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = ARIA_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -165,10 +163,9 @@ static struct skcipher_alg aria_algs[] = {
|
||||
.encrypt = aria_avx_ecb_encrypt,
|
||||
.decrypt = aria_avx_ecb_decrypt,
|
||||
}, {
|
||||
.base.cra_name = "__ctr(aria)",
|
||||
.base.cra_driver_name = "__ctr-aria-avx",
|
||||
.base.cra_name = "ctr(aria)",
|
||||
.base.cra_driver_name = "ctr-aria-avx",
|
||||
.base.cra_priority = 400,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = 1,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -184,8 +181,6 @@ static struct skcipher_alg aria_algs[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct simd_skcipher_alg *aria_simd_algs[ARRAY_SIZE(aria_algs)];
|
||||
|
||||
static int __init aria_avx_init(void)
|
||||
{
|
||||
const char *feature_name;
|
||||
@@ -213,15 +208,12 @@ static int __init aria_avx_init(void)
|
||||
aria_ops.aria_ctr_crypt_16way = aria_aesni_avx_ctr_crypt_16way;
|
||||
}
|
||||
|
||||
return simd_register_skciphers_compat(aria_algs,
|
||||
ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
return crypto_register_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
static void __exit aria_avx_exit(void)
|
||||
{
|
||||
simd_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
crypto_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
module_init(aria_avx_init);
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
*/
|
||||
|
||||
#include <crypto/algapi.h>
|
||||
#include <crypto/internal/simd.h>
|
||||
#include <crypto/aria.h>
|
||||
#include <linux/crypto.h>
|
||||
#include <linux/err.h>
|
||||
@@ -165,10 +164,9 @@ static int aria_avx512_init_tfm(struct crypto_skcipher *tfm)
|
||||
|
||||
static struct skcipher_alg aria_algs[] = {
|
||||
{
|
||||
.base.cra_name = "__ecb(aria)",
|
||||
.base.cra_driver_name = "__ecb-aria-avx512",
|
||||
.base.cra_name = "ecb(aria)",
|
||||
.base.cra_driver_name = "ecb-aria-avx512",
|
||||
.base.cra_priority = 600,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL,
|
||||
.base.cra_blocksize = ARIA_BLOCK_SIZE,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -178,11 +176,10 @@ static struct skcipher_alg aria_algs[] = {
|
||||
.encrypt = aria_avx512_ecb_encrypt,
|
||||
.decrypt = aria_avx512_ecb_decrypt,
|
||||
}, {
|
||||
.base.cra_name = "__ctr(aria)",
|
||||
.base.cra_driver_name = "__ctr-aria-avx512",
|
||||
.base.cra_name = "ctr(aria)",
|
||||
.base.cra_driver_name = "ctr-aria-avx512",
|
||||
.base.cra_priority = 600,
|
||||
.base.cra_flags = CRYPTO_ALG_INTERNAL |
|
||||
CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE,
|
||||
.base.cra_flags = CRYPTO_ALG_SKCIPHER_REQSIZE_LARGE,
|
||||
.base.cra_blocksize = 1,
|
||||
.base.cra_ctxsize = sizeof(struct aria_ctx),
|
||||
.base.cra_module = THIS_MODULE,
|
||||
@@ -197,8 +194,6 @@ static struct skcipher_alg aria_algs[] = {
|
||||
}
|
||||
};
|
||||
|
||||
static struct simd_skcipher_alg *aria_simd_algs[ARRAY_SIZE(aria_algs)];
|
||||
|
||||
static int __init aria_avx512_init(void)
|
||||
{
|
||||
const char *feature_name;
|
||||
@@ -229,15 +224,12 @@ static int __init aria_avx512_init(void)
|
||||
aria_ops.aria_decrypt_64way = aria_gfni_avx512_decrypt_64way;
|
||||
aria_ops.aria_ctr_crypt_64way = aria_gfni_avx512_ctr_crypt_64way;
|
||||
|
||||
return simd_register_skciphers_compat(aria_algs,
|
||||
ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
return crypto_register_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
static void __exit aria_avx512_exit(void)
|
||||
{
|
||||
simd_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs),
|
||||
aria_simd_algs);
|
||||
crypto_unregister_skciphers(aria_algs, ARRAY_SIZE(aria_algs));
|
||||
}
|
||||
|
||||
module_init(aria_avx512_init);
|
||||
|
||||
Reference in New Issue
Block a user