From: Amos Jeffries Date: Wed, 27 Jan 2016 04:41:56 +0000 (+1300) Subject: Cleanup: remove last SSL_CTX_Pointer uses X-Git-Tag: SQUID_4_0_5~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3db3be00426ea38316b03ef3cfa4b6466916c8ea;p=thirdparty%2Fsquid.git Cleanup: remove last SSL_CTX_Pointer uses --- diff --git a/src/client_side.cc b/src/client_side.cc index 8c87acc9e6..7916977080 100644 --- a/src/client_side.cc +++ b/src/client_side.cc @@ -3673,7 +3673,7 @@ ConnStateData::getSslContextStart() debugs(33, 5, "Finding SSL certificate for " << sslBumpCertKey << " in cache"); Ssl::LocalContextStorage * ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s); Security::ContextPtr dynCtx = nullptr; - Ssl::SSL_CTX_Pointer *cachedCtx = ssl_ctx_cache ? ssl_ctx_cache->get(sslBumpCertKey.termedBuf()) : NULL; + Security::ContextPointer *cachedCtx = ssl_ctx_cache ? ssl_ctx_cache->get(sslBumpCertKey.termedBuf()) : nullptr; if (cachedCtx && (dynCtx = cachedCtx->get())) { debugs(33, 5, "SSL certificate for " << sslBumpCertKey << " found in cache"); if (Ssl::verifySslCertificate(dynCtx, certProperties)) { @@ -3746,7 +3746,7 @@ ConnStateData::getSslContextDone(Security::ContextPtr sslContext, bool isNew) Ssl::LocalContextStorage *ssl_ctx_cache = Ssl::TheGlobalContextStorage.getLocalStorage(port->s); assert(sslBumpCertKey.size() > 0 && sslBumpCertKey[0] != '\0'); if (sslContext) { - if (!ssl_ctx_cache || !ssl_ctx_cache->add(sslBumpCertKey.termedBuf(), new Ssl::SSL_CTX_Pointer(sslContext))) { + if (!ssl_ctx_cache || !ssl_ctx_cache->add(sslBumpCertKey.termedBuf(), new Security::ContextPointer(sslContext))) { // If it is not in storage delete after using. Else storage deleted it. fd_table[clientConnection->fd].dynamicSslContext = sslContext; } diff --git a/src/ssl/context_storage.h b/src/ssl/context_storage.h index ddc383db52..b10a7af959 100644 --- a/src/ssl/context_storage.h +++ b/src/ssl/context_storage.h @@ -16,6 +16,7 @@ #include "ip/Address.h" #include "mgr/Action.h" #include "mgr/Command.h" +#include "security/forward.h" #include "SquidTime.h" #include "ssl/gadgets.h" @@ -47,7 +48,7 @@ public: virtual bool aggregatable() const { return false; } }; -typedef LruMap LocalContextStorage; +typedef LruMap LocalContextStorage; /// Class for storing/manipulating LocalContextStorage per local listening address/port. class GlobalContextStorage diff --git a/src/ssl/gadgets.h b/src/ssl/gadgets.h index 30c24b1b86..8b8afc9128 100644 --- a/src/ssl/gadgets.h +++ b/src/ssl/gadgets.h @@ -66,9 +66,6 @@ typedef TidyPointer RSA_Pointer; CtoCpp1(X509_REQ_free, X509_REQ *) typedef TidyPointer X509_REQ_Pointer; -CtoCpp1(SSL_CTX_free, SSL_CTX *) -typedef TidyPointer SSL_CTX_Pointer; - sk_free_wrapper(sk_X509_NAME, STACK_OF(X509_NAME) *, X509_NAME_free) typedef TidyPointer X509_NAME_STACK_Pointer; diff --git a/src/ssl/support.cc b/src/ssl/support.cc index 6b9688fb36..51130d200f 100644 --- a/src/ssl/support.cc +++ b/src/ssl/support.cc @@ -937,9 +937,9 @@ Security::ContextPtr Ssl::createSSLContext(Security::CertPointer & x509, Ssl::EVP_PKEY_Pointer & pkey, AnyP::PortCfg &port) { #if (OPENSSL_VERSION_NUMBER >= 0x10100000L) - Ssl::SSL_CTX_Pointer sslContext(SSL_CTX_new(TLS_server_method())); + Security::ContextPointer sslContext(SSL_CTX_new(TLS_server_method())); #else - Ssl::SSL_CTX_Pointer sslContext(SSL_CTX_new(SSLv23_server_method())); + Security::ContextPointer sslContext(SSL_CTX_new(SSLv23_server_method())); #endif if (!SSL_CTX_use_certificate(sslContext.get(), x509.get()))