Skip to contentSkip to conversation

ipe: fallback to platform keyring also if key in trusted keyring is rejected

PATCH In review [email protected] 2 participants 2 messages Sep 27, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ipe: fallback to platform keyring also if key in trusted keyring is rejected

From: Luca Boccassi <[email protected]>

If enabled, we fallback to the platform keyring if the trusted keyring doesn't have the key used to sign the roothash. But if pkcs7_verify() rejects the key for other reasons, such as usage restrictions, we do not fallback. Do so, following the same change in dm-verity.

---
The equivalent change in dm-verity was accepted, so apply it to IPE as well:
https://lore.kernel.org/all/[email protected]/

 security/ipe/policy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
security/ipe/policy.c +1 -1
index 45f7d6a0ed23..b628f696e32b 100644
@@ -178,7 +178,7 @@ struct ipe_policy *ipe_new_policy(const char *text, size_t textlen,
 					    VERIFYING_UNSPECIFIED_SIGNATURE,
 					    set_pkcs7_data, new);
 #ifdef CONFIG_IPE_POLICY_SIG_PLATFORM_KEYRING
-		if (rc == -ENOKEY)
+		if (rc == -ENOKEY || rc == -EKEYREJECTED)
 			rc = verify_pkcs7_signature(NULL, 0, new->pkcs7, pkcs7len,
 						    VERIFY_USE_PLATFORM_KEYRING,
 						    VERIFYING_UNSPECIFIED_SIGNATURE,
Signature · 1 line
2.39.5
Acked-by on v1 1/1
#1 lore raw
Quoted 21 lines · On 9/27/2024 1:23 AM, [email protected] wrote:

From: Luca Boccassi <[email protected]>

If enabled, we fallback to the platform keyring if the trusted keyring doesn't have the key used to sign the roothash. But if pkcs7_verify() rejects the key for other reasons, such as usage restrictions, we do not fallback. Do so, following the same change in dm-verity.

---
The equivalent change in dm-verity was accepted, so apply it to IPE as well:
https://lore.kernel.org/all/[email protected]/

  security/ipe/policy.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
security/ipe/policy.c +0 -0
index 45f7d6a0ed23..b628f696e32b 100644

security/ipe/policy.c struct ipe_policy *ipe_new_policy(const char *text, size_t textlen, · line 184

Quoted 8 lines
security/ipe/policy.c +1 -1
@@ -178,7 +178,7 @@ struct ipe_policy *ipe_new_policy(const char *text, size_t textlen,
  					    VERIFYING_UNSPECIFIED_SIGNATURE,
  					    set_pkcs7_data, new);
  #ifdef CONFIG_IPE_POLICY_SIG_PLATFORM_KEYRING
-		if (rc == -ENOKEY)
+		if (rc == -ENOKEY || rc == -EKEYREJECTED)
  			rc = verify_pkcs7_signature(NULL, 0, new->pkcs7, pkcs7len,
  						    VERIFY_USE_PLATFORM_KEYRING,
  						    VERIFYING_UNSPECIFIED_SIGNATURE,