[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20211008134547.32281-1-mcroce@linux.microsoft.com>
Date: Fri, 8 Oct 2021 15:45:47 +0200
From: Matteo Croce <mcroce@...ux.microsoft.com>
To: David Howells <dhowells@...hat.com>,
David Woodhouse <dwmw2@...radead.org>, keyrings@...r.kernel.org
Cc: linux-kernel@...r.kernel.org
Subject: [PATCH] sign-file: refactor help output
From: Matteo Croce <mcroce@...rosoft.com>
Tidy up the error output, and document the undocumented
flags -k and -s.
Signed-off-by: Matteo Croce <mcroce@...rosoft.com>
---
scripts/sign-file.c | 23 +++++++++++++++--------
1 file changed, 15 insertions(+), 8 deletions(-)
diff --git a/scripts/sign-file.c b/scripts/sign-file.c
index fbd34b8e8f57..fad6563b2127 100644
--- a/scripts/sign-file.c
+++ b/scripts/sign-file.c
@@ -67,12 +67,19 @@ struct module_signature {
static char magic_number[] = "~Module signature appended~\n";
static __attribute__((noreturn))
-void format(void)
+void format(char *argv0)
{
fprintf(stderr,
- "Usage: scripts/sign-file [-dp] <hash algo> <key> <x509> <module> [<dest>]\n");
- fprintf(stderr,
- " scripts/sign-file -s <raw sig> <hash algo> <x509> <module> [<dest>]\n");
+ "Usage: %s [-dp] <hash algo> <key> <x509> <module> [<dest>]\n"
+ " %s -s <raw sig> <hash algo> <x509> <module> [<dest>]\n"
+ "\n"
+ " -d only generate signature (implies -p)\n"
+#ifndef USE_PKCS7
+ " -k use subject key identifier\n"
+#endif
+ " -p keep signature file\n"
+ " -s use raw signature\n",
+ argv0, argv0);
exit(2);
}
@@ -245,20 +252,20 @@ int main(int argc, char **argv)
opt = getopt(argc, argv, "sdpk");
switch (opt) {
case 's': raw_sig = true; break;
+ case 'd': sign_only = true;
case 'p': save_sig = true; break;
- case 'd': sign_only = true; save_sig = true; break;
#ifndef USE_PKCS7
case 'k': use_keyid = CMS_USE_KEYID; break;
#endif
case -1: break;
- default: format();
+ default: format(basename(argv[0]));
}
} while (opt != -1);
argc -= optind;
- argv += optind;
if (argc < 4 || argc > 5)
- format();
+ format(basename(argv[0]));
+ argv += optind;
if (raw_sig) {
raw_sig_name = argv[0];
--
2.33.0
Powered by blists - more mailing lists