-
Notifications
You must be signed in to change notification settings - Fork 717
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
feat: Add additional EC key validation for FIPS #4452
Conversation
3cf7a0e
to
7a48299
Compare
7a48299
to
24afd67
Compare
02941cd
to
30bc322
Compare
30bc322
to
746381c
Compare
tests/unit/s2n_ecc_evp_test.c
Outdated
if (s2n_is_in_fips_mode() && s2n_libcrypto_supports_ec_key_check_fips()) { | ||
EXPECT_FAILURE_WITH_ERRNO(ret, S2N_ERR_ECDHE_INVALID_PUBLIC_KEY_FIPS); | ||
} else { | ||
EXPECT_FAILURE_WITH_ERRNO(ret, S2N_ERR_ECDHE_INVALID_PUBLIC_KEY); | ||
} |
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.
I still don't know that I love this trick, but it does work?
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.
Yeah... I'm not really sure it's worth it. If you think it's better without it let me know and I will remove it. I think the test itself is worth keeping either way though, since the call to EC_KEY_check_key
isn't currently being tested.
Unfortunately the debug line hack won't work either, since it requires different builds (AWS-LC vs AWS-LC-FIPS), so we can't compare the two line numbers.
Description of changes:
The EC_KEY_check_key libcrypto API is used in s2n-tls to validate the public key received from the peer. Some libcryptos, such as AWS-LC, provide another API: EC_KEY_check_fips, which includes the validation performed by
EC_KEY_check_key
as well as additional validation for FIPS.This PR calls the
EC_KEY_check_fips
API instead ofEC_KEY_check_key
when s2n-tls is operating in FIPS mode.Call-outs:
EC_KEY_check_fips
isn't defined in all libcryptos, so a new feature probe was added.Testing:
A new test was added to ensure that the feature probe is working correctly.
Performance:
I ran benchmarks to determine the performance impact of this change with AWS-LC-FIPS-2022. I used this s2n_perf unit test to get results. I ran each operation for 10 minutes.
While this change did significantly impact the performance of
s2n_ecc_evp_compute_shared_secret_from_params
, this is such a small part of the handshake that there wasn't really a noticeable change.generate vs compute_shared_secret comparison:
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.