futility: gscvd: Add -G flag for GBB ranges

This patch adds a new `--add_gbb`/`-G` flag to the `gscvd` command that
can be used as a shorthand option to add the `GBB` FMAP section to the
covered ranges. When adding the GBB, it is important that we exclude the
HWID and HWID digest from the covered ranges, because they can vary
between units and it would be too cumbersome to sign every possible HWID
separately. Figuring out the right ranges to pass that exclude these
individual fields of the structure manually from the build scripts would
be very awkward, so let's add this option here where we can write the
logic cleanly with C code and have all the vboot data structure
definitions readily available.

Also do some minor option parsing cleanups.

BRANCH=none
BUG=b:229015103
TEST=Created GSCVDs with this flag, manually confirmed with a hex editor
that the correct ranges were created.

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I3bef5355506d831353afe6f534ae9303334d014c
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3653203
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
1 file changed