aboutsummaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2009-01-15 22:40:54 -0500
committerHerbert Xu <herbert@gondor.apana.org.au>2009-01-27 01:11:13 -0500
commitbac1b5c4696f217afeac5b29874a337bc39da717 (patch)
tree7e13f7953ea27cff00ef5e45a3fd8e7dac4ea95a /crypto
parent29b37f42127f7da511560a40ea74f5047da40c13 (diff)
crypto: blkcipher - Fix WARN_ON handling in walk_done
When we get left-over bits from a slow walk, it means that the underlying cipher has gone troppo. However, as we're handling that case we should ensure that the caller terminates the walk. This patch does this by setting walk->nbytes to zero. Reported-by: Roel Kluin <roel.kluin@gmail.com> Reported-by: Huang Ying <ying.huang@intel.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/blkcipher.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c
index 4a7e65c4df4d..d70a41c002df 100644
--- a/crypto/blkcipher.c
+++ b/crypto/blkcipher.c
@@ -124,6 +124,7 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
124 scatterwalk_done(&walk->in, 0, nbytes); 124 scatterwalk_done(&walk->in, 0, nbytes);
125 scatterwalk_done(&walk->out, 1, nbytes); 125 scatterwalk_done(&walk->out, 1, nbytes);
126 126
127err:
127 walk->total = nbytes; 128 walk->total = nbytes;
128 walk->nbytes = nbytes; 129 walk->nbytes = nbytes;
129 130
@@ -132,7 +133,6 @@ int blkcipher_walk_done(struct blkcipher_desc *desc,
132 return blkcipher_walk_next(desc, walk); 133 return blkcipher_walk_next(desc, walk);
133 } 134 }
134 135
135err:
136 if (walk->iv != desc->info) 136 if (walk->iv != desc->info)
137 memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm)); 137 memcpy(desc->info, walk->iv, crypto_blkcipher_ivsize(tfm));
138 if (walk->buffer != walk->page) 138 if (walk->buffer != walk->page)