summaryrefslogtreecommitdiff
path: root/lib/libcrypto/ecdh
diff options
context:
space:
mode:
authorTheo Buehler <tb@cvs.openbsd.org>2023-07-01 14:57:52 +0000
committerTheo Buehler <tb@cvs.openbsd.org>2023-07-01 14:57:52 +0000
commiteb0d420d55d334e7d62d0a4d2a1e148e92962793 (patch)
treef6d11cf7b318e48dd04c7a027afd582cc0dd613b /lib/libcrypto/ecdh
parent9f47a110a1bcb281874be2012016f9916613e821 (diff)
Garbage collect the now unused len
Diffstat (limited to 'lib/libcrypto/ecdh')
-rw-r--r--lib/libcrypto/ecdh/ech_key.c8
1 files 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;
}