mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-05 19:31:57 -04:00
BACKPORT: 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>. Change-Id: I644073a52d964f4c641a089cd42b9085d5454d5f Signed-off-by: Eric Biggers <ebiggers@google.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
30118db4b2
commit
39c446881b
7 changed files with 40 additions and 34 deletions
|
|
@ -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));
|
||||
|
|
|
|||
Loading…
Reference in a new issue