From bebcae1f79aa667770f0c301df3339f449331bc2 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sat, 5 Nov 2016 23:34:55 +0100 Subject: chacha20poly1305: cleanup magic constants --- src/crypto/chacha20poly1305.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/crypto') 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); -- cgit v1.2.3-59-g8ed1b