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

Add possibility to load providers and use them in Poco #4656

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mapogu
Copy link

@mapogu mapogu commented Aug 28, 2024

We have need to externally configure and load providers to OpenSSL 3.x and I noticed that current implementation of the Poco::Net::Context does not provide a way to do this. In my understanding the library context needs to be configured for OpenSSL to search for Providers at an appropriate location. In addition to this, the actual external providers need to be loaded and kept alive until shutdown. These two steps have to happen prior to creation of the SSL Context in order to use providers.

Therefore, I've created this patch as a suggestion to add this improvement to Poco.

@mapogu
Copy link
Author

mapogu commented Aug 30, 2024

OK so two failed checks. Is it correct that CIFuzz and CodeQL build with OpenSSL version < 3.x ? In that case the correct way would be to add #if OPENSSL_VERSION_NUMBER >= 0x10100000L around changes, as the OpenSSL Provider API (replacement to Engine) is to my understanding a OpenSSL 3.x addition to OpenSSL ?

@aleks-f
Copy link
Member

aleks-f commented Sep 10, 2024

@mapogu is it possible to add a unit test here? I'm not sure what provider(s) are reasonable to expect on different platforms

@mapogu
Copy link
Author

mapogu commented Sep 23, 2024

Sorry for the late response. I can try to add unit test. To my understanding the Provider API in OpenSSL should be available on all platforms from OpenSSL 3.x. It can be used to load for instance:

  • Default Provider : standard built-in OpenSSL algorithm
  • Legacy Provider: collection of legacy algorithms (md2, md4, ... BF, DES)
  • FIPS Provider: algorithms conforming to FIPS standards
  • Base Provider: small sub-set of non-cryptographic algorithms available in the default provider.
  • Null Provider: "built-in" to libcrypto and contains no algorithm implementations. Guarantees that the default provider is not loaded.

A note in the docs seems to be that if a provider is loaded then the default provider is not automatically loaded by OpenSSL (has to be explicitly).

Hence I could try to write a test where we load for instance FIPS provider through Poco and check that the default provider is not available.

I guess this addition could be useful when you want to run the combination Poco, OpenSSL 3.x and only FIPS approved algorithms.

@mapogu
Copy link
Author

mapogu commented Sep 23, 2024

Since this is explicitly for OpenSSL 3.x is there any good compiler flag for the unit test framework so that the test case doesn't run on OpenSSL 1.x ?

@aleks-f
Copy link
Member

aleks-f commented Oct 3, 2024

Since this is explicitly for OpenSSL 3.x is there any good compiler flag for the unit test framework so that the test case doesn't run on OpenSSL 1.x ?

@mapogu see openssl3 CI jobs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants