crypto: marvell: cesa: ECB does not IV
Subsystems (2)
PATCH 1/2 crypto: marvell: cesa: ECB does not IV
The DES3 ECB has an IV size set but ECB does not need one.
--- drivers/crypto/marvell/cesa/cipher.c | 1 - 1 file changed, 1 deletion(-)
drivers/crypto/marvell/cesa/cipher.c +0 -1
@@ -624,7 +624,6 @@ struct skcipher_alg mv_cesa_ecb_des3_ede_alg = { .decrypt = mv_cesa_ecb_des3_ede_decrypt, .min_keysize = DES3_EDE_KEY_SIZE, .max_keysize = DES3_EDE_KEY_SIZE, - .ivsize = DES3_EDE_BLOCK_SIZE, .base = { .cra_name = "ecb(des3_ede)", .cra_driver_name = "mv-ecb-des3-ede",
Signature · 1 line
2.35.1
PATCH 2/2 crypto: marvell: cesa: Add fallback for handling empty length case
The driver does not handle case where cryptlen is zero and fail crypto selftests. So let's add a fallback for this case.
--- drivers/crypto/marvell/Kconfig | 4 ++ drivers/crypto/marvell/cesa/cesa.h | 12 +++-- drivers/crypto/marvell/cesa/cipher.c | 69 ++++++++++++++++++++++++---- 3 files changed, 72 insertions(+), 13 deletions(-)
drivers/crypto/marvell/Kconfig +4 -0
@@ -13,6 +13,10 @@ config CRYPTO_DEV_MARVELL_CESA select CRYPTO_SKCIPHER select CRYPTO_HASH select SRAM + select CRYPTO_ECB + select CRYPTO_CBC + select CRYPTO_DES + select CRYPTO_AES select CRYPTO_DEV_MARVELL help This driver allows you to utilize the Cryptographic Engines and
drivers/crypto/marvell/cesa/cesa.h +8 -4
@@ -487,12 +487,14 @@ struct mv_cesa_req_ops {/** * struct mv_cesa_ctx - CESA operation context -* @ops: crypto operations +* @ops: crypto operations +* @fallback_tfm: pointer to the fallback TFM * * Base context structure inherited by operation specific ones. */ struct mv_cesa_ctx {const struct mv_cesa_req_ops *ops; +struct crypto_skcipher *fallback_tfm; };/**
@@ -563,15 +565,17 @@ struct mv_cesa_skcipher_std_req {/** * struct mv_cesa_skcipher_req - cipher request -* @req: type specific request information -* @src_nents: number of entries in the src sg list -* @dst_nents: number of entries in the dest sg list +* @req: type specific request information +* @src_nents: number of entries in the src sg list +* @dst_nents: number of entries in the dest sg list +* @fallback_req: request struct for invoking the fallback skcipher TFM */ struct mv_cesa_skcipher_req {struct mv_cesa_req base;struct mv_cesa_skcipher_std_req std;int src_nents;int dst_nents; +struct skcipher_request fallback_req;// keep at the end };/**
drivers/crypto/marvell/cesa/cipher.c +60 -9
143 lines not on this page · raw message
Signature · 1 line
2.35.1
Herbert Xu
maintainerRe: [PATCH 2/2] crypto: marvell: cesa: Add fallback for handling empty length case
Quoted 2 lines · Corentin Labbe
The driver does not handle case where cryptlen is zero and fail crypto selftests. So let's add a fallback for this case.
Wouldn't it be easier to just handle this in the software? After all, a zero encryption/decryption is just a no-op, right?
Thanks,
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Herbert Xu
maintainerQuoted 7 lines · Corentin Labbe
The DES3 ECB has an IV size set but ECB does not need one.
Fixes 4ada483978237 ("crypto: marvell/cesa - add Triple-DES support")Signed-off-by Corentin Labbe <[email protected]>--- drivers/crypto/marvell/cesa/cipher.c | 1 - 1 file changed, 1 deletion(-)
Patch applied. Thanks.
Signature · 3 lines
Email: Herbert Xu <[email protected]> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt