All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heiko Schocher <hs@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [U-Boot v2] [PATCH] rsa: add a more flexible way to support different hash algorithms (e.g. sha256)
Date: Mon, 02 Dec 2013 07:10:09 +0100	[thread overview]
Message-ID: <529C2441.8080801@denx.de> (raw)
In-Reply-To: <842410203.349181.1385554208943.open-xchange@email.1und1.de>

Hello Andreas,

Am 27.11.2013 13:10, schrieb andreas at oetken.name:
> As proposed by Heiko I made some small changes and verified the patch with the
> checkpatch-script.
>
>
>> From 169f40e72fceb222bb15dd59c1337f42371e97a5 Mon Sep 17 00:00:00 2001
> From: Andreas Oetken<andreas.oetken@siemens.com>
> Date: Wed, 27 Nov 2013 13:09:19 +0100
> Subject: [PATCH] Added rsa-sha256 support.

Could you fix your commit message?

Please write in the commit message why and what you have changed
in your patch. After "---" you can write for example the changelog
of your patch, see a detailed help for sending patches, here:

http://www.denx.de/wiki/U-Boot/Patches

> Signed-off-by: Andreas Oetken<andreas.oetken@siemens.com>
> ---
>   common/image-sig.c          |   33 +++++++++++++
>   include/image.h             |   20 +++++++-
>   include/rsa-checksum.h      |   25 ++++++++++
>   include/rsa.h               |   17 +++++++
>   lib/rsa/Makefile            |    2 +-
>   lib/rsa/rsa-checksum.c      |  108 +++++++++++++++++++++++++++++++++++++++++++
>   lib/rsa/rsa-sign.c          |   10 ++--
>   lib/rsa/rsa-verify.c        |   80 +++++++++-----------------------
>   test/vboot/sign-configs.its |    2 +-
>   test/vboot/sign-images.its  |    2 +-
>   10 files changed, 233 insertions(+), 66 deletions(-)
>   create mode 100644 include/rsa-checksum.h
>   create mode 100644 lib/rsa/rsa-checksum.c

Hmm.. I tried to apply your patch, but I get:

pollux:u-boot hs [20131202] $ git am mbox
Wende an: rsa: add a more flexible way to support different hash algorithms (e.g. sha256)
fatal: fehlerhafter Patch bei Zeile 24
Anwendung des Patches fehlgeschlagen bei 0001 rsa: add a more flexible way to support different hash algorithms (e.g. sha256)
Die Kopie des fehlgeschlagenen Patches befindet sich in:
    /home/hs/ids/u-boot/.git/rebase-apply/patch
Wenn Sie das Problem gel?st haben, f?hren Sie "git am --resolved" aus.
Falls Sie diesen Patch auslassen m?chten, f?hren Sie stattdessen
"git am --skip" aus.
Um den urspr?nglichen Zweig wiederherzustellen und die Anwendung der
Patches abzubrechen, f?hren Sie "git am --abort" aus.
pollux:u-boot hs [20131202] $ git am --abort
pollux:u-boot hs [20131202] $ vi mbox
pollux:u-boot hs [20131202] $ patch -p1 < mbox
patching file common/image-sig.c
patch: **** malformed patch at line 49:  #endif /* !USE_HOSTCC*/

pollux:u-boot hs [20131202] $

Can you have a look@this issue?

Beside of that, just some nitpicking comment:

[...]
> diff --git a/include/rsa.h b/include/rsa.h
> index add4c78..12ae443 100644
> --- a/include/rsa.h
> +++ b/include/rsa.h
> @@ -15,6 +15,23 @@
>   #include<errno.h>
>   #include<image.h>
>
> +#define RSA2048_BYTES  (2048 / 8)
> +
> +/**
> + * struct rsa_public_key - holder for a public key
> + *
> + * An RSA public key consists of a modulus (typically called N), the inverse
> + * and R^2, where R is 2^(# key bits).
> + */
> +
> +struct rsa_public_key {
> +       uint len;               /* Length of modulus[] in number of uint32_t */
> +       uint32_t n0inv;         /* -1 / modulus[0] mod 2^32 */
> +       uint32_t *modulus;      /* modulus as little endian array */
> +       uint32_t *rr;           /* R^2 as little endian array */
> +};
> +
> +

only one empty line please.

>   #if IMAGE_ENABLE_SIGN
>   /**
>    * sign() - calculate and return signature for given input data
[...]
> diff --git a/lib/rsa/rsa-checksum.c b/lib/rsa/rsa-checksum.c
> new file mode 100644
> index 0000000..e75abb8
> --- /dev/null
> +++ b/lib/rsa/rsa-checksum.c
> @@ -0,0 +1,108 @@
> +/*
> + * Copyright (c) 2013, Andreas Oetken.
> + *
> + * SPDX-License-Identifier:    GPL-2.0+
> + */
> +
> +#include<common.h>
> +#include<fdtdec.h>
> +#include<rsa.h>
> +#include<sha1.h>
> +#include<sha256.h>
> +#include<asm/byteorder.h>
> +#include<asm/errno.h>
> +#include<asm/unaligned.h>
> +
> +

only one empty line please.

> +/* PKCS 1.5 paddings as described in the RSA PKCS#1 v2.1 standard. */
> +
> +

here too.. please fix globally.

[...]

bye,
Heiko
-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany

  reply	other threads:[~2013-12-02  6:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 12:10 [U-Boot] [U-Boot v2] [PATCH] rsa: add a more flexible way to support different hash algorithms (e.g. sha256) andreas at oetken.name
2013-12-02  6:10 ` Heiko Schocher [this message]
2013-12-13 22:40   ` Simon Glass

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=529C2441.8080801@denx.de \
    --to=hs@denx.de \
    --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.