aboutsummaryrefslogtreecommitdiff
path: root/crypto/authencesn.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2017-09-24 22:45:01 -0700
committerAlex Shi <alex.shi@linaro.org>2017-09-24 22:45:01 -0700
commit1cfb9d628fa24c0a8b24cd604ae62dfa10a0d716 (patch)
tree4e57e7465ce5fbc2a6cc838fd78e5e8a2b9799ff /crypto/authencesn.c
parentd595150285cf886cf2399fd74b0eeb43b444c706 (diff)
parent7ecc9777c5c76d7b31c376ffd4f59c4a85472a1b (diff)
Merge branch 'linux-linaro-lsk-v4.9' into v4.9/topic/ionv4.9/topic/ion
Diffstat (limited to 'crypto/authencesn.c')
-rw-r--r--crypto/authencesn.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/crypto/authencesn.c b/crypto/authencesn.c
index 121010ac9962..18c94e1c31d1 100644
--- a/crypto/authencesn.c
+++ b/crypto/authencesn.c
@@ -248,6 +248,9 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
u8 *ihash = ohash + crypto_ahash_digestsize(auth);
u32 tmp[2];
+ if (!authsize)
+ goto decrypt;
+
/* Move high-order bits of sequence number back. */
scatterwalk_map_and_copy(tmp, dst, 4, 4, 0);
scatterwalk_map_and_copy(tmp + 1, dst, assoclen + cryptlen, 4, 0);
@@ -256,6 +259,8 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
if (crypto_memneq(ihash, ohash, authsize))
return -EBADMSG;
+decrypt:
+
sg_init_table(areq_ctx->dst, 2);
dst = scatterwalk_ffwd(areq_ctx->dst, dst, assoclen);