From 9414b8785347e1c0b5eb2d963077e9b3b543e3ac Mon Sep 17 00:00:00 2001 From: tb Date: Sat, 1 Jul 2023 14:57:51 +0000 Subject: [PATCH] Garbage collect the now unused len --- lib/libcrypto/ecdh/ech_key.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lib/libcrypto/ecdh/ech_key.c b/lib/libcrypto/ecdh/ech_key.c index f4d20cd0cee..7d4fba76fe9 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.25 2023/07/01 14:56:12 tb Exp $ */ +/* $OpenBSD: ech_key.c,v 1.26 2023/07/01 14:57:51 tb Exp $ */ /* ==================================================================== * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. * @@ -98,7 +98,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, const BIGNUM *priv_key; const EC_GROUP* group; unsigned char *buf = NULL; - int buflen, len; + int buflen; int ret = -1; if (outlen > INT_MAX) { @@ -141,9 +141,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, goto err; } - buflen = ECDH_size(ecdh); - len = BN_num_bytes(x); - if (len > buflen) { + if ((buflen = ECDH_size(ecdh)) < BN_num_bytes(x)) { ECDHerror(ERR_R_INTERNAL_ERROR); goto err; } -- 2.20.1