Files
OpenCellular/futility/file_type.inc
Bill Richardson 82db93d5fc futility: Add show capability for usbpd1 images
The firmware for the USB Type-C power adapters uses raw binary
blobs for the public keys and signatures instead of
readily-identifiable structs. We've been able to sign these
firmware images for some time, but verifying the result generally
required testing them on hardware.

This CL adds some futilty support for recognizing and verifying
those images too. It just tries various sig and hash algorithms,
until it finds a combination for which the image is
self-consistent (where the pubkey blob verifies the signature
blob).

BUG=none
BRANCH=none
TEST=make runtests

This change also adds additional tests for usbpd1 images. We
ensure that we correctly recognize and verify an MP-signed
firmware, plus test signing and verifying usbpd1 images using
multiple signature and hash algorithms.

Change-Id: I4fbe8b37a694992f635d5469ae1c2449b1610dfd
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302415
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-09-25 10:31:24 -07:00

79 lines
2.5 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)
/* 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))