aboutsummaryrefslogtreecommitdiff
path: root/crypto/hmac.c
diff options
context:
space:
mode:
authorAlex Shi <alex.shi@linaro.org>2018-01-18 15:26:28 +0800
committerAlex Shi <alex.shi@linaro.org>2018-01-18 15:26:28 +0800
commit2ba51c6d36ee1b43c1f898c6c48ddf3d33e9ab30 (patch)
treeff3302dc45a91d7bfcaabd37bfa8fa391a954180 /crypto/hmac.c
parent28610abf4a574c33ca70e3d7b0e523fdede488d1 (diff)
parent90816cc1d4a1d23efe37b74866c6174dd5eab6b5 (diff)
Merge remote-tracking branch 'rt-stable/v4.9-rt' into linux-linaro-lsk-v4.9-rtlsk-v4.9-18.02-rt
Conflicts: arch/arm64/mm/init.c
Diffstat (limited to 'crypto/hmac.c')
-rw-r--r--crypto/hmac.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/crypto/hmac.c b/crypto/hmac.c
index 72e38c098bb3..ba07fb6221ae 100644
--- a/crypto/hmac.c
+++ b/crypto/hmac.c
@@ -194,11 +194,15 @@ static int hmac_create(struct crypto_template *tmpl, struct rtattr **tb)
salg = shash_attr_alg(tb[1], 0, 0);
if (IS_ERR(salg))
return PTR_ERR(salg);
+ alg = &salg->base;
+ /* The underlying hash algorithm must be unkeyed */
err = -EINVAL;
+ if (crypto_shash_alg_has_setkey(salg))
+ goto out_put_alg;
+
ds = salg->digestsize;
ss = salg->statesize;
- alg = &salg->base;
if (ds > alg->cra_blocksize ||
ss < alg->cra_blocksize)
goto out_put_alg;