[U-Boot] Add md5sum and sha1 commands...

Robin Getz rgetz at blackfin.uclinux.org
Sun Jul 26 05:25:00 CEST 2009


On Sat 25 Jul 2009 22:49, Mike Frysinger pondered:
> On Saturday 25 July 2009 16:07:49 Robin Getz wrote:
> > --- a/common/cmd_mem.c
> > +++ b/common/cmd_mem.c
> > @@ -34,6 +34,14 @@
> >  #endif
> >  #include <watchdog.h>
> >
> > +#ifdef CONFIG_CMD_MD5SUM
> > +#include <u-boot/md5.h>
> > +#endif
> > +
> > +#ifdef CONFIG_CMD_SHA1
> > +#include <sha1.h>
> > +#endif
> 
> i dont think there would be a problem just including these all the time.  
> would make it easier to notice problems down the line if people moved files 
> and compile tested with boards that didnt enable these commands for example.

I'm OK with either way.


> > +	for (i = 0; i < 16 ; i++)
> 
> no space before that semicolon
> 
> > +	for (i = 0; i < 20 ; i++)
> 
> same here

Oops.
 
> > +#ifdef CONFIG_CMD_MD5SUM
> > +U_BOOT_CMD(
> > +	md5sum,	3,	1,	do_md5sum,
> > +	"compute MD5 message digest",
> > +	"address count"
> > +);
> > +#endif
> > +
> > +#ifdef CONFIG_CMD_SHA1
> > +U_BOOT_CMD(
> > +	sha1,	3,	1,	do_sha1,
> > +	"compute SHA1 message digest",
> > +	"address count"
> > +);
> > +#endif /* CONFIG_CMD_SHA1 */
> 
> there's no need for these to be at the bottom of the file.  move the 
> U_BOOT_CMD() into the releated #ifdef block.

I'm just doing the same as all the other things in the same file (which 
doesn't mean it is correct). What is the preferred style?

> also, they should both have a "sum" suffix or neither.  i'd lean towards the 
> former ...

Will do. Since the standard Linux console commands are sha1sum & md5sum I'll 
make U-Boot do like-wise.

I'll send a new version, when Wolfgang lets me know what the ifdef preference 
is...

-Robin


More information about the U-Boot mailing list