From ea81962ee58922fa9f1eadcebbae893262e5dd03 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Mon, 26 Feb 2018 14:01:24 +0100 Subject: crypto: read only after init --- src/crypto/blake2s.c | 4 ++-- src/crypto/chacha20poly1305.c | 12 ++++++------ src/crypto/curve25519-arm.h | 2 +- src/crypto/curve25519-x86_64.h | 3 ++- 4 files changed, 11 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/crypto/blake2s.c b/src/crypto/blake2s.c index 1bb3cc1..d5d65c1 100644 --- a/src/crypto/blake2s.c +++ b/src/crypto/blake2s.c @@ -113,8 +113,8 @@ void blake2s_init_key(struct blake2s_state *state, const size_t outlen, const vo #include #include #include -static bool blake2s_use_avx __read_mostly; -static bool blake2s_use_avx512 __read_mostly; +static bool blake2s_use_avx __ro_after_init; +static bool blake2s_use_avx512 __ro_after_init; void __init blake2s_fpu_init(void) { #ifndef CONFIG_UML diff --git a/src/crypto/chacha20poly1305.c b/src/crypto/chacha20poly1305.c index 25eb4b4..45825e9 100644 --- a/src/crypto/chacha20poly1305.c +++ b/src/crypto/chacha20poly1305.c @@ -38,11 +38,11 @@ asmlinkage void chacha20_avx512vl(u8 *out, const u8 *in, size_t len, const u32 k asmlinkage void poly1305_blocks_avx512(void *ctx, const u8 *inp, size_t len, u32 padbit); #endif -static bool chacha20poly1305_use_ssse3 __read_mostly; -static bool chacha20poly1305_use_avx __read_mostly; -static bool chacha20poly1305_use_avx2 __read_mostly; -static bool chacha20poly1305_use_avx512 __read_mostly; -static bool chacha20poly1305_use_avx512vl __read_mostly; +static bool chacha20poly1305_use_ssse3 __ro_after_init; +static bool chacha20poly1305_use_avx __ro_after_init; +static bool chacha20poly1305_use_avx2 __ro_after_init; +static bool chacha20poly1305_use_avx512 __ro_after_init; +static bool chacha20poly1305_use_avx512vl __ro_after_init; void __init chacha20poly1305_fpu_init(void) { @@ -74,7 +74,7 @@ asmlinkage void poly1305_blocks_neon(void *ctx, const u8 *inp, size_t len, u32 p asmlinkage void poly1305_emit_neon(void *ctx, u8 mac[16], const u32 nonce[4]); asmlinkage void chacha20_neon(u8 *out, const u8 *in, size_t len, const u32 key[8], const u32 counter[4]); #endif -static bool chacha20poly1305_use_neon __read_mostly; +static bool chacha20poly1305_use_neon __ro_after_init; void __init chacha20poly1305_fpu_init(void) { #if defined(CONFIG_ARM64) diff --git a/src/crypto/curve25519-arm.h b/src/crypto/curve25519-arm.h index 4142e4e..4271ab5 100644 --- a/src/crypto/curve25519-arm.h +++ b/src/crypto/curve25519-arm.h @@ -7,7 +7,7 @@ #include #include asmlinkage void curve25519_neon(u8 mypublic[CURVE25519_POINT_SIZE], const u8 secret[CURVE25519_POINT_SIZE], const u8 basepoint[CURVE25519_POINT_SIZE]); -static bool curve25519_use_neon __read_mostly; +static bool curve25519_use_neon __ro_after_init; void __init curve25519_fpu_init(void) { curve25519_use_neon = elf_hwcap & HWCAP_NEON; diff --git a/src/crypto/curve25519-x86_64.h b/src/crypto/curve25519-x86_64.h index dba5812..c90b13d 100644 --- a/src/crypto/curve25519-x86_64.h +++ b/src/crypto/curve25519-x86_64.h @@ -9,7 +9,8 @@ #include #include #include -static bool curve25519_use_avx __read_mostly; + +static bool curve25519_use_avx __ro_after_init; void __init curve25519_fpu_init(void) { #ifndef CONFIG_UML -- cgit v1.2.3-59-g8ed1b