grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
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 v8 14/20] powerpc_ieee1275: Introduce use_static_keys flag
Date: Thu, 21 Aug 2025 13:25:07 +0530	[thread overview]
Message-ID: <20250821075513.82881-15-sudhakar@linux.ibm.com> (raw)
In-Reply-To: <20250821075513.82881-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 | 13 ++++++++++++-
 include/grub/powerpc/ieee1275/platform_keystore.h   |  1 +
 2 files changed, 13 insertions(+), 1 deletion(-)

diff --git a/grub-core/kern/powerpc/ieee1275/platform_keystore.c b/grub-core/kern/powerpc/ieee1275/platform_keystore.c
index aaf90500f..2c556a563 100644
--- a/grub-core/kern/powerpc/ieee1275/platform_keystore.c
+++ b/grub-core/kern/powerpc/ieee1275/platform_keystore.c
@@ -58,7 +58,8 @@ bool grub_pks_use_keystore = false;
 bool grub_pks_is_support_pks = false;
 
 /* Platform KeyStore db and dbx. */
-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),
@@ -325,6 +326,16 @@ 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 4b34a3198..666f39684 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

  parent reply	other threads:[~2025-08-21  8:00 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-21  7:54 [PATCH v8 00/20] Appended Signature Secure Boot Support for PowerPC Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 01/20] powerpc-ieee1275: Add support for signing GRUB with an appended signature Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 02/20] crypto: Move storage for grub_crypto_pk_* to crypto.c Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 03/20] pgp: Rename OBJ_TYPE_PUBKEY to OBJ_TYPE_GPG_PUBKEY Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 04/20] grub-install: Support embedding x509 certificates Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 05/20] appended signatures: Import GNUTLS's ASN.1 description files Sudhakar Kuppusamy
2025-08-21  7:54 ` [PATCH v8 06/20] appended signatures: Parse ASN1 node Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 07/20] appended signatures: Parse PKCS#7 signedData Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 08/20] appended signatures: Parse X.509 certificates Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 09/20] powerpc_ieee1275: Enter lockdown based on /ibm, secure-boot Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 10/20] appended signatures: Support verifying appended signatures Sudhakar Kuppusamy
2025-08-21 15:23   ` Daniel Kiper
2025-08-22 15:30     ` Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 11/20] powerpc_ieee1275: Read the db and dbx secure boot variables Sudhakar Kuppusamy
2025-08-22 18:53   ` Daniel Kiper
2025-08-23  6:53     ` Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 12/20] appended signatures: Create db and dbx lists Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 13/20] appended signatures: Using db and dbx lists for signature verification Sudhakar Kuppusamy
2025-08-21  7:55 ` Sudhakar Kuppusamy [this message]
2025-08-21  7:55 ` [PATCH v8 15/20] appended signatures: Read default db keys from the ELF Note Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 16/20] appended signatures: Introduce GRUB commands to access db and dbx Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 17/20] appended signatures: Verification tests Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 18/20] docs/grub: Document signing GRUB under UEFI Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 19/20] docs/grub: Document signing GRUB with an appended signature Sudhakar Kuppusamy
2025-08-21  7:55 ` [PATCH v8 20/20] docs/grub: Document " 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=20250821075513.82881-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).