mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 2/7] digest: make it multi-instance
Date: Wed, 11 Mar 2015 06:21:20 +0100	[thread overview]
Message-ID: <20150311052120.GK24885@pengutronix.de> (raw)
In-Reply-To: <1425997697-27467-2-git-send-email-plagnioj@jcrosoft.com>

On Tue, Mar 10, 2015 at 03:28:12PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Now you need to call digest_alloc and when you finish to use it digest_free.
> 
> We need this for upcomming aes encryption support and secure boot
> as we will need multiple instance of the same digest.
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  commands/digest.c |  3 ++-
>  common/digest.c   | 50 ++++++++++++++++++++++++++++++++++++++++----------
>  common/password.c |  5 +++--
>  crypto/md5.c      | 34 +++++++++++-----------------------
>  crypto/sha1.c     | 34 +++++++++++-----------------------
>  crypto/sha2.c     | 55 ++++++++++++++++++++-----------------------------------
>  include/digest.h  | 26 +++++++++++++++++---------
>  7 files changed, 104 insertions(+), 103 deletions(-)
> 
> diff --git a/commands/digest.c b/commands/digest.c
> index bad7d3f..c6a2751 100644
> --- a/commands/digest.c
> +++ b/commands/digest.c
> @@ -33,7 +33,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
>  	int i;
>  	unsigned char *hash;
>  
> -	d = digest_get_by_name(algorithm);
> +	d = digest_alloc(algorithm);
>  	BUG_ON(!d);
>  
>  	if (argc < 2)
> @@ -71,6 +71,7 @@ static int do_digest(char *algorithm, int argc, char *argv[])
>  	}
>  
>  	free(hash);
> +	digest_free(d);
>  
>  	return ret;
>  }
> diff --git a/common/digest.c b/common/digest.c
> index 789c0b2..89af862 100644
> --- a/common/digest.c
> +++ b/common/digest.c
> @@ -28,12 +28,14 @@
>  
>  static LIST_HEAD(digests);
>  
> +static struct digest_algo* digest_algo_get_by_name(char* name);

The coding style is to put the '*' adjacent to the data name or function
name, not adjacent to the type name. Please stick to it. A patch to
clean this up first in this file would be very welcomed.

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

  reply	other threads:[~2015-03-11  5:21 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 14:16 [PATCH 0/7] add sha384/sha512 and hmac support Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28 ` [PATCH 1/7] digest: introduce digest_{init/update/final/length} Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28   ` [PATCH 2/7] digest: make it multi-instance Jean-Christophe PLAGNIOL-VILLARD
2015-03-11  5:21     ` Sascha Hauer [this message]
2015-03-11  5:32     ` Sascha Hauer
2015-03-11 10:44       ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-11 11:45         ` Sascha Hauer
2015-03-10 14:28   ` [PATCH 3/7] crypto: add sha384 & sha512 support Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28   ` [PATCH 4/7] command: add sha384sum and sha512sum support Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28   ` [PATCH 5/7] password: add support for sha512 Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28   ` [PATCH 6/7] digest: add HMAC support for md5, sha1, sha224, sha256, sha384, sha512 Jean-Christophe PLAGNIOL-VILLARD
2015-03-11  5:40     ` Sascha Hauer
2015-03-11 10:47       ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-10 14:28   ` [PATCH 7/7] command: add hmac sum supportfor " Jean-Christophe PLAGNIOL-VILLARD
2015-03-11  5:43     ` Sascha Hauer
2015-03-11 10:52       ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-11 11:00         ` Jean-Christophe PLAGNIOL-VILLARD
2015-03-11 11:41           ` Sascha Hauer

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=20150311052120.GK24885@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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