sbsign: convert to the new option and verb parsers

The options --private-key, --private-key-source, --certificate,
--certificate-source are almost identical in sbsign, but are described
slightly differently. Add OPTION_COMMON_ macros that are parametrized
to keep the purpose of the --private-key and --certificate options
in the description.

Co-developed-by: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-04-23 19:13:44 +02:00
parent b7f2c23da9
commit 04ad6079bb
3 changed files with 79 additions and 102 deletions
+4 -12
View File
@@ -605,16 +605,13 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
return r;
break;
OPTION_LONG("private-key", "PATH|URI",
"Private key for Secure Boot auto-enrollment"):
OPTION_COMMON_PRIVATE_KEY("Private key for Secure Boot auto-enrollment"):
r = free_and_strdup_warn(&arg_private_key, arg);
if (r < 0)
return r;
break;
OPTION_LONG("private-key-source", "SOURCE",
"Specify how to use the private key "
"(file, provider:PROVIDER, engine:ENGINE)"):
OPTION_COMMON_PRIVATE_KEY_SOURCE:
r = parse_openssl_key_source_argument(arg,
&arg_private_key_source,
&arg_private_key_source_type);
@@ -622,18 +619,13 @@ static int parse_argv(int argc, char *argv[], char ***ret_args) {
return r;
break;
OPTION_LONG("certificate", "PATH|URI",
"PEM certificate to use when setting up Secure Boot auto-enrollment, "
"or a provider specific designation if --certificate-source= is used"):
OPTION_COMMON_CERTIFICATE("PEM certificate to use when setting up Secure Boot auto-enrollment"):
r = free_and_strdup_warn(&arg_certificate, arg);
if (r < 0)
return r;
break;
OPTION_LONG("certificate-source", "SOURCE",
"Specify how to interpret the certificate from --certificate=. "
"Allows the certificate to be loaded from an OpenSSL provider "
"(file, provider:PROVIDER)"):
OPTION_COMMON_CERTIFICATE_SOURCE:
r = parse_openssl_certificate_source_argument(arg,
&arg_certificate_source,
&arg_certificate_source_type);