summaryrefslogtreecommitdiff
path: root/crypto/skcipher.c
diff options
context:
space:
mode:
authorJames Morris <james.l.morris@oracle.com>2017-12-11 17:01:08 +1100
committerJames Morris <james.l.morris@oracle.com>2017-12-11 17:01:08 +1100
commit4a06f454768a7e11e8f10b900b450786546cbba1 (patch)
tree149f57c9ce794734883e326d63040b1381dc1a59 /crypto/skcipher.c
parentfe6ec4634c4b41ea65f055ea709a6f3d5bf67bec (diff)
parent8dce1988dfaa3668372990f05ee2202d9d9521b5 (diff)
downloadlinux-crypto-4a06f454768a7e11e8f10b900b450786546cbba1.tar.gz
linux-crypto-4a06f454768a7e11e8f10b900b450786546cbba1.zip
Sync to v4.15-rc3 for security subsystem developers to work against.
Diffstat (limited to 'crypto/skcipher.c')
-rw-r--r--crypto/skcipher.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/crypto/skcipher.c b/crypto/skcipher.c
index 4faa0fd5..778e0ff4 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,10 +447,15 @@ static int skcipher_walk_skcipher(struct skcipher_walk *walk,
{
struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
+ walk->total = req->cryptlen;
+ walk->nbytes = 0;
+
+ if (unlikely(!walk->total))
+ return 0;
+
scatterwalk_start(&walk->in, req->src);
scatterwalk_start(&walk->out, req->dst);
- walk->total = req->cryptlen;
walk->iv = req->iv;
walk->oiv = req->iv;
@@ -509,6 +509,11 @@ static int skcipher_walk_aead_common(struct skcipher_walk *walk,
struct crypto_aead *tfm = crypto_aead_reqtfm(req);
int err;
+ walk->nbytes = 0;
+
+ if (unlikely(!walk->total))
+ return 0;
+
walk->flags &= ~SKCIPHER_WALK_PHYS;
scatterwalk_start(&walk->in, req->src);
@@ -517,6 +522,9 @@ 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);
+ scatterwalk_done(&walk->in, 0, walk->total);
+ scatterwalk_done(&walk->out, 0, walk->total);
+
walk->iv = req->iv;
walk->oiv = req->iv;