2017-06-23 08:54:30

by Raveendra Padasalagi

[permalink] [raw]
Subject: [PATCH v1] crypto: brcm - software fallback for cryptlen zero

Zero length payload requests are not handled in
Broadcom SPU2 engine, so this patch adds conditional
check to fallback to software implementation for AES-GCM
and AES-CCM algorithms.

Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
Signed-off-by: Raveendra Padasalagi <[email protected]>
Reviewed-by: Ray Jui <[email protected]>
Reviewed-by: Scott Branden <[email protected]>
Cc: [email protected]
---

Changes in v1:
- Added Cc tag in the Signed-off area to send the patch to stable kernel

drivers/crypto/bcm/cipher.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index cc0d5b9..6c80863 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -2625,7 +2625,7 @@ static int aead_need_fallback(struct aead_request *req)
*/
if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
(ctx->cipher.mode == CIPHER_MODE_CCM)) &&
- (req->assoclen == 0)) {
+ ((req->assoclen == 0) || (req->cryptlen == 0))) {
if ((rctx->is_encrypt && (req->cryptlen == 0)) ||
(!rctx->is_encrypt && (req->cryptlen == ctx->digestsize))) {
flow_log("AES GCM/CCM needs fallback for 0 len req\n");
--
1.9.1


2017-06-23 17:14:02

by Raveendra Padasalagi

[permalink] [raw]
Subject: Re: [PATCH v1] crypto: brcm - software fallback for cryptlen zero

Need to consider some more scenarios.
So NAKing this patch. Will send out re-vised version.

Regards,
Raveendra


On Fri, Jun 23, 2017 at 2:24 PM, Raveendra Padasalagi
<[email protected]> wrote:
> Zero length payload requests are not handled in
> Broadcom SPU2 engine, so this patch adds conditional
> check to fallback to software implementation for AES-GCM
> and AES-CCM algorithms.
>
> Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")
> Signed-off-by: Raveendra Padasalagi <[email protected]>
> Reviewed-by: Ray Jui <[email protected]>
> Reviewed-by: Scott Branden <[email protected]>
> Cc: [email protected]
> ---
>
> Changes in v1:
> - Added Cc tag in the Signed-off area to send the patch to stable kernel
>
> drivers/crypto/bcm/cipher.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
> index cc0d5b9..6c80863 100644
> --- a/drivers/crypto/bcm/cipher.c
> +++ b/drivers/crypto/bcm/cipher.c
> @@ -2625,7 +2625,7 @@ static int aead_need_fallback(struct aead_request *req)
> */
> if (((ctx->cipher.mode == CIPHER_MODE_GCM) ||
> (ctx->cipher.mode == CIPHER_MODE_CCM)) &&
> - (req->assoclen == 0)) {
> + ((req->assoclen == 0) || (req->cryptlen == 0))) {
> if ((rctx->is_encrypt && (req->cryptlen == 0)) ||
> (!rctx->is_encrypt && (req->cryptlen == ctx->digestsize))) {
> flow_log("AES GCM/CCM needs fallback for 0 len req\n");
> --
> 1.9.1
>