/* Key derivation function from X9.62/SECG */
-
-#define ECDH_KDF_MAX (1L << 31)
+/* Way more than we will ever need */
+#define ECDH_KDF_MAX (1 << 30)
int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,
const unsigned char *Z, size_t Zlen,
goto err;
if (!EVP_DigestUpdate(&mctx, sinfo, sinfolen))
goto err;
- if (outlen > mdlen)
+ if (outlen >= mdlen)
{
if (!EVP_DigestFinal(&mctx, out, NULL))
goto err;