]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
crypto: brcm - explicitly cast cipher to hash type
authorStefan Agner <stefan@agner.ch>
Sat, 24 Mar 2018 11:02:42 +0000 (12:02 +0100)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 30 Mar 2018 17:33:14 +0000 (01:33 +0800)
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>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/bcm/cipher.c

index 2b75f95bbe1b73d73e8bbfca7a4f7a7a38c3c8b6..309c67c7012f5a1a469e0e1d5931841fb887d656 100644 (file)
@@ -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,