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

implement keysize mismatch #197

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

implement keysize mismatch #197

wants to merge 8 commits into from

Conversation

russelltg
Copy link
Owner

Fixes #195

@russelltg russelltg marked this pull request as draft March 23, 2023 22:11
@russelltg russelltg changed the title add some failing tests implement keysize mismatch Mar 23, 2023
@russelltg russelltg marked this pull request as ready for review March 23, 2023 23:11
@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.84%. Comparing base (36f92e6) to head (cb45645).
Report is 14 commits behind head on main.

Current head cb45645 differs from pull request most recent head b4b6d65

Please upload reports for the commit b4b6d65 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #197      +/-   ##
==========================================
- Coverage   77.54%   75.84%   -1.70%     
==========================================
  Files          85       88       +3     
  Lines       14000    14287     +287     
==========================================
- Hits        10856    10836      -20     
- Misses       3144     3451     +307     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Comment on lines +74 to +75
warn!("Key size mismatch: caller requested {:?}, listener was configured with {:?}. Selecting {:?}", incoming.key_size, key_settings.key_size, incoming.key_size);
key_settings.key_size = incoming.key_size;
Copy link

@Sculas Sculas Mar 23, 2023

Choose a reason for hiding this comment

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

Is this intended behavior? If my understanding is correct, this means the client can change the server's encryption settings to what it wants.
It can even set the key size to 0, but thankfully that is then caught here by defaulting to Bytes16 instead of no encryption at all.

Copy link
Owner Author

Choose a reason for hiding this comment

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

Let me confirm what the ref impl does...

Copy link
Owner Author

Choose a reason for hiding this comment

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

Copy link
Owner Author

Choose a reason for hiding this comment

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

We don't currently implement SRTO_SENDER because it is only really needed for old SRT compatibility (new SRT is always full duplex). However the docs say that this is the only modern use of it https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#SRTO_SENDER

Copy link
Owner Author

Choose a reason for hiding this comment

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

For example:

$ srt-live-transmit "srt://:2222?pbkeylen=24&passphrase=password123" udp://127.0.0.1:3333 -a:no &
$ srt-live-transmit udp://:1111 "srt://127.0.0.1:2222?passphrase=password123&pbkeylen=16" -a:no
18:55:59.730216/SRT:RcvQ:w1!W:SRT.cn: processConnectResponse: PBKEYLEN conflict - keep 16; peer-advertised PBKEYLEN 24 rejected because Agent is SRTO_SENDER
$ srt-live-transmit udp://:1111 "srt://:2222?passphrase=password123&pbkeylen=16" -a:no &
$ srt-live-transmit "srt://127.0.0.1:2222?pbkeylen=24&passphrase=password123" udp://127.0.0.1:3333 -a:no
18:57:28.338138/SRT:RcvQ:w1!W:SRT.cn: processConnectResponse: PBKEYLEN conflict - OVERRIDDEN 24 by 16 from PEER (as AGENT is not SRTO_SENDER)

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.

Implement key size mismatch
3 participants