Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ccp - 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: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
f32b6775 7e3e48d8

+2 -7
+2 -7
drivers/crypto/ccp/ccp-crypto-sha.c
··· 272 272 { 273 273 struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm)); 274 274 struct crypto_shash *shash = ctx->u.sha.hmac_tfm; 275 - 276 - SHASH_DESC_ON_STACK(sdesc, shash); 277 - 278 275 unsigned int block_size = crypto_shash_blocksize(shash); 279 276 unsigned int digest_size = crypto_shash_digestsize(shash); 280 277 int i, ret; ··· 286 289 287 290 if (key_len > block_size) { 288 291 /* Must hash the input key */ 289 - sdesc->tfm = shash; 290 - 291 - ret = crypto_shash_digest(sdesc, key, key_len, 292 - ctx->u.sha.key); 292 + ret = crypto_shash_tfm_digest(shash, key, key_len, 293 + ctx->u.sha.key); 293 294 if (ret) 294 295 return -EINVAL; 295 296