aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crypto/sha256_generic.c11
-rw-r--r--include/crypto/sha.h2
2 files changed, 8 insertions, 5 deletions
diff --git a/crypto/sha256_generic.c b/crypto/sha256_generic.c
index c3ed4ec924e1..543366779524 100644
--- a/crypto/sha256_generic.c
+++ b/crypto/sha256_generic.c
@@ -246,7 +246,7 @@ static int sha256_init(struct shash_desc *desc)
246 return 0; 246 return 0;
247} 247}
248 248
249static int sha256_update(struct shash_desc *desc, const u8 *data, 249int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
250 unsigned int len) 250 unsigned int len)
251{ 251{
252 struct sha256_state *sctx = shash_desc_ctx(desc); 252 struct sha256_state *sctx = shash_desc_ctx(desc);
@@ -277,6 +277,7 @@ static int sha256_update(struct shash_desc *desc, const u8 *data,
277 277
278 return 0; 278 return 0;
279} 279}
280EXPORT_SYMBOL(crypto_sha256_update);
280 281
281static int sha256_final(struct shash_desc *desc, u8 *out) 282static int sha256_final(struct shash_desc *desc, u8 *out)
282{ 283{
@@ -293,10 +294,10 @@ static int sha256_final(struct shash_desc *desc, u8 *out)
293 /* Pad out to 56 mod 64. */ 294 /* Pad out to 56 mod 64. */
294 index = sctx->count & 0x3f; 295 index = sctx->count & 0x3f;
295 pad_len = (index < 56) ? (56 - index) : ((64+56) - index); 296 pad_len = (index < 56) ? (56 - index) : ((64+56) - index);
296 sha256_update(desc, padding, pad_len); 297 crypto_sha256_update(desc, padding, pad_len);
297 298
298 /* Append length (before padding) */ 299 /* Append length (before padding) */
299 sha256_update(desc, (const u8 *)&bits, sizeof(bits)); 300 crypto_sha256_update(desc, (const u8 *)&bits, sizeof(bits));
300 301
301 /* Store state in digest */ 302 /* Store state in digest */
302 for (i = 0; i < 8; i++) 303 for (i = 0; i < 8; i++)
@@ -339,7 +340,7 @@ static int sha256_import(struct shash_desc *desc, const void *in)
339static struct shash_alg sha256_algs[2] = { { 340static struct shash_alg sha256_algs[2] = { {
340 .digestsize = SHA256_DIGEST_SIZE, 341 .digestsize = SHA256_DIGEST_SIZE,
341 .init = sha256_init, 342 .init = sha256_init,
342 .update = sha256_update, 343 .update = crypto_sha256_update,
343 .final = sha256_final, 344 .final = sha256_final,
344 .export = sha256_export, 345 .export = sha256_export,
345 .import = sha256_import, 346 .import = sha256_import,
@@ -355,7 +356,7 @@ static struct shash_alg sha256_algs[2] = { {
355}, { 356}, {
356 .digestsize = SHA224_DIGEST_SIZE, 357 .digestsize = SHA224_DIGEST_SIZE,
357 .init = sha224_init, 358 .init = sha224_init,
358 .update = sha256_update, 359 .update = crypto_sha256_update,
359 .final = sha224_final, 360 .final = sha224_final,
360 .descsize = sizeof(struct sha256_state), 361 .descsize = sizeof(struct sha256_state),
361 .base = { 362 .base = {
diff --git a/include/crypto/sha.h b/include/crypto/sha.h
index c6c9c1fe460c..f46ff61e3780 100644
--- a/include/crypto/sha.h
+++ b/include/crypto/sha.h
@@ -87,4 +87,6 @@ struct shash_desc;
87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data, 87extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
88 unsigned int len); 88 unsigned int len);
89 89
90extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
91 unsigned int len);
90#endif 92#endif