forked from pool/grub2
d6d145b71a
- Power guest secure boot with static keys: GRUB2 signing portion (jsc#SLE-18271) (bsc#1192764) * grub2.spec - Power guest secure boot with static keys: GRUB2 portion (jsc#SLE-18144) (bsc#1192686) * 0001-ieee1275-Drop-HEAP_MAX_ADDR-and-HEAP_MIN_SIZE-consta.patch * 0002-ieee1275-claim-more-memory.patch * 0003-ieee1275-request-memory-with-ibm-client-architecture.patch * 0004-Add-suport-for-signing-grub-with-an-appended-signatu.patch * 0005-docs-grub-Document-signing-grub-under-UEFI.patch * 0006-docs-grub-Document-signing-grub-with-an-appended-sig.patch * 0007-dl-provide-a-fake-grub_dl_set_persistent-for-the-emu.patch * 0008-pgp-factor-out-rsa_pad.patch * 0009-crypto-move-storage-for-grub_crypto_pk_-to-crypto.c.patch * 0010-posix_wrap-tweaks-in-preparation-for-libtasn1.patch * 0011-libtasn1-import-libtasn1-4.18.0.patch * 0012-libtasn1-disable-code-not-needed-in-grub.patch * 0013-libtasn1-changes-for-grub-compatibility.patch * 0014-libtasn1-compile-into-asn1-module.patch * 0015-test_asn1-test-module-for-libtasn1.patch * 0016-grub-install-support-embedding-x509-certificates.patch * 0017-appended-signatures-import-GNUTLS-s-ASN.1-descriptio.patch * 0018-appended-signatures-parse-PKCS-7-signedData-and-X.50.patch * 0019-appended-signatures-support-verifying-appended-signa.patch * 0020-appended-signatures-verification-tests.patch * 0021-appended-signatures-documentation.patch * 0022-ieee1275-enter-lockdown-based-on-ibm-secure-boot.patch * 0023-x509-allow-Digitial-Signature-plus-other-Key-Usages.patch - Fix no menuentry is found if hibernation on btrfs RAID1 (bsc#1193090) OBS-URL: https://build.opensuse.org/request/show/945751 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=401
72 lines
2.4 KiB
Diff
72 lines
2.4 KiB
Diff
From ac539a315495792cd75fe8ab1c474f26e0a78852 Mon Sep 17 00:00:00 2001
|
|
From: Daniel Axtens <dja@axtens.net>
|
|
Date: Sat, 15 Aug 2020 02:19:36 +1000
|
|
Subject: [PATCH 06/23] docs/grub: Document signing grub with an appended
|
|
signature
|
|
|
|
Signing grub for firmware that verifies an appended signature is a
|
|
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>
|
|
---
|
|
docs/grub.texi | 42 ++++++++++++++++++++++++++++++++++++++++++
|
|
1 file changed, 42 insertions(+)
|
|
|
|
diff --git a/docs/grub.texi b/docs/grub.texi
|
|
index b1d808d93..dc1c58304 100644
|
|
--- a/docs/grub.texi
|
|
+++ b/docs/grub.texi
|
|
@@ -6074,6 +6074,48 @@ image works under UEFI secure boot and can maintain the secure-boot chain. It
|
|
will also be necessary to enrol 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
|
|
+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
|
|
+# 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.
|
|
+
|
|
+
|
|
@node Platform limitations
|
|
@chapter Platform limitations
|
|
|
|
--
|
|
2.31.1
|
|
|