Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

libssl: Load only the ciphers and digests needed for TLS, not all of them #11166

Merged
merged 1 commit into from
Jan 14, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions pdns/libssl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,17 @@ void registerOpenSSLUser()
if (s_users.fetch_add(1) == 0) {
#ifdef HAVE_OPENSSL_INIT_CRYPTO
/* load the default configuration file (or one specified via OPENSSL_CONF),
which can then be used to load engines */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG, nullptr);
which can then be used to load engines.
Do not load all ciphers and digests, we only need a few of them and these
will be loaded by OPENSSL_init_ssl(). */
OPENSSL_init_crypto(OPENSSL_INIT_LOAD_CONFIG|OPENSSL_INIT_NO_ADD_ALL_CIPHERS|OPENSSL_INIT_NO_ADD_ALL_DIGESTS, nullptr);
OPENSSL_init_ssl(0, nullptr);
#endif

#if (OPENSSL_VERSION_NUMBER < 0x1010000fL || (defined LIBRESSL_VERSION_NUMBER && LIBRESSL_VERSION_NUMBER < 0x2090100fL))
/* load error strings for both libcrypto and libssl */
SSL_load_error_strings();
/* load all ciphers and digests needed for TLS support */
OpenSSL_add_ssl_algorithms();
openssl_thread_setup();
#endif
Expand Down