diff mbox

crypto: brcm - software fallback for cryptlen zero

Message ID 1498206130-15188-1-git-send-email-raveendra.padasalagi@broadcom.com (mailing list archive)
State Superseded
Delegated to: Herbert Xu
Headers show

Commit Message

Raveendra Padasalagi June 23, 2017, 8:22 a.m. UTC
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.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Scott Branden <scott.branden@broadcom.com>
---
 drivers/crypto/bcm/cipher.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Anup Patel June 23, 2017, 8:34 a.m. UTC | #1
On Fri, Jun 23, 2017 at 1:52 PM, Raveendra Padasalagi
<raveendra.padasalagi@broadcom.com> 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.
>
> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> Reviewed-by: Ray Jui <ray.jui@broadcom.com>
> Reviewed-by: Scott Branden <scott.branden@broadcom.com>
> ---
>  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
>

This should go in linux-stable too.

Please CC Linux stable and include "Fixes:".

Regards,
Anup
diff mbox

Patch

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");