summaryrefslogtreecommitdiff
path: root/crypto/sha1_generic.c
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-02 21:24:25 +0300
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-08 08:32:17 +0300
commit6b0b0fa2bce61db790efc8070ae6e5696435b0a8 (patch)
treee849f9c027696010b95ebec127d4b4b86196f8f8 /crypto/sha1_generic.c
parent4d21e594508c9dca0a51e41a684e16cb5c420c36 (diff)
downloadlinux-6b0b0fa2bce61db790efc8070ae6e5696435b0a8.tar.xz
crypto: lib/sha1 - rename "sha" to "sha1"
The library implementation of the SHA-1 compression function is confusingly called just "sha_transform()". Alongside it are some "SHA_" constants and "sha_init()". Presumably these are left over from a time when SHA just meant SHA-1. But now there are also SHA-2 and SHA-3, and moreover SHA-1 is now considered insecure and thus shouldn't be used. Therefore, rename these functions and constants to make it very clear that they are for SHA-1. Also add a comment to make it clear that these shouldn't be used. For the extra-misleadingly named "SHA_MESSAGE_BYTES", rename it to SHA1_BLOCK_SIZE and define it to just '64' rather than '(512/8)' so that it matches the same definition in <crypto/sha.h>. This prepares for merging <linux/cryptohash.h> into <crypto/sha.h>. Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto/sha1_generic.c')
-rw-r--r--crypto/sha1_generic.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/crypto/sha1_generic.c b/crypto/sha1_generic.c
index 7c57b844c382..a16d9787dcd2 100644
--- a/crypto/sha1_generic.c
+++ b/crypto/sha1_generic.c
@@ -31,10 +31,10 @@ EXPORT_SYMBOL_GPL(sha1_zero_message_hash);
static void sha1_generic_block_fn(struct sha1_state *sst, u8 const *src,
int blocks)
{
- u32 temp[SHA_WORKSPACE_WORDS];
+ u32 temp[SHA1_WORKSPACE_WORDS];
while (blocks--) {
- sha_transform(sst->state, src, temp);
+ sha1_transform(sst->state, src, temp);
src += SHA1_BLOCK_SIZE;
}
memzero_explicit(temp, sizeof(temp));