summaryrefslogtreecommitdiffhomepage
path: root/src/crypto/zinc/poly1305
diff options
context:
space:
mode:
Diffstat (limited to 'src/crypto/zinc/poly1305')
-rw-r--r--src/crypto/zinc/poly1305/poly1305-arm-glue.h8
-rw-r--r--src/crypto/zinc/poly1305/poly1305-mips-glue.h4
-rw-r--r--src/crypto/zinc/poly1305/poly1305-x86_64-glue.h16
-rw-r--r--src/crypto/zinc/poly1305/poly1305.c12
4 files changed, 20 insertions, 20 deletions
diff --git a/src/crypto/zinc/poly1305/poly1305-arm-glue.h b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
index 8181703..6ec2fc8 100644
--- a/src/crypto/zinc/poly1305/poly1305-arm-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-arm-glue.h
@@ -39,10 +39,10 @@ static inline bool poly1305_init_arch(void *ctx,
static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
const size_t len, const u32 padbit,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
#if defined(ARM_USE_NEON)
- if (simd_context == HAVE_FULL_SIMD && poly1305_use_neon) {
+ if (poly1305_use_neon && simd_use(simd_context)) {
poly1305_blocks_neon(ctx, inp, len, padbit);
return true;
}
@@ -53,10 +53,10 @@ static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
const u32 nonce[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
#if defined(ARM_USE_NEON)
- if (simd_context == HAVE_FULL_SIMD && poly1305_use_neon) {
+ if (poly1305_use_neon && simd_use(simd_context)) {
poly1305_emit_neon(ctx, mac, nonce);
return true;
}
diff --git a/src/crypto/zinc/poly1305/poly1305-mips-glue.h b/src/crypto/zinc/poly1305/poly1305-mips-glue.h
index 960abee..0e72c8b 100644
--- a/src/crypto/zinc/poly1305/poly1305-mips-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-mips-glue.h
@@ -22,7 +22,7 @@ static inline bool poly1305_init_arch(void *ctx,
static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
const size_t len, const u32 padbit,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
poly1305_blocks_mips(ctx, inp, len, padbit);
return true;
@@ -30,7 +30,7 @@ static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
const u32 nonce[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
poly1305_emit_mips(ctx, mac, nonce);
return true;
diff --git a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
index 7f1af44..1afd1c5 100644
--- a/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
+++ b/src/crypto/zinc/poly1305/poly1305-x86_64-glue.h
@@ -63,20 +63,20 @@ static inline bool poly1305_init_arch(void *ctx,
static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
const size_t len, const u32 padbit,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
#ifdef CONFIG_AS_AVX512
- if (poly1305_use_avx512 && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx512 && simd_use(simd_context))
poly1305_blocks_avx512(ctx, inp, len, padbit);
else
#endif
#ifdef CONFIG_AS_AVX2
- if (poly1305_use_avx2 && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx2 && simd_use(simd_context))
poly1305_blocks_avx2(ctx, inp, len, padbit);
else
#endif
#ifdef CONFIG_AS_AVX
- if (poly1305_use_avx && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx && simd_use(simd_context))
poly1305_blocks_avx(ctx, inp, len, padbit);
else
#endif
@@ -86,20 +86,20 @@ static inline bool poly1305_blocks_arch(void *ctx, const u8 *inp,
static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
const u32 nonce[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
#ifdef CONFIG_AS_AVX512
- if (poly1305_use_avx512 && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx512 && simd_use(simd_context))
poly1305_emit_avx(ctx, mac, nonce);
else
#endif
#ifdef CONFIG_AS_AVX2
- if (poly1305_use_avx2 && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx2 && simd_use(simd_context))
poly1305_emit_avx(ctx, mac, nonce);
else
#endif
#ifdef CONFIG_AS_AVX
- if (poly1305_use_avx && simd_context == HAVE_FULL_SIMD)
+ if (poly1305_use_avx && simd_use(simd_context))
poly1305_emit_avx(ctx, mac, nonce);
else
#endif
diff --git a/src/crypto/zinc/poly1305/poly1305.c b/src/crypto/zinc/poly1305/poly1305.c
index d8c103f..a098b61 100644
--- a/src/crypto/zinc/poly1305/poly1305.c
+++ b/src/crypto/zinc/poly1305/poly1305.c
@@ -21,13 +21,13 @@ static inline bool poly1305_init_arch(void *ctx,
}
static inline bool poly1305_blocks_arch(void *ctx, const u8 *input,
const size_t len, const u32 padbit,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
return false;
}
static inline bool poly1305_emit_arch(void *ctx, u8 mac[POLY1305_MAC_SIZE],
const u32 nonce[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
return false;
}
@@ -58,7 +58,7 @@ EXPORT_SYMBOL(poly1305_init);
static inline void poly1305_blocks(void *ctx, const u8 *input, const size_t len,
const u32 padbit,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
if (!poly1305_blocks_arch(ctx, input, len, padbit, simd_context))
poly1305_blocks_generic(ctx, input, len, padbit);
@@ -66,14 +66,14 @@ static inline void poly1305_blocks(void *ctx, const u8 *input, const size_t len,
static inline void poly1305_emit(void *ctx, u8 mac[POLY1305_KEY_SIZE],
const u32 nonce[4],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
if (!poly1305_emit_arch(ctx, mac, nonce, simd_context))
poly1305_emit_generic(ctx, mac, nonce);
}
void poly1305_update(struct poly1305_ctx *ctx, const u8 *input, size_t len,
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
const size_t num = ctx->num % POLY1305_BLOCK_SIZE;
size_t rem;
@@ -108,7 +108,7 @@ void poly1305_update(struct poly1305_ctx *ctx, const u8 *input, size_t len,
EXPORT_SYMBOL(poly1305_update);
void poly1305_final(struct poly1305_ctx *ctx, u8 mac[POLY1305_MAC_SIZE],
- simd_context_t simd_context)
+ simd_context_t *simd_context)
{
size_t num = ctx->num % POLY1305_BLOCK_SIZE;