[PATCH 20/20] ASoC: cros_ec_codec: use crypto_shash_tfm_digest()

From
Eric Biggers <ebiggers@kernel.org>
Date
2020-05-02 05:33:51
Reply to
Eric Biggers, 2020-05-02
From: Eric Biggers <redacted>

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 <redacted>
Cc: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Eric Biggers <redacted>
---
 sound/soc/codecs/cros_ec_codec.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
diff --git a/sound/soc/codecs/cros_ec_codec.c b/sound/soc/codecs/cros_ec_codec.c
index d3dc42aa682565..bfdd852bdc0de4 100644
--- a/sound/soc/codecs/cros_ec_codec.c
+++ b/sound/soc/codecs/cros_ec_codec.c
@@ -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);
 
-- 
2.26.2
Thread (28 messages) 28 messages, 8 authors, last reply 2020-05-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help