summaryrefslogtreecommitdiffstats
path: root/crypto/ecdh.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ecdh.c')
-rw-r--r--crypto/ecdh.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index 4aa0b0cb4627..61c7708905d0 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -55,6 +55,10 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
ctx->curve_id = params.curve_id;
ctx->ndigits = ndigits;
+ if (!params.key || !params.key_size)
+ return ecc_gen_privkey(ctx->curve_id, ctx->ndigits,
+ ctx->private_key);
+
if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
(const u64 *)params.key, params.key_size) < 0)
return -EINVAL;