clientVerifyCrls(),
clientCA(),
dhParams(),
-- eecdhCurve(NULL),
- contextMethod()
- sslContextFlags(0),
- sslOptions(0)
++ eecdhCurve(NULL)
#endif
{
memset(&tcp_keepalive, 0, sizeof(tcp_keepalive));
}
}
- // backward compatibility hack for sslversion= configuration
- if (version > 2) {
- const char *add = NULL;
- switch (version) {
- case 3:
- add = "NO_TLSv1,NO_TLSv1_1,NO_TLSv1_2";
- break;
- case 4:
- add = "NO_SSLv3,NO_TLSv1_1,NO_TLSv1_2";
- break;
- case 5:
- add = "NO_SSLv3,NO_TLSv1,NO_TLSv1_2";
- break;
- case 6:
- add = "NO_SSLv3,NO_TLSv1,NO_TLSv1_1";
- break;
- default: // nothing
- break;
- }
- if (add) {
- SBuf tmpOpts;
- if (options) {
- tmpOpts.append(options, strlen(options));
- tmpOpts.append(",",1);
- }
- tmpOpts.append(add, strlen(add));
- xfree(options);
- options = xstrdup(tmpOpts.c_str());
- }
- version = 0; // prevent options being repeatedly appended
- }
+ secure.updateTlsVersionLimits();
- #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
- contextMethod = TLS_server_method();
- #else
- contextMethod = SSLv23_server_method();
- #endif
const char *dhParamsFile = dhfile; // backward compatibility for dhparams= configuration
safe_free(eecdhCurve); // clear any previous EECDH configuration
Ssl::X509_NAME_STACK_Pointer clientCA; ///< CA certificates to use when verifying client certificates
Ssl::DH_Pointer dhParams; ///< DH parameters for temporary/ephemeral DH key exchanges
char *eecdhCurve; ///< Elliptic curve for ephemeral EC-based DH key exchanges
- Ssl::ContextMethod contextMethod; ///< The context method (SSL_METHOD) to use when creating certificates
- long sslContextFlags; ///< flags modifying the use of SSL
- long sslOptions; ///< SSL engine options
#endif
};
SSL_CTX *
sslCreateServerContext(AnyP::PortCfg &port)
{
- int ssl_error;
- const char *keyfile, *certfile;
- certfile = port.cert;
- keyfile = port.key;
-
ssl_initialize();
- SSL_CTX *sslContext = SSL_CTX_new(port.contextMethod);
+
- if (!keyfile)
- keyfile = certfile;
-
- if (!certfile)
- certfile = keyfile;
-
+ #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+ SSL_CTX *sslContext = SSL_CTX_new(TLS_server_method());
+ #else
+ SSL_CTX *sslContext = SSL_CTX_new(SSLv23_server_method());
+ #endif
if (sslContext == NULL) {
- ssl_error = ERR_get_error();
+ int ssl_error = ERR_get_error();
debugs(83, DBG_CRITICAL, "ERROR: Failed to allocate SSL context: " << ERR_error_string(ssl_error, NULL));
return NULL;
}