diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-02 19:45:08 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2019-06-02 19:45:08 +0200 |
commit | 799b33af50d2db5cce849f16e34056c46a2fcd02 (patch) | |
tree | 00ed66971039601258298e46bbfd712d935f7e2e /src/crypto/zinc/curve25519/curve25519-x86_64-glue.c | |
parent | 4614146eaa751755fd2dcbfe25410ade89b0b2e2 (diff) |
curve25519: not all linkers support bmi2 and adx
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'src/crypto/zinc/curve25519/curve25519-x86_64-glue.c')
-rw-r--r-- | src/crypto/zinc/curve25519/curve25519-x86_64-glue.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/crypto/zinc/curve25519/curve25519-x86_64-glue.c b/src/crypto/zinc/curve25519/curve25519-x86_64-glue.c index 19c86c6..d62bd37 100644 --- a/src/crypto/zinc/curve25519/curve25519-x86_64-glue.c +++ b/src/crypto/zinc/curve25519/curve25519-x86_64-glue.c @@ -15,8 +15,10 @@ static bool *const curve25519_nobs[] __initconst = { static void __init curve25519_fpu_init(void) { - curve25519_use_bmi2 = boot_cpu_has(X86_FEATURE_BMI2); - curve25519_use_adx = boot_cpu_has(X86_FEATURE_BMI2) && + curve25519_use_bmi2 = IS_ENABLED(CONFIG_AS_BMI2) && + boot_cpu_has(X86_FEATURE_BMI2); + curve25519_use_adx = IS_ENABLED(CONFIG_AS_ADX) && + boot_cpu_has(X86_FEATURE_BMI2) && boot_cpu_has(X86_FEATURE_ADX); } @@ -24,10 +26,10 @@ static inline bool curve25519_arch(u8 mypublic[CURVE25519_KEY_SIZE], const u8 secret[CURVE25519_KEY_SIZE], const u8 basepoint[CURVE25519_KEY_SIZE]) { - if (curve25519_use_adx) { + if (IS_ENABLED(CONFIG_AS_ADX) && curve25519_use_adx) { curve25519_adx(mypublic, secret, basepoint); return true; - } else if (curve25519_use_bmi2) { + } else if (IS_ENABLED(CONFIG_AS_BMI2) && curve25519_use_bmi2) { curve25519_bmi2(mypublic, secret, basepoint); return true; } @@ -37,10 +39,10 @@ static inline bool curve25519_arch(u8 mypublic[CURVE25519_KEY_SIZE], static inline bool curve25519_base_arch(u8 pub[CURVE25519_KEY_SIZE], const u8 secret[CURVE25519_KEY_SIZE]) { - if (curve25519_use_adx) { + if (IS_ENABLED(CONFIG_AS_ADX) && curve25519_use_adx) { curve25519_adx_base(pub, secret); return true; - } else if (curve25519_use_bmi2) { + } else if (IS_ENABLED(CONFIG_AS_BMI2) && curve25519_use_bmi2) { curve25519_bmi2_base(pub, secret); return true; } |