Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 371111
b: refs/heads/master
c: bf70fa9
h: refs/heads/master
i:
  371109: 0cabfc8
  371107: ad6971f
  371103: 997c46f
v: v3
  • Loading branch information
Tim Chen authored and Herbert Xu committed Apr 25, 2013
1 parent cf3ed7d commit cc0c35c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 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: 8275d1aa642295edd34a11a117080384bb9d65c2
refs/heads/master: bf70fa9d9ee07aa175453b19a39b2b9dab602d97
13 changes: 7 additions & 6 deletions trunk/crypto/sha512_generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ sha384_init(struct shash_desc *desc)
return 0;
}

static int
sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)
int crypto_sha512_update(struct shash_desc *desc, const u8 *data,
unsigned int len)
{
struct sha512_state *sctx = shash_desc_ctx(desc);

Expand Down Expand Up @@ -197,6 +197,7 @@ sha512_update(struct shash_desc *desc, const u8 *data, unsigned int len)

return 0;
}
EXPORT_SYMBOL(crypto_sha512_update);

static int
sha512_final(struct shash_desc *desc, u8 *hash)
Expand All @@ -215,10 +216,10 @@ sha512_final(struct shash_desc *desc, u8 *hash)
/* Pad out to 112 mod 128. */
index = sctx->count[0] & 0x7f;
pad_len = (index < 112) ? (112 - index) : ((128+112) - index);
sha512_update(desc, padding, pad_len);
crypto_sha512_update(desc, padding, pad_len);

/* Append length (before padding) */
sha512_update(desc, (const u8 *)bits, sizeof(bits));
crypto_sha512_update(desc, (const u8 *)bits, sizeof(bits));

/* Store state in digest */
for (i = 0; i < 8; i++)
Expand All @@ -245,7 +246,7 @@ static int sha384_final(struct shash_desc *desc, u8 *hash)
static struct shash_alg sha512_algs[2] = { {
.digestsize = SHA512_DIGEST_SIZE,
.init = sha512_init,
.update = sha512_update,
.update = crypto_sha512_update,
.final = sha512_final,
.descsize = sizeof(struct sha512_state),
.base = {
Expand All @@ -257,7 +258,7 @@ static struct shash_alg sha512_algs[2] = { {
}, {
.digestsize = SHA384_DIGEST_SIZE,
.init = sha384_init,
.update = sha512_update,
.update = crypto_sha512_update,
.final = sha384_final,
.descsize = sizeof(struct sha512_state),
.base = {
Expand Down
3 changes: 3 additions & 0 deletions trunk/include/crypto/sha.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,7 @@ extern int crypto_sha1_update(struct shash_desc *desc, const u8 *data,

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

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

0 comments on commit cc0c35c

Please sign in to comment.