author: Ard Biesheuvel <ardb@kernel.org> 2021-01-02 14:59:09 +0100
committer: Herbert Xu <herbert@gondor.apana.org.au> 2021-01-03 08:35:35 +1100
commit: 0aa171e9b267ce7c52d3a3df7bc9c1fc0203dec5
parent: fd16931a2f518a32753920ff20895e5cf04c8ff1
Commit Summary:
Diffstat:
1 file changed, 2 insertions, 1 deletion
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index d56b8603dec9..96f80c8f8e30 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -39,7 +39,8 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
struct ecdh params;
unsigned int ndigits;
- if (crypto_ecdh_decode_key(buf, len, ¶ms) < 0)
+ if (crypto_ecdh_decode_key(buf, len, ¶ms) < 0 ||
+ params.key_size > sizeof(ctx->private_key))
return -EINVAL;
ndigits = ecdh_supported_curve(params.curve_id);