Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid
[linux-2.6-microblaze.git] / crypto / ecdh.c
index d56b860..96f80c8 100644 (file)
@@ -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, &params) < 0)
+       if (crypto_ecdh_decode_key(buf, len, &params) < 0 ||
+           params.key_size > sizeof(ctx->private_key))
                return -EINVAL;
 
        ndigits = ecdh_supported_curve(params.curve_id);