Commit Graph

10 Commits

Author SHA1 Message Date
Daisuke Nojiri
c3daa95c50 bdb: Make 'futility show' support BDB
This patch makes futility show command support boot block descriptor (BDB)
of the common boot flow.

BUG=chromium:649554
BRANCH=none
TEST=make runtests. Ran futility show bdb.bin.

Change-Id: I5f199a32ab1c268351e822e37ed39e41ae19bc7a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/388631
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2016-10-04 21:19:12 -07:00
Vincent Palatin
4d47243c90 futility: fix segfault on short files
Verify the size of the buffer read from the file before trying to use 1KB of
it for the new rwsig format detection.

Add a new test case with a short file containing only 4 bytes of unknown
data and run "futility show" on it.

BRANCH=smaug
BUG=none
TEST=futility show foobar.pub.pem
where foobar.pub.pem is a 451-byte file.
check that "make runtests" passes with the fix
and fails without it with the following message :
test_file_types.sh ... failed
FAIL: 13 / 14 passed

Change-Id: Ia9d68c6b528c2b3a595ea6791c907374616d051f
Reviewed-on: https://chromium-review.googlesource.com/306682
Commit-Ready: Vincent Palatin <vpalatin@chromium.org>
Tested-by: Vincent Palatin <vpalatin@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
2015-10-17 08:18:48 -07:00
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
Bill Richardson
b5a439241f futility: add support for usbpd1 images
The USB Type-C chargers released with Samus ("Pixel (2015)") have
upgradable firmware. Those firmware images are currently signed
by some custom scripts. This adds support for those images to
futility, so that those custom scripts can be replaced.

Note that due to space considerations, the usbpd firmware images
don't have room for handy things like an FMAP or headers for the
signatures. Accordingly, all the normally variable factors (image
size, signature algorithms, etc.) are hard coded and the image
itself just looks like a bunch of random numbers. Because of
this:

1. There's no way to recognize this type of file, and nothing to
   display about it.

2. You have to give the "--type usbpd1" arg to the sign command.

3. I'm designating this file type "v1" because I hope that the
   firmware for any future adapters will be more readily
   identifiable.

BUG=chromium:231574
BRANCH=none
TEST=make runtests

This adds a new test that signs usbpd1 firmware images using
futility, and compares the result to the same files signed by the
custom scripts, ensuring that they are bitwise identical.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: Idbe061db5b3c8e474ada47b40bcbe04bbecdba3a
Reviewed-on: https://chromium-review.googlesource.com/262899
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-03-31 06:30:36 +00:00
Bill Richardson
89901f00ef futility: add tests for futil_file_type(), correctly this time
This adds a test to be sure we can identify the types of input
files that futility can handle.

This fixes commit d7e1e4f0be, which
was reverted in commit 1ab2c10e8c
because the Makefile dependencies were wrong.

BUG=chromium:466433
BRANCH=none
TEST=make runtests

Also try this:

  \rm -rf build
  make $(pwd)/build/tests/futility/test_file_types -j16

Before, that failed every time. Now it works.

Change-Id: I7702e1b99f4f593ef0121686a8616a2cb132e64a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/259651
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2015-03-12 19:27:28 +00:00
Prathmesh Prabhu
1ab2c10e8c Revert "futility: add tests for futil_file_type()"
This reverts commit 271c071344.

BUG=chromium:466433
TEST=None.

Change-Id: Ic84d069d672a76b46201a0e3700801a1e6d47438
Reviewed-on: https://chromium-review.googlesource.com/259364
Reviewed-by: David James <davidjames@chromium.org>
Tested-by: Prathmesh Prabhu <pprabhu@chromium.org>
2015-03-12 03:15:51 +00:00
Bill Richardson
271c071344 futility: add tests for futil_file_type()
This adds a test to be sure we can identify the types of input
files that futility can handle.

BUG=none
BRANCH=none
TEST=make runtests

Change-Id: Iff1dcc05530af2969a82d7c32599850bba59597a
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/258501
2015-03-11 07:50:34 +00:00
Bill Richardson
52a15f96ac futility: show vs verify
This adds a --strict mode to the show command, which requires
that all signatures be valid in order to exit cleanly. It also
creates a "verify" command, which is really just an alias for
"show --strict".

BUG=none
BRANCH=ToT
TEST=make runtests

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: I1fed7db7fe7128191bcab0c615706ef4fe2709f5
Reviewed-on: https://chromium-review.googlesource.com/219732
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-27 00:28:55 +00:00
Bill Richardson
f318ee205c futility: implement vbutil_kernel using buffers, not files
The original vbutil_kernel command used file read and write to
make changes. Futility prefers to use memory-mapped files. This
rewrites cmd_vbutil_kernel.c to use that scheme.

BUG=none
BRANCH=ToT
TEST=make runtests

The original cmd_vbutil_kernel.c is renamed, and a test written
to ensure that the refactored version produces identical results.

Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Change-Id: Ic6c3e12429a5dcb271f8136a9edac70807d66120
Reviewed-on: https://chromium-review.googlesource.com/219647
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-25 20:27:00 +00:00
Bill Richardson
64ddad77e5 futility: Add a test for the resign_firmwarefd.sh script
This resigns official MP-signed BIOS images, because that's the best way to
ensure we remain compatible forever. The resign_firmwarefd.sh script is
invoked make_dev_firmware.sh, which is used for development and bringup.

BUG=chromium:224734
BRANCH=ToT
TEST=make runtests

No new functionality, only a new test.

Change-Id: I4bf9cdd8321d126e1c1a45fc198ef46b0eeb5c36
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/216226
Reviewed-by: Randall Spangler <rspangler@chromium.org>
2014-09-05 07:20:49 +00:00