aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/crypto/n2_core.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/crypto/n2_core.c b/drivers/crypto/n2_core.c
index 7263c10a56ee..f8e3207fecb1 100644
--- a/drivers/crypto/n2_core.c
+++ b/drivers/crypto/n2_core.c
@@ -445,10 +445,7 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,
445 struct n2_hmac_ctx *ctx = crypto_ahash_ctx(tfm); 445 struct n2_hmac_ctx *ctx = crypto_ahash_ctx(tfm);
446 struct crypto_shash *child_shash = ctx->child_shash; 446 struct crypto_shash *child_shash = ctx->child_shash;
447 struct crypto_ahash *fallback_tfm; 447 struct crypto_ahash *fallback_tfm;
448 struct { 448 SHASH_DESC_ON_STACK(shash, child_shash);
449 struct shash_desc shash;
450 char ctx[crypto_shash_descsize(child_shash)];
451 } desc;
452 int err, bs, ds; 449 int err, bs, ds;
453 450
454 fallback_tfm = ctx->base.fallback_tfm; 451 fallback_tfm = ctx->base.fallback_tfm;
@@ -456,15 +453,15 @@ static int n2_hmac_async_setkey(struct crypto_ahash *tfm, const u8 *key,
456 if (err) 453 if (err)
457 return err; 454 return err;
458 455
459 desc.shash.tfm = child_shash; 456 shash->tfm = child_shash;
460 desc.shash.flags = crypto_ahash_get_flags(tfm) & 457 shash->flags = crypto_ahash_get_flags(tfm) &
461 CRYPTO_TFM_REQ_MAY_SLEEP; 458 CRYPTO_TFM_REQ_MAY_SLEEP;
462 459
463 bs = crypto_shash_blocksize(child_shash); 460 bs = crypto_shash_blocksize(child_shash);
464 ds = crypto_shash_digestsize(child_shash); 461 ds = crypto_shash_digestsize(child_shash);
465 BUG_ON(ds > N2_HASH_KEY_MAX); 462 BUG_ON(ds > N2_HASH_KEY_MAX);
466 if (keylen > bs) { 463 if (keylen > bs) {
467 err = crypto_shash_digest(&desc.shash, key, keylen, 464 err = crypto_shash_digest(shash, key, keylen,
468 ctx->hash_key); 465 ctx->hash_key);
469 if (err) 466 if (err)
470 return err; 467 return err;