mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] digest: digest doesn't return an error if the signature length is incorrect
@ 2015-07-03  6:47 Philippe Leduc
  2015-07-03  6:58 ` Marc Kleine-Budde
  2015-07-06 11:31 ` Sascha Hauer
  0 siblings, 2 replies; 4+ messages in thread
From: Philippe Leduc @ 2015-07-03  6:47 UTC (permalink / raw)
  To: barebox

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] digest: digest doesn't return an error if the signature length is incorrect
  2015-07-03  6:47 [PATCH] digest: digest doesn't return an error if the signature length is incorrect Philippe Leduc
@ 2015-07-03  6:58 ` Marc Kleine-Budde
  2015-07-06 11:31 ` Sascha Hauer
  1 sibling, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2015-07-03  6:58 UTC (permalink / raw)
  To: Philippe Leduc, barebox


[-- Attachment #1.1: Type: text/plain, Size: 2414 bytes --]

On 07/03/2015 08:47 AM, Philippe Leduc wrote:
> 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;

Better use COMMAND_ERROR here.

>                         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)

Your patch is line wrapped. Please consider using git send-email to send
your patches.

Marc

-- 
Pengutronix e.K.                  | Marc Kleine-Budde           |
Industrial Linux Solutions        | Phone: +49-231-2826-924     |
Vertretung West/Dortmund          | Fax:   +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686  | http://www.pengutronix.de   |


[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 455 bytes --]

[-- Attachment #2: Type: text/plain, Size: 149 bytes --]

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] digest: digest doesn't return an error if the signature length is incorrect
  2015-07-03  6:47 [PATCH] digest: digest doesn't return an error if the signature length is incorrect Philippe Leduc
  2015-07-03  6:58 ` Marc Kleine-Budde
@ 2015-07-06 11:31 ` Sascha Hauer
  2015-07-06 11:33   ` Philippe Leduc
  1 sibling, 1 reply; 4+ messages in thread
From: Sascha Hauer @ 2015-07-06 11:31 UTC (permalink / raw)
  To: Philippe Leduc; +Cc: barebox

On Fri, Jul 03, 2015 at 08:47:26AM +0200, Philippe Leduc wrote:
> 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>

Applied with the fixup Marc suggested. Your mailer wraps the lines, I
had to apply this one manually. Please have a look if you can fix that
next time.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] digest: digest doesn't return an error if the signature length is incorrect
  2015-07-06 11:31 ` Sascha Hauer
@ 2015-07-06 11:33   ` Philippe Leduc
  0 siblings, 0 replies; 4+ messages in thread
From: Philippe Leduc @ 2015-07-06 11:33 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

I'm working on it :) (I am currently working on how to use git
send-email for the next patch).

Thank you for the handiwork!

--
Philippe LEDUC
ledphilippe@gmail.com


2015-07-06 13:31 GMT+02:00 Sascha Hauer <s.hauer@pengutronix.de>:
> On Fri, Jul 03, 2015 at 08:47:26AM +0200, Philippe Leduc wrote:
>> 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>
>
> Applied with the fixup Marc suggested. Your mailer wraps the lines, I
> had to apply this one manually. Please have a look if you can fix that
> next time.
>
> Sascha
>
> --
> Pengutronix e.K.                           |                             |
> Industrial Linux Solutions                 | http://www.pengutronix.de/  |
> Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-07-06 11:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-03  6:47 [PATCH] digest: digest doesn't return an error if the signature length is incorrect Philippe Leduc
2015-07-03  6:58 ` Marc Kleine-Budde
2015-07-06 11:31 ` Sascha Hauer
2015-07-06 11:33   ` Philippe Leduc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox