From 6b7d734ee75319cc421c57f47d295ed911033947 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 24 Sep 2018 22:02:13 +0200 Subject: crypto: make constant naming scheme consistent Signed-off-by: Jason A. Donenfeld --- src/crypto/zinc/chacha20poly1305.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'src/crypto/zinc/chacha20poly1305.c') 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; } -- cgit v1.2.3