Skip to content

Commit

Permalink
Merge branch 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git…
Browse files Browse the repository at this point in the history
…/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
  • Loading branch information
Linus Torvalds committed Dec 15, 2015
2 parents 173ae9b + 70d906b commit ca43444
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion crypto/ablkcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -277,12 +277,12 @@ static int ablkcipher_walk_first(struct ablkcipher_request *req,
if (WARN_ON_ONCE(in_irq()))
return -EDEADLK;

walk->iv = req->info;
walk->nbytes = walk->total;
if (unlikely(!walk->total))
return 0;

walk->iv_buffer = NULL;
walk->iv = req->info;
if (unlikely(((unsigned long)walk->iv & alignmask))) {
int err = ablkcipher_copy_iv(walk, tfm, alignmask);

Expand Down
2 changes: 1 addition & 1 deletion crypto/blkcipher.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,12 +326,12 @@ static int blkcipher_walk_first(struct blkcipher_desc *desc,
if (WARN_ON_ONCE(in_irq()))
return -EDEADLK;

walk->iv = desc->info;
walk->nbytes = walk->total;
if (unlikely(!walk->total))
return 0;

walk->buffer = NULL;
walk->iv = desc->info;
if (unlikely(((unsigned long)walk->iv & walk->alignmask))) {
int err = blkcipher_copy_iv(walk);
if (err)
Expand Down

0 comments on commit ca43444

Please sign in to comment.