diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/crypto/include/zinc/chacha20.h | 1 | ||||
-rw-r--r-- | src/crypto/zinc/chacha20/chacha20.c | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/src/crypto/include/zinc/chacha20.h b/src/crypto/include/zinc/chacha20.h index d09afbc..3c2c2f7 100644 --- a/src/crypto/include/zinc/chacha20.h +++ b/src/crypto/include/zinc/chacha20.h @@ -15,6 +15,7 @@ enum { CHACHA20_IV_SIZE = 16, CHACHA20_KEY_SIZE = 32, CHACHA20_BLOCK_SIZE = 64, + CHACHA20_BLOCK_WORDS = CHACHA20_BLOCK_SIZE / sizeof(u32), HCHACHA20_KEY_SIZE = 32, HCHACHA20_NONCE_SIZE = 16 }; diff --git a/src/crypto/zinc/chacha20/chacha20.c b/src/crypto/zinc/chacha20/chacha20.c index ab5ef07..1d9168e 100644 --- a/src/crypto/zinc/chacha20/chacha20.c +++ b/src/crypto/zinc/chacha20/chacha20.c @@ -72,7 +72,7 @@ static inline bool hchacha20_arch(u8 *derived_key, const u8 *nonce, static void chacha20_block_generic(__le32 *stream, u32 *state) { - u32 x[CHACHA20_BLOCK_SIZE / sizeof(u32)]; + u32 x[CHACHA20_BLOCK_WORDS]; int i; for (i = 0; i < ARRAY_SIZE(x); ++i) @@ -89,7 +89,7 @@ static void chacha20_block_generic(__le32 *stream, u32 *state) static void chacha20_generic(u8 *out, const u8 *in, u32 len, const u32 key[8], const u32 counter[4]) { - __le32 buf[CHACHA20_BLOCK_SIZE / sizeof(__le32)]; + __le32 buf[CHACHA20_BLOCK_WORDS]; u32 x[] = { EXPAND_32_BYTE_K, key[0], key[1], key[2], key[3], |