summaryrefslogtreecommitdiff
path: root/tests/futility/test_file_types.c
Commit message (Collapse)AuthorAgeFilesLines
* vboot: fix up some headers, includes, comments, spacingJoel Kitching2019-08-281-2/+2
| | | | | | | | | | | | | BUG=b:124141368 TEST=make clean && make runtests BRANCH=none Change-Id: Id97f544da845f7070555e5e8cc6e782b2d45c300 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1758151 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* vboot: remove Boot Descriptor Block (BDB) library and utilitiesJoel Kitching2019-07-241-1/+0
| | | | | | | | | | | | | | | | Remove unused BDB code, previously created for a cancelled SoC project. BUG=b:124141368, chromium:986177 TEST=make clean && make runtests BRANCH=none Change-Id: I91faf97d9850f8afb816fa324ad9a4d9f3842888 Signed-off-by: Joel Kitching <kitching@google.com> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1710336 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Joel Kitching <kitching@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
* Makefile: Enable more warnings for host utilities / testsJulius Werner2019-05-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds a bunch of more warnings that are already enabled in coreboot and thus already enabled for firmware builds anyway (because coreboot just passes its CFLAGS through). Enabling it in the vboot Makefile means they also apply to host utilities and tests, which sounds desirable for consistency. Fix enough of the cruft and bad coding practices that accumulated over the years of not having warnings enabled to get it to build again (this includes making functions static, removing dead code, cleaning up prototypes, etc.). Also remove -fno-strict-aliasing from the x86 firmware build options, because it's not clear why it's there (coreboot isn't doing this, so presumably it's not needed). BRANCH=None BUG=None TEST=make runtests Change-Id: Ie4a42083c4770a4eca133b22725be9ba85b24184 Signed-off-by: Julius Werner <jwerner@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1598721 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
* bdb: Make 'futility show' support BDBDaisuke Nojiri2016-10-041-0/+1
| | | | | | | | | | | | | | 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>
* futility: Support for signing RO+RW firmwarestabilize-smaug-7547.BBill Richardson2015-10-131-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the "rwsig" type, with initial support for RO+RW firmware images that need to verify themselves instead of using software sync. This uses our vb2 structs instead of raw binary blobs. That will help us locate, identify, and verify the keys and signatures in the signed firmware images. BUG=chrome-os-partner:46254 BRANCH=smaug,ToT TEST=make runtests I also hacked up a test board with the EC-side signature verification routines from a preliminary CL and tested this signing scheme with that. It works. Additional work is needed to make this seamless, but you can try it out like so: futility create ./tests/testkeys/key_rsa2048.pem foo futility sign --type rwsig --prikey foo.vbprik2 --pubkey foo.vbpubk2 ec.bin Change-Id: I876ab312a2b0b36411c5f739fe3252529728d034 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/305394 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Add show capability for usbpd1 imagesBill Richardson2015-09-251-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* futility: add support for usbpd1 imagesBill Richardson2015-03-311-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* futility: add --type arg to show and sign commandsBill Richardson2015-03-311-0/+1
| | | | | | | | | | | | | | | | | This allows the user to manually specify the type of an input file, since not all file types can be reliably identified. This also adds a test to ensure that futility doesn't coredump if you give it the wrong type (although I'm sure it's not exhaustive). BUG=chromium:231574 BRANCH=none TEST=make runtests Signed-off-by: Bill Richardson <wfrichar@chromium.org> Change-Id: I9d909305d9989fe7299e744c585de380109cf8cd Reviewed-on: https://chromium-review.googlesource.com/262895 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: Split help for "sign" command into partsBill Richardson2015-03-201-3/+3
| | | | | | | | | | | | | | | | | | | | | The help message for the sign command is much too long. This breaks it into several subcategories. BUG=none BRANCH=none TEST=make runtests futility help sign futility help sign pubkey futility help sign fwblob futility help sign bios futility help sign vmlinuz futility help sign kernel Change-Id: I3e12b2cfdfb17a77c171f925a53748efb1d6c440 Signed-off-by: Bill Richardson <wfrichar@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/260496 Reviewed-by: Randall Spangler <rspangler@chromium.org>
* futility: add tests for futil_file_type(), correctly this timeBill Richardson2015-03-121-0/+95
| | | | | | | | | | | | | | | | | | | | | | | | | This adds a test to be sure we can identify the types of input files that futility can handle. This fixes commit d7e1e4f0befdda52ad48e5a8eb5fc49dbee40247, which was reverted in commit 1ab2c10e8cc51a66272458117e35619d87f53db0 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>
* Revert "futility: add tests for futil_file_type()"Prathmesh Prabhu2015-03-121-95/+0
| | | | | | | | | | | | This reverts commit 271c071344beaacc45201c17406bcf3b4daece88. 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>
* futility: add tests for futil_file_type()Bill Richardson2015-03-111-0/+95
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