mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Philippe Leduc <ledphilippe@gmail.com>
To: barebox@lists.infradead.org
Subject: [PATCH] digest: digest doesn't return an error if the signature length is incorrect
Date: Fri, 3 Jul 2015 08:47:26 +0200	[thread overview]
Message-ID: <CABQt-UkHumKVU+-tEjj2moz_S8vbdeYDtY7CfJqA-qZbrWiyWw@mail.gmail.com> (raw)

Hi,

I noticed that digest return 0 even if the signature length is
detected as incorrect. This patch also fix the documentation that
seems obsolete (I considered that the patch was simply enough to make
two corrections, but tell me if I should propose two patch).


Subject: [PATCH] digest: digest doesn't return an error if the
signature length is incorrect

fix: digest return no error even if the digest length is wrong
fix: documentation error (-v -> -s / -V -> -S)

Signed-off-by: Philippe Leduc <ledphilippe@gmail.com>
---
 commands/digest.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/commands/digest.c b/commands/digest.c
index 340c07a..5304f32 100644
--- a/commands/digest.c
+++ b/commands/digest.c
@@ -167,6 +167,7 @@ static int do_digest(int argc, char *argv[])
                } else if (siglen != digestlen) {
                        eprintf("%s wrong size %zu, expected %zu\n",
                                sigfile, siglen, digestlen);
+                       ret = 1;
                        goto err;
                }
        }
@@ -186,8 +187,8 @@ BAREBOX_CMD_HELP_TEXT("Options:")
 BAREBOX_CMD_HELP_OPT ("-a <algo>\t",  "hash or signature algorithm to use")
 BAREBOX_CMD_HELP_OPT ("-k <key>\t",   "use supplied <key> (ASCII or
hex) for MAC")
 BAREBOX_CMD_HELP_OPT ("-K <file>\t",  "use key from <file> (binary) for MAC")
-BAREBOX_CMD_HELP_OPT ("-v <hex>\t",   "verify data against supplied
<hex> (hash, MAC or signature)")
-BAREBOX_CMD_HELP_OPT ("-V <file>\t",  "verify data against <file>
(hash, MAC or signature)")
+BAREBOX_CMD_HELP_OPT ("-s <hex>\t",   "verify data against supplied
<hex> (hash, MAC or signature)")
+BAREBOX_CMD_HELP_OPT ("-S <file>\t",  "verify data against <file>
(hash, MAC or signature)")
 BAREBOX_CMD_HELP_END

 BAREBOX_CMD_START(digest)
--
2.1.4


Philippe LEDUC
ledphilippe@gmail.com

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2015-07-03  6:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-03  6:47 Philippe Leduc [this message]
2015-07-03  6:58 ` Marc Kleine-Budde
2015-07-06 11:31 ` Sascha Hauer
2015-07-06 11:33   ` Philippe Leduc

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=CABQt-UkHumKVU+-tEjj2moz_S8vbdeYDtY7CfJqA-qZbrWiyWw@mail.gmail.com \
    --to=ledphilippe@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox