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

Enable supported EC point formats and supported algorithm extensions #556

Merged
merged 5 commits into from
Jul 6, 2023

Conversation

hasheddan
Copy link
Contributor

Enables parsing the elliptic curve supported points format extension.

https://www.rfc-editor.org/rfc/rfc8422.html#section-5.1.2

Signed-off-by: Daniel Mangum georgedanielmangum@gmail.com

Enables parsing the supported signature algorithms extension.

https://datatracker.ietf.org/doc/html/rfc5246#autoid-39

Signed-off-by: Daniel Mangum georgedanielmangum@gmail.com

Note: I noticed these while tracing and capturing packets in wireshark. They were present in the relevant ClientHello / ServerHello, but were not be extracted by their counterpart.

@hasheddan hasheddan requested a review from Sean-Der July 6, 2023 13:57
Copy link
Contributor Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like our tests fail due to an error parsing the supported points format:

dtls internal: data length and declared length do not match

We are sending the supported points so it seems like we just have been avoiding this error due to not parsing them.

image

@codecov
Copy link

codecov bot commented Jul 6, 2023

Codecov Report

Patch coverage: 62.50% and project coverage change: +0.35 🎉

Comparison is base (d7303d0) 76.37% compared to head (3ddcaba) 76.73%.

❗ Current head 3ddcaba differs from pull request most recent head fa7bdc0. Consider uploading reports for the commit fa7bdc0 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #556      +/-   ##
==========================================
+ Coverage   76.37%   76.73%   +0.35%     
==========================================
  Files          95       95              
  Lines        5672     5677       +5     
==========================================
+ Hits         4332     4356      +24     
+ Misses        999      974      -25     
- Partials      341      347       +6     
Flag Coverage Δ
go 76.75% <62.50%> (+0.35%) ⬆️
wasm 66.97% <12.50%> (+0.52%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/protocol/extension/supported_point_formats.go 67.74% <25.00%> (+24.40%) ⬆️
pkg/protocol/extension/extension.go 68.85% <100.00%> (+0.43%) ⬆️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines -51 to +54
pointFormatCount := int(binary.BigEndian.Uint16(data[4:]))
if supportedGroupsHeaderSize+(pointFormatCount) > len(data) {
pointFormatCount := int(data[4])
if supportedPointFormatsSize+pointFormatCount > len(data) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now adheres to the same way that we encode the supported EC point formats.

@daenney
Copy link
Member

daenney commented Jul 6, 2023

Could we add a test or two for this before we merge?

@hasheddan
Copy link
Contributor Author

@daenney sure thing -- this is being tested in the general case, which is why enabling these extensions started causing test failures. However, I think the unit tests could be improved... will do so ASAP.

Copy link
Contributor Author

@hasheddan hasheddan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daenney added checks for unmarshal in the extensions that were missing them if you want to take another look :)

@hasheddan hasheddan requested a review from daenney July 6, 2023 16:40
Copy link
Member

@daenney daenney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks for adding those.

Enables parsing the elliptic curve supported points format extension.

https://www.rfc-editor.org/rfc/rfc8422.html#section-5.1.2

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Enables parsing the supported signature algorithms extension.

https://datatracker.ietf.org/doc/html/rfc5246#autoid-39

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Adds Daniel Mangum to AUTHORS.txt.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Fixes error in parsing supported elliptic curve point formats extension.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
Adds missing unmarshal unit tests for extensions that did not have them.
These ensure that marshal / unmarshal is round-trippable.

Signed-off-by: Daniel Mangum <georgedanielmangum@gmail.com>
@hasheddan hasheddan merged commit b905606 into pion:master Jul 6, 2023
14 checks passed
@hasheddan hasheddan self-assigned this Jul 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants