summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-02-26 14:01:24 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2018-03-02 16:42:29 +0100
commitea81962ee58922fa9f1eadcebbae893262e5dd03 (patch)
tree06ddde413aa7a99ab0a41b3bdd5ca264e426a20e /src
parentKconfig: require DST_CACHE explicitly (diff)
downloadwireguard-monolithic-historical-ea81962ee58922fa9f1eadcebbae893262e5dd03.tar.xz
wireguard-monolithic-historical-ea81962ee58922fa9f1eadcebbae893262e5dd03.zip
crypto: read only after init
Diffstat (limited to 'src')
-rw-r--r--src/crypto/blake2s.c4
-rw-r--r--src/crypto/chacha20poly1305.c12
-rw-r--r--src/crypto/curve25519-arm.h2
-rw-r--r--src/crypto/curve25519-x86_64.h3
4 files changed, 11 insertions, 10 deletions
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 <asm/processor.h>
#include <asm/fpu/api.h>
#include <asm/simd.h>
-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 <asm/neon.h>
#include <asm/simd.h>
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 <asm/processor.h>
#include <asm/fpu/api.h>
#include <asm/simd.h>
-static bool curve25519_use_avx __read_mostly;
+
+static bool curve25519_use_avx __ro_after_init;
void __init curve25519_fpu_init(void)
{
#ifndef CONFIG_UML