diff options
Diffstat (limited to 'src/crypto')
-rw-r--r-- | src/crypto/chacha20poly1305.c | 12 | ||||
-rw-r--r-- | src/crypto/chacha20poly1305.h | 8 | ||||
-rw-r--r-- | src/crypto/curve25519.c | 14 | ||||
-rw-r--r-- | src/crypto/curve25519.h | 6 | ||||
-rw-r--r-- | src/crypto/siphash24.c | 2 | ||||
-rw-r--r-- | src/crypto/siphash24.h | 2 |
6 files changed, 22 insertions, 22 deletions
diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c index cc48a9e..961bd60 100644 --- a/src/crypto/chacha20poly1305.c +++ b/src/crypto/chacha20poly1305.c @@ -133,7 +133,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[static 32], const u8 nonce[static 8]) +static void chacha20_keysetup(struct chacha20_ctx *ctx, const u8 key[32], const u8 nonce[8]) { static const char constant[16] = "expand 32-byte k"; ctx->state[0] = le32_to_cpuvp(constant + 0); @@ -240,7 +240,7 @@ struct poly1305_ctx { u32 r4[5]; }; -static void poly1305_init(struct poly1305_ctx *ctx, const u8 key[static POLY1305_KEY_SIZE]) +static void poly1305_init(struct poly1305_ctx *ctx, const u8 key[POLY1305_KEY_SIZE]) { #ifndef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS u32 t0, t1, t2, t3; @@ -519,7 +519,7 @@ static struct blkcipher_desc chacha20_desc = { bool chacha20poly1305_encrypt(uint8_t *dst, const uint8_t *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]) + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]) { struct poly1305_ctx poly1305_state; struct chacha20_ctx chacha20_state; @@ -560,7 +560,7 @@ bool chacha20poly1305_encrypt(uint8_t *dst, const uint8_t *src, const size_t src bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN], + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN], bool have_simd) { struct poly1305_ctx poly1305_state; @@ -614,7 +614,7 @@ bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *sr bool chacha20poly1305_decrypt(uint8_t *dst, const uint8_t *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]) + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]) { struct poly1305_ctx poly1305_state; struct chacha20_ctx chacha20_state; @@ -666,7 +666,7 @@ bool chacha20poly1305_decrypt(uint8_t *dst, const uint8_t *src, const size_t src bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]) + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]) { struct poly1305_ctx poly1305_state; struct chacha20_ctx chacha20_state; diff --git a/src/crypto/chacha20poly1305.h b/src/crypto/chacha20poly1305.h index 57d3d23..d7f1f98 100644 --- a/src/crypto/chacha20poly1305.h +++ b/src/crypto/chacha20poly1305.h @@ -16,20 +16,20 @@ void chacha20poly1305_init(void); bool chacha20poly1305_encrypt(uint8_t *dst, const uint8_t *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]); + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]); bool chacha20poly1305_encrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN], + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN], bool have_simd); bool chacha20poly1305_decrypt(uint8_t *dst, const uint8_t *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]); + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]); bool chacha20poly1305_decrypt_sg(struct scatterlist *dst, struct scatterlist *src, const size_t src_len, const uint8_t *ad, const size_t ad_len, - const uint64_t nonce, const uint8_t key[static CHACHA20POLY1305_KEYLEN]); + const uint64_t nonce, const uint8_t key[CHACHA20POLY1305_KEYLEN]); #ifdef CONFIG_X86_64 #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0) diff --git a/src/crypto/curve25519.c b/src/crypto/curve25519.c index 8f6b562..b96b69c 100644 --- a/src/crypto/curve25519.c +++ b/src/crypto/curve25519.c @@ -10,7 +10,7 @@ #include <linux/random.h> #include <crypto/algapi.h> -static __always_inline void normalize_secret(uint8_t secret[static CURVE25519_POINT_SIZE]) +static __always_inline void normalize_secret(uint8_t secret[CURVE25519_POINT_SIZE]) { secret[0] &= 248; secret[31] &= 127; @@ -300,7 +300,7 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */ * This function performs the swap without leaking any side-channel * information. */ -static void swap_conditional(limb a[static 5], limb b[static 5], limb iswap) +static void swap_conditional(limb a[5], limb b[5], limb iswap) { unsigned i; const limb swap = -iswap; @@ -393,7 +393,7 @@ static void crecip(felem out, const felem z) /* 2^255 - 21 */ fmul(out, t0, a); } -void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE], const uint8_t basepoint[static CURVE25519_POINT_SIZE]) +void curve25519(uint8_t mypublic[CURVE25519_POINT_SIZE], const uint8_t secret[CURVE25519_POINT_SIZE], const uint8_t basepoint[CURVE25519_POINT_SIZE]) { limb bp[5], x[5], z[5], zmone[5]; uint8_t e[32]; @@ -1071,7 +1071,7 @@ static void fmonty(limb *x2, limb *z2, /* output 2Q */ * reduced-degree form: the values in a[10..19] or b[10..19] aren't swapped, * and all all values in a[0..9],b[0..9] must have magnitude less than * INT32_MAX. */ -static void swap_conditional(limb a[static 19], limb b[static 19], limb iswap) +static void swap_conditional(limb a[19], limb b[19], limb iswap) { unsigned i; const int32_t swap = (int32_t) -iswap; @@ -1202,7 +1202,7 @@ static void crecip(limb *out, const limb *z) /* 2^255 - 21 */ fmul(out,t1,z11); } -void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE], const uint8_t basepoint[static CURVE25519_POINT_SIZE]) +void curve25519(uint8_t mypublic[CURVE25519_POINT_SIZE], const uint8_t secret[CURVE25519_POINT_SIZE], const uint8_t basepoint[CURVE25519_POINT_SIZE]) { limb bp[10], x[10], z[11], zmone[10]; uint8_t e[32]; @@ -1225,13 +1225,13 @@ void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t se #endif -void curve25519_generate_secret(uint8_t secret[static CURVE25519_POINT_SIZE]) +void curve25519_generate_secret(uint8_t secret[CURVE25519_POINT_SIZE]) { get_random_bytes(secret, CURVE25519_POINT_SIZE); normalize_secret(secret); } -void curve25519_generate_public(uint8_t pub[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE]) +void curve25519_generate_public(uint8_t pub[CURVE25519_POINT_SIZE], const uint8_t secret[CURVE25519_POINT_SIZE]) { static const uint8_t basepoint[CURVE25519_POINT_SIZE] = { 9 }; curve25519(pub, secret, basepoint); diff --git a/src/crypto/curve25519.h b/src/crypto/curve25519.h index 23f4d74..f16fc30 100644 --- a/src/crypto/curve25519.h +++ b/src/crypto/curve25519.h @@ -9,9 +9,9 @@ enum curve25519_lengths { CURVE25519_POINT_SIZE = 32 }; -void curve25519(uint8_t mypublic[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE], const uint8_t basepoint[static CURVE25519_POINT_SIZE]); -void curve25519_generate_secret(uint8_t secret[static CURVE25519_POINT_SIZE]); -void curve25519_generate_public(uint8_t pub[static CURVE25519_POINT_SIZE], const uint8_t secret[static CURVE25519_POINT_SIZE]); +void curve25519(uint8_t mypublic[CURVE25519_POINT_SIZE], const uint8_t secret[CURVE25519_POINT_SIZE], const uint8_t basepoint[CURVE25519_POINT_SIZE]); +void curve25519_generate_secret(uint8_t secret[CURVE25519_POINT_SIZE]); +void curve25519_generate_public(uint8_t pub[CURVE25519_POINT_SIZE], const uint8_t secret[CURVE25519_POINT_SIZE]); #ifdef DEBUG bool curve25519_selftest(void); diff --git a/src/crypto/siphash24.c b/src/crypto/siphash24.c index 1203d90..7395413 100644 --- a/src/crypto/siphash24.c +++ b/src/crypto/siphash24.c @@ -16,7 +16,7 @@ } while(0) __attribute__((optimize("unroll-loops"))) -uint64_t siphash24(const uint8_t *data, size_t len, const uint8_t key[static SIPHASH24_KEY_LEN]) +uint64_t siphash24(const uint8_t *data, size_t len, const uint8_t key[SIPHASH24_KEY_LEN]) { uint64_t v0 = 0x736f6d6570736575ULL; uint64_t v1 = 0x646f72616e646f6dULL; diff --git a/src/crypto/siphash24.h b/src/crypto/siphash24.h index ec893bd..f06a87c 100644 --- a/src/crypto/siphash24.h +++ b/src/crypto/siphash24.h @@ -7,7 +7,7 @@ enum siphash24_lengths { SIPHASH24_KEY_LEN = 16 }; -uint64_t siphash24(const uint8_t *data, size_t len, const uint8_t key[static SIPHASH24_KEY_LEN]); +uint64_t siphash24(const uint8_t *data, size_t len, const uint8_t key[SIPHASH24_KEY_LEN]); #ifdef DEBUG bool siphash24_selftest(void); |