summaryrefslogtreecommitdiff
path: root/drivers/crypto/msm
diff options
context:
space:
mode:
authorSivanesan Rajapupathi <srajap@codeaurora.org>2016-02-16 14:31:17 -0500
committerDavid Keitel <dkeitel@codeaurora.org>2016-03-23 21:20:40 -0700
commit112e4366ae85b6f1f1a4155a57aa37487a98f352 (patch)
tree41e6c8e1d25ce8bc14c8e3bd822a8a5bd2c944d6 /drivers/crypto/msm
parent8cda11332431479d5f52e1527e5bce3e379f2443 (diff)
crypto: msm: qcrypto: Fix hash crash if not last issue
If an ahash request is not final, the result variable of ahash_request may not exist. In the completion callback function, then, do not copy the digest result to result variable of ahash_request, if it not final. Otherwise, crash may happen. Change-Id: I169218e8658500539b19408eca3afeabcaa4816b Acked-by: Che-Min Hsieh <cheminh@qti.qualcomm.com> Signed-off-by: Sivanesan Rajapupathi <srajap@codeaurora.org>
Diffstat (limited to 'drivers/crypto/msm')
-rw-r--r--drivers/crypto/msm/qcrypto.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/crypto/msm/qcrypto.c b/drivers/crypto/msm/qcrypto.c
index 9a6258230080..d676f5a46650 100644
--- a/drivers/crypto/msm/qcrypto.c
+++ b/drivers/crypto/msm/qcrypto.c
@@ -1,6 +1,6 @@
/* Qualcomm Crypto driver
*
- * Copyright (c) 2010-2015, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2010-2016, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1607,7 +1607,8 @@ static void _qce_ahash_complete(void *cookie, unsigned char *digest,
#endif
if (digest) {
memcpy(rctx->digest, digest, diglen);
- memcpy(areq->result, digest, diglen);
+ if (rctx->last_blk)
+ memcpy(areq->result, digest, diglen);
}
if (authdata) {
rctx->byte_count[0] = auth32[0];