diff options
author | Tom Lendacky <thomas.lendacky@amd.com> | 2014-01-06 13:34:05 -0600 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2014-01-15 11:33:36 +0800 |
commit | 77dc4a51a9d3386c318c1622fc126964f7cb0ee2 (patch) | |
tree | 734c859d66bd7665e1bb463814703b49c17e78a0 /drivers/crypto/ccp/ccp-crypto-aes-cmac.c | |
parent | 5258de8af04af0caf129f1ce432d1817a5800887 (diff) |
crypto: ccp - Cleanup scatterlist usage
Cleanup up the usage of scatterlists to make the code cleaner
and avoid extra memory allocations when not needed.
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.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c index 398832c2414..646c8d1bd03 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes-cmac.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-cmac.c @@ -125,8 +125,10 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, sg_init_one(&rctx->pad_sg, rctx->pad, pad_length); sg = ccp_crypto_sg_table_add(&rctx->data_sg, &rctx->pad_sg); } - if (sg) + if (sg) { sg_mark_end(sg); + sg = rctx->data_sg.sgl; + } /* Initialize the K1/K2 scatterlist */ if (final) @@ -143,7 +145,7 @@ static int ccp_do_cmac_update(struct ahash_request *req, unsigned int nbytes, rctx->cmd.u.aes.key_len = ctx->u.aes.key_len; rctx->cmd.u.aes.iv = &rctx->iv_sg; rctx->cmd.u.aes.iv_len = AES_BLOCK_SIZE; - rctx->cmd.u.aes.src = (sg) ? rctx->data_sg.sgl : NULL; + rctx->cmd.u.aes.src = sg; rctx->cmd.u.aes.src_len = rctx->hash_cnt; rctx->cmd.u.aes.dst = NULL; rctx->cmd.u.aes.cmac_key = cmac_key_sg; |