summaryrefslogtreecommitdiff
path: root/crypto/ecdh.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/ecdh.c')
-rw-r--r--crypto/ecdh.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/crypto/ecdh.c b/crypto/ecdh.c
index c02c9a2b9682..72cfd1590156 100644
--- a/crypto/ecdh.c
+++ b/crypto/ecdh.c
@@ -27,7 +27,6 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
unsigned int len)
{
struct ecdh_ctx *ctx = ecdh_get_ctx(tfm);
- u64 priv[ECC_MAX_DIGITS];
struct ecdh params;
int ret = 0;
@@ -41,15 +40,14 @@ static int ecdh_set_secret(struct crypto_kpp *tfm, const void *buf,
return ecc_gen_privkey(ctx->curve_id, ctx->ndigits,
ctx->private_key);
- memcpy(ctx->private_key, params.key, params.key_size);
- ecc_swap_digits(ctx->private_key, priv, ctx->ndigits);
+ ecc_digits_from_bytes(params.key, params.key_size,
+ ctx->private_key, ctx->ndigits);
if (ecc_is_key_valid(ctx->curve_id, ctx->ndigits,
- priv, params.key_size) < 0) {
+ ctx->private_key, params.key_size) < 0) {
memzero_explicit(ctx->private_key, params.key_size);
ret = -EINVAL;
}
- memzero_explicit(priv, sizeof(priv));
return ret;
}