cert_create: update help message
The help message printed by the cert_create tool using the command
line option -h (or --help) does not correctly list all the available
command line options.
This patch reworks the print_help() function to print the help
messages in a data driven approach. For each command line option
registered, an optional help message can be specified, which will
be printed by print_help().
Help messages for the TBBR options (certificates, keys and images)
are also provided.
Fix a small bug in the short options string passed to getopt_long:
the ':' was missing in the '-a' option (this option must take an
argument).
Fixes ARM-software/tf-issues#337
Change-Id: I9d08c2dfd349022808fcc884724f677eefdc1452
diff --git a/tools/cert_create/src/tbbr/tbb_cert.c b/tools/cert_create/src/tbbr/tbb_cert.c
index 20be59f..7a50ab3 100644
--- a/tools/cert_create/src/tbbr/tbb_cert.c
+++ b/tools/cert_create/src/tbbr/tbb_cert.c
@@ -43,6 +43,7 @@
[TRUSTED_BOOT_FW_CERT] = {
.id = TRUSTED_BOOT_FW_CERT,
.opt = "tb-fw-cert",
+ .help_msg = "Trusted Boot FW Certificate (output file)",
.fn = NULL,
.cn = "Trusted Boot FW Certificate",
.key = ROT_KEY,
@@ -55,6 +56,7 @@
[TRUSTED_KEY_CERT] = {
.id = TRUSTED_KEY_CERT,
.opt = "trusted-key-cert",
+ .help_msg = "Trusted Key Certificate (output file)",
.fn = NULL,
.cn = "Trusted Key Certificate",
.key = ROT_KEY,
@@ -68,6 +70,7 @@
[SCP_FW_KEY_CERT] = {
.id = SCP_FW_KEY_CERT,
.opt = "scp-fw-key-cert",
+ .help_msg = "SCP Firmware Key Certificate (output file)",
.fn = NULL,
.cn = "SCP Firmware Key Certificate",
.key = TRUSTED_WORLD_KEY,
@@ -80,6 +83,7 @@
[SCP_FW_CONTENT_CERT] = {
.id = SCP_FW_CONTENT_CERT,
.opt = "scp-fw-cert",
+ .help_msg = "SCP Firmware Content Certificate (output file)",
.fn = NULL,
.cn = "SCP Firmware Content Certificate",
.key = SCP_FW_CONTENT_CERT_KEY,
@@ -92,6 +96,7 @@
[SOC_FW_KEY_CERT] = {
.id = SOC_FW_KEY_CERT,
.opt = "soc-fw-key-cert",
+ .help_msg = "SoC Firmware Key Certificate (output file)",
.fn = NULL,
.cn = "SoC Firmware Key Certificate",
.key = TRUSTED_WORLD_KEY,
@@ -104,6 +109,7 @@
[SOC_FW_CONTENT_CERT] = {
.id = SOC_FW_CONTENT_CERT,
.opt = "soc-fw-cert",
+ .help_msg = "SoC Firmware Content Certificate (output file)",
.fn = NULL,
.cn = "SoC Firmware Content Certificate",
.key = SOC_FW_CONTENT_CERT_KEY,
@@ -116,6 +122,7 @@
[TRUSTED_OS_FW_KEY_CERT] = {
.id = TRUSTED_OS_FW_KEY_CERT,
.opt = "tos-fw-key-cert",
+ .help_msg = "Trusted OS Firmware Key Certificate (output file)",
.fn = NULL,
.cn = "Trusted OS Firmware Key Certificate",
.key = TRUSTED_WORLD_KEY,
@@ -128,6 +135,7 @@
[TRUSTED_OS_FW_CONTENT_CERT] = {
.id = TRUSTED_OS_FW_CONTENT_CERT,
.opt = "tos-fw-cert",
+ .help_msg = "Trusted OS Firmware Content Certificate (output file)",
.fn = NULL,
.cn = "Trusted OS Firmware Content Certificate",
.key = TRUSTED_OS_FW_CONTENT_CERT_KEY,
@@ -140,6 +148,7 @@
[NON_TRUSTED_FW_KEY_CERT] = {
.id = NON_TRUSTED_FW_KEY_CERT,
.opt = "nt-fw-key-cert",
+ .help_msg = "Non-Trusted Firmware Key Certificate (output file)",
.fn = NULL,
.cn = "Non-Trusted Firmware Key Certificate",
.key = NON_TRUSTED_WORLD_KEY,
@@ -152,6 +161,7 @@
[NON_TRUSTED_FW_CONTENT_CERT] = {
.id = NON_TRUSTED_FW_CONTENT_CERT,
.opt = "nt-fw-cert",
+ .help_msg = "Non-Trusted Firmware Content Certificate (output file)",
.fn = NULL,
.cn = "Non-Trusted Firmware Content Certificate",
.key = NON_TRUSTED_FW_CONTENT_CERT_KEY,
@@ -164,8 +174,9 @@
[FWU_CERT] = {
.id = FWU_CERT,
.opt = "fwu-cert",
+ .help_msg = "Firmware Update Certificate (output file)",
.fn = NULL,
- .cn = "FWU Certificate",
+ .cn = "Firmware Update Certificate",
.key = ROT_KEY,
.issuer = FWU_CERT,
.ext = {