OSDN Git Service

KEYS: trusted: Fix trusted key backends when building as module
authorAndreas Rammhold <andreas@rammhold.de>
Wed, 1 Dec 2021 09:59:00 +0000 (10:59 +0100)
committerJarkko Sakkinen <jarkko@kernel.org>
Tue, 8 Mar 2022 11:55:52 +0000 (13:55 +0200)
commit969a26446bcd142faedfe8c6f41cd7668596c1fa
tree0178a0270dd561f7cddc5b8c479f377a80f972df
parent2dd634664d4128668c44bc9e497af24157f1eef4
KEYS: trusted: Fix trusted key backends when building as module

Before this commit the kernel could end up with no trusted key sources
even though both of the currently supported backends (TPM and TEE) were
compiled as modules. This manifested in the trusted key type not being
registered at all.

When checking if a CONFIG_… preprocessor variable is defined we only
test for the builtin (=y) case and not the module (=m) case. By using
the IS_REACHABLE() macro we do test for both cases.

Fixes: 5d0682be3189 ("KEYS: trusted: Add generic trusted keys framework")
Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Sumit Garg <sumit.garg@linaro.org>
Signed-off-by: Andreas Rammhold <andreas@rammhold.de>
Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
security/keys/trusted-keys/trusted_core.c