Skip to content

Commit

Permalink
cut legacy checks for openssl sni support
Browse files Browse the repository at this point in the history
Summary: Since v1.1.0, openssl always has sni support. In particular, openssl no longer can be built without tlxext and no longer can export `OPENSSL_NO_TLSEXT`.

Reviewed By: AjanthanAsogamoorthy

Differential Revision: D55331824

fbshipit-source-id: 551b9007654c0a29eb3399b9069ffcc2ae151683
  • Loading branch information
yfeldblum authored and facebook-github-bot committed Mar 28, 2024
1 parent d71117e commit b0bccaf
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
16 changes: 0 additions & 16 deletions wangle/ssl/SSLContextManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,10 @@ class SSLContextManager::SslContexts
* Callback function from openssl to find the right X509 to
* use during SSL handshake
*/
#if FOLLY_OPENSSL_HAS_SNI
static folly::SSLContext::ServerNameCallbackResult serverNameCallback(
SSL* ssl,
ClientHelloExtStats* stats,
const std::shared_ptr<SslContexts>& contexts);
#endif

private:
SslContexts(bool strict);
Expand Down Expand Up @@ -860,7 +858,6 @@ void SSLContextManager::verifyCertNames(
}
}

#if FOLLY_OPENSSL_HAS_SNI
/*static*/ SSLContext::ServerNameCallbackResult
SSLContextManager::SslContexts::serverNameCallback(
SSL* ssl,
Expand Down Expand Up @@ -914,7 +911,6 @@ SSLContextManager::SslContexts::serverNameCallback(
}
return SSLContext::SERVER_NAME_NOT_FOUND;
}
#endif

// Consolidate all SSL_CTX setup which depends on openssl version/feature
void SSLContextManager::SslContexts::ctxSetupByOpensslFeature(
Expand Down Expand Up @@ -959,7 +955,6 @@ void SSLContextManager::SslContexts::ctxSetupByOpensslFeature(
}

// SNI
#if FOLLY_OPENSSL_HAS_SNI
if (ctxConfig.isDefault) {
if (newDefault) {
throw std::runtime_error("More than 1 X509 is set as default");
Expand All @@ -973,18 +968,7 @@ void SSLContextManager::SslContexts::ctxSetupByOpensslFeature(
});
}
}
#else
// without SNI support, we expect only a single cert. set it as default and
// error if we go to another.
if (newDefault) {
OPENSSL_MISSING_FEATURE(SNI);
}

newDefault = sslCtx;

// Silence unused parameter warning
(mgr);
#endif
#ifdef SSL_OP_NO_RENEGOTIATION
// Disable renegotiation at the OpenSSL layer
sslCtx->setOptions(SSL_OP_NO_RENEGOTIATION);
Expand Down
3 changes: 0 additions & 3 deletions wangle/ssl/test/SSLContextManagerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,6 @@ TEST(SSLContextManagerTest, Test1) {
sslCtxMgr.getSSLCtxBySuffix(SSLContextKey("abc.xyz.example.com")));
}

// This test uses multiple contexts, which requires SNI support to work at all.
#if FOLLY_OPENSSL_HAS_SNI
TEST(SSLContextManagerTest, TestResetSSLContextConfigs) {
SSLContextManagerForTest sslCtxMgr(
"vip_ssl_context_manager_test_", getSettings(), nullptr);
Expand Down Expand Up @@ -440,7 +438,6 @@ TEST(SSLContextManagerTest, TestResetSSLContextConfigs) {
checkSeeds(
sslCtxMgr.getSSLCtxByExactDomain(SSLContextKey("test.com")), seeds2);
}
#endif

TEST(SSLContextManagerTest, TestSessionContextCertRemoval) {
SSLContextManagerForTest sslCtxMgr(
Expand Down

0 comments on commit b0bccaf

Please sign in to comment.