From 5a98268b9634e4996e4a69f624c09d896645a4a2 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Thu, 2 Jan 2020 10:39:52 -0800 Subject: common/vboot: Add rwsig info command The rwsig info command provides additional details on the verified boot key used to sign the RW firmware. The information about the key can be used by factory tests to validate that the factory is flashing firmware that is signed by the expected key. In addition, we refactor the "rwsig"-related commands into a generic "rwsig" command that takes additional subcommands. This allows adding an "rwsig dump" command that allows displaying individual fields, which is useful in scripts and tests. "rwsigstatus" becomes "rwsig status" "rwsigaction" becomes "rwsig action" The old commands are preserved for backward compatibility. BRANCH=none BUG=b:144958737 TEST=(kohaku) $ ectool --name=cros_fp rwsig info TEST=(kohaku) $ ectool --name=cros_fp rwsig dump key_id TEST=(kohaku) $ ectool --name=cros_fp reboot_ec; sleep 0.5; ectool --name=cros_fp rwsig action abort; sleep 2; ectool --name=cros_fp version | grep "Firmware copy" => Firmware copy: RO TEST=On dragonclaw v0.2 console: rwsiginfo Change-Id: Ib0ee4be33e6636ff702eeaef941cc3abed0594cb Signed-off-by: Tom Hughes Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1999607 Reviewed-by: Daisuke Nojiri Reviewed-by: Denis Brockus --- common/rwsig.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'common/rwsig.c') diff --git a/common/rwsig.c b/common/rwsig.c index 8bccd2acb1..0d0a8e765c 100644 --- a/common/rwsig.c +++ b/common/rwsig.c @@ -21,6 +21,7 @@ #include "usb_pd.h" #include "util.h" #include "vb21_struct.h" +#include "vboot.h" #include "version.h" /* Console output macros */ @@ -142,7 +143,7 @@ int rwsig_check_signature(void) sig = (const uint8_t *)CONFIG_RW_SIG_ADDR; rwlen = CONFIG_RW_SIZE - CONFIG_RW_SIG_SIZE; #elif defined(CONFIG_RWSIG_TYPE_RWSIG) - vb21_key = (const struct vb21_packed_key *)CONFIG_RO_PUBKEY_ADDR; + vb21_key = vb21_get_packed_key(); vb21_sig = (const struct vb21_signature *)CONFIG_RW_SIG_ADDR; if (vb21_key->c.magic != VB21_MAGIC_PACKED_KEY || -- cgit v1.2.1