Skip to content

Commit 01c55e6

Browse files
authored
Merge pull request ClickHouse#59870 from rschu1ze/be-less-boring-32
boringssl --> OpenSSL 3.2
2 parents ea42c98 + 9d2301f commit 01c55e6

File tree

454 files changed

+79417
-254791
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

454 files changed

+79417
-254791
lines changed

.github/workflows/master.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -238,14 +238,15 @@ jobs:
238238
build_name: binary_riscv64
239239
data: ${{ needs.RunConfig.outputs.data }}
240240
checkout_depth: 0
241-
BuilderBinS390X:
242-
needs: [RunConfig, BuilderDebRelease]
243-
if: ${{ !failure() && !cancelled() }}
244-
uses: ./.github/workflows/reusable_build.yml
245-
with:
246-
build_name: binary_s390x
247-
data: ${{ needs.RunConfig.outputs.data }}
248-
checkout_depth: 0
241+
# disabled because s390x refused to build in the migration to OpenSSL
242+
# BuilderBinS390X:
243+
# needs: [RunConfig, BuilderDebRelease]
244+
# if: ${{ !failure() && !cancelled() }}
245+
# uses: ./.github/workflows/reusable_build.yml
246+
# with:
247+
# build_name: binary_s390x
248+
# data: ${{ needs.RunConfig.outputs.data }}
249+
# checkout_depth: 0
249250
############################################################################################
250251
##################################### Docker images #######################################
251252
############################################################################################
@@ -296,7 +297,7 @@ jobs:
296297
- BuilderBinFreeBSD
297298
- BuilderBinPPC64
298299
- BuilderBinRISCV64
299-
- BuilderBinS390X
300+
# - BuilderBinS390X # disabled because s390x refused to build in the migration to OpenSSL
300301
- BuilderBinAmd64Compat
301302
- BuilderBinAarch64V80Compat
302303
- BuilderBinClangTidy

.gitmodules

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,6 @@
173173
[submodule "contrib/libpq"]
174174
path = contrib/libpq
175175
url = https://github.com/ClickHouse/libpq
176-
[submodule "contrib/boringssl"]
177-
path = contrib/boringssl
178-
url = https://github.com/ClickHouse/boringssl
179176
[submodule "contrib/NuRaft"]
180177
path = contrib/NuRaft
181178
url = https://github.com/ClickHouse/NuRaft
@@ -275,9 +272,6 @@
275272
[submodule "contrib/crc32-s390x"]
276273
path = contrib/crc32-s390x
277274
url = https://github.com/linux-on-ibm-z/crc32-s390x
278-
[submodule "contrib/openssl"]
279-
path = contrib/openssl
280-
url = https://github.com/openssl/openssl
281275
[submodule "contrib/google-benchmark"]
282276
path = contrib/google-benchmark
283277
url = https://github.com/google/benchmark
@@ -366,6 +360,9 @@
366360
[submodule "contrib/idna"]
367361
path = contrib/idna
368362
url = https://github.com/ada-url/idna.git
363+
[submodule "contrib/openssl"]
364+
path = contrib/openssl
365+
url = https://github.com/ClickHouse/openssl.git
369366
[submodule "contrib/double-conversion"]
370367
path = contrib/double-conversion
371368
url = https://github.com/ClickHouse/double-conversion.git

CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,8 +455,6 @@ endif ()
455455

456456
enable_testing() # Enable for tests without binary
457457

458-
option(ENABLE_OPENSSL "This option performs a build with OpenSSL. NOTE! This option is insecure and should never be used. By default, ClickHouse uses and only supports BoringSSL" OFF)
459-
460458
if (ARCH_S390X)
461459
set(ENABLE_OPENSSL_DYNAMIC_DEFAULT ON)
462460
else ()

base/poco/Crypto/src/OpenSSLInitializer.cpp

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@
2323
#include <openssl/conf.h>
2424
#endif
2525

26+
#if __has_feature(address_sanitizer)
27+
#include <sanitizer/lsan_interface.h>
28+
#endif
2629

2730
using Poco::RandomInputStream;
2831
using Poco::Thread;
@@ -67,21 +70,27 @@ void OpenSSLInitializer::initialize()
6770
SSL_library_init();
6871
SSL_load_error_strings();
6972
OpenSSL_add_all_algorithms();
70-
73+
7174
char seed[SEEDSIZE];
7275
RandomInputStream rnd;
7376
rnd.read(seed, sizeof(seed));
74-
RAND_seed(seed, SEEDSIZE);
75-
77+
{
78+
# if __has_feature(address_sanitizer)
79+
/// Leak sanitizer (part of address sanitizer) thinks that a few bytes of memory in OpenSSL are allocated during but never released.
80+
__lsan::ScopedDisabler lsan_disabler;
81+
#endif
82+
RAND_seed(seed, SEEDSIZE);
83+
}
84+
7685
int nMutexes = CRYPTO_num_locks();
7786
_mutexes = new Poco::FastMutex[nMutexes];
7887
CRYPTO_set_locking_callback(&OpenSSLInitializer::lock);
7988
// Not needed on Windows (see SF #110: random unhandled exceptions when linking with ssl).
8089
// https://sourceforge.net/p/poco/bugs/110/
8190
//
8291
// From http://www.openssl.org/docs/crypto/threads.html :
83-
// "If the application does not register such a callback using CRYPTO_THREADID_set_callback(),
84-
// then a default implementation is used - on Windows and BeOS this uses the system's
92+
// "If the application does not register such a callback using CRYPTO_THREADID_set_callback(),
93+
// then a default implementation is used - on Windows and BeOS this uses the system's
8594
// default thread identifying APIs"
8695
CRYPTO_set_id_callback(&OpenSSLInitializer::id);
8796
CRYPTO_set_dynlock_create_callback(&OpenSSLInitializer::dynlockCreate);
@@ -100,7 +109,7 @@ void OpenSSLInitializer::uninitialize()
100109
CRYPTO_set_locking_callback(0);
101110
CRYPTO_set_id_callback(0);
102111
delete [] _mutexes;
103-
112+
104113
CONF_modules_free();
105114
}
106115
}

base/poco/NetSSL_OpenSSL/src/Context.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,7 @@ void Context::createSSLContext()
592592
SSL_CTX_set_default_passwd_cb(_pSSLContext, &SSLManager::privateKeyPassphraseCallback);
593593
Utility::clearErrorStack();
594594
SSL_CTX_set_options(_pSSLContext, SSL_OP_ALL);
595+
SSL_CTX_set_options(_pSSLContext, SSL_OP_IGNORE_UNEXPECTED_EOF);
595596
}
596597

597598

base/poco/NetSSL_OpenSSL/src/SSLManager.cpp

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ void SSLManager::initializeClient(PrivateKeyPassphraseHandlerPtr ptrPassphraseHa
125125
Context::Ptr SSLManager::defaultServerContext()
126126
{
127127
Poco::FastMutex::ScopedLock lock(_mutex);
128-
128+
129129
if (!_ptrDefaultServerContext)
130130
initDefaultContext(true);
131131

@@ -150,7 +150,7 @@ Context::Ptr SSLManager::defaultClientContext()
150150
_ptrDefaultClientContext->disableProtocols(Context::PROTO_SSLV2 | Context::PROTO_SSLV3);
151151
}
152152
}
153-
153+
154154
return _ptrDefaultClientContext;
155155
}
156156

@@ -256,7 +256,7 @@ void SSLManager::initDefaultContext(bool server)
256256
Context::Params params;
257257
// mandatory options
258258
params.privateKeyFile = config.getString(prefix + CFG_PRIV_KEY_FILE, "");
259-
params.certificateFile = config.getString(prefix + CFG_CERTIFICATE_FILE, params.privateKeyFile);
259+
params.certificateFile = config.getString(prefix + CFG_CERTIFICATE_FILE, params.privateKeyFile);
260260
params.caLocation = config.getString(prefix + CFG_CA_LOCATION, "");
261261

262262
if (server && params.certificateFile.empty() && params.privateKeyFile.empty())
@@ -283,7 +283,7 @@ void SSLManager::initDefaultContext(bool server)
283283
params.ecdhCurve = config.getString(prefix + CFG_ECDH_CURVE, "");
284284

285285
Context::Usage usage;
286-
286+
287287
if (server)
288288
{
289289
if (requireTLSv1_2)
@@ -308,7 +308,7 @@ void SSLManager::initDefaultContext(bool server)
308308
usage = Context::CLIENT_USE;
309309
_ptrDefaultClientContext = new Context(usage, params);
310310
}
311-
311+
312312
std::string disabledProtocolsList = config.getString(prefix + CFG_DISABLE_PROTOCOLS, "");
313313
Poco::StringTokenizer dpTok(disabledProtocolsList, ";,", Poco::StringTokenizer::TOK_TRIM | Poco::StringTokenizer::TOK_IGNORE_EMPTY);
314314
int disabledProtocols = 0;
@@ -329,27 +329,28 @@ void SSLManager::initDefaultContext(bool server)
329329
_ptrDefaultServerContext->disableProtocols(disabledProtocols);
330330
else
331331
_ptrDefaultClientContext->disableProtocols(disabledProtocols);
332-
333-
bool cacheSessions = config.getBool(prefix + CFG_CACHE_SESSIONS, false);
334-
if (server)
335-
{
336-
std::string sessionIdContext = config.getString(prefix + CFG_SESSION_ID_CONTEXT, config.getString("application.name", ""));
337-
_ptrDefaultServerContext->enableSessionCache(cacheSessions, sessionIdContext);
338-
if (config.hasProperty(prefix + CFG_SESSION_CACHE_SIZE))
339-
{
340-
int cacheSize = config.getInt(prefix + CFG_SESSION_CACHE_SIZE);
341-
_ptrDefaultServerContext->setSessionCacheSize(cacheSize);
342-
}
343-
if (config.hasProperty(prefix + CFG_SESSION_TIMEOUT))
344-
{
345-
int timeout = config.getInt(prefix + CFG_SESSION_TIMEOUT);
346-
_ptrDefaultServerContext->setSessionTimeout(timeout);
347-
}
348-
}
349-
else
350-
{
351-
_ptrDefaultClientContext->enableSessionCache(cacheSessions);
352-
}
332+
333+
/// Temporarily disabled during the transition from boringssl to OpenSSL due to tsan issues.
334+
/// bool cacheSessions = config.getBool(prefix + CFG_CACHE_SESSIONS, false);
335+
/// if (server)
336+
/// {
337+
/// std::string sessionIdContext = config.getString(prefix + CFG_SESSION_ID_CONTEXT, config.getString("application.name", ""));
338+
/// _ptrDefaultServerContext->enableSessionCache(cacheSessions, sessionIdContext);
339+
/// if (config.hasProperty(prefix + CFG_SESSION_CACHE_SIZE))
340+
/// {
341+
/// int cacheSize = config.getInt(prefix + CFG_SESSION_CACHE_SIZE);
342+
/// _ptrDefaultServerContext->setSessionCacheSize(cacheSize);
343+
/// }
344+
/// if (config.hasProperty(prefix + CFG_SESSION_TIMEOUT))
345+
/// {
346+
/// int timeout = config.getInt(prefix + CFG_SESSION_TIMEOUT);
347+
/// _ptrDefaultServerContext->setSessionTimeout(timeout);
348+
/// }
349+
/// }
350+
/// else
351+
/// {
352+
/// _ptrDefaultClientContext->enableSessionCache(cacheSessions);
353+
/// }
353354
bool extendedVerification = config.getBool(prefix + CFG_EXTENDED_VERIFICATION, false);
354355
if (server)
355356
_ptrDefaultServerContext->enableExtendedCertificateVerification(extendedVerification);
@@ -378,7 +379,7 @@ void SSLManager::initPassphraseHandler(bool server)
378379
{
379380
if (server && _ptrServerPassphraseHandler) return;
380381
if (!server && _ptrClientPassphraseHandler) return;
381-
382+
382383
std::string prefix = server ? CFG_SERVER_PREFIX : CFG_CLIENT_PREFIX;
383384
Poco::Util::AbstractConfiguration& config = appConfig();
384385

@@ -399,7 +400,7 @@ void SSLManager::initPassphraseHandler(bool server)
399400
}
400401
else throw Poco::Util::UnknownOptionException(std::string("No passphrase handler known with the name ") + className);
401402
}
402-
403+
403404

404405
void SSLManager::initCertificateHandler(bool server)
405406
{

contrib/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,7 @@ function(add_contrib cmake_folder)
3737
message(STATUS "Adding contrib module ${base_folders} (configuring with ${cmake_folder})")
3838
add_subdirectory (${cmake_folder})
3939
endfunction()
40-
if (ENABLE_OPENSSL OR ENABLE_OPENSSL_DYNAMIC)
41-
add_contrib (openssl-cmake openssl)
42-
else ()
43-
add_contrib (boringssl-cmake boringssl)
44-
endif ()
40+
add_contrib (openssl-cmake openssl)
4541
add_contrib (miniselect-cmake miniselect)
4642
add_contrib (pdqsort-cmake pdqsort)
4743
add_contrib (pocketfft-cmake pocketfft)

contrib/aws

contrib/aws-c-cal

contrib/boringssl

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)