From 656be58314a362a3f4620fdca3c9b3a4a434e777 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Wed, 30 May 2018 04:58:19 +0200 Subject: crypto: consistent constification --- src/crypto/blake2s.c | 6 +++--- src/crypto/blake2s.h | 4 ++-- src/crypto/chacha20.c | 14 +++++++------- src/crypto/chacha20.h | 2 +- src/crypto/poly1305.c | 18 +++++++++--------- src/crypto/poly1305.h | 2 +- 6 files changed, 23 insertions(+), 23 deletions(-) (limited to 'src') diff --git a/src/crypto/blake2s.c b/src/crypto/blake2s.c index e945992..322a682 100644 --- a/src/crypto/blake2s.c +++ b/src/crypto/blake2s.c @@ -120,16 +120,16 @@ void __init blake2s_fpu_init(void) #endif } #ifdef CONFIG_AS_AVX -asmlinkage void blake2s_compress_avx(struct blake2s_state *state, const u8 *block, size_t nblocks, u32 inc); +asmlinkage void blake2s_compress_avx(struct blake2s_state *state, const u8 *block, const size_t nblocks, const u32 inc); #endif #ifdef CONFIG_AS_AVX512 -asmlinkage void blake2s_compress_avx512(struct blake2s_state *state, const u8 *block, size_t nblocks, u32 inc); +asmlinkage void blake2s_compress_avx512(struct blake2s_state *state, const u8 *block, const size_t nblocks, const u32 inc); #endif #else void __init blake2s_fpu_init(void) { } #endif -static inline void blake2s_compress(struct blake2s_state *state, const u8 *block, size_t nblocks, u32 inc) +static inline void blake2s_compress(struct blake2s_state *state, const u8 *block, size_t nblocks, const u32 inc) { u32 m[16]; u32 v[16]; diff --git a/src/crypto/blake2s.h b/src/crypto/blake2s.h index e2ab137..7c42101 100644 --- a/src/crypto/blake2s.h +++ b/src/crypto/blake2s.h @@ -29,7 +29,7 @@ void blake2s_init(struct blake2s_state *state, const size_t outlen); void blake2s_init_key(struct blake2s_state *state, const size_t outlen, const void *key, const size_t keylen); void blake2s_update(struct blake2s_state *state, const u8 *in, size_t inlen); void __blake2s_final(struct blake2s_state *state); -static inline void blake2s_final(struct blake2s_state *state, u8 *out, size_t outlen) +static inline void blake2s_final(struct blake2s_state *state, u8 *out, const size_t outlen) { int i; @@ -66,7 +66,7 @@ static inline void blake2s_final(struct blake2s_state *state, u8 *out, size_t ou } -static inline void blake2s(u8 *out, const u8 *in, const u8 *key, const size_t outlen, size_t inlen, const size_t keylen) +static inline void blake2s(u8 *out, const u8 *in, const u8 *key, const size_t outlen, const size_t inlen, const size_t keylen) { struct blake2s_state state; diff --git a/src/crypto/chacha20.c b/src/crypto/chacha20.c index 0444d01..a65ec8b 100644 --- a/src/crypto/chacha20.c +++ b/src/crypto/chacha20.c @@ -15,14 +15,14 @@ #include #ifdef CONFIG_AS_SSSE3 asmlinkage void hchacha20_ssse3(u8 *derived_key, const u8 *nonce, const u8 *key); -asmlinkage void chacha20_ssse3(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_ssse3(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); #endif #ifdef CONFIG_AS_AVX2 -asmlinkage void chacha20_avx2(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_avx2(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); #endif #ifdef CONFIG_AS_AVX512 -asmlinkage void chacha20_avx512(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); -asmlinkage void chacha20_avx512vl(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_avx512(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_avx512vl(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); #endif static bool chacha20_use_ssse3 __ro_after_init; @@ -46,12 +46,12 @@ void __init chacha20_fpu_init(void) #endif } #elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) -asmlinkage void chacha20_arm(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_arm(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); #if IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && (!defined(__LINUX_ARM_ARCH__) || __LINUX_ARM_ARCH__ >= 7) #define ARM_USE_NEON #include #include -asmlinkage void chacha20_neon(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_neon(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); #endif static bool chacha20_use_neon __ro_after_init; void __init chacha20_fpu_init(void) @@ -63,7 +63,7 @@ void __init chacha20_fpu_init(void) #endif } #elif defined(CONFIG_MIPS) && defined(CONFIG_CPU_MIPS32_R2) -asmlinkage void chacha20_mips(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); +asmlinkage void chacha20_mips(u8 *out, const u8 *in, const size_t len, const u32 key[8], const u32 counter[4]); void __init chacha20_fpu_init(void) { } #else void __init chacha20_fpu_init(void) { } diff --git a/src/crypto/chacha20.h b/src/crypto/chacha20.h index e3b6b69..10f35ab 100644 --- a/src/crypto/chacha20.h +++ b/src/crypto/chacha20.h @@ -23,7 +23,7 @@ struct chacha20_ctx { void chacha20_fpu_init(void); -static inline void chacha20_init(struct chacha20_ctx *state, const u8 key[CHACHA20_KEY_SIZE], u64 nonce) +static inline void chacha20_init(struct chacha20_ctx *state, const u8 key[CHACHA20_KEY_SIZE], const u64 nonce) { __le32 *le_key = (__le32 *)key; state->key[0] = le32_to_cpu(le_key[0]); diff --git a/src/crypto/poly1305.c b/src/crypto/poly1305.c index e405141..26af4ad 100644 --- a/src/crypto/poly1305.c +++ b/src/crypto/poly1305.c @@ -14,17 +14,17 @@ #include #include asmlinkage void poly1305_init_x86_64(void *ctx, const u8 key[POLY1305_KEY_SIZE]); -asmlinkage void poly1305_blocks_x86_64(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_x86_64(void *ctx, const u8 *inp, const size_t len, const u32 padbit); asmlinkage void poly1305_emit_x86_64(void *ctx, u8 mac[POLY1305_MAC_SIZE], const u32 nonce[4]); #ifdef CONFIG_AS_AVX asmlinkage void poly1305_emit_avx(void *ctx, u8 mac[POLY1305_MAC_SIZE], const u32 nonce[4]); -asmlinkage void poly1305_blocks_avx(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_avx(void *ctx, const u8 *inp, const size_t len, const u32 padbit); #endif #ifdef CONFIG_AS_AVX2 -asmlinkage void poly1305_blocks_avx2(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_avx2(void *ctx, const u8 *inp, const size_t len, const u32 padbit); #endif #ifdef CONFIG_AS_AVX512 -asmlinkage void poly1305_blocks_avx512(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_avx512(void *ctx, const u8 *inp, const size_t len, const u32 padbit); #endif static bool poly1305_use_avx __ro_after_init; @@ -47,13 +47,13 @@ void __init poly1305_fpu_init(void) } #elif defined(CONFIG_ARM) || defined(CONFIG_ARM64) asmlinkage void poly1305_init_arm(void *ctx, const u8 key[16]); -asmlinkage void poly1305_blocks_arm(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_arm(void *ctx, const u8 *inp, const size_t len, const u32 padbit); asmlinkage void poly1305_emit_arm(void *ctx, u8 mac[16], const u32 nonce[4]); #if IS_ENABLED(CONFIG_KERNEL_MODE_NEON) && (!defined(__LINUX_ARM_ARCH__) || __LINUX_ARM_ARCH__ >= 7) #define ARM_USE_NEON #include #include -asmlinkage void poly1305_blocks_neon(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_neon(void *ctx, const u8 *inp, const size_t len, const u32 padbit); asmlinkage void poly1305_emit_neon(void *ctx, u8 mac[16], const u32 nonce[4]); #endif static bool poly1305_use_neon __ro_after_init; @@ -67,7 +67,7 @@ void __init poly1305_fpu_init(void) } #elif defined(CONFIG_MIPS) && (defined(CONFIG_64BIT) || defined(CONFIG_CPU_MIPS32_R2)) asmlinkage void poly1305_init_mips(void *ctx, const u8 key[16]); -asmlinkage void poly1305_blocks_mips(void *ctx, const u8 *inp, size_t len, u32 padbit); +asmlinkage void poly1305_blocks_mips(void *ctx, const u8 *inp, const size_t len, const u32 padbit); asmlinkage void poly1305_emit_mips(void *ctx, u8 mac[16], const u32 nonce[4]); void __init poly1305_fpu_init(void) { } #else @@ -98,7 +98,7 @@ static void poly1305_init_generic(void *ctx, const u8 key[16]) st->r[3] = le32_to_cpup((__le32 *)&key[12]) & 0x0ffffffc; } -static void poly1305_blocks_generic(void *ctx, const u8 *inp, size_t len, u32 padbit) +static void poly1305_blocks_generic(void *ctx, const u8 *inp, size_t len, const u32 padbit) { #define CONSTANT_TIME_CARRY(a,b) ((a ^ ((a ^ b) | ((a - b) ^ b))) >> (sizeof(a) * 8 - 1)) struct poly1305_internal *st = (struct poly1305_internal *)ctx; @@ -255,7 +255,7 @@ void poly1305_init(struct poly1305_ctx *ctx, const u8 key[POLY1305_KEY_SIZE], bo ctx->num = 0; } -static inline void poly1305_blocks(void *ctx, const u8 *inp, size_t len, u32 padbit, bool have_simd) +static inline void poly1305_blocks(void *ctx, const u8 *inp, const size_t len, const u32 padbit, bool have_simd) { #if defined(CONFIG_X86_64) #ifdef CONFIG_AS_AVX512 diff --git a/src/crypto/poly1305.h b/src/crypto/poly1305.h index 21833be..876234c 100644 --- a/src/crypto/poly1305.h +++ b/src/crypto/poly1305.h @@ -24,7 +24,7 @@ struct poly1305_ctx { void poly1305_fpu_init(void); void poly1305_init(struct poly1305_ctx *ctx, const u8 key[POLY1305_KEY_SIZE], bool have_simd); -void poly1305_update(struct poly1305_ctx *ctx, const u8 *inp, size_t len, bool have_simd); +void poly1305_update(struct poly1305_ctx *ctx, const u8 *inp, const size_t len, bool have_simd); void poly1305_finish(struct poly1305_ctx *ctx, u8 mac[POLY1305_MAC_SIZE], bool have_simd); #ifdef DEBUG -- cgit v1.2.3-59-g8ed1b