Skip to content

Commit

Permalink
crypto: shash - Fix async finup handling of null digest
Browse files Browse the repository at this point in the history
When shash_ahash_finup encounters a null request, we end up not
calling the underlying final function.  This patch fixes that.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Jul 15, 2009
1 parent fa64966 commit cbc86b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crypto/shash.c
Original file line number Diff line number Diff line change
Expand Up @@ -240,12 +240,17 @@ int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc)
struct crypto_hash_walk walk;
int nbytes;

for (nbytes = crypto_hash_walk_first(req, &walk); nbytes > 0;
nbytes = crypto_hash_walk_done(&walk, nbytes))
nbytes = crypto_hash_walk_first(req, &walk);
if (!nbytes)
return crypto_shash_final(desc, req->result);

do {
nbytes = crypto_hash_walk_last(&walk) ?
crypto_shash_finup(desc, walk.data, nbytes,
req->result) :
crypto_shash_update(desc, walk.data, nbytes);
nbytes = crypto_hash_walk_done(&walk, nbytes);
} while (nbytes > 0);

return nbytes;
}
Expand Down

0 comments on commit cbc86b9

Please sign in to comment.