All of lore.kernel.org
 help / color / mirror / Atom feed
From: Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>
To: Stefan Agner <stefan@agner.ch>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
	"David S. Miller" <davem@davemloft.net>,
	clabbe.montjoie@gmail.com,
	Scott Branden <scott.branden@broadcom.com>,
	Steven Lin <steven.lin1@broadcom.com>,
	garsilva@embeddedor.com, pravin.shedge4linux@gmail.com,
	linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type
Date: Wed, 28 Mar 2018 12:08:24 +0530	[thread overview]
Message-ID: <CAAFb_vrFF6D8DEvnZMDda-qd-jTh3mKt0BgGBJ5eWxydY1LEXA@mail.gmail.com> (raw)
In-Reply-To: <20180324110242.9474-1-stefan@agner.ch>

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
>

  reply	other threads:[~2018-03-28  6:38 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-24 11:02 [RFC PATCH] crypto: brcm - explicitly cast cipher to hash type Stefan Agner
2018-03-28  6:38 ` Raveendra Padasalagi [this message]
2018-03-28 15:41   ` Stefan Agner
2018-03-28 15:45     ` Herbert Xu
2018-03-30 17:43 ` Herbert Xu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAAFb_vrFF6D8DEvnZMDda-qd-jTh3mKt0BgGBJ5eWxydY1LEXA@mail.gmail.com \
    --to=raveendra.padasalagi@broadcom.com \
    --cc=clabbe.montjoie@gmail.com \
    --cc=davem@davemloft.net \
    --cc=garsilva@embeddedor.com \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pravin.shedge4linux@gmail.com \
    --cc=scott.branden@broadcom.com \
    --cc=stefan@agner.ch \
    --cc=steven.lin1@broadcom.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.