Skip to contentSkip to conversation

drivers/crypto/nx: saves chaining value from co-processor

PATCH In review Fionnuala Gunter 4 participants 5 messages Aug 7, 2013 – Aug 9, 2013

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 drivers/crypto/nx: saves chaining value from co-processor

This patch fixes a bug that is triggered when cts(cbc(aes)) is used with nx-crypto driver on input larger than 32 bytes.

The chaining value from co-processor was not being saved. This value is needed because it is used as the IV by cts(cbc(aes)).

---
v2. changed signed-off-by to reviewed-by and added more details to description

This bug appeared in the original submission (v3.5)

---
 drivers/crypto/nx/nx-aes-cbc.c |    1 +
 1 file changed, 1 insertion(+)
(quoted diff) +0 -0

b/drivers/crypto/nx/nx-aes-cbc.c
index 35d483f..a2f99a9 100644

drivers/crypto/nx/nx-aes-cbc.c +0 -0
@@ -95,6 +95,7 @@ static int cbc_aes_nx_crypt(struct blkcipher_desc

*desc,

        if (rc)
                goto out;
+       memcpy(desc->info, csbcpb->cpb.aes_cbc.cv, AES_BLOCK_SIZE);
        atomic_inc(&(nx_ctx->stats->aes_ops));
        atomic64_add(csbcpb->csb.processed_byte_count,
                     &(nx_ctx->stats->aes_bytes));
Signature · 1 line
1.7.10.4
#1 lore raw

Hi Fin,

I don't know anything about crypto so I can only critique you on your patch submission technique :) ...

Quoted 6 lines · Fionnuala Gunter

This patch fixes a bug that is triggered when cts(cbc(aes)) is used with nx-crypto driver on input larger than 32 bytes.

The chaining value from co-processor was not being saved. This value is needed because it is used as the IV by cts(cbc(aes)).

Quoted 7 lines

---
v2. changed signed-off-by to reviewed-by and added more details to description

This bug appeared in the original submission (v3.5)

Ideally this should identify the commit, so:

This bug was introduced in the original submission (v3.5), commit 856d673 "powerpc/crypto: AES-CBC mode routines for nx encryption".

Including the subject of the commit is handy in case the patch has been backported somewhere, in which case the commit sha will be different.

It should definitely be part of the commit message, not below the "---".

And Ben might disagree but I think with a clear cut bug fix like this it should include the CC to stable, so:

    Cc: [email protected] # 3.5+

cheers

#2 lore raw
In reply to Fionnuala Gunter
Quoted 8 lines · Fionnuala Gunter

This patch fixes a bug that is triggered when cts(cbc(aes)) is used with nx-crypto driver on input larger than 32 bytes.

The chaining value from co-processor was not being saved. This value is needed because it is used as the IV by cts(cbc(aes)).

Herbert, I assume you will handle this along with all the other NX fixes and I can safely take them out of linuxppc patchwork ?

Cheers,
Ben.

Quoted 23 lines

---
v2. changed signed-off-by to reviewed-by and added more details to description

This bug appeared in the original submission (v3.5)

---
 drivers/crypto/nx/nx-aes-cbc.c |    1 +
 1 file changed, 1 insertion(+)
drivers/crypto/nx/nx-aes-cbc.c +1 -0
index 35d483f..a2f99a9 100644
@@ -95,6 +95,7 @@ static int cbc_aes_nx_crypt(struct blkcipher_desc
 *desc,
        if (rc)
                goto out;
 
+       memcpy(desc->info, csbcpb->cpb.aes_cbc.cv, AES_BLOCK_SIZE);
        atomic_inc(&(nx_ctx->stats->aes_ops));
        atomic64_add(csbcpb->csb.processed_byte_count,
                     &(nx_ctx->stats->aes_bytes));
#3 lore raw
Quoted 4 lines · Benjamin Herrenschmidt
Quoted 3 lines · Fionnuala Gunter

This patch fixes a bug that is triggered when cts(cbc(aes)) is used with nx-crypto driver on input larger than 32 bytes.

Quoted 8 lines
Quoted 5 lines

The chaining value from co-processor was not being saved. This value is needed because it is used as the IV by cts(cbc(aes)).

Herbert, I assume you will handle this along with all the other NX fixes and I can safely take them out of linuxppc patchwork ?

Yes of course.

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
#4 lore raw
In reply to Fionnuala Gunter
Quoted 6 lines · Fionnuala Gunter

This patch fixes a bug that is triggered when cts(cbc(aes)) is used with nx-crypto driver on input larger than 32 bytes.

The chaining value from co-processor was not being saved. This value is needed because it is used as the IV by cts(cbc(aes)).

Quoted 7 lines

---
v2. changed signed-off-by to reviewed-by and added more details to description

This bug appeared in the original submission (v3.5)

Patch applied. However your patch was totally white-space damaged. I've fixed it this time, but please fix this in your future submissions.

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