Skip to contentSkip to conversation

Add md5sum and sha1 commands...

U-Boot New Robin Getz 3 participants 11 messages Jul 25, 2009 – Aug 13, 2009

lore
Share & tools
lore

Robin Getz

author
#0 lore raw

From: Robin Getz <[email protected]>

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

 README           |    4 ++
 common/cmd_mem.c |   73 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)

---

README +4 -0
index 9071472..cf3867d 100644
@@ -629,6 +629,8 @@ The following options need to be configured:
 		CONFIG_CMD_KGDB		* kgdb
 		CONFIG_CMD_LOADB	  loadb
 		CONFIG_CMD_LOADS	  loads
+		CONFIG_CMD_MD5SUM	  print md5 message digest
+					  (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
 		CONFIG_CMD_MEMORY	  md, mm, nm, mw, cp, cmp, crc, base,
 					  loop, loopw, mtest
 		CONFIG_CMD_MISC		  Misc functions like sleep etc
@@ -652,6 +654,8 @@ The following options need to be configured:
 					  (requires CONFIG_CMD_I2C)
 		CONFIG_CMD_SETGETDCR	  Support for DCR Register access
 					  (4xx only)
+		CONFIG_CMD_SHA1		  print sha1 memory digest
+					  (requires CONFIG_CMD_MEMORY)
 		CONFIG_CMD_SOURCE	  "source" command Support
 		CONFIG_CMD_SPI		* SPI serial bus support
 		CONFIG_CMD_USB		* USB support
common/cmd_mem.c +73 -0

91 lines not on this page · raw message

#1 lore raw

common/cmd_mem.c line 43

Quoted 13 lines · On Saturday 25 July 2009 16:07:49 Robin Getz wrote:
common/cmd_mem.c +7 -0
@@ -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.

common/cmd_mem.c int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 1169

Quoted 1 line
common/cmd_mem.c +1 -0
+	for (i = 0; i < 16 ; i++)

no space before that semicolon

common/cmd_mem.c int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 1194

Quoted 1 line
common/cmd_mem.c +1 -0
+	for (i = 0; i < 20 ; i++)

same here

Quoted 5 lines
common/cmd_mem.c +5 -0
+#ifdef CONFIG_CMD_MD5SUM
+U_BOOT_CMD(
+	md5sum,	3,	1,	do_md5sum,
+	"compute MD5 message digest",
+	"address count"

common/cmd_mem.c U_BOOT_CMD( · line 1341

Quoted 10 lines
common/cmd_mem.c +10 -0
+);
+#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.

also, they should both have a "sum" suffix or neither. i'd lean towards the former ...
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090725/3a69b9b6/attachment.pgp

author
#2 lore raw

On Sat 25 Jul 2009 22:49, Mike Frysinger pondered:

Quoted 7 lines · On Saturday 25 July 2009 16:07:49 Robin Getz wrote:
Quoted 6 lines
common/cmd_mem.c +0 -0
@@ -34,6 +34,14 @@
 #endif
 #include <watchdog.h>
 
Quoted 11 lines

common/cmd_mem.c line 43

Quoted 7 lines
common/cmd_mem.c +7 -0
+#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.

Quoted 7 lines

common/cmd_mem.c int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 1169

Quoted 1 line
common/cmd_mem.c +1 -0
+	for (i = 0; i < 16 ; i++)

no space before that semicolon

common/cmd_mem.c int do_mem_crc (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) · line 1194

Quoted 1 line
common/cmd_mem.c +1 -0
+	for (i = 0; i < 20 ; i++)

same here

Oops.

Quoted 10 lines
Quoted 10 lines
common/cmd_mem.c +10 -0
+#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(
Quoted 8 lines

common/cmd_mem.c U_BOOT_CMD( · line 1341

Quoted 5 lines
common/cmd_mem.c +5 -0
+	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?

Quoted 2 lines

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

#3 lore raw
Quoted 21 lines · On Saturday 25 July 2009 23:25:00 Robin Getz wrote:

On Sat 25 Jul 2009 22:49, Mike Frysinger pondered:

Quoted 11 lines · On Saturday 25 July 2009 16:07:49 Robin Getz wrote:
Quoted 10 lines
common/cmd_mem.c +10 -0
+#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(
Quoted 8 lines

common/cmd_mem.c U_BOOT_CMD( · line 1341

Quoted 5 lines
common/cmd_mem.c +5 -0
+	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.

Quoted 2 lines

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?

ive been merging them to reduce #ifdef noise
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090726/4aa056bc/attachment.pgp

#4 lore raw
In reply to Robin Getz

Dear Robin Getz,

Quoted 4 lines · In message <[email protected]> you wrote:

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?

Quoted 8 lines
Quoted 2 lines

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...

I'm not aware of an "official" preferred style. When adding to existing code, I recommend to copy what you find there.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
A person who is more than casually interested in computers should  be
well  schooled in machine language, since it is a fundamental part of
a computer.                                           -- Donald Knuth
author
#5 lore raw

PATCH 1/1 Add md5sum and sha1 commands...

In reply to Robin Getz

From: Robin Getz <[email protected]>

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

 README           |    4 ++
 common/cmd_mem.c |   68 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

---

README +4 -0
index 9071472..cf3867d 100644
@@ -629,6 +629,8 @@ The following options need to be configured:
 		CONFIG_CMD_KGDB		* kgdb
 		CONFIG_CMD_LOADB	  loadb
 		CONFIG_CMD_LOADS	  loads
+		CONFIG_CMD_MD5SUM	  print md5 message digest
+					  (requires CONFIG_CMD_MEMORY and CONFIG_MD5)
 		CONFIG_CMD_MEMORY	  md, mm, nm, mw, cp, cmp, crc, base,
 					  loop, loopw, mtest
 		CONFIG_CMD_MISC		  Misc functions like sleep etc
@@ -652,6 +654,8 @@ The following options need to be configured:
 					  (requires CONFIG_CMD_I2C)
 		CONFIG_CMD_SETGETDCR	  Support for DCR Register access
 					  (4xx only)
+		CONFIG_CMD_SHA1		  print sha1 memory digest
+					  (requires CONFIG_CMD_MEMORY)
 		CONFIG_CMD_SOURCE	  "source" command Support
 		CONFIG_CMD_SPI		* SPI serial bus support
 		CONFIG_CMD_USB		* USB support
common/cmd_mem.c +68 -0

86 lines not on this page · raw message

author
#6 lore raw

PATCH 1/1 Add md5sum and sha1 commands...

On Mon 27 Jul 2009 00:07, Robin Getz pondered:

Quoted 11 lines

From: Robin Getz <[email protected]>

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

 README           |    4 ++
 common/cmd_mem.c |   68 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

Wolfgang - was there anything wrong with this? or did you want me to send again?

#7 lore raw

PATCH 1/1 Add md5sum and sha1 commands...

Dear Robin Getz,

Quoted 4 lines · In message <[email protected]> you wrote:
Quoted 4 lines

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

Quoted 8 lines
Quoted 6 lines
 README           |    4 ++
 common/cmd_mem.c |   68 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)

Wolfgang - was there anything wrong with this? or did you want me to send again?

No, there is nothing wrog with it. Looks good to me. But it is new stuff, and the "next" branch is currently not so high on my priority list. Is this urgent to you?

Best regards,

Wolfgang Denk

Signature · 5 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
No question is too silly to ask. Of course, some  questions  are  too
silly to to answer...  - L. Wall & R. L. Schwartz, _Programming Perl_
author
#8 lore raw

PATCH 1/1 Add md5sum and sha1 commands...

On Tue 11 Aug 2009 15:21, Wolfgang Denk pondered:

Quoted 14 lines

Dear Robin Getz,

Quoted 11 lines · In message <[email protected]> you wrote:
Quoted 10 lines

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

 README           |    4 ++
 common/cmd_mem.c |   68 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+)
Quoted 6 lines
Quoted 2 lines

Wolfgang - was there anything wrong with this? or did you want me to send again?

No, there is nothing wrog with it. Looks good to me. But it is new stuff, and the "next" branch is currently not so high on my priority list. Is this urgent to you?

No - I was just going to update, and if I dropped it by accident (still learning git) - I wanted to make sure it was in your inbox...

:)

#9 lore raw

PATCH 1/1 Add md5sum and sha1 commands...

Quoted 13 lines · On Tuesday 11 August 2009 15:36:26 Robin Getz wrote:

On Tue 11 Aug 2009 15:21, Wolfgang Denk pondered:

Quoted 12 lines
Quoted 10 lines · Robin Getz
Quoted 7 lines

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

 README           |    4 ++
 common/cmd_mem.c |   68

Wolfgang - was there anything wrong with this? or did you want me to send again?

Quoted 6 lines
Quoted 3 lines

No, there is nothing wrog with it. Looks good to me. But it is new stuff, and the "next" branch is currently not so high on my priority list. Is this urgent to you?

No - I was just going to update, and if I dropped it by accident (still learning git) - I wanted to make sure it was in your inbox...

i stash patches in a dedicated branch or use git-format-patch and keep the result in ../patches/ so that i can git-am them if need be without ever losing them
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090813/44f718ba/attachment.pgp

#10 lore raw
In reply to Robin Getz

Dear Robin Getz,

Quoted 5 lines · In message <[email protected]> you wrote:

From: Robin Getz <[email protected]>

Now that we have sha1 and md5 in lib_generic, allow people to use them on the command line, for checking downloaded files

Quoted 7 lines
 README           |    4 ++
 common/cmd_mem.c |   73 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 77 insertions(+)

---

Applied to "next" branch.

Note that the statisctics lines are not part of the commit message, so they should go _below_ the '---' line.

Best regards,

Wolfgang Denk

Signature · 6 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Punishment becomes ineffective after a certain point. Men become  in-
sensitive.
	-- Eneg, "Patterns of Force", stardate 2534.7