-
Notifications
You must be signed in to change notification settings - Fork 720
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: don't enable custom random for openssl fips #5093
base: main
Are you sure you want to change the base?
Conversation
utils/s2n_random.c
Outdated
/* OpenSSL-FIPS never supports custom rand, regardless of mode */ | ||
/* OpenSSL non-fips always supports custom rand */ | ||
/* other libcryptos never support custom rand */ | ||
bool awslc_fips_with_fips_enabled = s2n_libcrypto_is_awslc() && s2n_is_in_fips_mode(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the AWS-LC check necessary? The custom RAND is never used with aws-lc anyway, right?
crypto/s2n_libcrypto.c
Outdated
* | ||
* This method does not check whether the linked libcrypto has fips mode enabled. | ||
*/ | ||
bool s2n_libcrypto_is_openssl_fips(void) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was also added in #5081, but with a different meaning.
This also won't return true for openssl3-fips (and we probably wouldn't want it to for this use case). To avoid having two similar APIs here, would it maybe make sense to just add a #elif
to s2n_supports_custom_rand
and return false specifically for OpenSSL 1.0.2-fips (OPENSSL_FIPS
is defined)? I'm not sure it's going to be that useful anywhere else anyway.
* just add condition to preprocessor
Resolved issues:
This addresses #5044
Description of changes:
Revert s2n-tls behavior to the behavior before #4878.
Before 4878, compiling s2n-tls with an openssl-fips libcrypto disabled custom rand, independent of whether s2n-tls was set to fips mode.
After 4878, compiling s2n-tls with an openssl-fips libcrypto only disables custom rand if s2n-tls is in fips mode.
Thie PR reverts to the previous behavior.
Call-outs:
I would love some additional thoughts on how to test this :(
I'd like something that isn't too bogged down in the details of libcrypto versions. E.g. "check that there is no memory leak when overriding the random engine". But I don't think that test would pass for standard openssl versions right now.
Testing:
I ran the reproducer provided in the customer issue.
Mainline fails as expected
Whereas the fix exits with no error
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.