diff options
author | Simon Glass <sjg@chromium.org> | 2013-02-24 17:33:32 +0000 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2013-02-28 19:49:13 -0800 |
commit | 218da0f35f4b5e5bf13d3dba6d975d4d5d65516f (patch) | |
tree | 0601a777e77d4c582882426e5aefcd3541032be5 /common/hash.c | |
parent | bd091b67d0ef2959ed0ff2aa6575ddb0d21c1f71 (diff) | |
download | u-boot-imx-218da0f35f4b5e5bf13d3dba6d975d4d5d65516f.zip u-boot-imx-218da0f35f4b5e5bf13d3dba6d975d4d5d65516f.tar.gz u-boot-imx-218da0f35f4b5e5bf13d3dba6d975d4d5d65516f.tar.bz2 |
hash: Use lower case for hash algorithm names
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>
Diffstat (limited to 'common/hash.c')
-rw-r--r-- | common/hash.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/common/hash.c b/common/hash.c index 0d04c4c..f5badcb 100644 --- a/common/hash.c +++ b/common/hash.c @@ -32,7 +32,8 @@ /* * These are the hash algorithms we support. Chips which support accelerated - * crypto could perhaps add named version of these algorithms here. + * crypto could perhaps add named version of these algorithms here. Note that + * algorithm names must be in lower case. */ static struct hash_algo hash_algo[] = { /* @@ -42,7 +43,7 @@ static struct hash_algo hash_algo[] = { */ #ifdef CONFIG_CMD_SHA1SUM { - "SHA1", + "sha1", SHA1_SUM_LEN, sha1_csum_wd, CHUNKSZ_SHA1, @@ -51,7 +52,7 @@ static struct hash_algo hash_algo[] = { #endif #ifdef CONFIG_SHA256 { - "SHA256", + "sha256", SHA256_SUM_LEN, sha256_csum_wd, CHUNKSZ_SHA256, @@ -59,7 +60,7 @@ static struct hash_algo hash_algo[] = { #define MULTI_HASH #endif { - "CRC32", + "crc32", 4, crc32_wd_buf, CHUNKSZ_CRC32, @@ -202,7 +203,7 @@ static struct hash_algo *find_hash_algo(const char *name) int i; for (i = 0; i < ARRAY_SIZE(hash_algo); i++) { - if (!strcasecmp(name, hash_algo[i].name)) + if (!strcmp(name, hash_algo[i].name)) return &hash_algo[i]; } |