ASoC: cros_ec_codec: use crypto_shash_tfm_digest()

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: Cheng-Yi Chiang <cychiang@chromium.org>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>
Cc: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
Eric Biggers 2020-05-01 22:31:22 -07:00 committed by Herbert Xu
parent bce395eea0
commit 85fc78b80f

View File

@ -115,14 +115,7 @@ static int calculate_sha256(struct cros_ec_codec_priv *priv,
return PTR_ERR(tfm);
}
{
SHASH_DESC_ON_STACK(desc, tfm);
desc->tfm = tfm;
crypto_shash_digest(desc, buf, size, digest);
shash_desc_zero(desc);
}
crypto_shash_tfm_digest(tfm, buf, size, digest);
crypto_free_shash(tfm);