Skip to content

Commit

Permalink
#4077: OpenSSL 3: Don't throw if legacy provider is not available
Browse files Browse the repository at this point in the history
  • Loading branch information
obiltschnig committed Jul 10, 2023
1 parent 1d64c61 commit e3a81b2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Crypto/include/Poco/Crypto/OpenSSLInitializer.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class Crypto_API OpenSSLInitializer
static void enableFIPSMode(bool enabled);
/// Enable or disable FIPS mode. If FIPS is not available, this method doesn't do anything.

static bool haveLegacyProvider();
/// Returns true if the OpenSSL 3.x legacy provider is available, otherwise false.

protected:
enum
{
Expand Down Expand Up @@ -109,6 +112,7 @@ inline bool OpenSSLInitializer::isFIPSEnabled()
#endif
}


#ifdef OPENSSL_FIPS
inline void OpenSSLInitializer::enableFIPSMode(bool enabled)
{
Expand All @@ -121,6 +125,12 @@ inline void OpenSSLInitializer::enableFIPSMode(bool /*enabled*/)
#endif


inline bool OpenSSLInitializer::haveLegacyProvider()
{
return _legacyProvider != nullptr;
}


} } // namespace Poco::Crypto


Expand Down
1 change: 0 additions & 1 deletion Crypto/src/OpenSSLInitializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,6 @@ void OpenSSLInitializer::initialize()
if (!_legacyProvider)
{
_legacyProvider = OSSL_PROVIDER_load(NULL, "legacy");
if (!_legacyProvider) throw CryptoException("Failed to load OpenSSL legacy provider");
}
#endif
}
Expand Down

0 comments on commit e3a81b2

Please sign in to comment.