All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
@ 2018-03-24 11:02 Stefan Agner
  2018-03-28  6:38 ` Raveendra Padasalagi
  2018-03-30 17:43 ` Herbert Xu
  0 siblings, 2 replies; 5+ messages in thread
From: Stefan Agner @ 2018-03-24 11:02 UTC (permalink / raw)
  To: herbert, davem, raveendra.padasalagi, clabbe.montjoie
  Cc: scott.branden, steven.lin1, garsilva, pravin.shedge4linux,
	linux-crypto, linux-kernel, Stefan Agner

In the AES cases enum spu_cipher_type and enum hash_type have
the same values, so the assignment is fine. Explicitly cast
the enum type conversion.

This fixes two warnings when building with clang:
  drivers/crypto/bcm/cipher.c:821:34: warning: implicit conversion from
      enumeration type 'enum spu_cipher_type' to different enumeration
      type 'enum hash_type' [-Wenum-conversion]
                hash_parms.type = cipher_parms.type;
                                ~ ~~~~~~~~~~~~~^~~~
  drivers/crypto/bcm/cipher.c:1412:26: warning: implicit conversion from
      enumeration type 'enum spu_cipher_type' to different enumeration
      type 'enum hash_type' [-Wenum-conversion]
                hash_parms.type = ctx->cipher_type;
                                ~ ~~~~~^~~~~~~~~~~

Signed-off-by: Stefan Agner <stefan@agner.ch>
---
I am not familar with the IP... I would be glad if somebody with
better insight could have a look whether that patch makes sense.

 drivers/crypto/bcm/cipher.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
index 2b75f95bbe1b..309c67c7012f 100644
--- a/drivers/crypto/bcm/cipher.c
+++ b/drivers/crypto/bcm/cipher.c
@@ -818,7 +818,7 @@ static int handle_ahash_req(struct iproc_reqctx_s *rctx)
 
 	/* AES hashing keeps key size in type field, so need to copy it here */
 	if (hash_parms.alg == HASH_ALG_AES)
-		hash_parms.type = cipher_parms.type;
+		hash_parms.type = (enum hash_type)cipher_parms.type;
 	else
 		hash_parms.type = spu->spu_hash_type(rctx->total_sent);
 
@@ -1409,7 +1409,7 @@ static int handle_aead_req(struct iproc_reqctx_s *rctx)
 						rctx->iv_ctr_len);
 
 	if (ctx->auth.alg == HASH_ALG_AES)
-		hash_parms.type = ctx->cipher_type;
+		hash_parms.type = (enum hash_type)ctx->cipher_type;
 
 	/* General case AAD padding (CCM and RFC4543 special cases below) */
 	aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
-- 
2.16.2

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

* Re: [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
  2018-03-24 11:02 [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type Stefan Agner
@ 2018-03-28  6:38 ` Raveendra Padasalagi
  2018-03-28 15:41   ` Stefan Agner
  2018-03-30 17:43 ` Herbert Xu
  1 sibling, 1 reply; 5+ messages in thread
From: Raveendra Padasalagi @ 2018-03-28  6:38 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Herbert Xu, David S. Miller, clabbe.montjoie, Scott Branden,
	Steven Lin, garsilva, pravin.shedge4linux, linux-crypto,
	linux-kernel

Hi Stefan,

The change looks to be fine.  From the IP point of view its using the
same values in case of AES cipher and hash types so explicit casting
should be ok.

-Raveendra

On Sat, Mar 24, 2018 at 4:32 PM, Stefan Agner <stefan@agner.ch> wrote:
> In the AES cases enum spu_cipher_type and enum hash_type have
> the same values, so the assignment is fine. Explicitly cast
> the enum type conversion.
>
> This fixes two warnings when building with clang:
>   drivers/crypto/bcm/cipher.c:821:34: warning: implicit conversion from
>       enumeration type 'enum spu_cipher_type' to different enumeration
>       type 'enum hash_type' [-Wenum-conversion]
>                 hash_parms.type = cipher_parms.type;
>                                 ~ ~~~~~~~~~~~~~^~~~
>   drivers/crypto/bcm/cipher.c:1412:26: warning: implicit conversion from
>       enumeration type 'enum spu_cipher_type' to different enumeration
>       type 'enum hash_type' [-Wenum-conversion]
>                 hash_parms.type = ctx->cipher_type;
>                                 ~ ~~~~~^~~~~~~~~~~
>
> Signed-off-by: Stefan Agner <stefan@agner.ch>
> ---
> I am not familar with the IP... I would be glad if somebody with
> better insight could have a look whether that patch makes sense.
>
>  drivers/crypto/bcm/cipher.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
> index 2b75f95bbe1b..309c67c7012f 100644
> --- a/drivers/crypto/bcm/cipher.c
> +++ b/drivers/crypto/bcm/cipher.c
> @@ -818,7 +818,7 @@ static int handle_ahash_req(struct iproc_reqctx_s *rctx)
>
>         /* AES hashing keeps key size in type field, so need to copy it here */
>         if (hash_parms.alg == HASH_ALG_AES)
> -               hash_parms.type = cipher_parms.type;
> +               hash_parms.type = (enum hash_type)cipher_parms.type;
>         else
>                 hash_parms.type = spu->spu_hash_type(rctx->total_sent);
>
> @@ -1409,7 +1409,7 @@ static int handle_aead_req(struct iproc_reqctx_s *rctx)
>                                                 rctx->iv_ctr_len);
>
>         if (ctx->auth.alg == HASH_ALG_AES)
> -               hash_parms.type = ctx->cipher_type;
> +               hash_parms.type = (enum hash_type)ctx->cipher_type;
>
>         /* General case AAD padding (CCM and RFC4543 special cases below) */
>         aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
> --
> 2.16.2
>

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

* Re: [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
  2018-03-28  6:38 ` Raveendra Padasalagi
@ 2018-03-28 15:41   ` Stefan Agner
  2018-03-28 15:45     ` Herbert Xu
  0 siblings, 1 reply; 5+ messages in thread
From: Stefan Agner @ 2018-03-28 15:41 UTC (permalink / raw)
  To: Raveendra Padasalagi, Herbert Xu
  Cc: David S. Miller, clabbe.montjoie, Scott Branden, Steven Lin,
	garsilva, pravin.shedge4linux, linux-crypto, linux-kernel

On 28.03.2018 08:38, Raveendra Padasalagi wrote:
> Hi Stefan,
> 
> The change looks to be fine.  From the IP point of view its using the
> same values in case of AES cipher and hash types so explicit casting
> should be ok.

Can I take that as an Ack?

Herbert, given that Raveendra agrees to the change, do you want me to
send a non-RFC version or can you merge the patch as is?

--
Stefan


> 
> -Raveendra
> 
> On Sat, Mar 24, 2018 at 4:32 PM, Stefan Agner <stefan@agner.ch> wrote:
>> In the AES cases enum spu_cipher_type and enum hash_type have
>> the same values, so the assignment is fine. Explicitly cast
>> the enum type conversion.
>>
>> This fixes two warnings when building with clang:
>>   drivers/crypto/bcm/cipher.c:821:34: warning: implicit conversion from
>>       enumeration type 'enum spu_cipher_type' to different enumeration
>>       type 'enum hash_type' [-Wenum-conversion]
>>                 hash_parms.type = cipher_parms.type;
>>                                 ~ ~~~~~~~~~~~~~^~~~
>>   drivers/crypto/bcm/cipher.c:1412:26: warning: implicit conversion from
>>       enumeration type 'enum spu_cipher_type' to different enumeration
>>       type 'enum hash_type' [-Wenum-conversion]
>>                 hash_parms.type = ctx->cipher_type;
>>                                 ~ ~~~~~^~~~~~~~~~~
>>
>> Signed-off-by: Stefan Agner <stefan@agner.ch>
>> ---
>> I am not familar with the IP... I would be glad if somebody with
>> better insight could have a look whether that patch makes sense.
>>
>>  drivers/crypto/bcm/cipher.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c
>> index 2b75f95bbe1b..309c67c7012f 100644
>> --- a/drivers/crypto/bcm/cipher.c
>> +++ b/drivers/crypto/bcm/cipher.c
>> @@ -818,7 +818,7 @@ static int handle_ahash_req(struct iproc_reqctx_s *rctx)
>>
>>         /* AES hashing keeps key size in type field, so need to copy it here */
>>         if (hash_parms.alg == HASH_ALG_AES)
>> -               hash_parms.type = cipher_parms.type;
>> +               hash_parms.type = (enum hash_type)cipher_parms.type;
>>         else
>>                 hash_parms.type = spu->spu_hash_type(rctx->total_sent);
>>
>> @@ -1409,7 +1409,7 @@ static int handle_aead_req(struct iproc_reqctx_s *rctx)
>>                                                 rctx->iv_ctr_len);
>>
>>         if (ctx->auth.alg == HASH_ALG_AES)
>> -               hash_parms.type = ctx->cipher_type;
>> +               hash_parms.type = (enum hash_type)ctx->cipher_type;
>>
>>         /* General case AAD padding (CCM and RFC4543 special cases below) */
>>         aead_parms.aad_pad_len = spu->spu_gcm_ccm_pad_len(ctx->cipher.mode,
>> --
>> 2.16.2
>>

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

* Re: [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
  2018-03-28 15:41   ` Stefan Agner
@ 2018-03-28 15:45     ` Herbert Xu
  0 siblings, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2018-03-28 15:45 UTC (permalink / raw)
  To: Stefan Agner
  Cc: Raveendra Padasalagi, David S. Miller, clabbe.montjoie,
	Scott Branden, Steven Lin, garsilva, pravin.shedge4linux,
	linux-crypto, linux-kernel

On Wed, Mar 28, 2018 at 05:41:30PM +0200, Stefan Agner wrote:
>
> Herbert, given that Raveendra agrees to the change, do you want me to
> send a non-RFC version or can you merge the patch as is?

There is no need to resend it.

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] 5+ messages in thread

* Re: [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
  2018-03-24 11:02 [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type Stefan Agner
  2018-03-28  6:38 ` Raveendra Padasalagi
@ 2018-03-30 17:43 ` Herbert Xu
  1 sibling, 0 replies; 5+ messages in thread
From: Herbert Xu @ 2018-03-30 17:43 UTC (permalink / raw)
  To: Stefan Agner
  Cc: davem, raveendra.padasalagi, clabbe.montjoie, scott.branden,
	steven.lin1, garsilva, pravin.shedge4linux, linux-crypto,
	linux-kernel

On Sat, Mar 24, 2018 at 12:02:42PM +0100, Stefan Agner wrote:
> In the AES cases enum spu_cipher_type and enum hash_type have
> the same values, so the assignment is fine. Explicitly cast
> the enum type conversion.
> 
> This fixes two warnings when building with clang:
>   drivers/crypto/bcm/cipher.c:821:34: warning: implicit conversion from
>       enumeration type 'enum spu_cipher_type' to different enumeration
>       type 'enum hash_type' [-Wenum-conversion]
>                 hash_parms.type = cipher_parms.type;
>                                 ~ ~~~~~~~~~~~~~^~~~
>   drivers/crypto/bcm/cipher.c:1412:26: warning: implicit conversion from
>       enumeration type 'enum spu_cipher_type' to different enumeration
>       type 'enum hash_type' [-Wenum-conversion]
>                 hash_parms.type = ctx->cipher_type;
>                                 ~ ~~~~~^~~~~~~~~~~
> 
> Signed-off-by: Stefan Agner <stefan@agner.ch>

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] 5+ messages in thread

end of thread, other threads:[~2018-03-30 17:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-24 11:02 [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type Stefan Agner
2018-03-28  6:38 ` Raveendra Padasalagi
2018-03-28 15:41   ` Stefan Agner
2018-03-28 15:45     ` Herbert Xu
2018-03-30 17:43 ` 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.