
Hi,
On Sun, Feb 24, 2013 at 7:33 PM, Simon Glass sjg@chromium.org wrote:
Add the CRC32 algorithm to the list of available hashes, and make the crc32 command use hash_command(). Add a new crc32_wd_buf() to make this possible, which puts its result in a buffer rather than returning it as a 32-bit value.
Note: For some boards the hash command is not enabled, neither are sha1, sha256 or the verify option. In this case the full hash implementation adds about 500 bytes of overhead. So as a special case, we use #ifdef to select very simple bahaviour in that case. The justification for this is that it is currently a very common case (virtually all boards enable crc32 but only some enable more advanced features).
Signed-off-by: Simon Glass sjg@chromium.org
Changes in v3:
- Fix 'bahviour' typo
- Make sha1 code dependent on CONFIG_CMD_SHA1, for code size reasons
Changes in v2:
- Rewrite crc32 support in hash to improve code size
common/cmd_mem.c | 75 +++----------------------------- common/hash.c | 118 ++++++++++++++++++++++++++++++++++----------------- include/hash.h | 2 +- include/u-boot/crc.h | 11 +++++ lib/crc32.c | 9 ++++ 5 files changed, 108 insertions(+), 107 deletions(-)
...
diff --git a/common/hash.c b/common/hash.c index 462853d..2617316 100644 --- a/common/hash.c +++ b/common/hash.c @@ -34,13 +34,19 @@
- crypto could perhaps add named version of these algorithms here.
*/ static struct hash_algo hash_algo[] = { -#ifdef CONFIG_SHA1
/*
* This is CONFIG_CMD_SHA1 instead of CONFIG_SHA1 since otherwise it
* bloats the code for boards which use SHA1 but not the 'hash'
* or 'sha1sum' commands.
*/
+#ifdef CONFIG_CMD_SHA1
Unfortunately this is completely wrong - it should be CONFIG_CMD_SHA1SUM. I will update with a new patch once my build complete.
Regards, Simon