Patch "crypto: talitos - fix AEAD tcrypt tests" has been added to the 4.5-stable tree
Subsystems (2)
This is a note to let you know that I've just added the patch titled
crypto: talitos - fix AEAD tcrypt tests
to the 4.5-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
crypto-talitos-fix-aead-tcrypt-tests.patch
and it can be found in the queue-4.5 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.
Quoted 1 line
From
340ff60ae93a5db2b2be6f38868df9a1293b6007Mon Sep 17 00:00:00 2001
From: Horia Geant? <[email protected]>
Date: Tue, 19 Apr 2016 20:33:48 +0300
Subject: crypto: talitos - fix AEAD tcrypt tests
From: Horia Geant? <[email protected]>
commit 340ff60ae93a5db2b2be6f38868df9a1293b6007 upstream.
After conversion to new AEAD interface, tcrypt tests fail as follows:
[...]
[ 1.145414] alg: aead: Test 1 failed on encryption for authenc-hmac-sha1-cbc-aes-talitos [ 1.153564] 00000000: 53 69 6e 67 6c 65 20 62 6c 6f 63 6b 20 6d 73 67 [ 1.160041] 00000010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 1.166509] 00000020: 00 00 00 00
[...]
Fix them by providing the correct cipher in & cipher out pointers, i.e. must skip over associated data in src and dst S/G.
While here, fix a problem with the HW S/G table index usage:tbl_off must be updated after the pointer to the table entries is set.
--- drivers/crypto/talitos.c | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-)
drivers/crypto/talitos.c +30 -16
@@ -63,6 +63,14 @@ static void to_talitos_ptr(struct talito ptr->eptr =upper_32_bits (dma_addr); } +static void copy_talitos_ptr (struct talitos_ptr *dst_ptr, +struct talitos_ptr *src_ptr,bool is_sec1) +{ + dst_ptr->ptr = src_ptr->ptr; +if (!is_sec1) + dst_ptr->eptr = src_ptr->eptr; +} +static void to_talitos_ptr_len (struct talitos_ptr *ptr,unsigned int len,bool is_sec1) {
@@ -1083,21 +1091,20 @@ static int ipsec_esp(struct talitos_edes sg_count =dma_map_sg (dev, areq->src, edesc->src_nents ?:1 , (areq->src == areq->dst) ?DMA_BIDIRECTIONAL :DMA_TO_DEVICE ); -/* hmac data */ desc->ptr[1 ].len =cpu_to_be16 (areq->assoclen);if (sg_count >1 && (ret =sg_to_link_tbl_offset (areq->src, sg_count,0 , areq->assoclen, &edesc->link_tbl[tbl_off])) >1 ) { - tbl_off += ret; -to_talitos_ptr (&desc->ptr[1 ], edesc->dma_link_tbl + tbl_off *sizeof (struct talitos_ptr ),0 ); desc->ptr[1 ].j_extent =DESC_PTR_LNKTBL_JUMP ;dma_sync_single_for_device (dev, edesc->dma_link_tbl, edesc->dma_len,DMA_BIDIRECTIONAL ); + + tbl_off += ret; }else {to_talitos_ptr (&desc->ptr[1 ],sg_dma_address (areq->src),0 ); desc->ptr[1 ].j_extent =0 ;
@@ -1126,11 +1133,13 @@ static int ipsec_esp(struct talitos_edesif (edesc->desc.hdr &DESC_HDR_MODE1_MDEU_CICV ) sg_link_tbl_len += authsize; - if (sg_count > 1 && - (ret = sg_to_link_tbl_offset(areq->src, sg_count, areq->assoclen, - sg_link_tbl_len, - &edesc->link_tbl[tbl_off])) > 1) { - tbl_off += ret; +if (sg_count ==1 ) { +to_talitos_ptr (&desc->ptr[4 ],sg_dma_address (areq->src) + + areq->assoclen,0 ); + } else if ((ret = sg_to_link_tbl_offset(areq->src, sg_count, + areq->assoclen, sg_link_tbl_len, + &edesc->link_tbl[tbl_off])) > + 1) { desc->ptr[4].j_extent |= DESC_PTR_LNKTBL_JUMP; to_talitos_ptr(&desc->ptr[4], edesc->dma_link_tbl + tbl_off *
@@ -1138,8 +1147,10 @@ static int ipsec_esp(struct talitos_edesdma_sync_single_for_device (dev, edesc->dma_link_tbl, edesc->dma_len,DMA_BIDIRECTIONAL ); - }else -to_talitos_ptr (&desc->ptr[4 ],sg_dma_address (areq->src),0 ); + tbl_off += ret; + }else { +copy_talitos_ptr (&desc->ptr[4 ], &edesc->link_tbl[tbl_off],0 ); + }/* cipher out */ desc->ptr[5 ].len =cpu_to_be16 (cryptlen);
@@ -1151,11 +1162,13 @@ static int ipsec_esp(struct talitos_edes edesc->icv_ool = false; -if (sg_count >1 && - (sg_count =sg_to_link_tbl_offset (areq->dst, sg_count, +if (sg_count ==1 ) { +to_talitos_ptr (&desc->ptr[5 ],sg_dma_address (areq->dst) + + areq->assoclen,0 ); + }else if ((sg_count = +sg_to_link_tbl_offset (areq->dst, sg_count, areq->assoclen, cryptlen, - &edesc->link_tbl[tbl_off])) > -1 ) { + &edesc->link_tbl[tbl_off])) >1 ) {struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off]; to_talitos_ptr(&desc->ptr[5], edesc->dma_link_tbl +
@@ -1178,8 +1191,9 @@ static int ipsec_esp(struct talitos_edes edesc->dma_len, DMA_BIDIRECTIONAL); edesc->icv_ool = true; - }else -to_talitos_ptr (&desc->ptr[5 ],sg_dma_address (areq->dst),0 ); + }else { +copy_talitos_ptr (&desc->ptr[5 ], &edesc->link_tbl[tbl_off],0 ); + }/* iv out */ map_single_talitos_ptr(dev, &desc->ptr[6], ivsize, ctx->iv,
Patches currently in stable-queue which might be from [email protected] are
queue-4.5/crypto-talitos-fix-aead-tcrypt-tests.patch queue-4.5/crypto-talitos-fix-crash-in-talitos_cra_init.patch