From: tb Date: Sat, 1 Jul 2023 14:39:34 +0000 (+0000) Subject: Remove unused y from ECDH key computation X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=c117f75ed662c29238c184b69b0242e39da42321;p=openbsd Remove unused y from ECDH key computation ok jsing --- 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; }