crypto: shash - Fix async finup handling of null digest
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 <herbert@gondor.apana.org.au>
This commit is contained in:
parent
fa64966473
commit
cbc86b9161
@ -240,12 +240,17 @@ int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc)
|
|||||||
struct crypto_hash_walk walk;
|
struct crypto_hash_walk walk;
|
||||||
int nbytes;
|
int nbytes;
|
||||||
|
|
||||||
for (nbytes = crypto_hash_walk_first(req, &walk); nbytes > 0;
|
nbytes = crypto_hash_walk_first(req, &walk);
|
||||||
nbytes = crypto_hash_walk_done(&walk, nbytes))
|
if (!nbytes)
|
||||||
|
return crypto_shash_final(desc, req->result);
|
||||||
|
|
||||||
|
do {
|
||||||
nbytes = crypto_hash_walk_last(&walk) ?
|
nbytes = crypto_hash_walk_last(&walk) ?
|
||||||
crypto_shash_finup(desc, walk.data, nbytes,
|
crypto_shash_finup(desc, walk.data, nbytes,
|
||||||
req->result) :
|
req->result) :
|
||||||
crypto_shash_update(desc, walk.data, nbytes);
|
crypto_shash_update(desc, walk.data, nbytes);
|
||||||
|
nbytes = crypto_hash_walk_done(&walk, nbytes);
|
||||||
|
} while (nbytes > 0);
|
||||||
|
|
||||||
return nbytes;
|
return nbytes;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user