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 OpenSSL 3.x support to openssl-dynamic #867

Merged
merged 2 commits into from Apr 23, 2024

Conversation

klaren
Copy link
Contributor

@klaren klaren commented Apr 12, 2024

Motivation:

The openssl-dynamic module only compiles against OpenSSL 1.x.

Modifications:

The most significant change is that one no longer needs to provide DH parameters manually. By calling SSL_CTX_set_dh_auto(), OpenSSL will use the built-in parameters that match the key pair size. E.g. RSA 2048 will use DH 2048 and so on.

The property jdk.tls.ephemeralDHKeySize, which was used to affect the size of the DH parameters before, will be ignored when using the dynamically linked OpenSSL. Instead, the system OpenSSL library's config will be used.

Another change is how FIPS is managed because OpenSSL 3 introduces a "Provider" concept. The FIPS_mode_set is removed and is now replaced with EVP_default_properties_enable_fips which instructs OpenSSL to load the FIPS compliant provider, if no provider is explicitly requested.

Result:

The openssl-dynamic module can now successfully compile and run with OpenSSL 3.x.


This only makes the necessary changes to the code. There is still the question of how this should be published(if at all?) since it has to be a separate artifact from the 1.x version. Some alternatives I see are

  • Completely drop 1.x support. This would also unnest all the pre-processing spaghetti in the code.
  • Publish under a separate classifier.
  • Some hybrid of the above by creating a new openssl3-dynamic module.

Motivation:

The `openssl-dynamic` module only compiles against OpenSSL 1.x.

Modifications:

The most significant change is that one no longer needs to provide DH parameters manually. By calling `SSL_CTX_set_dh_auto()`, OpenSSL will use the built-in parameters that match the key pair size. E.g. RSA 2048 will use DH 2048 and so on.

The property `jdk.tls.ephemeralDHKeySize`, which was used to affect the size of the DH parameters before, will be ignored when using the dynamically linked OpenSSL. Instead, the system OpenSSL library's config will be used.

Another change is how FIPS is managed because OpenSSL 3 introduces a "Provider" concept. The `FIPS_mode_set` is removed and is now replaced with `EVP_default_properties_enable_fips` which instructs OpenSSL to load the FIPS compliant provider, if no provider is explicitly requested.

Result:

The `openssl-dynamic` module can now successfully compile and run with OpenSSL 3.x.
@normanmaurer
Copy link
Member

@klaren thanks a lot for the contribution... Did you sign our ICLA yet, https://netty.io/s/icla ?

@klaren
Copy link
Contributor Author

klaren commented Apr 18, 2024

@normanmaurer yes, I signed it just before I created the PR.

@normanmaurer
Copy link
Member

@klaren
Copy link
Contributor Author

klaren commented Apr 23, 2024

@normanmaurer Minor typo, should be fixed now.

@normanmaurer normanmaurer merged commit c9b4b6a into netty:main Apr 23, 2024
7 checks passed
@normanmaurer normanmaurer added this to the 2.0.66.Final milestone Apr 23, 2024
@normanmaurer
Copy link
Member

Thanks a lot @klaren

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.

None yet

2 participants