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>
This commit is contained in:
Tom Lendacky
2014-01-06 13:34:11 -06:00
committed by Herbert Xu
parent 77dc4a51a9
commit 393897c515
2 changed files with 8 additions and 3 deletions

View File

@@ -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);