This patch fixes a issue with crypto4xx's ctr(aes) that was
discovered by libcapi's kcapi-enc-test.sh test.
The some of the ctr(aes) encryptions test were failing on the
non-power-of-two test:
kcapi-enc - Error: encryption failed with error 0
kcapi-enc - Error: decryption failed with error 0
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits):
original file (1d100e..cc96184c) and generated file (e3b0c442..1b7852b855)
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
(openssl generated CT): original file (e3b0..5) and generated file (3..8e)
[PASSED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
(openssl generated PT)
[FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (password):
original file (1d1..84c) and generated file (e3b..852b855)
But the 16, 32, 512, 65536 tests always worked.
Thankfully, this isn't a hidden hardware problem like previously,
instead this turned out to be a copy and paste issue.
With this patch, all the tests are passing with and
kcapi-enc-test.sh gives crypto4xx's a clean bill of health:
"Number of failures: 0" :).
Cc: [email protected]
Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support")
Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
Signed-off-by: Christian Lamparter <[email protected]>
---
drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/amcc/crypto4xx_core.c b/drivers/crypto/amcc/crypto4xx_core.c
index 3934c2523762..0322ae8ac466 100644
--- a/drivers/crypto/amcc/crypto4xx_core.c
+++ b/drivers/crypto/amcc/crypto4xx_core.c
@@ -1252,7 +1252,7 @@ static struct crypto4xx_alg_common crypto4xx_alg[] = {
.cra_flags = CRYPTO_ALG_NEED_FALLBACK |
CRYPTO_ALG_ASYNC |
CRYPTO_ALG_KERN_DRIVER_ONLY,
- .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_blocksize = 1,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_module = THIS_MODULE,
},
@@ -1272,7 +1272,7 @@ static struct crypto4xx_alg_common crypto4xx_alg[] = {
.cra_priority = CRYPTO4XX_CRYPTO_PRIORITY,
.cra_flags = CRYPTO_ALG_ASYNC |
CRYPTO_ALG_KERN_DRIVER_ONLY,
- .cra_blocksize = AES_BLOCK_SIZE,
+ .cra_blocksize = 1,
.cra_ctxsize = sizeof(struct crypto4xx_ctx),
.cra_module = THIS_MODULE,
},
--
2.20.1
Hi Christian,
On Fri, May 17, 2019 at 11:15:57PM +0200, Christian Lamparter wrote:
> This patch fixes a issue with crypto4xx's ctr(aes) that was
> discovered by libcapi's kcapi-enc-test.sh test.
>
> The some of the ctr(aes) encryptions test were failing on the
> non-power-of-two test:
>
> kcapi-enc - Error: encryption failed with error 0
> kcapi-enc - Error: decryption failed with error 0
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits):
> original file (1d100e..cc96184c) and generated file (e3b0c442..1b7852b855)
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
> (openssl generated CT): original file (e3b0..5) and generated file (3..8e)
> [PASSED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
> (openssl generated PT)
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (password):
> original file (1d1..84c) and generated file (e3b..852b855)
>
> But the 16, 32, 512, 65536 tests always worked.
>
> Thankfully, this isn't a hidden hardware problem like previously,
> instead this turned out to be a copy and paste issue.
>
> With this patch, all the tests are passing with and
> kcapi-enc-test.sh gives crypto4xx's a clean bill of health:
> "Number of failures: 0" :).
>
> Cc: [email protected]
> Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support")
> Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
> Signed-off-by: Christian Lamparter <[email protected]>
With this patch applied to the latest mainline kernel, did you check whether
this driver also passes the in-kernel crypto self-tests when
CONFIG_CRYPTO_MANAGER_EXTRA_TESTS=y is set? Those should have detected this bug
too, maybe even without EXTRA_TESTS.
- Eric
On Fri, May 17, 2019 at 11:15:57PM +0200, Christian Lamparter wrote:
> This patch fixes a issue with crypto4xx's ctr(aes) that was
> discovered by libcapi's kcapi-enc-test.sh test.
>
> The some of the ctr(aes) encryptions test were failing on the
> non-power-of-two test:
>
> kcapi-enc - Error: encryption failed with error 0
> kcapi-enc - Error: decryption failed with error 0
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits):
> original file (1d100e..cc96184c) and generated file (e3b0c442..1b7852b855)
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
> (openssl generated CT): original file (e3b0..5) and generated file (3..8e)
> [PASSED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (128 bits)
> (openssl generated PT)
> [FAILED: 32-bit - 5.1.0-rc1+] 15 bytes: STDIN / STDOUT enc test (password):
> original file (1d1..84c) and generated file (e3b..852b855)
>
> But the 16, 32, 512, 65536 tests always worked.
>
> Thankfully, this isn't a hidden hardware problem like previously,
> instead this turned out to be a copy and paste issue.
>
> With this patch, all the tests are passing with and
> kcapi-enc-test.sh gives crypto4xx's a clean bill of health:
> "Number of failures: 0" :).
>
> Cc: [email protected]
> Fixes: 98e87e3d933b ("crypto: crypto4xx - add aes-ctr support")
> Fixes: f2a13e7cba9e ("crypto: crypto4xx - enable AES RFC3686, ECB, CFB and OFB offloads")
> Signed-off-by: Christian Lamparter <[email protected]>
> ---
> drivers/crypto/amcc/crypto4xx_core.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
Patch 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