diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-15 13:21:04 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-12-15 13:21:04 -0500 |
| commit | ca43444e4342e9ce38202fb1082d38a7afa8f977 (patch) | |
| tree | 3400d3466c252957ead4c87a19e5784cd1bf299c | |
| parent | 173ae9ba63349194ae180622f05fb49f55a4df46 (diff) | |
| parent | 70d906bc17500edfa9bdd8c8b7e59618c7911613 (diff) | |
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
Pull crypto fix from Herbert Xu:
"This fixes a boundary condition in the blkcipher SG walking code that
can lead to a crash when used with the new chacha20 algorithm"
* 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
crypto: skcipher - Copy iv from desc even for 0-len walks
| -rw-r--r-- | crypto/ablkcipher.c | 2 | ||||
| -rw-r--r-- | crypto/blkcipher.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/crypto/ablkcipher.c b/crypto/ablkcipher.c index b4ffc5be1a93..e5b5721809e2 100644 --- a/crypto/ablkcipher.c +++ b/crypto/ablkcipher.c | |||
| @@ -277,12 +277,12 @@ static int ablkcipher_walk_first(struct ablkcipher_request *req, | |||
| 277 | if (WARN_ON_ONCE(in_irq())) | 277 | if (WARN_ON_ONCE(in_irq())) |
| 278 | return -EDEADLK; | 278 | return -EDEADLK; |
| 279 | 279 | ||
| 280 | walk->iv = req->info; | ||
| 280 | walk->nbytes = walk->total; | 281 | walk->nbytes = walk->total; |
| 281 | if (unlikely(!walk->total)) | 282 | if (unlikely(!walk->total)) |
| 282 | return 0; | 283 | return 0; |
| 283 | 284 | ||
| 284 | walk->iv_buffer = NULL; | 285 | walk->iv_buffer = NULL; |
| 285 | walk->iv = req->info; | ||
| 286 | if (unlikely(((unsigned long)walk->iv & alignmask))) { | 286 | if (unlikely(((unsigned long)walk->iv & alignmask))) { |
| 287 | int err = ablkcipher_copy_iv(walk, tfm, alignmask); | 287 | int err = ablkcipher_copy_iv(walk, tfm, alignmask); |
| 288 | 288 | ||
diff --git a/crypto/blkcipher.c b/crypto/blkcipher.c index 11b981492031..8cc1622b2ee0 100644 --- a/crypto/blkcipher.c +++ b/crypto/blkcipher.c | |||
| @@ -326,12 +326,12 @@ static int blkcipher_walk_first(struct blkcipher_desc *desc, | |||
| 326 | if (WARN_ON_ONCE(in_irq())) | 326 | if (WARN_ON_ONCE(in_irq())) |
| 327 | return -EDEADLK; | 327 | return -EDEADLK; |
| 328 | 328 | ||
| 329 | walk->iv = desc->info; | ||
| 329 | walk->nbytes = walk->total; | 330 | walk->nbytes = walk->total; |
| 330 | if (unlikely(!walk->total)) | 331 | if (unlikely(!walk->total)) |
| 331 | return 0; | 332 | return 0; |
| 332 | 333 | ||
| 333 | walk->buffer = NULL; | 334 | walk->buffer = NULL; |
| 334 | walk->iv = desc->info; | ||
| 335 | if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { | 335 | if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { |
| 336 | int err = blkcipher_copy_iv(walk); | 336 | int err = blkcipher_copy_iv(walk); |
| 337 | if (err) | 337 | if (err) |
