From: Nils Larsch Date: Mon, 8 Aug 2005 20:02:18 +0000 (+0000) Subject: a ssl object needs it's own instance of a ecdh key; remove obsolete comment X-Git-Tag: OpenSSL_0_9_8k^2~1862 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=eba63ef58b29c38f2849e0bc28f26f9b563fa0bb;p=oweals%2Fopenssl.git a ssl object needs it's own instance of a ecdh key; remove obsolete comment --- diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c index e98f62900f..f9d536e229 100644 --- a/ssl/s3_lib.c +++ b/ssl/s3_lib.c @@ -1797,12 +1797,12 @@ long ssl3_ctx_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg) SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_ECDH_LIB); return 0; } - if (!EC_KEY_up_ref((EC_KEY *)parg)) + ecdh = EC_KEY_dup((EC_KEY *)parg); + if (ecdh == NULL) { - SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_ECDH_LIB); + SSLerr(SSL_F_SSL3_CTX_CTRL,ERR_R_EC_LIB); return 0; } - ecdh = (EC_KEY *)parg; if (!(ctx->options & SSL_OP_SINGLE_ECDH_USE)) { if (!EC_KEY_generate_key(ecdh)) diff --git a/ssl/ssl_cert.c b/ssl/ssl_cert.c index 997528e97d..7908dcccdb 100644 --- a/ssl/ssl_cert.c +++ b/ssl/ssl_cert.c @@ -200,7 +200,6 @@ CERT *ssl_cert_dup(CERT *cert) #ifndef OPENSSL_NO_DH if (cert->dh_tmp != NULL) { - /* DH parameters don't have a reference count */ ret->dh_tmp = DHparams_dup(cert->dh_tmp); if (ret->dh_tmp == NULL) { @@ -234,8 +233,12 @@ CERT *ssl_cert_dup(CERT *cert) #ifndef OPENSSL_NO_ECDH if (cert->ecdh_tmp) { - EC_KEY_up_ref(cert->ecdh_tmp); - ret->ecdh_tmp = cert->ecdh_tmp; + ret->ecdh_tmp = EC_KEY_dup(cert->ecdh_tmp); + if (ret->ecdh_tmp == NULL) + { + SSLerr(SSL_F_SSL_CERT_DUP, ERR_R_EC_LIB); + goto err; + } } ret->ecdh_tmp_cb = cert->ecdh_tmp_cb; #endif