-/* $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.
*
const BIGNUM *priv_key;
const EC_GROUP* group;
unsigned char *buf = NULL;
- int buflen, len;
+ int buflen;
int ret = -1;
if (outlen > INT_MAX) {
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;
}