From c117f75ed662c29238c184b69b0242e39da42321 Mon Sep 17 00:00:00 2001 From: tb Date: Sat, 1 Jul 2023 14:39:34 +0000 Subject: [PATCH] Remove unused y from ECDH key computation ok jsing --- lib/libcrypto/ecdh/ech_key.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/libcrypto/ecdh/ech_key.c b/lib/libcrypto/ecdh/ech_key.c index e41092a411c..1dfb3c0fa90 100644 --- a/lib/libcrypto/ecdh/ech_key.c +++ b/lib/libcrypto/ecdh/ech_key.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ech_key.c,v 1.19 2023/06/25 19:35:56 tb Exp $ */ +/* $OpenBSD: ech_key.c,v 1.20 2023/07/01 14:39:34 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -94,7 +94,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, { BN_CTX *ctx; EC_POINT *tmp = NULL; - BIGNUM *x = NULL, *y = NULL; + BIGNUM *x; const BIGNUM *priv_key; const EC_GROUP* group; int ret = -1; @@ -109,11 +109,11 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, if ((ctx = BN_CTX_new()) == NULL) goto err; + BN_CTX_start(ctx); + if ((x = BN_CTX_get(ctx)) == NULL) goto err; - if ((y = BN_CTX_get(ctx)) == NULL) - goto err; priv_key = EC_KEY_get0_private_key(ecdh); if (priv_key == NULL) { @@ -136,7 +136,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, goto err; } - if (!EC_POINT_get_affine_coordinates(group, tmp, x, y, ctx)) { + if (!EC_POINT_get_affine_coordinates(group, tmp, x, NULL, ctx)) { ECDHerror(ECDH_R_POINT_ARITHMETIC_FAILURE); goto err; } -- 2.20.1