All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] crypto: bcm: fix normal/non key hash algorithm failure
@ 2018-11-06  8:28 Raveendra Padasalagi
  2018-11-06 18:02 ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: Raveendra Padasalagi @ 2018-11-06  8:28 UTC (permalink / raw)
  To: Herbert Xu, David S. Miller, Eric Biggers, linux-crypto,
	linux-kernel, Stefan Agner
  Cc: bcm-kernel-feedback-list, Raveendra Padasalagi

Remove setkey() callback handler for normal/non key
hash algorithms and keep it for AES-CBC/CMAC which needs key.

Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
---
 drivers/crypto/bcm/cipher.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 2d1f1db..4d67e22 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -4652,12 +4652,16 @@ static int spu_register_ahash(struct iproc_alg_s *driver_alg)
 	hash->halg.statesize = sizeof(struct spu_hash_export_s);
 
 	if (driver_alg->auth_info.mode != HASH_MODE_HMAC) {
-		hash->setkey = ahash_setkey;
 		hash->init = ahash_init;
 		hash->update = ahash_update;
 		hash->final = ahash_final;
 		hash->finup = ahash_finup;
 		hash->digest = ahash_digest;
+		if ((driver_alg->auth_info.alg == HASH_ALG_AES) &&
+		    ((driver_alg->auth_info.mode == HASH_MODE_XCBC) ||
+		    (driver_alg->auth_info.mode == HASH_MODE_CMAC))) {
+			hash->setkey = ahash_setkey;
+		}
 	} else {
 		hash->setkey = ahash_hmac_setkey;
 		hash->init = ahash_hmac_init;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: bcm: fix normal/non key hash algorithm failure
  2018-11-06  8:28 [PATCH] crypto: bcm: fix normal/non key hash algorithm failure Raveendra Padasalagi
@ 2018-11-06 18:02 ` Florian Fainelli
  2018-11-16  6:18   ` Herbert Xu
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2018-11-06 18:02 UTC (permalink / raw)
  To: Raveendra Padasalagi, Herbert Xu, David S. Miller, Eric Biggers,
	linux-crypto, linux-kernel, Stefan Agner
  Cc: bcm-kernel-feedback-list

On 11/6/18 12:28 AM, Raveendra Padasalagi wrote:
> Remove setkey() callback handler for normal/non key
> hash algorithms and keep it for AES-CBC/CMAC which needs key.
> 
> Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>

Should this have the following Fixes tag?

Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")

> ---
>  drivers/crypto/bcm/cipher.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
> index 2d1f1db..4d67e22 100644
> --- a/drivers/crypto/bcm/cipher.c
> +++ b/drivers/crypto/bcm/cipher.c
> @@ -4652,12 +4652,16 @@ static int spu_register_ahash(struct iproc_alg_s *driver_alg)
>  	hash->halg.statesize = sizeof(struct spu_hash_export_s);
>  
>  	if (driver_alg->auth_info.mode != HASH_MODE_HMAC) {
> -		hash->setkey = ahash_setkey;
>  		hash->init = ahash_init;
>  		hash->update = ahash_update;
>  		hash->final = ahash_final;
>  		hash->finup = ahash_finup;
>  		hash->digest = ahash_digest;
> +		if ((driver_alg->auth_info.alg == HASH_ALG_AES) &&
> +		    ((driver_alg->auth_info.mode == HASH_MODE_XCBC) ||
> +		    (driver_alg->auth_info.mode == HASH_MODE_CMAC))) {
> +			hash->setkey = ahash_setkey;
> +		}
>  	} else {
>  		hash->setkey = ahash_hmac_setkey;
>  		hash->init = ahash_hmac_init;
> 


-- 
Florian

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] crypto: bcm: fix normal/non key hash algorithm failure
  2018-11-06 18:02 ` Florian Fainelli
@ 2018-11-16  6:18   ` Herbert Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Herbert Xu @ 2018-11-16  6:18 UTC (permalink / raw)
  To: Florian Fainelli
  Cc: Raveendra Padasalagi, David S. Miller, Eric Biggers,
	linux-crypto, linux-kernel, Stefan Agner,
	bcm-kernel-feedback-list

On Tue, Nov 06, 2018 at 10:02:47AM -0800, Florian Fainelli wrote:
> On 11/6/18 12:28 AM, Raveendra Padasalagi wrote:
> > Remove setkey() callback handler for normal/non key
> > hash algorithms and keep it for AES-CBC/CMAC which needs key.
> > 
> > Signed-off-by: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
> 
> Should this have the following Fixes tag?
> 
> Fixes: 9d12ba86f818 ("crypto: brcm - Add Broadcom SPU driver")

I added it when applying.

> >  drivers/crypto/bcm/cipher.c | 6 +++++-
> >  1 file changed, 5 insertions(+), 1 deletion(-)

Patch applied.  Thanks.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-16 16:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-06  8:28 [PATCH] crypto: bcm: fix normal/non key hash algorithm failure Raveendra Padasalagi
2018-11-06 18:02 ` Florian Fainelli
2018-11-16  6:18   ` Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.