mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-29 12:43:55 +00:00
The "rwsig" type is used for independent device firmware (not Chromebook BIOS) that need to verify themselves instead of using software sync. The expected use case is that a RO firmware contains a vb2_public_key struct along with an FMAP or other pointers to a slot for RW firmware. The RW firmware slot reserves room for a vb2_signature struct. This CL changes the args and behavior of the rwsig type, so that the RW firmware can be [re]signed independently of the rest of the image. BUG=chrome-os-partner:46254 BRANCH=smaug,ToT TEST=make runtests, manual Create a keypair: futility create --desc "Key One" tests/testkeys/key_rsa2048.pem foo Sign a RW binary and build a complete image out of the parts: futility sign --type rwsig --prikey foo.vbprik2 rw.bin sig.bin dd if=/dev/zero bs=65536 count=1 of=image.bin dd if=rw.bin of=image.bin conv=notrunc dd if=sig.bin bs=$((65536 - 1024)) seek=1 of=image.bin conv=notrunc Verify both the separate parts and the combined image: futility show --type rwsig --pubkey foo.vbpubk2 rw.bin sig.bin futility show --type rwsig --pubkey foo.vbpubk2 image.bin Re-sign the combined image with a different keypair: futility create --desc "Key Two" tests/testkeys/key_rsa1024.pem bar futility sign --type rwsig --prikey bar.vbprik2 image.bin Now the first key no longer verifies: futility show --type rwsig --pubkey foo.vbpubk2 image.bin But the second key does: futility show --type rwsig --pubkey bar.vbpubk2 image.bin Change-Id: Ifdddab08f218f506eb1dce28851b153d70140a7b Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305980 Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
83 lines
2.6 KiB
C
83 lines
2.6 KiB
C
/* -*- mode:c -*-
|
|
*
|
|
* Copyright 2015 The Chromium OS Authors. All rights reserved.
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*
|
|
* This declares the file types that we can handle. Note that the order may be
|
|
* important for types with recognizer functions, since we generally want to to
|
|
* look for big things first.
|
|
*/
|
|
|
|
/*
|
|
* enum --type desc
|
|
* recognizer function
|
|
* show function
|
|
* sign function
|
|
*/
|
|
FILE_TYPE(BIOS_IMAGE, "bios", "Chrome OS BIOS image",
|
|
R_(ft_recognize_bios_image),
|
|
S_(ft_show_bios),
|
|
S_(ft_sign_bios))
|
|
FILE_TYPE(OLD_BIOS_IMAGE, "oldbios", "Cr-48 Chrome OS BIOS image",
|
|
R_(ft_recognize_bios_image),
|
|
S_(ft_show_bios),
|
|
S_(ft_sign_bios))
|
|
FILE_TYPE(GBB, "gbb", "GBB",
|
|
R_(ft_recognize_gbb),
|
|
S_(ft_show_gbb),
|
|
NONE)
|
|
FILE_TYPE(FW_PREAMBLE, "fw_pre", "VbFirmwarePreamble (VBLOCK_A/B)",
|
|
R_(ft_recognize_vblock1),
|
|
S_(ft_show_fw_preamble),
|
|
NONE)
|
|
FILE_TYPE(KERN_PREAMBLE, "kernel", "kernel preamble/partition",
|
|
R_(ft_recognize_vblock1),
|
|
S_(ft_show_kernel_preamble),
|
|
S_(ft_sign_kern_preamble))
|
|
FILE_TYPE(KEYBLOCK, "keyblock", "VbKeyBlock",
|
|
R_(ft_recognize_vblock1),
|
|
S_(ft_show_keyblock),
|
|
NONE)
|
|
FILE_TYPE(PUBKEY, "pubkey", "VbPublicKey (.vbpubk)",
|
|
R_(ft_recognize_vb1_key),
|
|
S_(ft_show_pubkey),
|
|
S_(ft_sign_pubkey))
|
|
FILE_TYPE(PRIVKEY, "prikey", "VbPrivateKey (.vbprivk)",
|
|
R_(ft_recognize_vb1_key),
|
|
S_(ft_show_privkey),
|
|
NONE)
|
|
FILE_TYPE(VB2_PUBKEY, "pubkey21", "vb21 public key (.vbpubk2)",
|
|
R_(ft_recognize_vb2_key),
|
|
S_(ft_show_vb2_pubkey),
|
|
NONE)
|
|
FILE_TYPE(VB2_PRIVKEY, "prikey21", "vb21 private key (.vbprik2)",
|
|
R_(ft_recognize_vb2_key),
|
|
S_(ft_show_vb2_privkey),
|
|
NONE)
|
|
FILE_TYPE(PEM, "pem", "RSA private key (.pem)",
|
|
R_(ft_recognize_pem),
|
|
S_(ft_show_pem),
|
|
NONE)
|
|
FILE_TYPE(RAW_FIRMWARE, "fwblob", "raw firmware blob (FW_MAIN_A/B)",
|
|
NONE,
|
|
NONE,
|
|
S_(ft_sign_raw_firmware))
|
|
FILE_TYPE(RAW_KERNEL, "vmlinuz", "raw linux kernel",
|
|
NONE,
|
|
NONE,
|
|
S_(ft_sign_raw_kernel))
|
|
FILE_TYPE(CHROMIUMOS_DISK, "disk_img", "chromiumos disk image",
|
|
NONE,
|
|
NONE,
|
|
NONE)
|
|
FILE_TYPE(RWSIG, "rwsig", "RW device image",
|
|
R_(ft_recognize_rwsig),
|
|
S_(ft_show_rwsig),
|
|
S_(ft_sign_rwsig))
|
|
/* Firmware for USB Type-C power adapters */
|
|
FILE_TYPE(USBPD1, "usbpd1", "USB-PD charger image (v1.0)",
|
|
R_(ft_recognize_usbpd1),
|
|
S_(ft_show_usbpd1),
|
|
S_(ft_sign_usbpd1))
|