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

crypto: n2 - 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.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Eric Biggers and committed by
Herbert Xu
ce8e0488 e0077ea8

+2 -5
+2 -5
drivers/crypto/n2_core.c
··· 462 462 struct n2_hmac_ctx *ctx = crypto_ahash_ctx(tfm); 463 463 struct crypto_shash *child_shash = ctx->child_shash; 464 464 struct crypto_ahash *fallback_tfm; 465 - SHASH_DESC_ON_STACK(shash, child_shash); 466 465 int err, bs, ds; 467 466 468 467 fallback_tfm = ctx->base.fallback_tfm; ··· 469 470 if (err) 470 471 return err; 471 472 472 - shash->tfm = child_shash; 473 - 474 473 bs = crypto_shash_blocksize(child_shash); 475 474 ds = crypto_shash_digestsize(child_shash); 476 475 BUG_ON(ds > N2_HASH_KEY_MAX); 477 476 if (keylen > bs) { 478 - err = crypto_shash_digest(shash, key, keylen, 479 - ctx->hash_key); 477 + err = crypto_shash_tfm_digest(child_shash, key, keylen, 478 + ctx->hash_key); 480 479 if (err) 481 480 return err; 482 481 keylen = ds;