All of lore.kernel.org
 help / color / mirror / Atom feed
From: sudhakar <sudhakar@linux.ibm.com>
To: Daniel Kiper <dkiper@net-space.pl>
Cc: grub-devel@gnu.org, 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
Subject: Re: [PATCH v2 03/21] docs/grub: Document signing grub with an appended signature
Date: Tue, 10 Jun 2025 22:03:10 +0530	[thread overview]
Message-ID: <63330777667dcc0259985b7fdf2dc33c@linux.ibm.com> (raw)
In-Reply-To: <20250522181911.wocdh6u5liwrugkb@tomti.i.net-space.pl>

Hi Daniel,

Thank you for your valuable review comments. addressed all your 
comments.

On 2025-05-22 23:49, Daniel Kiper wrote:
> On Thu, Mar 27, 2025 at 01:02:24AM +0530, Sudhakar Kuppusamy wrote:
>> From: Daniel Axtens <dja@axtens.net>
>> 
>> Signing grub for firmware that verifies an appended signature is a
> 
> s/grub/GRUB/
> 
> The project name is GRUB. Please fix it everywhere.
> 
>> bit fiddly. I don't want people to have to figure it out from scratch
>> so document it here.
>> 
>> Signed-off-by: Daniel Axtens <dja@axtens.net>
>> 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>
>> ---
>>  docs/grub.texi | 32 ++++++++++++++++++++++++++++++++
>>  1 file changed, 32 insertions(+)
>> 
>> diff --git a/docs/grub.texi b/docs/grub.texi
>> index 0e877e026..19bbe9b2b 100644
>> --- a/docs/grub.texi
>> +++ b/docs/grub.texi
>> @@ -9262,6 +9262,38 @@ image works under UEFI secure boot and can 
>> maintain the secure-boot chain. It
>>  will also be necessary to enroll the public key used into a relevant 
>> firmware
>>  key database.
>> 
>> +@section Signing GRUB with an appended signature
>> +The @file{core.img} itself can be signed with a Linux kernel 
>> module-style
>> +appended signature.
>> +To support IEEE1275 platforms where the boot image is often loaded 
>> directly
>> +from a disk partition rather than from a file system, the 
>> @file{core.img}
>> +can specify the size and location of the appended signature with an 
>> ELF
>> +note added by @command{grub-install}.
>> +An image can be signed this way using the @command{sign-file} command 
>> from
>> +the Linux kernel:
>> +@example
>> +@group
>> +# grub.key is your private key and certificate.der is your public key
>> +# Determine the size of the appended signature. It depends on the 
>> signing
>> +# certificate and the hash algorithm
>> +touch empty
>> +sign-file SHA256 grub.key certificate.der empty empty.sig
> 
> Would not signing /dev/null instead of empty work?

It is work for /dev/null. addressed this in v3

> 
>> +SIG_SIZE=`stat -c '%s' empty.sig`
>> +rm empty empty.sig
>> +# Build a grub image with $SIG_SIZE reserved for the signature
>> +grub-install --appended-signature-size $SIG_SIZE --modules="..." ...
>> +# Replace the reserved size with a signature:
>> +# cut off the last $SIG_SIZE bytes with truncate's minus modifier
>> +truncate -s -$SIG_SIZE /boot/grub/powerpc-ieee1275/core.elf 
>> core.elf.unsigned
> 
> This could be possibly done by grub-install/grub-mkimage. Then you 
> would
> have one step less. Or even automate signing process by calling 
> sign-file
> from the GRUB utils.

In v3, I reduced the truncate step and added the same in 
grub-install/grub-mkimage.
In future, I will add automate signing process in the GRUB utils

>> +# sign the trimmed file with an appended signature, restoring the 
>> correct size
>> +sign-file SHA256 grub.key certificate.der core.elf.unsigned 
>> core.elf.signed
>> +# Don't forget to install the signed image as required
>> +# (e.g. on powerpc-ieee1275, to the PReP partition)
>> +@end group
>> +@end example
>> +As with UEFI secure boot, it is necessary to build-in the required 
>> modules,
>> +or sign them separately.

> Daniel

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

  reply	other threads:[~2025-06-10 16:36 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-26 19:32 [PATCH v2 00/21] Appended Signature Secure Boot Support for PowerPC Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 01/21] powerpc-ieee1275: Add support for signing grub with an appended signature Sudhakar Kuppusamy
2025-05-22 17:49   ` Daniel Kiper
2025-06-10 16:27     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 02/21] docs/grub: Document signing grub under UEFI Sudhakar Kuppusamy
2025-05-22 17:53   ` Daniel Kiper
2025-03-26 19:32 ` [PATCH v2 03/21] docs/grub: Document signing grub with an appended signature Sudhakar Kuppusamy
2025-05-22 18:19   ` Daniel Kiper
2025-06-10 16:33     ` sudhakar [this message]
2025-03-26 19:32 ` [PATCH v2 04/21] dl: provide a fake grub_dl_set_persistent for the emu target Sudhakar Kuppusamy
2025-05-22 18:23   ` Daniel Kiper
2025-03-26 19:32 ` [PATCH v2 05/21] pgp: factor out rsa_pad Sudhakar Kuppusamy
2025-05-22 18:31   ` Daniel Kiper
2025-03-26 19:32 ` [PATCH v2 06/21] crypto: move storage for grub_crypto_pk_* to crypto.c Sudhakar Kuppusamy
2025-05-22 18:34   ` Daniel Kiper
2025-03-26 19:32 ` [PATCH v2 07/21] grub-install: support embedding x509 certificates Sudhakar Kuppusamy
2025-05-28 15:47   ` Daniel Kiper
2025-06-10 16:22     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 08/21] appended signatures: import GNUTLS's ASN.1 description files Sudhakar Kuppusamy
2025-05-28 15:55   ` Daniel Kiper
2025-06-10 16:20     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 09/21] appended signatures: parse PKCS#7 signedData and X.509 certificates Sudhakar Kuppusamy
2025-05-28 16:44   ` Daniel Kiper
2025-06-10 16:19     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 10/21] appended signatures: support verifying appended signatures Sudhakar Kuppusamy
2025-04-15  3:46   ` Gary Lin via Grub-devel
2025-05-21 12:49     ` sudhakar
2025-05-28 17:20   ` Daniel Kiper
2025-06-10 16:18     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 11/21] appended signatures: verification tests Sudhakar Kuppusamy
2025-05-28 17:29   ` Daniel Kiper
2025-06-10 16:16     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 12/21] appended signatures: documentation Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 13/21] ieee1275: enter lockdown based on /ibm,secure-boot Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 14/21] ieee1275: Platform Keystore (PKS) Support Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 15/21] ieee1275: Read the DB and DBX secure boot variables Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 16/21] appendedsig: The creation of trusted and distrusted lists Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 17/21] appendedsig: While verifying the kernel, use " Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 18/21] powerpc_ieee1275: set use_static_keys flag Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 19/21] appendedsig: Reads the default DB keys from ELF Note Sudhakar Kuppusamy
2025-03-26 19:32 ` [PATCH v2 20/21] appendedsig: The grub command's trusted and distrusted support Sudhakar Kuppusamy
2025-04-15  8:24   ` Gary Lin via Grub-devel
2025-05-21 12:49     ` sudhakar
2025-04-17  7:43   ` Gary Lin via Grub-devel
2025-05-21 12:46     ` sudhakar
2025-03-26 19:32 ` [PATCH v2 21/21] appendedsig: documentation Sudhakar Kuppusamy
2025-05-13 14:16 ` [PATCH v2 00/21] Appended Signature Secure Boot Support for PowerPC Marta Lewandowska via Grub-devel
2025-05-20 13:50   ` sudhakar

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=63330777667dcc0259985b7fdf2dc33c@linux.ibm.com \
    --to=sudhakar@linux.ibm.com \
    --cc=dja@axtens.net \
    --cc=dkiper@net-space.pl \
    --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=pjones@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.