2019-06-24 07:21:08

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v5 0/4] *** SUBJECT HERE ***

This series is the last set of fixes for the Talitos driver.

We now get a fully clean boot on both SEC1 (SEC1.2 on mpc885) and
SEC2 (SEC2.2 on mpc8321E) with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS:

[ 3.385197] bus: 'platform': really_probe: probing driver talitos with device ff020000.crypto
[ 3.450982] random: fast init done
[ 12.252548] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
[ 12.262226] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
[ 43.310737] Bug in SEC1, padding ourself
[ 45.603318] random: crng init done
[ 54.612333] talitos ff020000.crypto: fsl,sec1.2 algorithms registered in /proc/crypto
[ 54.620232] driver: 'talitos': driver_bound: bound to device 'ff020000.crypto'

[ 1.193721] bus: 'platform': really_probe: probing driver talitos with device b0030000.crypto
[ 1.229197] random: fast init done
[ 2.714920] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
[ 2.724312] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos-hsna)
[ 4.482045] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos)
[ 4.490940] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
[ 4.500280] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos)
[ 4.509727] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
[ 6.631781] random: crng init done
[ 11.521795] talitos b0030000.crypto: fsl,sec2.2 algorithms registered in /proc/crypto
[ 11.529803] driver: 'talitos': driver_bound: bound to device 'b0030000.crypto'

v2: dropped patch 1 which was irrelevant due to a rebase weirdness. Added Cc to stable on the 2 first patches.

v3:
- removed stable reference in patch 1
- reworded patch 1 to include name of patch 2 for the dependency.
- mentionned this dependency in patch 2 as well.
- corrected the Fixes: sha1 in patch 4

v4:
- using scatterwalk_ffwd() instead of opencodying SG list forwarding.
- Added a patch to fix sg_copy_to_buffer() when sg->offset() is greater than PAGE_SIZE,
otherwise sg_copy_to_buffer() fails when the list has been forwarded with scatterwalk_ffwd().
- taken the patch "crypto: talitos - eliminate unneeded 'done' functions at build time"
out of the series because it is independent.
- added a helper to find the header field associated to a request in flush_channe()

v5:
- Replacing the while loop by a direct shift/mask operation, as suggested by Herbert in patch 1.

Christophe Leroy (4):
lib/scatterlist: Fix mapping iterator when sg->offset is greater than
PAGE_SIZE
crypto: talitos - move struct talitos_edesc into talitos.h
crypto: talitos - fix hash on SEC1.
crypto: talitos - drop icv_ool

drivers/crypto/talitos.c | 102 +++++++++++++++++++----------------------------
drivers/crypto/talitos.h | 28 +++++++++++++
lib/scatterlist.c | 9 +++--
3 files changed, 74 insertions(+), 65 deletions(-)

--
2.13.3


2019-06-24 07:21:08

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v5 2/4] crypto: talitos - move struct talitos_edesc into talitos.h

Moves struct talitos_edesc into talitos.h so that it can be used
from any place in talitos.c

It will be required for next patch ("crypto: talitos - fix hash
on SEC1")

Signed-off-by: Christophe Leroy <[email protected]>
Cc: [email protected]
---
drivers/crypto/talitos.c | 30 ------------------------------
drivers/crypto/talitos.h | 30 ++++++++++++++++++++++++++++++
2 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index a7704b53529d..95dc3957f358 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -951,36 +951,6 @@ static int aead_des3_setkey(struct crypto_aead *authenc,
goto out;
}

-/*
- * talitos_edesc - s/w-extended descriptor
- * @src_nents: number of segments in input scatterlist
- * @dst_nents: number of segments in output scatterlist
- * @icv_ool: whether ICV is out-of-line
- * @iv_dma: dma address of iv for checking continuity and link table
- * @dma_len: length of dma mapped link_tbl space
- * @dma_link_tbl: bus physical address of link_tbl/buf
- * @desc: h/w descriptor
- * @link_tbl: input and output h/w link tables (if {src,dst}_nents > 1) (SEC2)
- * @buf: input and output buffeur (if {src,dst}_nents > 1) (SEC1)
- *
- * if decrypting (with authcheck), or either one of src_nents or dst_nents
- * is greater than 1, an integrity check value is concatenated to the end
- * of link_tbl data
- */
-struct talitos_edesc {
- int src_nents;
- int dst_nents;
- bool icv_ool;
- dma_addr_t iv_dma;
- int dma_len;
- dma_addr_t dma_link_tbl;
- struct talitos_desc desc;
- union {
- struct talitos_ptr link_tbl[0];
- u8 buf[0];
- };
-};
-
static void talitos_sg_unmap(struct device *dev,
struct talitos_edesc *edesc,
struct scatterlist *src,
diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h
index 32ad4fc679ed..95f78c6d9206 100644
--- a/drivers/crypto/talitos.h
+++ b/drivers/crypto/talitos.h
@@ -42,6 +42,36 @@ struct talitos_desc {

#define TALITOS_DESC_SIZE (sizeof(struct talitos_desc) - sizeof(__be32))

+/*
+ * talitos_edesc - s/w-extended descriptor
+ * @src_nents: number of segments in input scatterlist
+ * @dst_nents: number of segments in output scatterlist
+ * @icv_ool: whether ICV is out-of-line
+ * @iv_dma: dma address of iv for checking continuity and link table
+ * @dma_len: length of dma mapped link_tbl space
+ * @dma_link_tbl: bus physical address of link_tbl/buf
+ * @desc: h/w descriptor
+ * @link_tbl: input and output h/w link tables (if {src,dst}_nents > 1) (SEC2)
+ * @buf: input and output buffeur (if {src,dst}_nents > 1) (SEC1)
+ *
+ * if decrypting (with authcheck), or either one of src_nents or dst_nents
+ * is greater than 1, an integrity check value is concatenated to the end
+ * of link_tbl data
+ */
+struct talitos_edesc {
+ int src_nents;
+ int dst_nents;
+ bool icv_ool;
+ dma_addr_t iv_dma;
+ int dma_len;
+ dma_addr_t dma_link_tbl;
+ struct talitos_desc desc;
+ union {
+ struct talitos_ptr link_tbl[0];
+ u8 buf[0];
+ };
+};
+
/**
* talitos_request - descriptor submission request
* @desc: descriptor pointer (kernel virtual)
--
2.13.3

2019-06-24 07:21:13

by Christophe Leroy

[permalink] [raw]
Subject: [PATCH v5 4/4] crypto: talitos - drop icv_ool

icv_ool is not used anymore, drop it.

Fixes: e345177ded17 ("crypto: talitos - fix AEAD processing.")
Signed-off-by: Christophe Leroy <[email protected]>
---
drivers/crypto/talitos.c | 3 ---
drivers/crypto/talitos.h | 2 --
2 files changed, 5 deletions(-)

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index ab6bd45addf7..c9d686a0e805 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -1285,9 +1285,6 @@ static int ipsec_esp(struct talitos_edesc *edesc, struct aead_request *areq,
is_ipsec_esp && !encrypt);
tbl_off += ret;

- /* ICV data */
- edesc->icv_ool = !encrypt;
-
if (!encrypt && is_ipsec_esp) {
struct talitos_ptr *tbl_ptr = &edesc->link_tbl[tbl_off];

diff --git a/drivers/crypto/talitos.h b/drivers/crypto/talitos.h
index 95f78c6d9206..1469b956948a 100644
--- a/drivers/crypto/talitos.h
+++ b/drivers/crypto/talitos.h
@@ -46,7 +46,6 @@ struct talitos_desc {
* talitos_edesc - s/w-extended descriptor
* @src_nents: number of segments in input scatterlist
* @dst_nents: number of segments in output scatterlist
- * @icv_ool: whether ICV is out-of-line
* @iv_dma: dma address of iv for checking continuity and link table
* @dma_len: length of dma mapped link_tbl space
* @dma_link_tbl: bus physical address of link_tbl/buf
@@ -61,7 +60,6 @@ struct talitos_desc {
struct talitos_edesc {
int src_nents;
int dst_nents;
- bool icv_ool;
dma_addr_t iv_dma;
int dma_len;
dma_addr_t dma_link_tbl;
--
2.13.3

2019-07-02 09:23:52

by Christophe Leroy

[permalink] [raw]
Subject: Re: [PATCH v5 0/4] Additional fixes on Talitos driver

Hi Herbert,

Le 24/06/2019 à 09:21, Christophe Leroy a écrit :
> This series is the last set of fixes for the Talitos driver.

Do you plan to apply this series, or are you expecting anythink from
myself ?

Thanks
Christophe

>
> We now get a fully clean boot on both SEC1 (SEC1.2 on mpc885) and
> SEC2 (SEC2.2 on mpc8321E) with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS:
>
> [ 3.385197] bus: 'platform': really_probe: probing driver talitos with device ff020000.crypto
> [ 3.450982] random: fast init done
> [ 12.252548] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
> [ 12.262226] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
> [ 43.310737] Bug in SEC1, padding ourself
> [ 45.603318] random: crng init done
> [ 54.612333] talitos ff020000.crypto: fsl,sec1.2 algorithms registered in /proc/crypto
> [ 54.620232] driver: 'talitos': driver_bound: bound to device 'ff020000.crypto'
>
> [ 1.193721] bus: 'platform': really_probe: probing driver talitos with device b0030000.crypto
> [ 1.229197] random: fast init done
> [ 2.714920] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
> [ 2.724312] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos-hsna)
> [ 4.482045] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos)
> [ 4.490940] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
> [ 4.500280] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos)
> [ 4.509727] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
> [ 6.631781] random: crng init done
> [ 11.521795] talitos b0030000.crypto: fsl,sec2.2 algorithms registered in /proc/crypto
> [ 11.529803] driver: 'talitos': driver_bound: bound to device 'b0030000.crypto'
>
> v2: dropped patch 1 which was irrelevant due to a rebase weirdness. Added Cc to stable on the 2 first patches.
>
> v3:
> - removed stable reference in patch 1
> - reworded patch 1 to include name of patch 2 for the dependency.
> - mentionned this dependency in patch 2 as well.
> - corrected the Fixes: sha1 in patch 4
>
> v4:
> - using scatterwalk_ffwd() instead of opencodying SG list forwarding.
> - Added a patch to fix sg_copy_to_buffer() when sg->offset() is greater than PAGE_SIZE,
> otherwise sg_copy_to_buffer() fails when the list has been forwarded with scatterwalk_ffwd().
> - taken the patch "crypto: talitos - eliminate unneeded 'done' functions at build time"
> out of the series because it is independent.
> - added a helper to find the header field associated to a request in flush_channe()
>
> v5:
> - Replacing the while loop by a direct shift/mask operation, as suggested by Herbert in patch 1.
>
> Christophe Leroy (4):
> lib/scatterlist: Fix mapping iterator when sg->offset is greater than
> PAGE_SIZE
> crypto: talitos - move struct talitos_edesc into talitos.h
> crypto: talitos - fix hash on SEC1.
> crypto: talitos - drop icv_ool
>
> drivers/crypto/talitos.c | 102 +++++++++++++++++++----------------------------
> drivers/crypto/talitos.h | 28 +++++++++++++
> lib/scatterlist.c | 9 +++--
> 3 files changed, 74 insertions(+), 65 deletions(-)
>

2019-07-03 14:28:45

by Herbert Xu

[permalink] [raw]
Subject: Re: [PATCH v5 0/4] *** SUBJECT HERE ***

On Mon, Jun 24, 2019 at 07:20:13AM +0000, Christophe Leroy wrote:
> This series is the last set of fixes for the Talitos driver.
>
> We now get a fully clean boot on both SEC1 (SEC1.2 on mpc885) and
> SEC2 (SEC2.2 on mpc8321E) with CONFIG_CRYPTO_MANAGER_EXTRA_TESTS:
>
> [ 3.385197] bus: 'platform': really_probe: probing driver talitos with device ff020000.crypto
> [ 3.450982] random: fast init done
> [ 12.252548] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
> [ 12.262226] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
> [ 43.310737] Bug in SEC1, padding ourself
> [ 45.603318] random: crng init done
> [ 54.612333] talitos ff020000.crypto: fsl,sec1.2 algorithms registered in /proc/crypto
> [ 54.620232] driver: 'talitos': driver_bound: bound to device 'ff020000.crypto'
>
> [ 1.193721] bus: 'platform': really_probe: probing driver talitos with device b0030000.crypto
> [ 1.229197] random: fast init done
> [ 2.714920] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos)
> [ 2.724312] alg: No test for authenc(hmac(sha224),cbc(aes)) (authenc-hmac-sha224-cbc-aes-talitos-hsna)
> [ 4.482045] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos)
> [ 4.490940] alg: No test for authenc(hmac(md5),cbc(aes)) (authenc-hmac-md5-cbc-aes-talitos-hsna)
> [ 4.500280] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos)
> [ 4.509727] alg: No test for authenc(hmac(md5),cbc(des3_ede)) (authenc-hmac-md5-cbc-3des-talitos-hsna)
> [ 6.631781] random: crng init done
> [ 11.521795] talitos b0030000.crypto: fsl,sec2.2 algorithms registered in /proc/crypto
> [ 11.529803] driver: 'talitos': driver_bound: bound to device 'b0030000.crypto'
>
> v2: dropped patch 1 which was irrelevant due to a rebase weirdness. Added Cc to stable on the 2 first patches.
>
> v3:
> - removed stable reference in patch 1
> - reworded patch 1 to include name of patch 2 for the dependency.
> - mentionned this dependency in patch 2 as well.
> - corrected the Fixes: sha1 in patch 4
>
> v4:
> - using scatterwalk_ffwd() instead of opencodying SG list forwarding.
> - Added a patch to fix sg_copy_to_buffer() when sg->offset() is greater than PAGE_SIZE,
> otherwise sg_copy_to_buffer() fails when the list has been forwarded with scatterwalk_ffwd().
> - taken the patch "crypto: talitos - eliminate unneeded 'done' functions at build time"
> out of the series because it is independent.
> - added a helper to find the header field associated to a request in flush_channe()
>
> v5:
> - Replacing the while loop by a direct shift/mask operation, as suggested by Herbert in patch 1.
>
> Christophe Leroy (4):
> lib/scatterlist: Fix mapping iterator when sg->offset is greater than
> PAGE_SIZE
> crypto: talitos - move struct talitos_edesc into talitos.h
> crypto: talitos - fix hash on SEC1.
> crypto: talitos - drop icv_ool
>
> drivers/crypto/talitos.c | 102 +++++++++++++++++++----------------------------
> drivers/crypto/talitos.h | 28 +++++++++++++
> lib/scatterlist.c | 9 +++--
> 3 files changed, 74 insertions(+), 65 deletions(-)

All applied. Thanks.
--
Email: Herbert Xu <[email protected]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt