aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/shash.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-07-15 09:26:41 -0400
committerHerbert Xu <herbert@gondor.apana.org.au>2009-07-15 09:26:41 -0400
commitcbc86b9161b40f95caee0e56381b68956fc28cc4 (patch)
tree0170d3692f1bd5aadf07a219641f0658877cbfdd /crypto/shash.c
parentfa64966473830219fe74952029ddb0e981a87749 (diff)
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>
Diffstat (limited to 'crypto/shash.c')
-rw-r--r--crypto/shash.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/crypto/shash.c b/crypto/shash.c
index 834d9d24cdae..7713b520bc98 100644
--- a/crypto/shash.c
+++ b/crypto/shash.c
@@ -240,12 +240,17 @@ int shash_ahash_finup(struct ahash_request *req, struct shash_desc *desc)
240 struct crypto_hash_walk walk; 240 struct crypto_hash_walk walk;
241 int nbytes; 241 int nbytes;
242 242
243 for (nbytes = crypto_hash_walk_first(req, &walk); nbytes > 0; 243 nbytes = crypto_hash_walk_first(req, &walk);
244 nbytes = crypto_hash_walk_done(&walk, nbytes)) 244 if (!nbytes)
245 return crypto_shash_final(desc, req->result);
246
247 do {
245 nbytes = crypto_hash_walk_last(&walk) ? 248 nbytes = crypto_hash_walk_last(&walk) ?
246 crypto_shash_finup(desc, walk.data, nbytes, 249 crypto_shash_finup(desc, walk.data, nbytes,
247 req->result) : 250 req->result) :
248 crypto_shash_update(desc, walk.data, nbytes); 251 crypto_shash_update(desc, walk.data, nbytes);
252 nbytes = crypto_hash_walk_done(&walk, nbytes);
253 } while (nbytes > 0);
249 254
250 return nbytes; 255 return nbytes;
251} 256}