summaryrefslogtreecommitdiff
path: root/crypto/ccm.c
diff options
context:
space:
mode:
authorMark Brown <broonie@linaro.org>2014-01-14 14:14:47 +0000
committerMark Brown <broonie@linaro.org>2014-01-14 14:14:47 +0000
commit13ea3300100ec3461560b1e061033cd167333a86 (patch)
treec60a016a06c488adada6959516e2a2de96d6d7d3 /crypto/ccm.c
parentb7ed6b88b2a5e961eeb939ef637a3cbb435a23a7 (diff)
parent68e67d97e1f91ed11e041b67f3a1336f518c608f (diff)
downloadlinux-next-13ea3300100ec3461560b1e061033cd167333a86.tar.gz
Merge branch 'topic/rcar' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi into spi-rspi
Diffstat (limited to 'crypto/ccm.c')
-rw-r--r--crypto/ccm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/crypto/ccm.c b/crypto/ccm.c
index 499c91717d93..1df84217f7c9 100644
--- a/crypto/ccm.c
+++ b/crypto/ccm.c
@@ -271,7 +271,8 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain,
}
/* compute plaintext into mac */
- get_data_to_compute(cipher, pctx, plain, cryptlen);
+ if (cryptlen)
+ get_data_to_compute(cipher, pctx, plain, cryptlen);
out:
return err;
@@ -363,7 +364,7 @@ static void crypto_ccm_decrypt_done(struct crypto_async_request *areq,
if (!err) {
err = crypto_ccm_auth(req, req->dst, cryptlen);
- if (!err && memcmp(pctx->auth_tag, pctx->odata, authsize))
+ if (!err && crypto_memneq(pctx->auth_tag, pctx->odata, authsize))
err = -EBADMSG;
}
aead_request_complete(req, err);
@@ -422,7 +423,7 @@ static int crypto_ccm_decrypt(struct aead_request *req)
return err;
/* verify */
- if (memcmp(authtag, odata, authsize))
+ if (crypto_memneq(authtag, odata, authsize))
return -EBADMSG;
return err;