aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/crypto/curve25519-x86_64.c
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-11-25 11:31:12 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2019-11-27 13:08:49 +0800
commit8394bfec51e0e565556101bcc4e2fe7551104cd8 (patch)
treef6500eacc0aa2e818f39286ee59f3e106a4b6578 /arch/x86/crypto/curve25519-x86_64.c
parentcrypto: vmx - Avoid weird build failures (diff)
downloadlinux-dev-8394bfec51e0e565556101bcc4e2fe7551104cd8.tar.xz
linux-dev-8394bfec51e0e565556101bcc4e2fe7551104cd8.zip
crypto: arch - conditionalize crypto api in arch glue for lib code
For glue code that's used by Zinc, the actual Crypto API functions might not necessarily exist, and don't need to exist either. Before this patch, there are valid build configurations that lead to a unbuildable kernel. This fixes it to conditionalize those symbols on the existence of the proper config entry. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/x86/crypto/curve25519-x86_64.c')
-rw-r--r--arch/x86/crypto/curve25519-x86_64.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/arch/x86/crypto/curve25519-x86_64.c b/arch/x86/crypto/curve25519-x86_64.c
index a52a3fb15727..eec7d2d24239 100644
--- a/arch/x86/crypto/curve25519-x86_64.c
+++ b/arch/x86/crypto/curve25519-x86_64.c
@@ -2457,13 +2457,14 @@ static int __init curve25519_mod_init(void)
static_branch_enable(&curve25519_use_adx);
else
return 0;
- return crypto_register_kpp(&curve25519_alg);
+ return IS_REACHABLE(CONFIG_CRYPTO_KPP) ?
+ crypto_register_kpp(&curve25519_alg) : 0;
}
static void __exit curve25519_mod_exit(void)
{
- if (boot_cpu_has(X86_FEATURE_BMI2) ||
- boot_cpu_has(X86_FEATURE_ADX))
+ if (IS_REACHABLE(CONFIG_CRYPTO_KPP) &&
+ (boot_cpu_has(X86_FEATURE_BMI2) || boot_cpu_has(X86_FEATURE_ADX)))
crypto_unregister_kpp(&curve25519_alg);
}