]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
Bluetooth: use crypto_shash_tfm_digest()
authorEric Biggers <ebiggers@google.com>
Sat, 2 May 2020 05:31:19 +0000 (22:31 -0700)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 8 May 2020 05:32:15 +0000 (15:32 +1000)
Instead of manually allocating a 'struct shash_desc' on the stack and
calling crypto_shash_digest(), switch to using the new helper function
crypto_shash_tfm_digest() which does this for us.

Cc: linux-bluetooth@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
net/bluetooth/smp.c

index 1476a91ce935725e06d4979d96fad1a6b036a811..d022f126eb026b2caaa3ead84f6c3131b6d45cfe 100644 (file)
@@ -170,7 +170,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m,
                    size_t len, u8 mac[16])
 {
        uint8_t tmp[16], mac_msb[16], msg_msb[CMAC_MSG_MAX];
-       SHASH_DESC_ON_STACK(desc, tfm);
        int err;
 
        if (len > CMAC_MSG_MAX)
@@ -181,8 +180,6 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m,
                return -EINVAL;
        }
 
-       desc->tfm = tfm;
-
        /* Swap key and message from LSB to MSB */
        swap_buf(k, tmp, 16);
        swap_buf(m, msg_msb, len);
@@ -196,8 +193,7 @@ static int aes_cmac(struct crypto_shash *tfm, const u8 k[16], const u8 *m,
                return err;
        }
 
-       err = crypto_shash_digest(desc, msg_msb, len, mac_msb);
-       shash_desc_zero(desc);
+       err = crypto_shash_tfm_digest(tfm, msg_msb, len, mac_msb);
        if (err) {
                BT_ERR("Hash computation error %d", err);
                return err;