All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/5] crypto: talitos - fix icv management on outbound direction
@ 2012-08-02 14:16 Horia Geanta
  2012-08-02 14:16 ` [PATCH 2/5] crypto: talitos - prune unneeded descriptor allocation param Horia Geanta
                   ` (3 more replies)
  0 siblings, 4 replies; 12+ messages in thread
From: Horia Geanta @ 2012-08-02 14:16 UTC (permalink / raw)
  To: linux-crypto; +Cc: Herbert Xu, David S. Miller, Kim Phillips

For IPsec encryption, in the case when:
-the input buffer is fragmented (edesc->src_nents > 0)
-the output buffer is not fragmented (edesc->dst_nents = 0)
the ICV is not output in the link table, but after the encrypted payload.

Copying the ICV must be avoided in this case; consequently the condition
edesc->dma_len > 0 must be more specific, i.e. must depend on the type
of the output buffer - fragmented or not.

Testing was performed by modifying testmgr to support src != dst,
since currently native kernel IPsec does in-place encryption
(src == dst).

Signed-off-by: Horia Geanta <horia.geanta@freescale.com>
---
 drivers/crypto/talitos.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index efff788..9d56763 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -825,7 +825,7 @@ static void ipsec_esp_encrypt_done(struct device *dev,
 	ipsec_esp_unmap(dev, edesc, areq);
 
 	/* copy the generated ICV to dst */
-	if (edesc->dma_len) {
+	if (edesc->dst_nents) {
 		icvdata = &edesc->link_tbl[edesc->src_nents +
 					   edesc->dst_nents + 2];
 		sg = sg_last(areq->dst, edesc->dst_nents);
-- 
1.7.3.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2012-08-20  8:33 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-08-02 14:16 [PATCH 1/5] crypto: talitos - fix icv management on outbound direction Horia Geanta
2012-08-02 14:16 ` [PATCH 2/5] crypto: talitos - prune unneeded descriptor allocation param Horia Geanta
2012-08-02 14:16 ` [PATCH 3/5] crypto: talitos - change type and name for [src|dst]_is_chained Horia Geanta
2012-08-02 14:16 ` [PATCH 4/5] crypto: talitos - support for assoc data provided as scatterlist Horia Geanta
2012-08-02 14:16 ` [PATCH 5/5] crypto: talitos - add IPsec ESN support Horia Geanta
2012-08-07  1:47   ` Kim Phillips
2012-08-07  6:54     ` Geanta Neag Horia Ioan-B05471
2012-08-07 13:34       ` Geanta Neag Horia Ioan-B05471
2012-08-08  2:27         ` Kim Phillips
2012-08-09  1:32           ` [PATCH 1/2] crypto: talitos - consolidate cra_type assignments Kim Phillips
2012-08-20  8:33             ` Herbert Xu
2012-08-09  1:33           ` [PATCH 2/2] crypto: talitos - consolidate common cra_* assignments Kim Phillips

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.