Add hash command to perform hashing using various algorithms
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>
diff --git a/README b/README
index 5810ced..4d9dd57 100644
--- a/README
+++ b/README
@@ -827,6 +827,7 @@
CONFIG_CMD_GETTIME * Get time since boot
CONFIG_CMD_GO * the 'go' command (exec code)
CONFIG_CMD_GREPENV * search environment
+ CONFIG_CMD_HASH * calculate hash / digest
CONFIG_CMD_HWFLOW * RTS/CTS hw flow control
CONFIG_CMD_I2C * I2C serial bus support
CONFIG_CMD_IDE * IDE harddisk support
@@ -2411,6 +2412,23 @@
A better solution is to properly configure the firewall,
but sometimes that is not allowed.
+- Hashing support:
+ CONFIG_CMD_HASH
+
+ This enables a generic 'hash' command which can produce
+ hashes / digests from a few algorithms (e.g. SHA1, SHA256).
+
+ CONFIG_HASH_VERIFY
+
+ Enable the hash verify command (hash -v). This adds to code
+ size a little.
+
+ CONFIG_SHA1 - support SHA1 hashing
+ CONFIG_SHA256 - support SHA256 hashing
+
+ Note: There is also a sha1sum command, which should perhaps
+ be deprecated in favour of 'hash sha1'.
+
- Show boot progress:
CONFIG_SHOW_BOOT_PROGRESS