All of lore.kernel.org
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: u-boot@lists.denx.de
Subject: [PATCH v2 4/4] mkimge: Reject signing-related flags without FIT_SIGNATURE
Date: Tue,  8 Dec 2020 14:42:16 +1030	[thread overview]
Message-ID: <20201208041216.888902-5-joel@jms.id.au> (raw)
In-Reply-To: <20201208041216.888902-1-joel@jms.id.au>

When CONFIG_FIT_SIGNATURE=n the signing options are not available. If a
user is careful they will notice this when looking at the help output.

If they are not careful they will waste several hours wondering why
their FIT doesn't contain a /signature node, as mkimage will silently
ingore the signing related options.

Make it obvious that the commands don't work by removing them from the
getopt opt_string.

 $ mkimage -f machine.its -k keys -K u-boot-pubkey.dtb -r image.fit
 mkimage: invalid option -- 'k'
 Error: Invalid option

Signed-off-by: Joel Stanley <joel@jms.id.au>
--
v2: Leave padding related options in the CONFIG_FIT_SIGNATURE=y optargs
---
 tools/mkimage.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/mkimage.c b/tools/mkimage.c
index 68d5206cb4fd..f7d3ac40e681 100644
--- a/tools/mkimage.c
+++ b/tools/mkimage.c
@@ -142,7 +142,11 @@ static int add_content(int type, const char *fname)
 	return 0;
 }
 
+#ifdef CONFIG_FIT_SIGNATURE
 #define OPT_STRING "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx"
+#else
+#define OPT_STRING "a:A:b:B:C:d:D:e:Ef:i:ln:O:R:qstT:vVx"
+#endif
 static void process_args(int argc, char **argv)
 {
 	char *ptr;
@@ -150,8 +154,7 @@ static void process_args(int argc, char **argv)
 	char *datafile = NULL;
 	int opt;
 
-	while ((opt = getopt(argc, argv,
-		   "a:A:b:B:c:C:d:D:e:Ef:Fk:i:K:ln:N:p:O:rR:qstT:vVx")) != -1) {
+	while ((opt = getopt(argc, argv, OPT_STRING)) != -1) {
 		switch (opt) {
 		case 'a':
 			params.addr = strtoull(optarg, &ptr, 16);
-- 
2.29.2

  parent reply	other threads:[~2020-12-08  4:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-08  4:12 [PATCH v2 0/4] mkimage usability fixes Joel Stanley
2020-12-08  4:12 ` [PATCH v2 1/4] tools/Makefile: FIT_CIPHER requires libssl Joel Stanley
2020-12-08 15:25   ` Philippe REYNES
2021-01-23 17:46   ` Tom Rini
2020-12-08  4:12 ` [PATCH v2 2/4] image-fit: Fix FIT_CIPHER linking Joel Stanley
2020-12-08 15:26   ` Philippe REYNES
2021-01-23 17:46   ` Tom Rini
2020-12-08  4:12 ` [PATCH v2 3/4] mkimage: Move padding commands outside of FIT_SIGNATURE Joel Stanley
2020-12-08 15:35   ` Philippe REYNES
2021-01-23 17:46   ` Tom Rini
2020-12-08  4:12 ` Joel Stanley [this message]
2020-12-08 15:38   ` [PATCH v2 4/4] mkimge: Reject signing-related flags without FIT_SIGNATURE Philippe REYNES
2020-12-12 15:39     ` Simon Glass
2021-01-22 21:58   ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201208041216.888902-5-joel@jms.id.au \
    --to=joel@jms.id.au \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.