Skip to content

Commit 96ede30

Browse files
uudiinherbertx
authored andcommitted
crypto: sha256 - remove duplicate generic hash init function
crypto_sha256_init() and sha256_base_init() are the same repeated implementations, remove the crypto_sha256_init() in generic implementation, sha224 is the same process. Signed-off-by: Tianjia Zhang <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 908dffa commit 96ede30

File tree

1 file changed

+2
-14
lines changed

1 file changed

+2
-14
lines changed

crypto/sha256_generic.c

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ const u8 sha256_zero_message_hash[SHA256_DIGEST_SIZE] = {
3333
};
3434
EXPORT_SYMBOL_GPL(sha256_zero_message_hash);
3535

36-
static int crypto_sha256_init(struct shash_desc *desc)
37-
{
38-
sha256_init(shash_desc_ctx(desc));
39-
return 0;
40-
}
41-
42-
static int crypto_sha224_init(struct shash_desc *desc)
43-
{
44-
sha224_init(shash_desc_ctx(desc));
45-
return 0;
46-
}
47-
4836
int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
4937
unsigned int len)
5038
{
@@ -72,7 +60,7 @@ EXPORT_SYMBOL(crypto_sha256_finup);
7260

7361
static struct shash_alg sha256_algs[2] = { {
7462
.digestsize = SHA256_DIGEST_SIZE,
75-
.init = crypto_sha256_init,
63+
.init = sha256_base_init,
7664
.update = crypto_sha256_update,
7765
.final = crypto_sha256_final,
7866
.finup = crypto_sha256_finup,
@@ -86,7 +74,7 @@ static struct shash_alg sha256_algs[2] = { {
8674
}
8775
}, {
8876
.digestsize = SHA224_DIGEST_SIZE,
89-
.init = crypto_sha224_init,
77+
.init = sha224_base_init,
9078
.update = crypto_sha256_update,
9179
.final = crypto_sha256_final,
9280
.finup = crypto_sha256_finup,

0 commit comments

Comments
 (0)