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/include | |
parent | 3106f71185676be1b95a814e9015525dd17ab19c (diff) |
crypto: make constant naming scheme consistent
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/include')
-rw-r--r-- | src/crypto/include/zinc/blake2s.h | 10 | ||||
-rw-r--r-- | src/crypto/include/zinc/chacha20.h | 6 | ||||
-rw-r--r-- | src/crypto/include/zinc/chacha20poly1305.h | 22 | ||||
-rw-r--r-- | src/crypto/include/zinc/curve25519.h | 12 |
4 files changed, 25 insertions, 25 deletions
diff --git a/src/crypto/include/zinc/blake2s.h b/src/crypto/include/zinc/blake2s.h index f14230e..da313de 100644 --- a/src/crypto/include/zinc/blake2s.h +++ b/src/crypto/include/zinc/blake2s.h @@ -11,16 +11,16 @@ #include <crypto/algapi.h> enum blake2s_lengths { - BLAKE2S_BLOCKBYTES = 64, - BLAKE2S_OUTBYTES = 32, - BLAKE2S_KEYBYTES = 32 + BLAKE2S_BLOCK_SIZE = 64, + BLAKE2S_HASH_SIZE = 32, + BLAKE2S_KEY_SIZE = 32 }; struct blake2s_state { u32 h[8]; u32 t[2]; u32 f[2]; - u8 buf[BLAKE2S_BLOCKBYTES]; + u8 buf[BLAKE2S_BLOCK_SIZE]; size_t buflen; u8 last_node; }; @@ -39,7 +39,7 @@ static inline void blake2s(u8 *out, const u8 *in, const u8 *key, #ifdef DEBUG BUG_ON((!in && inlen > 0) || !out || !outlen || - outlen > BLAKE2S_OUTBYTES || keylen > BLAKE2S_KEYBYTES || + outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || (!key && keylen)); #endif diff --git a/src/crypto/include/zinc/chacha20.h b/src/crypto/include/zinc/chacha20.h index 34d577d..14bbadd 100644 --- a/src/crypto/include/zinc/chacha20.h +++ b/src/crypto/include/zinc/chacha20.h @@ -12,13 +12,13 @@ #include <linux/types.h> enum { - CHACHA20_IV_SIZE = 16, + CHACHA20_NONCE_SIZE = 16, CHACHA20_KEY_SIZE = 32, CHACHA20_KEY_WORDS = CHACHA20_KEY_SIZE / sizeof(u32), CHACHA20_BLOCK_SIZE = 64, CHACHA20_BLOCK_WORDS = CHACHA20_BLOCK_SIZE / sizeof(u32), - HCHACHA20_KEY_SIZE = 32, - HCHACHA20_NONCE_SIZE = 16 + HCHACHA20_NONCE_SIZE = CHACHA20_NONCE_SIZE, + HCHACHA20_KEY_SIZE = CHACHA20_KEY_SIZE }; enum { /* expand 32-byte k */ diff --git a/src/crypto/include/zinc/chacha20poly1305.h b/src/crypto/include/zinc/chacha20poly1305.h index 50b2be9..d2753c5 100644 --- a/src/crypto/include/zinc/chacha20poly1305.h +++ b/src/crypto/include/zinc/chacha20poly1305.h @@ -12,39 +12,39 @@ struct scatterlist; enum chacha20poly1305_lengths { - XCHACHA20POLY1305_NONCELEN = 24, - CHACHA20POLY1305_KEYLEN = 32, - CHACHA20POLY1305_AUTHTAGLEN = 16 + XCHACHA20POLY1305_NONCE_SIZE = 24, + CHACHA20POLY1305_KEY_SIZE = 32, + CHACHA20POLY1305_AUTHTAG_SIZE = 16 }; 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]); bool __must_check 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], simd_context_t *simd_context); + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context); bool __must_check 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]); bool __must_check 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], simd_context_t *simd_context); + const u8 key[CHACHA20POLY1305_KEY_SIZE], simd_context_t *simd_context); 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]); bool __must_check 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 size_t ad_len, const u8 nonce[XCHACHA20POLY1305_NONCE_SIZE], + const u8 key[CHACHA20POLY1305_KEY_SIZE]); #endif /* _ZINC_CHACHA20POLY1305_H */ diff --git a/src/crypto/include/zinc/curve25519.h b/src/crypto/include/zinc/curve25519.h index ac5979c..def173e 100644 --- a/src/crypto/include/zinc/curve25519.h +++ b/src/crypto/include/zinc/curve25519.h @@ -9,14 +9,14 @@ #include <linux/types.h> enum curve25519_lengths { - CURVE25519_POINT_SIZE = 32 + CURVE25519_KEY_SIZE = 32 }; -bool __must_check curve25519(u8 mypublic[CURVE25519_POINT_SIZE], - const u8 secret[CURVE25519_POINT_SIZE], - const u8 basepoint[CURVE25519_POINT_SIZE]); -void curve25519_generate_secret(u8 secret[CURVE25519_POINT_SIZE]); +bool __must_check curve25519(u8 mypublic[CURVE25519_KEY_SIZE], + const u8 secret[CURVE25519_KEY_SIZE], + const u8 basepoint[CURVE25519_KEY_SIZE]); +void curve25519_generate_secret(u8 secret[CURVE25519_KEY_SIZE]); bool __must_check curve25519_generate_public( - u8 pub[CURVE25519_POINT_SIZE], const u8 secret[CURVE25519_POINT_SIZE]); + u8 pub[CURVE25519_KEY_SIZE], const u8 secret[CURVE25519_KEY_SIZE]); #endif /* _ZINC_CURVE25519_H */ |