diff options
author | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2017-12-29 17:49:13 +0100 |
---|---|---|
committer | Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> | 2017-12-29 17:49:13 +0100 |
commit | 59d9ddb192bc424cc53e52180478001af4fb99a4 (patch) | |
tree | 0abd8646ad5a39bf4993faf67e0200c6be6a5e13 /crypto/skcipher.c | |
parent | 1ca96e9695b6c448befcd0abacaf473458f22d1c (diff) | |
parent | d5abe860ac298ebe723b37a6f63a5b2d404fca60 (diff) | |
download | linux-crypto-59d9ddb192bc424cc53e52180478001af4fb99a4.tar.gz linux-crypto-59d9ddb192bc424cc53e52180478001af4fb99a4.zip |
Merge tag 'v4.15-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into fbdev-for-next
Linux 4.15-rc5
Diffstat (limited to '')
-rw-r--r-- | crypto/skcipher.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c index 4faa0fd5..11af5fd6 100644 --- a/crypto/skcipher.c +++ b/crypto/skcipher.c @@ -426,14 +426,9 @@ static int skcipher_copy_iv(struct skcipher_walk *walk) static int skcipher_walk_first(struct skcipher_walk *walk) { - walk->nbytes = 0; - if (WARN_ON_ONCE(in_irq())) return -EDEADLK; - if (unlikely(!walk->total)) - return 0; - walk->buffer = NULL; if (unlikely(((unsigned long)walk->iv & walk->alignmask))) { int err = skcipher_copy_iv(walk); @@ -452,13 +447,17 @@ static int skcipher_walk_skcipher(struct skcipher_walk *walk, { struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req); - scatterwalk_start(&walk->in, req->src); - scatterwalk_start(&walk->out, req->dst); - walk->total = req->cryptlen; + walk->nbytes = 0; walk->iv = req->iv; walk->oiv = req->iv; + if (unlikely(!walk->total)) + return 0; + + scatterwalk_start(&walk->in, req->src); + scatterwalk_start(&walk->out, req->dst); + walk->flags &= ~SKCIPHER_WALK_SLEEP; walk->flags |= req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP ? SKCIPHER_WALK_SLEEP : 0; @@ -509,6 +508,13 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk, struct crypto_aead *tfm = crypto_aead_reqtfm(req); int err; + walk->nbytes = 0; + walk->iv = req->iv; + walk->oiv = req->iv; + + if (unlikely(!walk->total)) + return 0; + walk->flags &= ~SKCIPHER_WALK_PHYS; scatterwalk_start(&walk->in, req->src); @@ -517,8 +523,8 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk, scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2); scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2); - walk->iv = req->iv; - walk->oiv = req->iv; + scatterwalk_done(&walk->in, 0, walk->total); + scatterwalk_done(&walk->out, 0, walk->total); if (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) walk->flags |= SKCIPHER_WALK_SLEEP; |