aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/crypto/zinc/chacha20/chacha20-arm-glue.h
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-09-30 03:07:51 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-10-02 03:41:49 +0200
commit26b94a83ba634669cfcc0fc362ffe1f2eaefb43f (patch)
tree9dcf99b3d71414beee6ad924e667f66bd7173708 /src/crypto/zinc/chacha20/chacha20-arm-glue.h
parentqemu: support m68k (diff)
downloadwireguard-monolithic-historical-26b94a83ba634669cfcc0fc362ffe1f2eaefb43f.tar.xz
wireguard-monolithic-historical-26b94a83ba634669cfcc0fc362ffe1f2eaefb43f.zip
chacha20: split chacha20_ctx into union
This avoids casts and makes counter increments obvious.
Diffstat (limited to 'src/crypto/zinc/chacha20/chacha20-arm-glue.h')
-rw-r--r--src/crypto/zinc/chacha20/chacha20-arm-glue.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/crypto/zinc/chacha20/chacha20-arm-glue.h b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
index 881e16c..2504448 100644
--- a/src/crypto/zinc/chacha20/chacha20-arm-glue.h
+++ b/src/crypto/zinc/chacha20/chacha20-arm-glue.h
@@ -37,7 +37,7 @@ static void __init chacha20_fpu_init(void)
#endif
}
-static inline bool chacha20_arch(struct chacha20_ctx *state, u8 *dst,
+static inline bool chacha20_arch(struct chacha20_ctx *ctx, u8 *dst,
const u8 *src, size_t len,
simd_context_t *simd_context)
{
@@ -50,8 +50,8 @@ static inline bool chacha20_arch(struct chacha20_ctx *state, u8 *dst,
len >= CHACHA20_BLOCK_SIZE * 3 && simd_use(simd_context)) {
const size_t bytes = min_t(size_t, len, PAGE_SIZE);
- chacha20_neon(dst, src, bytes, state->key, state->counter);
- state->counter[0] += (bytes + 63) / 64;
+ chacha20_neon(dst, src, bytes, ctx->key, ctx->counter);
+ ctx->counter[0] += (bytes + 63) / 64;
len -= bytes;
if (!len)
break;
@@ -59,8 +59,8 @@ static inline bool chacha20_arch(struct chacha20_ctx *state, u8 *dst,
src += bytes;
simd_relax(simd_context);
} else {
- chacha20_arm(dst, src, len, state->key, state->counter);
- state->counter[0] += (len + 63) / 64;
+ chacha20_arm(dst, src, len, ctx->key, ctx->counter);
+ ctx->counter[0] += (len + 63) / 64;
break;
}
}