From: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
To: grub-devel@gnu.org
Cc: dja@axtens.net, jan.setjeeilers@oracle.com,
julian.klode@canonical.com, mate.kukri@canonical.com,
pjones@redhat.com, msuchanek@suse.com, mlewando@redhat.com,
stefanb@linux.ibm.com, avnish@linux.ibm.com, nayna@linux.ibm.com,
ssrish@linux.ibm.com, Sudhakar Kuppusamy <sudhakar@linux.ibm.com>,
sridharm@linux.ibm.com, Daniel Kiper <daniel.kiper@oracle.com>
Subject: [PATCH v7 14/20] powerpc_ieee1275: Introduce use_static_keys flag
Date: Tue, 19 Aug 2025 18:43:17 +0530 [thread overview]
Message-ID: <20250819131323.57631-15-sudhakar@linux.ibm.com> (raw)
In-Reply-To: <20250819131323.57631-1-sudhakar@linux.ibm.com>
Introduce the use_static_keys flag to indicate that static keys are to be used
rather than keys from the PKS storage's db variable. This flag is set when
Secure Boot is enabled with PKS but the db variable is not present in the PKS storage.
The appendedsig module would use this flag to extract the static keys from
the GRUB ELF Note and stored in the db list.
Signed-off-by: Sudhakar Kuppusamy <sudhakar@linux.ibm.com>
Reviewed-by: Stefan Berger <stefanb@linux.ibm.com>
Reviewed-by: Avnish Chouhan <avnish@linux.ibm.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/kern/powerpc/ieee1275/platform_keystore.c | 12 +++++++++++-
include/grub/powerpc/ieee1275/platform_keystore.h | 1 +
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/grub-core/kern/powerpc/ieee1275/platform_keystore.c b/grub-core/kern/powerpc/ieee1275/platform_keystore.c
index 16b2229b5..8009d766f 100644
--- a/grub-core/kern/powerpc/ieee1275/platform_keystore.c
+++ b/grub-core/kern/powerpc/ieee1275/platform_keystore.c
@@ -47,7 +47,8 @@ static grub_size_t pks_max_object_size;
bool grub_pks_use_keystore = false;
/* Platform Keystore. */
-grub_pks_t grub_pks_keystore = { .db = NULL, .dbx = NULL, .db_entries = 0, .dbx_entries = 0 };
+grub_pks_t grub_pks_keystore = { .db = NULL, .dbx = NULL, .db_entries = 0, .dbx_entries = 0,
+ .use_static_keys = false };
/*
* Import the Globally Unique Identifier (GUID), EFI Signature Database (ESD),
@@ -316,6 +317,15 @@ grub_pks_keystore_init (void)
grub_memset (&grub_pks_keystore, 0, sizeof (grub_pks_t));
/* Read db from PKS. */
rc = read_secure_boot_variables (0, DB, &grub_pks_keystore.db, &grub_pks_keystore.db_entries);
+ if (rc == GRUB_ERR_UNKNOWN_COMMAND)
+ {
+ rc = GRUB_ERR_NONE;
+ /*
+ * The db variable won't be available by default in PKS.
+ * So, it will use the static key as a default key from the GRUB ELF Note.
+ */
+ grub_pks_keystore.use_static_keys = true;
+ }
if (rc == GRUB_ERR_NONE)
{
/* Read dbx from PKS. */
diff --git a/include/grub/powerpc/ieee1275/platform_keystore.h b/include/grub/powerpc/ieee1275/platform_keystore.h
index f0f6af2a0..76733a707 100644
--- a/include/grub/powerpc/ieee1275/platform_keystore.h
+++ b/include/grub/powerpc/ieee1275/platform_keystore.h
@@ -97,6 +97,7 @@ struct grub_pks
grub_pks_sd_t *dbx; /* Forbidden signature database. */
grub_uint32_t db_entries; /* Size of signature database. */
grub_uint32_t dbx_entries;/* Size of forbidden signature database. */
+ bool use_static_keys; /* Flag to indicate use of static keys. */
} GRUB_PACKED;
typedef struct grub_pks grub_pks_t;
--
2.39.5 (Apple Git-154)
_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel
next prev parent reply other threads:[~2025-08-19 13:15 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-19 13:13 [PATCH v7 00/20] Appended Signature Secure Boot Support for PowerPC Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 01/20] powerpc-ieee1275: Add support for signing GRUB with an appended signature Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 02/20] crypto: Move storage for grub_crypto_pk_* to crypto.c Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 03/20] pgp: Rename OBJ_TYPE_PUBKEY to OBJ_TYPE_GPG_PUBKEY Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 04/20] grub-install: Support embedding x509 certificates Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 05/20] appended signatures: Import GNUTLS's ASN.1 description files Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 06/20] appended signatures: Parse ASN1 node Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 07/20] appended signatures: Parse PKCS#7 signedData Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 08/20] appended signatures: Parse X.509 certificates Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 09/20] powerpc_ieee1275: Enter lockdown based on /ibm, secure-boot Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 10/20] appended signatures: Support verifying appended signatures Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 11/20] powerpc_ieee1275: Read the db and dbx secure boot variables Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 12/20] appended signatures: Create db and dbx lists Sudhakar Kuppusamy
2025-08-21 2:34 ` Gary Lin via Grub-devel
2025-08-21 3:08 ` Gary Lin via Grub-devel
2025-08-21 6:22 ` Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 13/20] appended signatures: Using db and dbx lists for signature verification Sudhakar Kuppusamy
2025-08-19 13:13 ` Sudhakar Kuppusamy [this message]
2025-08-19 13:13 ` [PATCH v7 15/20] appended signatures: Read default db keys from the ELF Note Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 16/20] appended signatures: Introduce GRUB commands to access db and dbx Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 17/20] appended signatures: Verification tests Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 18/20] docs/grub: Document signing GRUB under UEFI Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 19/20] docs/grub: Document signing GRUB with an appended signature Sudhakar Kuppusamy
2025-08-19 13:13 ` [PATCH v7 20/20] docs/grub: Document " Sudhakar Kuppusamy
2025-08-21 6:44 ` Gary Lin via Grub-devel
2025-08-21 6:46 ` Sudhakar Kuppusamy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250819131323.57631-15-sudhakar@linux.ibm.com \
--to=sudhakar@linux.ibm.com \
--cc=avnish@linux.ibm.com \
--cc=daniel.kiper@oracle.com \
--cc=dja@axtens.net \
--cc=grub-devel@gnu.org \
--cc=jan.setjeeilers@oracle.com \
--cc=julian.klode@canonical.com \
--cc=mate.kukri@canonical.com \
--cc=mlewando@redhat.com \
--cc=msuchanek@suse.com \
--cc=nayna@linux.ibm.com \
--cc=pjones@redhat.com \
--cc=sridharm@linux.ibm.com \
--cc=ssrish@linux.ibm.com \
--cc=stefanb@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).