Skip to content

Commit

Permalink
KEYS: trusted: Fix trusted key backends when building as module
Browse files Browse the repository at this point in the history
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: 5d0682b ("KEYS: trusted: Add generic trusted keys framework")
Reviewed-by: Jarkko Sakkinen <[email protected]>
Reviewed-by: Ahmad Fatoum <[email protected]>
Reviewed-by: Sumit Garg <[email protected]>
Signed-off-by: Andreas Rammhold <[email protected]>
Tested-by: Ahmad Fatoum <[email protected]>
Signed-off-by: Ahmad Fatoum <[email protected]>
Signed-off-by: Jarkko Sakkinen <[email protected]>
  • Loading branch information
andir authored and jarkkojs committed Mar 8, 2022
1 parent 2dd6346 commit 969a264
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions security/keys/trusted-keys/trusted_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ module_param_named(source, trusted_key_source, charp, 0);
MODULE_PARM_DESC(source, "Select trusted keys source (tpm or tee)");

static const struct trusted_key_source trusted_key_sources[] = {
#if defined(CONFIG_TCG_TPM)
#if IS_REACHABLE(CONFIG_TCG_TPM)
{ "tpm", &trusted_key_tpm_ops },
#endif
#if defined(CONFIG_TEE)
#if IS_REACHABLE(CONFIG_TEE)
{ "tee", &trusted_key_tee_ops },
#endif
};
Expand Down

0 comments on commit 969a264

Please sign in to comment.