Commit f32b6775 authored by Eric Biggers's avatar Eric Biggers Committed by Herbert Xu
Browse files

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: default avatarEric Biggers <ebiggers@google.com>
Acked-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 7e3e48d8
Loading
Loading
Loading
Loading
+2 −7
Original line number Diff line number Diff line
@@ -272,9 +272,6 @@ static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,
{
	struct ccp_ctx *ctx = crypto_tfm_ctx(crypto_ahash_tfm(tfm));
	struct crypto_shash *shash = ctx->u.sha.hmac_tfm;

	SHASH_DESC_ON_STACK(sdesc, shash);

	unsigned int block_size = crypto_shash_blocksize(shash);
	unsigned int digest_size = crypto_shash_digestsize(shash);
	int i, ret;
@@ -289,9 +286,7 @@ static int ccp_sha_setkey(struct crypto_ahash *tfm, const u8 *key,

	if (key_len > block_size) {
		/* Must hash the input key */
		sdesc->tfm = shash;

		ret = crypto_shash_digest(sdesc, key, key_len,
		ret = crypto_shash_tfm_digest(shash, key, key_len,
					      ctx->u.sha.key);
		if (ret)
			return -EINVAL;