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

Fix SSLv3 detection with AWS-LC #4361

Merged
merged 6 commits into from
Jan 27, 2024
Merged

Fix SSLv3 detection with AWS-LC #4361

merged 6 commits into from
Jan 27, 2024

Conversation

goatgoose
Copy link
Contributor

@goatgoose goatgoose commented Jan 16, 2024

Description of changes:

Currently when s2n-tls is in FIPS mode, the SSLv3 HMAC algorithms are disabled. This prevents SSLv3 from being used in FIPS mode, which is a valid use case for customers using the same FIPS build of s2n-tls for FIPS and non-FIPS endpoints.

Note that restricting SSLv3 for FIPS-compliance is unrelated to this issue, and determined by selecting a FIPS-compatible s2n-tls security policy, not by the MD5/SSLv3 runtime checks. This change does not impact the s2n-tls FIPS-compatible security policies, which are not able to negotiate SSLv3.

The runtime check exists due to how the FIPS build of OpenSSL behaves. By default, OpenSSL disables MD5 at runtime when FIPS mode is enabled, which is required for SSLv3. This causes EVP_DigestInit calls to fail, unless md5 is explicitly enabled. s2n_hmac_is_available() isn't actually necessary to disable SSLv3 with OpenSSL-FIPS since attempting to use md5 later will fail, but it is used in tests to determine if the tests should be run or not.

This PR updates s2n_hmac_is_available() to indicate that the SSLv3 HMAC algorithms are available with AWS-LC, since AWS-LC-FIPS doesn't disable any functionality in FIPS mode. This allows SSLv3 to be negotiated with non-FIPS security policies that allow SSLv3.

Call-outs:

Adding an exception for AWS-LC essentially means we're bypassing the need to explicitly enable MD5 for the SSLv3 PRF when linked with AWS-LC. An alternative solution for this would be to just remove all of the logic for enabling/checking the status of MD5 and have it always be enabled on hash init. This would make OpenSSL-FIPs behave like AWS-LC-FIPS where MD5 functionality is always available, and we wouldn't need separate logic for OpenSSL and AWS-LC. This is a much bigger change, though.

I used cbmc/stubs/s2n_is_in_fips_mode.c as a reference for writing the s2n_libcrypto_is_awslc stub.

Testing:

I added a new self-talk unit test for SSLv3 which runs with AWS-LC-FIPS.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@github-actions github-actions bot added the s2n-core team label Jan 16, 2024
@goatgoose goatgoose force-pushed the sslv3-awslc branch 2 times, most recently from 1dc6cf3 to 13dd469 Compare January 23, 2024 16:45
@goatgoose goatgoose changed the title Fix sslv3 detection with AWS-LC Fix SSLv3 detection with AWS-LC Jan 24, 2024
@goatgoose goatgoose marked this pull request as ready for review January 24, 2024 06:44
@goatgoose
Copy link
Contributor Author

This change can be tested in the integration tests now that @maddeleine added SSLv3 support in #4372. I updated the tests to not skip SSLv3 in FIPS mode with AWS-LC.

This can be confirmed by observing the SSLv3 tests that run in the AWS-LC-FIPS/AWS-LC-FIPS 2022 happy path jobs.

@goatgoose goatgoose enabled auto-merge (squash) January 27, 2024 00:03
@goatgoose goatgoose merged commit dcdb0ed into aws:main Jan 27, 2024
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants