summaryrefslogtreecommitdiff
path: root/include/hash.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2013-02-24 17:33:26 +0000
committerSimon Glass <sjg@chromium.org>2013-02-28 19:09:23 -0800
commitd5b76673a5dfe0b5250baea3c36cdfa7a9fd5230 (patch)
tree70e8af37b0ecd53b92336afe52c9515647e0ea55 /include/hash.h
parent0ccff500cf787bb71e514eb2904d773ec84bf11d (diff)
downloadu-boot-imx-d5b76673a5dfe0b5250baea3c36cdfa7a9fd5230.zip
u-boot-imx-d5b76673a5dfe0b5250baea3c36cdfa7a9fd5230.tar.gz
u-boot-imx-d5b76673a5dfe0b5250baea3c36cdfa7a9fd5230.tar.bz2
hash: Add a flag to support saving hashes in the environment
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>
Diffstat (limited to 'include/hash.h')
-rw-r--r--include/hash.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/hash.h b/include/hash.h
index 34ba558..88fa2b5 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -51,19 +51,24 @@ struct hash_algo {
*/
#define HASH_MAX_DIGEST_SIZE 32
+enum {
+ HASH_FLAG_VERIFY = 1 << 0, /* Enable verify mode */
+ HASH_FLAG_ENV = 1 << 1, /* Allow env vars */
+};
+
/**
* hash_command: Process a hash command for a particular algorithm
*
* This common function is used to implement specific hash commands.
*
* @algo_name: Hash algorithm being used
- * @verify: Non-zero to enable verify mode
+ * @flags: Flags value (HASH_FLAG_...)
* @cmdtp: Pointer to command table entry
* @flag: Some flags normally 0 (see CMD_FLAG_.. above)
* @argc: Number of arguments (arg 0 must be the command text)
* @argv: Arguments
*/
-int hash_command(const char *algo_name, int verify, cmd_tbl_t *cmdtp, int flag,
+int hash_command(const char *algo_name, int flags, cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[]);
#endif