aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc/chacha20
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/zinc/chacha20')
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h3
-rw-r--r--src/crypto/zinc/chacha20/chacha20.c6
2 files changed, 7 insertions, 2 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index f3a7456..912bded 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -60,7 +60,8 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
const u32 key[8], const u32 counter[4],
simd_context_t *simd_context)
{
- if (len <= CHACHA20_BLOCK_SIZE || !simd_use(simd_context))
+ if (!chacha20_use_ssse3 || len <= CHACHA20_BLOCK_SIZE ||
+ !simd_use(simd_context))
return false;
#ifdef CONFIG_AS_AVX512
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c
index 2b3644f..ef2404f 100644
--- a/src/crypto/zinc/chacha20/chacha20.c
+++ b/src/crypto/zinc/chacha20/chacha20.c
@@ -172,13 +172,16 @@ void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE],
}
EXPORT_SYMBOL(hchacha20);
+static bool nosimd __initdata = false;
+
#ifndef COMPAT_ZINC_IS_A_MODULE
int __init chacha20_mod_init(void)
#else
static int __init mod_init(void)
#endif
{
- chacha20_fpu_init();
+ if (!nosimd)
+ chacha20_fpu_init();
return 0;
}
@@ -187,6 +190,7 @@ static void __exit mod_exit(void)
{
}
+module_param(nosimd, bool, 0);
module_init(mod_init);
module_exit(mod_exit);
MODULE_LICENSE("GPL v2");