From: Dr. Stephen Henson Date: Thu, 1 Aug 2013 14:48:44 +0000 (+0100) Subject: Minor optimisation to KDF algorithm. X-Git-Tag: OpenSSL_1_0_2-beta1~221 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ecf9ceb90dbc28a34cdad2f0b0c2b73c3ae628f6;p=openssl Minor optimisation to KDF algorithm. Don't need to use temporary buffer if remaining length equals digest length. (cherry picked from commit 3f6b6f0b8cbd7173b6c007b07caa6ec34cda08c5) --- diff --git a/crypto/ecdh/ech_kdf.c b/crypto/ecdh/ech_kdf.c index 84bf108b90..848b91745f 100644 --- a/crypto/ecdh/ech_kdf.c +++ b/crypto/ecdh/ech_kdf.c @@ -90,7 +90,7 @@ int ECDH_KDF_X9_62(unsigned char *out, size_t outlen, goto err; if (!EVP_DigestUpdate(&mctx, sinfo, sinfolen)) goto err; - if (outlen > mdlen) + if (outlen >= mdlen) { if (!EVP_DigestFinal(&mctx, out, NULL)) goto err;