diff mbox series

[v1,1/5] crypto: talitos - fix ECB and CBC algs ivsize

Message ID c8b988faeea463b89e7d9485c9328dc65a909e8e.1559819372.git.christophe.leroy@c-s.fr (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show
Series Additional fixes on Talitos driver | expand

Commit Message

Christophe Leroy June 6, 2019, 11:31 a.m. UTC
commit d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
wrongly modified CBC algs ivsize instead of ECB aggs ivsize.

This restore the CBC algs original ivsize of removes ECB's ones.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Fixes: d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
---
 drivers/crypto/talitos.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Comments

Horia Geanta June 11, 2019, 11:52 a.m. UTC | #1
On 6/6/2019 2:31 PM, Christophe Leroy wrote:
> commit d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
> wrongly modified CBC algs ivsize instead of ECB aggs ivsize.
> 
> This restore the CBC algs original ivsize of removes ECB's ones.
> 
> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
> Fixes: d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
Initial patch is correct:

$ git show -U10 d84cc9c9524e
[...]
@@ -2802,21 +2802,20 @@ static struct talitos_alg_template driver_algs[] = {
        {       .type = CRYPTO_ALG_TYPE_ABLKCIPHER,
                .alg.crypto = {
                        .cra_name = "ecb(aes)",
                        .cra_driver_name = "ecb-aes-talitos",
                        .cra_blocksize = AES_BLOCK_SIZE,
                        .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
                                     CRYPTO_ALG_ASYNC,
                        .cra_ablkcipher = {
                                .min_keysize = AES_MIN_KEY_SIZE,
                                .max_keysize = AES_MAX_KEY_SIZE,
-                               .ivsize = AES_BLOCK_SIZE,
                                .setkey = ablkcipher_aes_setkey,
                        }
                },
[...]

and similar for ecb(des), ecb(des3_ede).

Current patch is incorrect: it adds ivsize for ecb and removes it from cbc.

Horia
Christophe Leroy June 11, 2019, 2:04 p.m. UTC | #2
Le 11/06/2019 à 13:52, Horia Geanta a écrit :
> On 6/6/2019 2:31 PM, Christophe Leroy wrote:
>> commit d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
>> wrongly modified CBC algs ivsize instead of ECB aggs ivsize.
>>
>> This restore the CBC algs original ivsize of removes ECB's ones.
>>
>> Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
>> Fixes: d84cc9c9524e ("crypto: talitos - fix ECB algs ivsize")
> Initial patch is correct:
> 
> $ git show -U10 d84cc9c9524e
> [...]
> @@ -2802,21 +2802,20 @@ static struct talitos_alg_template driver_algs[] = {
>          {       .type = CRYPTO_ALG_TYPE_ABLKCIPHER,
>                  .alg.crypto = {
>                          .cra_name = "ecb(aes)",
>                          .cra_driver_name = "ecb-aes-talitos",
>                          .cra_blocksize = AES_BLOCK_SIZE,
>                          .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |
>                                       CRYPTO_ALG_ASYNC,
>                          .cra_ablkcipher = {
>                                  .min_keysize = AES_MIN_KEY_SIZE,
>                                  .max_keysize = AES_MAX_KEY_SIZE,
> -                               .ivsize = AES_BLOCK_SIZE,
>                                  .setkey = ablkcipher_aes_setkey,
>                          }
>                  },
> [...]
> 
> and similar for ecb(des), ecb(des3_ede).
> 
> Current patch is incorrect: it adds ivsize for ecb and removes it from cbc.

Very strange. Looks like there has been some rebase weirdness which have 
applied the patch on the wrong block at some point on my side, probably 
due to the fact that both blocks have the two previous and following 
lines identical.

I've now rebased my serie on cryptodev/master and have the same 
behaviour as you. I'll resend the series without this patch.

Christophe


> 
> Horia
>
diff mbox series

Patch

diff --git a/drivers/crypto/talitos.c b/drivers/crypto/talitos.c
index 122ec6c85446..3b3e99f1cddb 100644
--- a/drivers/crypto/talitos.c
+++ b/drivers/crypto/talitos.c
@@ -2753,7 +2753,6 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = AES_MIN_KEY_SIZE,
 				.max_keysize = AES_MAX_KEY_SIZE,
-				.ivsize = AES_BLOCK_SIZE,
 				.setkey = ablkcipher_aes_setkey,
 			}
 		},
@@ -2770,6 +2769,7 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = AES_MIN_KEY_SIZE,
 				.max_keysize = AES_MAX_KEY_SIZE,
+				.ivsize = AES_BLOCK_SIZE,
 				.setkey = ablkcipher_aes_setkey,
 			}
 		},
@@ -2805,7 +2805,6 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = DES_KEY_SIZE,
 				.max_keysize = DES_KEY_SIZE,
-				.ivsize = DES_BLOCK_SIZE,
 				.setkey = ablkcipher_des_setkey,
 			}
 		},
@@ -2822,6 +2821,7 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = DES_KEY_SIZE,
 				.max_keysize = DES_KEY_SIZE,
+				.ivsize = DES_BLOCK_SIZE,
 				.setkey = ablkcipher_des_setkey,
 			}
 		},
@@ -2839,7 +2839,6 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = DES3_EDE_KEY_SIZE,
 				.max_keysize = DES3_EDE_KEY_SIZE,
-				.ivsize = DES3_EDE_BLOCK_SIZE,
 				.setkey = ablkcipher_des3_setkey,
 			}
 		},
@@ -2857,6 +2856,7 @@  static struct talitos_alg_template driver_algs[] = {
 			.cra_ablkcipher = {
 				.min_keysize = DES3_EDE_KEY_SIZE,
 				.max_keysize = DES3_EDE_KEY_SIZE,
+				.ivsize = DES3_EDE_BLOCK_SIZE,
 				.setkey = ablkcipher_des3_setkey,
 			}
 		},