From: Dr. Matthias St. Pierre Date: Sat, 15 Oct 2016 22:53:33 +0000 (+0200) Subject: Fix leak of secrecy in ecdh_compute_key() X-Git-Tag: OpenSSL_1_0_2k~58 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0e4690165b4beb6777b747b0aeb1646a301f41d9;p=oweals%2Fopenssl.git Fix leak of secrecy in ecdh_compute_key() A temporary buffer containing g^xy was not cleared in ecdh_compute_key() before freeing it, so the shared secret was leaked in memory. Reviewed-by: Kurt Roeckx Reviewed-by: Matt Caswell --- diff --git a/crypto/ecdh/ech_ossl.c b/crypto/ecdh/ech_ossl.c index df115cc262..d3b05247fe 100644 --- a/crypto/ecdh/ech_ossl.c +++ b/crypto/ecdh/ech_ossl.c @@ -212,7 +212,9 @@ static int ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, BN_CTX_end(ctx); if (ctx) BN_CTX_free(ctx); - if (buf) + if (buf) { + OPENSSL_cleanse(buf, buflen); OPENSSL_free(buf); + } return (ret); }