[PATCH 8/8] command: add hmac sum supportfor md5, sha1, sha224, sha256, sha384, sha512

Sascha Hauer s.hauer at pengutronix.de
Mon Mar 16 05:52:29 PDT 2015


On Mon, Mar 16, 2015 at 12:01:32PM +0100, Jan Lübbe wrote:
> On Mi, 2015-03-11 at 17:53 +0100, Jean-Christophe PLAGNIOL-VILLARD
> wrote:
> > diff --git a/include/digest.h b/include/digest.h
> > index a26848c..fd47a7e 100644
> > --- a/include/digest.h
> > +++ b/include/digest.h
> > @@ -54,11 +54,14 @@ struct digest *digest_alloc(char* name);
> >  void digest_free(struct digest *d);
> >  
> >  int digest_file_window(struct digest *d, char *filename,
> > +                      unsigned char *key, size_t keylen,
> >                        unsigned char *hash,
> >                        ulong start, ulong size);
> >  int digest_file(struct digest *d, char *filename,
> > +                      unsigned char *key, size_t keylen,
> >                        unsigned char *hash);
> 
> This is already in next, but I'd like to know why you added the
> key/keylen args to each function instead of letting the caller use
> digest_set_key()?
> 
> In the patch "[PATCH 04/10] command: add generic digest command" you add
> another parameter (unsigned char *sig) to these functions, which is used
> instead of the key parameter when verifying.
> 
> Maybe we are overloading them with to much different functionality?

I agree here. For the caller of digest_file() it is equally simple to
call digest_set_key() beforehand.

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 |



More information about the barebox mailing list