futility: gscvd: Allow passing board ID in ASCII

In many places (e.g. go/cros-dlm), we treat GSC board IDs as a 4-letter
ASCII string rather than a hexadecimal number. To relieve people of the
need to manually convert between formats when copy&pasting IDs, this
patch makes the `gscvd` command accept both versions.

BRANCH=none
BUG=b:229015103
TEST=futility gscvd -b GVLR

Signed-off-by: Julius Werner <jwerner@chromium.org>
Change-Id: I50fa73f5a14d2747c3e1b15e5dc3fbfcb2391f47
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/3656349
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
diff --git a/futility/cmd_gscvd.c b/futility/cmd_gscvd.c
index 659716a..57e79ef 100644
--- a/futility/cmd_gscvd.c
+++ b/futility/cmd_gscvd.c
@@ -88,8 +88,10 @@
 	"                                     This option takes special care\n"
 	"                                     to exclude the HWID (and its\n"
 	"                                     digest) from this range.\n"
-	"  -b|--board_id  <hex value>      The Board ID of the board for which\n"
-	"                                     the image is being signed\n"
+	"  -b|--board_id  <string|hex>      The Board ID of the board for\n"
+	"                                     which the image is signed.\n"
+	"                                     Can be passed as a 4-letter\n"
+	"                                     string or a hexadecimal number.\n"
 	"  -r|--root_pub_key  <file>        The main public key, in .vbpubk\n"
 	"                                     format, used to verify platform\n"
 	"                                     key\n"
@@ -993,9 +995,17 @@
 			char *e;
 			long long bid;
 
+			if (strlen(optarg) == 4) {
+				board_id = optarg[0] << 24 |
+					   optarg[1] << 16 |
+					   optarg[2] << 8 |
+					   optarg[3];
+				break;
+			}
+
 			bid = strtoull(optarg, &e, 16);
 			if (*e || (bid >= UINT32_MAX)) {
-				ERROR("Board ID value '%s' is invalid\n",
+				ERROR("Cannot parse Board ID '%s'\n",
 				      optarg);
 				errorcount++;
 			} else {