summaryrefslogtreecommitdiffstats
path: root/crypto/dh.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/dh.c')
-rw-r--r--crypto/dh.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/dh.c b/crypto/dh.c
index 7cec04985b9d..e151f12775ca 100644
--- a/crypto/dh.c
+++ b/crypto/dh.c
@@ -85,6 +85,9 @@ static int dh_set_secret(struct crypto_kpp *tfm, const void *buf,
85 struct dh_ctx *ctx = dh_get_ctx(tfm); 85 struct dh_ctx *ctx = dh_get_ctx(tfm);
86 struct dh params; 86 struct dh params;
87 87
88 /* Free the old MPI key if any */
89 dh_free_ctx(ctx);
90
88 if (crypto_dh_decode_key(buf, len, &params) < 0) 91 if (crypto_dh_decode_key(buf, len, &params) < 0)
89 return -EINVAL; 92 return -EINVAL;
90 93