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 | bebcae1f79aa667770f0c301df3339f449331bc2 (patch) | |
tree | 69e4b6a9f9755effa6e88e935c59f8a58032ee44 /src/crypto | |
parent | c89: the static keyword is okay in c99, but not in c89 (diff) | |
download | wireguard-monolithic-historical-bebcae1f79aa667770f0c301df3339f449331bc2.tar.xz wireguard-monolithic-historical-bebcae1f79aa667770f0c301df3339f449331bc2.zip |
chacha20poly1305: cleanup magic constantsexperimental-0.0.20161105
Diffstat (limited to 'src/crypto')
-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); |