mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-08 16:41:55 +00:00
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
This commit is contained in:
@@ -57,6 +57,7 @@ struct cert_s {
|
||||
const char *opt; /* Command line option to pass filename */
|
||||
const char *fn; /* Filename to save the certificate */
|
||||
const char *cn; /* Subject CN (Company Name) */
|
||||
const char *help_msg; /* Help message */
|
||||
|
||||
/* These fields must be defined statically */
|
||||
int key; /* Key to be signed */
|
||||
|
||||
@@ -42,9 +42,16 @@ enum {
|
||||
CMD_OPT_EXT
|
||||
};
|
||||
|
||||
/* Structure to define a command line option */
|
||||
typedef struct cmd_opt_s {
|
||||
struct option long_opt;
|
||||
const char *help_msg;
|
||||
} cmd_opt_t;
|
||||
|
||||
/* Exported API*/
|
||||
int cmd_opt_add(const char *name, int has_arg, int val);
|
||||
void cmd_opt_add(const cmd_opt_t *cmd_opt);
|
||||
const struct option *cmd_opt_get_array(void);
|
||||
const char *cmd_opt_get_name(int idx);
|
||||
const char *cmd_opt_get_help_msg(int idx);
|
||||
|
||||
#endif /* CMD_OPT_H_ */
|
||||
|
||||
@@ -50,6 +50,7 @@ typedef struct ext_s {
|
||||
const char *oid; /* OID of the extension */
|
||||
const char *sn; /* Short name */
|
||||
const char *ln; /* Long description */
|
||||
const char *help_msg; /* Help message */
|
||||
int asn1_type; /* OpenSSL ASN1 type of the extension data.
|
||||
* Supported types are:
|
||||
* - V_ASN1_INTEGER
|
||||
|
||||
@@ -64,6 +64,7 @@ enum {
|
||||
typedef struct key_s {
|
||||
int id; /* Key id */
|
||||
const char *opt; /* Command line option to specify a key */
|
||||
const char *help_msg; /* Help message */
|
||||
const char *desc; /* Key description (debug purposes) */
|
||||
char *fn; /* Filename to load/store the key */
|
||||
EVP_PKEY *key; /* Key container */
|
||||
|
||||
Reference in New Issue
Block a user