-
Notifications
You must be signed in to change notification settings - Fork 707
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
api: add method to append protocol preferences #2534
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## main #2534 +/- ##
==========================================
+ Coverage 82.10% 82.17% +0.07%
==========================================
Files 272 272
Lines 19095 19095
==========================================
+ Hits 15677 15691 +14
+ Misses 3418 3404 -14 |
lrstewart
reviewed
Jan 26, 2021
camshaft
force-pushed
the
protocol-preferences-append
branch
from
January 29, 2021 22:53
0c7f229
to
fa8ddea
Compare
camshaft
commented
Feb 1, 2021
lrstewart
reviewed
Feb 1, 2021
lrstewart
reviewed
Feb 1, 2021
lrstewart
reviewed
Feb 2, 2021
lrstewart
approved these changes
Feb 2, 2021
maddeleine
approved these changes
Feb 2, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of changes:
The current
s2n_{config,connection}_set_protocol_preferences
use null-terminated strings to pass ALPN values. This is a bad idea for a few reasons:\0
(which is technically allowed by the spec).This PR adds
s2n_{config,connection}_append_protocol_preference
methods which take an explicit pointer and length and then copy the value into theprotocol_preferences
blob. This should fix all of the issues stated above.I've also added a minimum length check (required by the spec), added tests, and cleaned up a memory leak that happened in the previous version when a protocol value failed to validate.
I used doxygen-style documentation for the new methods in anticipation of that being used in the near future.
Testing:
There is now a dedicated
s2n_protocol_preference_test
unit test for checking the behavior of the API. Before it was implicitly checked in other tests. I've added a lot of validation checks in this new module as well.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.