diff options
Diffstat (limited to 'crypto/shash.c')
-rw-r--r-- | crypto/shash.c | 9 |
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 | } |