refactor: remove unused prf hmac impls #5148
Merged
+19
−211
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Release Summary:
Resolved issues:
related to #5143
Description of changes:
It looks like the PRF uses 3 different HMAC implementations, but in reality it only uses one. This PR removes the unused implementations for clarity.
The important code is:
s2n-tls/tls/s2n_prf.c
Lines 392 to 399 in 711ee0d
So we appear to have:
BUT:
So we ACTUALLY only have s2n_internal_p_hash_hmac.
Call-outs:
What about sslv3?
You might have noticed that we branch on sslv3 before we branch on on whether to use the libcrypto or custom PRF. That's not an issue. The sslv3 prf doesn't use the hmac implementation either (see the source. It's all hashes). Also, nothing we do to sslv3 is going to make it any more FIPS compliant :)
Testing:
Existing tests still pass.
I also proved that the other hmac implementation weren't being used by replacing their "final" methods with errors: c1f7183 Any meaningful use of hmac requires the "final" method, since that's the only way to actually produce output. The CI still passed (see the little green check next to the commit name-- it can be expanded to see the passing tests).
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.