diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-05 23:34:55 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2016-11-05 23:37:35 +0100 |
commit | 4d507da21c4ebde37efd85c5cc727fab26f5404a (patch) | |
tree | 3aa424a1d62e76b0d745944bf9f7ed8563919737 | |
parent | 88752e06441b212029fe8d9fcc3c605ddbc1586d (diff) |
chacha20poly1305: cleanup magic constants
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | src/crypto/chacha20poly1305.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c index 961bd60..201137a 100644 --- a/src/crypto/chacha20poly1305.c +++ b/src/crypto/chacha20poly1305.c @@ -71,9 +71,8 @@ static inline u32 and(u32 v, u32 mask) return v & mask; } - struct chacha20_ctx { - u32 state[16]; + u32 state[CHACHA20_BLOCK_SIZE / sizeof(u32)]; } __aligned(32); static void chacha20_generic_block(struct chacha20_ctx *ctx, void *stream) @@ -133,7 +132,7 @@ static void chacha20_generic_block(struct chacha20_ctx *ctx, void *stream) ctx->state[12]++; } -static void chacha20_keysetup(struct chacha20_ctx *ctx, const u8 key[32], const u8 nonce[8]) +static void chacha20_keysetup(struct chacha20_ctx *ctx, const u8 key[CHACHA20_KEY_SIZE], const u8 nonce[sizeof(u64)]) { static const char constant[16] = "expand 32-byte k"; ctx->state[0] = le32_to_cpuvp(constant + 0); |