Repository navigation
Allow OpenSSL FIPS mode - #78413
Allow OpenSSL FIPS mode#78413thevar1able wants to merge 20 commits into
Conversation
There was a problem hiding this comment.
The functions below (e.g. RSA_generate_key_ex) seem deprecated in OSSL 3.x.
There was a problem hiding this comment.
Yes, all non-EVP_* seem to be deprecated. Should we get rid of RSAKey and ECKey from Poco?
There was a problem hiding this comment.
If no other code within or outside Poco uses RSA/ECKey, then yes, let's remove it.
(as a general rule, the usage and even presence of Poco is discouraged)
There was a problem hiding this comment.
I hope we have test coverage for this code :-)
This comment was marked as outdated.
This comment was marked as outdated.
a9cd501 to
2693e04
Compare
| option(ENABLE_OPENSSL_DYNAMIC "This option removes SSL from ClickHouse and will link to the OpenSSL version supplied by OS." ${ENABLE_OPENSSL_DYNAMIC_DEFAULT}) | ||
|
|
||
| set(ENABLE_OPENSSL_FIPS_DEFAULT OFF) | ||
| option(ENABLE_OPENSSL_FIPS "Allow using OpenSSL library in FIPS mode." ${ENABLE_OPENSSL_FIPS_DEFAULT}) |
There was a problem hiding this comment.
Cosmetics: ENABLE_OPENSSL_FIPS = 1 forces FIPS (the initialization code in server/Server.cpp throws an exception if FIPS initialization fails). We should say in l. 481: "Enable FIPS mode in OpenSSL".
A more important question is where do we currently use the define?
- to enable the FIPS mode in programs/keeper/Keeper.cpp and programs/server/Server.cpp (*)
- to enable dynamic loading in programs/keeper/keeper_main.cpp and programs/main.cpp (**)
At least (*) could be made dependent on some server setting in the configuration file, e.g.
<enable_fips_mode>true</enable_fips_mode>(side note: such a config tag ideally goes into the existing server section <openSSL><server>[...], see here)
Not sure if we can do a similar change to (**).
Not introducing a CMake define would simplify testing in CI as we could (in principle) use the general ClickHouse binary for testing.
There was a problem hiding this comment.
we could (in principle) use the general ClickHouse binary for testing
Nope, because of forbidden dlopen.
| void OpenSSLInitializer::dynlockDestroy(struct CRYPTO_dynlock_value* lock, const char* file, int line) | ||
| { | ||
| delete lock; | ||
| if (--_rc == 0) |
There was a problem hiding this comment.
Just paranoid ... could you check that the function in l. 61 is really called from somewhere during server shutdown?
| #if OPENSSL_VERSION_NUMBER >= 0x0907000L | ||
| OPENSSL_config(NULL); | ||
| #endif | ||
| SSL_library_init(); |
There was a problem hiding this comment.
Outdated and considered harmful (explicitly setting rand seed).

Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):
Remove legacy OpenSSL API usage and update CMake to support FIPS mode