diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-24 22:02:13 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-09-25 03:01:21 +0200 |
commit | 6b7d734ee75319cc421c57f47d295ed911033947 (patch) | |
tree | 8176c3bd3b3e4e9c0157b256d11749530dbfd5e9 /src/crypto/zinc/chacha20poly1305.c | |
parent | 3106f71185676be1b95a814e9015525dd17ab19c (diff) |
crypto: make constant naming scheme consistent
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/chacha20poly1305.c')
-rw-r--r-- | src/crypto/zinc/chacha20poly1305.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/crypto/zinc/chacha20poly1305.c b/src/crypto/zinc/chacha20poly1305.c index f2d82a1..2d975c3 100644 --- a/src/crypto/zinc/chacha20poly1305.c +++ b/src/crypto/zinc/chacha20poly1305.c @@ -34,7 +34,7 @@ static struct blkcipher_desc chacha20_desc = { static inline void __chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN], + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context) { struct poly1305_ctx poly1305_state; @@ -73,7 +73,7 @@ __chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, void chacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN]) + const u8 key[CHACHA20POLY1305_KEY_SIZE]) { simd_context_t simd_context; @@ -88,7 +88,7 @@ bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN], + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context) { struct poly1305_ctx poly1305_state; @@ -157,7 +157,7 @@ EXPORT_SYMBOL(chacha20poly1305_encrypt_sg); static inline bool __chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN], + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context) { struct poly1305_ctx poly1305_state; @@ -207,7 +207,7 @@ __chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, bool chacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN]) + const u8 key[CHACHA20POLY1305_KEY_SIZE]) { simd_context_t simd_context, ret; @@ -223,7 +223,7 @@ bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const u8 *ad, const size_t ad_len, const u64 nonce, - const u8 key[CHACHA20POLY1305_KEYLEN], + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context) { struct poly1305_ctx poly1305_state; @@ -301,8 +301,8 @@ EXPORT_SYMBOL(chacha20poly1305_decrypt_sg); void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, - const u8 nonce[XCHACHA20POLY1305_NONCELEN], - const u8 key[CHACHA20POLY1305_KEYLEN]) + const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], + const u8 key[CHACHA20POLY1305_KEY_SIZE]) { simd_context_t simd_context; u32 derived_key[CHACHA20_KEY_WORDS] __aligned(16); @@ -313,15 +313,15 @@ void xchacha20poly1305_encrypt(u8 *dst, const u8 *src, const size_t src_len, __chacha20poly1305_encrypt(dst, src, src_len, ad, ad_len, get_unaligned_le64(nonce + 16), (u8 *)derived_key, &simd_context); - memzero_explicit(derived_key, CHACHA20POLY1305_KEYLEN); + memzero_explicit(derived_key, CHACHA20POLY1305_KEY_SIZE); simd_put(&simd_context); } EXPORT_SYMBOL(xchacha20poly1305_encrypt); bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, const u8 *ad, const size_t ad_len, - const u8 nonce[XCHACHA20POLY1305_NONCELEN], - const u8 key[CHACHA20POLY1305_KEYLEN]) + const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], + const u8 key[CHACHA20POLY1305_KEY_SIZE]) { bool ret; simd_context_t simd_context; @@ -333,7 +333,7 @@ bool xchacha20poly1305_decrypt(u8 *dst, const u8 *src, const size_t src_len, ret = __chacha20poly1305_decrypt(dst, src, src_len, ad, ad_len, get_unaligned_le64(nonce + 16), (u8 *)derived_key, &simd_context); - memzero_explicit(derived_key, CHACHA20POLY1305_KEYLEN); + memzero_explicit(derived_key, CHACHA20POLY1305_KEY_SIZE); simd_put(&simd_context); return ret; } |