Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371106
b: refs/heads/master
c: 35d2c9d
h: refs/heads/master
v: v3
  • Loading branch information
Tim Chen authored and Herbert Xu committed Apr 3, 2013
1 parent e6e4620 commit 1607ee6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 873b9cafa8cae695d92f0faabe7166af10078b78
refs/heads/master: 35d2c9d0c3cfd90850dc647250610587743e1f29
11 changes: 6 additions & 5 deletions trunk/crypto/sha256_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ static int sha256_init(struct shash_desc *desc)
return 0;
}

static int sha256_update(struct shash_desc *desc, const u8 *data,
int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha256_state *sctx = shash_desc_ctx(desc);
Expand Down Expand Up @@ -277,6 +277,7 @@ static int sha256_update(struct shash_desc *desc, const u8 *data,

return 0;
}
EXPORT_SYMBOL(crypto_sha256_update);

static int sha256_final(struct shash_desc *desc, u8 *out)
{
Expand All @@ -293,10 +294,10 @@ static int sha256_final(struct shash_desc *desc, u8 *out)
/* Pad out to 56 mod 64. */
index = sctx->count & 0x3f;
pad_len = (index < 56) ? (56 - index) : ((64+56) - index);
sha256_update(desc, padding, pad_len);
crypto_sha256_update(desc, padding, pad_len);

/* Append length (before padding) */
sha256_update(desc, (const u8 *)&bits, sizeof(bits));
crypto_sha256_update(desc, (const u8 *)&bits, sizeof(bits));

/* Store state in digest */
for (i = 0; i < 8; i++)
Expand Down Expand Up @@ -339,7 +340,7 @@ static int sha256_import(struct shash_desc *desc, const void *in)
static struct shash_alg sha256_algs[2] = { {
.digestsize = SHA256_DIGEST_SIZE,
.init = sha256_init,
.update = sha256_update,
.update = crypto_sha256_update,
.final = sha256_final,
.export = sha256_export,
.import = sha256_import,
Expand All @@ -355,7 +356,7 @@ static struct shash_alg sha256_algs[2] = { {
}, {
.digestsize = SHA224_DIGEST_SIZE,
.init = sha224_init,
.update = sha256_update,
.update = crypto_sha256_update,
.final = sha224_final,
.descsize = sizeof(struct sha256_state),
.base = {
Expand Down
2 changes: 2 additions & 0 deletions trunk/include/crypto/sha.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,6 @@ struct shash_desc;
extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,
unsigned int len);

extern int crypto_sha256_update(struct shash_desc *desc, const u8 *data,
unsigned int len);
#endif

0 comments on commit 1607ee6

Please sign in to comment.