summaryrefslogtreecommitdiff
path: root/common/cmd_hash.c
AgeCommit message (Collapse)Author
2014-12-29Fix hash verificationNikolay Dimitrov
Fix issue in parse_verify_sum() which swaps handling of env-var and *address. Move hash_command() argc check earlier. Cosmetic change on do_hash() variable declaration. Improved help message for "hash" command. Signed-off-by: Nikolay Dimitrov <picmaster@mail.bg> Reviewed-by: Simon Glass <sjg@chromium.org>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-02-28hash: Use lower case for hash algorithm namesSimon Glass
Rather than use strcasecmp() in the hash algorithm search, require the caller to do this first. Most of U-Boot can use lower case anyway, and the hash command can convert to lower case before calling hash_command(). This saves needing strcasecmp() for boards that use hashing but not the hash command. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-02-28hash: Add a flag to support saving hashes in the environmentSimon Glass
Some hashing commands permit saving the hash in an environment variable, and verifying a hash from there. But the crc32 command does not support this. In order to permit crc32 to use the generic hashing infrastructure, add a flag to select which behaviour to use. Signed-off-by: Simon Glass <sjg@chromium.org>
2013-02-28Tidy up error checking and fix bug in hash commandSimon Glass
There are two problems: 1. The argument count needs to be checked before argv is used 2. When verify is not enabled, we need to define a constant zero value Signed-off-by: Simon Glass <sjg@chromium.org>
2012-12-11Add hash command to perform hashing using various algorithmsSimon Glass
This new command supports hashing SHA1 and SHA256. It could be extended to others such as MD5 and the CRC algorithms. The syntax is modeled on those: hash <algorithm> <address> <length> [*<dest_addr> | <dest_envvar>] to calculate a hash, and: hash -v <algorithm> <address> <length> [*<verify_addr> | <verify_envvar>] to verify a hash. Use CONFIG_CMD_HASH to enable the command, CONFIG_SHA1 to enable SHA1 and CONFIG_SHA256 to enable SHA256. The existing sha1sum command remains. Signed-off-by: Simon Glass <sjg@chromium.org>