summaryrefslogtreecommitdiffstats
path: root/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
diff options
context:
space:
mode:
authorTom Lendacky <thomas.lendacky@amd.com>2014-01-06 20:34:11 +0100
committerHerbert Xu <herbert@gondor.apana.org.au>2014-01-15 04:33:36 +0100
commit393897c5156a415533ff85aa381458840417b032 (patch)
tree352d1e73a038f3496814406f917690232772a609 /drivers/crypto/ccp/ccp-crypto-aes-cmac.c
parentcrypto: ccp - Cleanup scatterlist usage (diff)
downloadlinux-393897c5156a415533ff85aa381458840417b032.tar.xz
linux-393897c5156a415533ff85aa381458840417b032.zip
crypto: ccp - Check for caller result area before using it
For a hash operation, the caller doesn't have to supply a result area on every call so don't use it / update it if it hasn't been supplied. Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/ccp/ccp-crypto-aes-cmac.c')
-rw-r--r--drivers/crypto/ccp/ccp-crypto-aes-cmac.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
index 646c8d1bd03c..c6b8f9e56aab 100644
--- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
+++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c
@@ -43,7 +43,9 @@ static int ccp_aes_cmac_complete(struct crypto_async_request *async_req,
} else
rctx->buf_count = 0;
- memcpy(req->result, rctx->iv, digest_size);
+ /* Update result area if supplied */
+ if (req->result)
+ memcpy(req->result, rctx->iv, digest_size);
e_free:
sg_free_table(&rctx->data_sg);