diff options
author | Nicolas Boichat <drinkcat@google.com> | 2017-02-10 13:59:39 +0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-17 04:09:37 -0800 |
commit | 07eccbb414962c09d411e8afeb6cfca71aebf838 (patch) | |
tree | cfd29416f3fe0ca397f5606ebbe19773ffa59e94 /common/firmware_image.S | |
parent | cb6e3ec3a0db005e62c94e3d8b667d4ef4a2d8d9 (diff) | |
download | chrome-ec-07eccbb414962c09d411e8afeb6cfca71aebf838.tar.gz |
rwsig: Add support for rwsig image types
usbpd1 futility image type is deprecated and should not be used for
new designs. This adds proper support for rwsig image type.
Key and signatures are added at linker stage step (futility cannot
directly create such signed images). Thanks to VB21 header, rwsig.c
can now tell how many bytes of the RW image need to be
cryptographically verified, and ensure that the rest is blank (0xff).
BRANCH=none
BUG=chromium:690773
TEST=make BOARD=hammer; flash, RW image is verified correctly.
TEST=make runtests -j
TEST=For the rest of the tests:
Change config option to CONFIG_RWSIG_TYPE_RWSIG
TEST=make BOARD=hammer; flash, hammer still verifies correctly.
TEST=cp build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig;
futility sign --type rwsig --prikey build/hammer/key.vbprik2 \
build/hammer/ec.RW.bin
diff build/hammer/ec.RW.bin build/hammer/ec.RW.bin.orig
=> Same file
TEST=Add CONFIG_CMD_FLASH, flashwrite 0x1e000, reboot, EC does
not verify anymore.
TEST=dump_fmap build/hammer/ec.bin shows KEY_RO and SIG_RW at
correct locations.
Change-Id: I50ec828284c2d1eca67fa8cbddaf6f3b06606c82
Reviewed-on: https://chromium-review.googlesource.com/441546
Commit-Ready: Nicolas Boichat <drinkcat@chromium.org>
Tested-by: Nicolas Boichat <drinkcat@chromium.org>
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'common/firmware_image.S')
-rw-r--r-- | common/firmware_image.S | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/common/firmware_image.S b/common/firmware_image.S index 1fa4f25f71..97a7123f49 100644 --- a/common/firmware_image.S +++ b/common/firmware_image.S @@ -8,12 +8,15 @@ #include "config.h" -#define FW_FILE(builddir,proj,sect,suffix) \ - builddir##/##sect##/##proj##.##sect##suffix##.flat +#define FW_FILE(builddir,proj,sect,suffix,ext) \ + builddir##/##sect##/##proj##.##sect##suffix##.flat##ext + #define STRINGIFY0(name) #name #define STRINGIFY(name) STRINGIFY0(name) #define FW_IMAGE(sect,suffix) \ - STRINGIFY(FW_FILE(FINAL_OUTDIR,PROJECT,sect,suffix)) + STRINGIFY(FW_FILE(FINAL_OUTDIR,PROJECT,sect,suffix,)) +#define FW_IMAGE_SIGN(sect,suffix) \ + STRINGIFY(FW_FILE(FINAL_OUTDIR,PROJECT,sect,suffix,.sig)) /* Read Only firmware */ #ifdef CONFIG_FW_INCLUDE_RO @@ -21,6 +24,11 @@ .incbin FW_IMAGE(RO,) #endif +#ifdef CONFIG_RWSIG_TYPE_RWSIG +.section .image.RO.key, "a" +.incbin STRINGIFY(FINAL_OUTDIR/key.vbpubk2) +#endif + /* Shared objects library */ #ifdef CONFIG_SHAREDLIB .section .image.libsharedobjs, "ax" @@ -31,6 +39,11 @@ .section .image.RW, "ax" .incbin FW_IMAGE(RW,) +#ifdef CONFIG_RWSIG_TYPE_RWSIG +.section .image.RW.sign, "a" +.incbin FW_IMAGE_SIGN(RW,) +#endif + #ifdef CONFIG_RW_B .section .image.RW_B, "ax" .incbin FW_IMAGE(RW,_B) |