diff options
author | Bill Richardson <wfrichar@chromium.org> | 2015-09-25 14:39:52 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2015-09-25 19:36:37 -0700 |
commit | 094a81f5deff3b8cf5342138afefef8d8f34f8ff (patch) | |
tree | 5e0624367d5b9b7ca1c25b877db217b999f8e80c /common/rwsig.c | |
parent | e9000b22cb0e15df7d1389da30d78e7244086d0b (diff) | |
download | chrome-ec-094a81f5deff3b8cf5342138afefef8d8f34f8ff.tar.gz |
cleanup: Handle signed RW images a bit cleaner
For signed EC RW images (CONFIG_RWSIG), there's no point in
embedding the public key or signature into the image itself since
it will just be replaced by the signer (either as the next step
in the build process, or after the fact for MP releases). This
takes that out and just points to where the pubkey and signature
will be placed.
BUG=none
BRANCH=none
TEST=make buildall
I also checked the signatures with
futility show -t build/*/ec.bin
They still look good, and the one signed image I booted (Cr50)
works as before.
Change-Id: Ib39b7c508914851f81a1bebb2450e08ef0def76c
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/302630
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'common/rwsig.c')
-rw-r--r-- | common/rwsig.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/common/rwsig.c b/common/rwsig.c index c58e7ab84d..ee1bd6c9fc 100644 --- a/common/rwsig.c +++ b/common/rwsig.c @@ -20,15 +20,6 @@ #define CPRINTF(format, args...) cprintf(CC_SYSTEM, format, ## args) #define CPRINTS(format, args...) cprints(CC_SYSTEM, format, ## args) -/* Insert the RSA public key definition */ -const struct rsa_public_key pkey __attribute__((section(".rsa_pubkey"))) = -#include "gen_pub_key.h" - -/* The RSA signature is stored at the end of the RW firmware */ -static const void *rw_sig = (void *)CONFIG_PROGRAM_MEMORY_BASE - + CONFIG_RW_MEM_OFF - + CONFIG_RW_SIZE - RSANUMBYTES; - /* RW firmware reset vector */ static uint32_t * const rw_rst = (uint32_t *)(CONFIG_PROGRAM_MEMORY_BASE + CONFIG_RW_MEM_OFF + 4); @@ -62,10 +53,12 @@ void check_rw_signature(void) SHA256_init(&ctx); SHA256_update(&ctx, (void *)CONFIG_PROGRAM_MEMORY_BASE + CONFIG_RW_MEM_OFF, - CONFIG_RW_SIZE - RSANUMBYTES); + CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE); hash = SHA256_final(&ctx); - good = rsa_verify(&pkey, (void *)rw_sig, (void *)hash, rsa_workbuf); + good = rsa_verify((const struct rsa_public_key *)CONFIG_RO_PUBKEY_ADDR, + (const uint8_t *)CONFIG_RW_SIG_ADDR, + hash, rsa_workbuf); if (good) { CPRINTS("RW image verified"); /* Jump to the RW firmware */ |