diff options
author | Joel Fernandes <joelf@ti.com> | 2013-08-17 22:42:24 -0400 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2013-08-21 07:27:59 -0400 |
commit | e77c756eca76077032db23d8d4b85dcd743742b4 (patch) | |
tree | 33f55e0e38d5aab727cb52d6c23f5e6bed781ecf /drivers/crypto/omap-aes.c | |
parent | 016af9b5c51e58ecda573f14dabe85a67363b20f (diff) |
crypto: omap-aes - Populate number of SG elements
Crypto layer only passes nbytes but number of SG elements is needed for mapping
or unmapping SGs at one time using dma_map* API and also needed to pass in for
dmaengine prep function.
We call function added to scatterwalk for this purpose in omap_aes_handle_queue
to populate the values which are used later.
Signed-off-by: Joel Fernandes <joelf@ti.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'drivers/crypto/omap-aes.c')
-rw-r--r-- | drivers/crypto/omap-aes.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/crypto/omap-aes.c b/drivers/crypto/omap-aes.c index e5b2120a12b9..1cad12ef4f55 100644 --- a/drivers/crypto/omap-aes.c +++ b/drivers/crypto/omap-aes.c | |||
@@ -165,6 +165,8 @@ struct omap_aes_dev { | |||
165 | void *buf_out; | 165 | void *buf_out; |
166 | int dma_out; | 166 | int dma_out; |
167 | struct dma_chan *dma_lch_out; | 167 | struct dma_chan *dma_lch_out; |
168 | int in_sg_len; | ||
169 | int out_sg_len; | ||
168 | dma_addr_t dma_addr_out; | 170 | dma_addr_t dma_addr_out; |
169 | 171 | ||
170 | const struct omap_aes_pdata *pdata; | 172 | const struct omap_aes_pdata *pdata; |
@@ -725,6 +727,10 @@ static int omap_aes_handle_queue(struct omap_aes_dev *dd, | |||
725 | dd->out_offset = 0; | 727 | dd->out_offset = 0; |
726 | dd->out_sg = req->dst; | 728 | dd->out_sg = req->dst; |
727 | 729 | ||
730 | dd->in_sg_len = scatterwalk_bytes_sglen(dd->in_sg, dd->total); | ||
731 | dd->out_sg_len = scatterwalk_bytes_sglen(dd->out_sg, dd->total); | ||
732 | BUG_ON(dd->in_sg_len < 0 || dd->out_sg_len < 0); | ||
733 | |||
728 | rctx = ablkcipher_request_ctx(req); | 734 | rctx = ablkcipher_request_ctx(req); |
729 | ctx = crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req)); | 735 | ctx = crypto_ablkcipher_ctx(crypto_ablkcipher_reqtfm(req)); |
730 | rctx->mode &= FLAGS_MODE_MASK; | 736 | rctx->mode &= FLAGS_MODE_MASK; |