[U-Boot] [PATCH 8/9] [v3] hash: Add function to find hash_algo struct with progressive hash

Simon Glass
2014-12-29T21:13:46Z

+Wolfgang

Hi Ruchika,

On 29 December 2014 at 00:07, Ruchika Gupta <ruchika.gupta@freescale.com> wrote:
> Hi Simon,
>
>> -----Original Message-----
>> From: sjg at google.com [mailto:sjg at google.com] On Behalf Of Simon Glass
>> Sent: Wednesday, December 24, 2014 6:20 AM
>> To: Gupta Ruchika-R66431
>> Cc: U-Boot Mailing List; Sun York-R58495
>> Subject: Re: [PATCH 8/9] [v3] hash: Add function to find hash_algo struct
>> with progressive hash
>>
>> Hi Ruchika,
>>
>> On 23 December 2014 at 04:32, Ruchika Gupta <ruchika.gupta@freescale.com>
>> wrote:
>> > The hash_algo structure has some implementations in which progressive
>> > hash API's are not defined. These are basically the hardware based
>> > implementations of SHA. An API is added to find the algo which has
>> > progressive hash API's defined. This can then be integrated with RSA
>> > checksum library which uses Progressive Hash API's.
>> >
>> > Signed-off-by: Ruchika Gupta <ruchika.gupta@freescale.com>
>> > CC: Simon Glass <sjg@chromium.org>
>> > ---
>> > Changes in v3 :
>> > Corrected ifdef for SHA1
>> >
>> > Changes in v2 :
>> > Added commit message
>> >
>> > common/hash.c | 33 ++++++++++++++++++++++++--------- include/hash.h
>> > | 15 +++++++++++++++
>> > 2 files changed, 39 insertions(+), 9 deletions(-)
>> >
>> > diff --git a/common/hash.c b/common/hash.c index 12d6759..ea1ec60
>> > 100644
>> > --- a/common/hash.c
>> > +++ b/common/hash.c
>> > @@ -20,7 +20,7 @@
>> > #include <asm/io.h>
>> > #include <asm/errno.h>
>> >
>> > -#ifdef CONFIG_CMD_SHA1SUM
>> > +#ifdef CONFIG_SHA1
>>
>> I'm still not sure about this. I suspect this will bloat the code for boards
>> that use CONFIG_SHA1 (most) but not CONFIG_CMD_SHA1SUM. You could check that,
>> but I went through some contortions to make sure that the hash API was not
>> compiled in when not needed.
>
> Since we will be using this API now in RSA checksum, defining CONFIG_SHA1 should allow the compilation of this structure. Asking user to enable CONFIG_CMD_SHA1SUM for using rsa-checksum doesn?t look right. Please suggest.

Agreed it doesn't, it was just a code size hack. Wolfgang might be
able to chime in with thoughts here (+Cc).

But still, do you need to change it? After all, CONFIG_CMD_SHA1SUM
should be a superest for CONFIG_SHA1.

[snip]

Regards,
Simon