Skip to content

Commit 6fce1f4

Browse files
blucaMikulas Patocka
authored andcommitted
dm verity: add support for signature verification with platform keyring
Add a new configuration CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_PLATFORM_KEYRING that enables verifying dm-verity signatures using the platform keyring, which is populated using the UEFI DB certificates. This is useful for self-enrolled systems that do not use MOK, as the secondary keyring which is already used for verification, if the relevant kconfig is enabled, is linked to the machine keyring, which gets its certificates loaded from MOK. On datacenter/virtual/cloud deployments it is more common to deploy one's own certificate chain directly in DB on first boot in unattended mode, rather than relying on MOK, as the latter typically requires interactive authentication to enroll, and is more suited for personal machines. Default to the same value as DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING if not otherwise specified, as it is likely that if one wants to use MOK certificates to verify dm-verity volumes, DB certificates are going to be used too. Keys in DB are allowed to load a full kernel already anyway, so they are already highly privileged. Signed-off-by: Luca Boccassi <bluca@debian.org> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
1 parent 3199a34 commit 6fce1f4

2 files changed

Lines changed: 17 additions & 0 deletions

File tree

drivers/md/Kconfig

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,16 @@ config DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING
540540

541541
If unsure, say N.
542542

543+
config DM_VERITY_VERIFY_ROOTHASH_SIG_PLATFORM_KEYRING
544+
bool "Verity data device root hash signature verification with platform keyring"
545+
default DM_VERITY_VERIFY_ROOTHASH_SIG_SECONDARY_KEYRING
546+
depends on DM_VERITY_VERIFY_ROOTHASH_SIG
547+
depends on INTEGRITY_PLATFORM_KEYRING
548+
help
549+
Rely also on the platform keyring to verify dm-verity signatures.
550+
551+
If unsure, say N.
552+
543553
config DM_VERITY_FEC
544554
bool "Verity forward error correction support"
545555
depends on DM_VERITY

drivers/md/dm-verity-verify-sig.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ int verity_verify_root_hash(const void *root_hash, size_t root_hash_len,
126126
NULL,
127127
#endif
128128
VERIFYING_UNSPECIFIED_SIGNATURE, NULL, NULL);
129+
#ifdef CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG_PLATFORM_KEYRING
130+
if (ret == -ENOKEY)
131+
ret = verify_pkcs7_signature(root_hash, root_hash_len, sig_data,
132+
sig_len,
133+
VERIFY_USE_PLATFORM_KEYRING,
134+
VERIFYING_UNSPECIFIED_SIGNATURE, NULL, NULL);
135+
#endif
129136

130137
return ret;
131138
}

0 commit comments

Comments
 (0)