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>
Wed, 23 Feb 2022 15:49:07 +0000 (16:49 +0100)
commitfba8fbf6f1a274a5d152d17fecb983cbf028e4a5
tree79576f808d0842be33a3bf5cb1b86a9fb125f3cc
parent50c486fe310890c134b5cb36cf9a4135475a6074
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