Skip to content

Commit 56edb6c

Browse files
esnowbergjarkkojs
authored andcommitted
KEYS: store reference to machine keyring
Expose the .machine keyring created in integrity code by adding a reference. Store a reference to the machine keyring in system keyring code. The system keyring code needs this to complete the keyring link to the machine keyring. Signed-off-by: Eric Snowberg <eric.snowberg@oracle.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Tested-by: Mimi Zohar <zohar@linux.ibm.com> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
1 parent 45fcd5e commit 56edb6c

3 files changed

Lines changed: 19 additions & 0 deletions

File tree

certs/system_keyring.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ static struct key *builtin_trusted_keys;
2222
#ifdef CONFIG_SECONDARY_TRUSTED_KEYRING
2323
static struct key *secondary_trusted_keys;
2424
#endif
25+
#ifdef CONFIG_INTEGRITY_MACHINE_KEYRING
26+
static struct key *machine_trusted_keys;
27+
#endif
2528
#ifdef CONFIG_INTEGRITY_PLATFORM_KEYRING
2629
static struct key *platform_trusted_keys;
2730
#endif
@@ -91,6 +94,12 @@ static __init struct key_restriction *get_builtin_and_secondary_restriction(void
9194
return restriction;
9295
}
9396
#endif
97+
#ifdef CONFIG_INTEGRITY_MACHINE_KEYRING
98+
void __init set_machine_trusted_keys(struct key *keyring)
99+
{
100+
machine_trusted_keys = keyring;
101+
}
102+
#endif
94103

95104
/*
96105
* Create the trusted keyrings

include/keys/system_keyring.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ extern int restrict_link_by_builtin_and_secondary_trusted(
3838
#define restrict_link_by_builtin_and_secondary_trusted restrict_link_by_builtin_trusted
3939
#endif
4040

41+
#ifdef CONFIG_INTEGRITY_MACHINE_KEYRING
42+
extern void __init set_machine_trusted_keys(struct key *keyring);
43+
#else
44+
static inline void __init set_machine_trusted_keys(struct key *keyring)
45+
{
46+
}
47+
#endif
48+
4149
extern struct pkcs7_message *pkcs7;
4250
#ifdef CONFIG_SYSTEM_BLACKLIST_KEYRING
4351
extern int mark_hash_blacklisted(const char *hash);

security/integrity/digsig.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ static int __init __integrity_init_keyring(const unsigned int id,
112112
} else {
113113
if (id == INTEGRITY_KEYRING_PLATFORM)
114114
set_platform_trusted_keys(keyring[id]);
115+
if (id == INTEGRITY_KEYRING_MACHINE)
116+
set_machine_trusted_keys(keyring[id]);
115117
if (id == INTEGRITY_KEYRING_IMA)
116118
load_module_cert(keyring[id]);
117119
}

0 commit comments

Comments
 (0)