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-arm-glue.h6
-rw-r--r--src/crypto/zinc/chacha20/chacha20-mips-glue.h4
-rw-r--r--src/crypto/zinc/chacha20/chacha20-x86_64-glue.h8
-rw-r--r--src/crypto/zinc/chacha20/chacha20.c8
4 files changed, 13 insertions, 13 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.h b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
index e661ed2..0c8c9d5 100644
--- a/src/crypto/zinc/chacha20/chacha20-arm-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
@@ -29,10 +29,10 @@ void __init chacha20_fpu_init(void)
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)
+ simd_context_t *simd_context)
{
#if defined(ARM_USE_NEON)
- if (simd_context == HAVE_FULL_SIMD && chacha20_use_neon) {
+ if (chacha20_use_neon && simd_use(simd_context)) {
chacha20_neon(dst, src, len, key, counter);
return true;
}
@@ -42,7 +42,7 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
}
static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
- const u8 *key, simd_context_t simd_context)
+ const u8 *key, simd_context_t *simd_context)
{
return false;
}
diff --git a/src/crypto/zinc/chacha20/chacha20-mips-glue.h b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
index ef8e4ab..e4185e1 100644
--- a/src/crypto/zinc/chacha20/chacha20-mips-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-mips-glue.h
@@ -13,14 +13,14 @@ void __init chacha20_fpu_init(void)
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)
+ simd_context_t *simd_context)
{
chacha20_mips(dst, src, len, key, counter);
return true;
}
static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
- const u8 *key, simd_context_t simd_context)
+ const u8 *key, simd_context_t *simd_context)
{
return false;
}
diff --git a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
index 78270d7..34919c7 100644
--- a/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-x86_64-glue.h
@@ -59,9 +59,9 @@ void __init chacha20_fpu_init(void)
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)
+ simd_context_t *simd_context)
{
- if (simd_context != HAVE_FULL_SIMD)
+ if (!simd_use(simd_context))
return false;
#ifdef CONFIG_AS_AVX512
@@ -90,10 +90,10 @@ static inline bool chacha20_arch(u8 *dst, const u8 *src, const size_t len,
}
static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
- const u8 *key, simd_context_t simd_context)
+ const u8 *key, simd_context_t *simd_context)
{
#if defined(CONFIG_AS_SSSE3)
- if (simd_context == HAVE_FULL_SIMD && chacha20_use_ssse3) {
+ if (chacha20_use_ssse3 && simd_use(simd_context)) {
hchacha20_ssse3(derived_key, nonce, key);
return true;
}
diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c
index fdfccdc..da04d5b 100644
--- a/src/crypto/zinc/chacha20/chacha20.c
+++ b/src/crypto/zinc/chacha20/chacha20.c
@@ -18,12 +18,12 @@ void __init chacha20_fpu_init(void)
}
static inline bool chacha20_arch(u8 *out, const u8 *in, const size_t len,
const u32 key[8], const u32 counter[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
return false;
}
static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce,
- const u8 *key, simd_context_t simd_context)
+ const u8 *key, simd_context_t *simd_context)
{
return false;
}
@@ -113,7 +113,7 @@ static void chacha20_generic(u8 *out, const u8 *in, u32 len, const u32 key[8],
}
void chacha20(struct chacha20_ctx *state, u8 *dst, const u8 *src, u32 len,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
if (!chacha20_arch(dst, src, len, state->key, state->counter,
simd_context))
@@ -157,7 +157,7 @@ static void hchacha20_generic(u8 derived_key[CHACHA20_KEY_SIZE],
/* Derived key should be 32-bit aligned */
void hchacha20(u8 derived_key[CHACHA20_KEY_SIZE],
const u8 nonce[HCHACHA20_NONCE_SIZE],
- const u8 key[HCHACHA20_KEY_SIZE], simd_context_t simd_context)
+ const u8 key[HCHACHA20_KEY_SIZE], simd_context_t *simd_context)
{
if (!hchacha20_arch(derived_key, nonce, key, simd_context))
hchacha20_generic(derived_key, nonce, key);