-
Notifications
You must be signed in to change notification settings - Fork 111
[stream] Use full transcript in dialer key confirmation #1188
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
Conversation
stream/src/public_key/connection.rs
Outdated
|
||
// Verify dialer's key confirmation proves they can derive the shared secret | ||
// This uses the d2l_confirmation cipher with the handshake transcript as associated data | ||
let transcript = union(&d2l_msg, &response_msg); |
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.
Would it not be simpler for understanding
let transcript = union(&transcript, confirmation.encode());
?
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 think some people might find it simpler or more complicated.
What's definitely true though is that it does more CPU work by doing additional encoding, and does the same amount of bytes copying. I'll leave it largely as-is for now but will try to clarify with better naming
// Create and send hello + confirmation (Message 2) | ||
let cipher::Directional { l2d, d2l } = confirmation; | ||
let confirmation = Confirmation::create(l2d, &hello_transcript)?; | ||
let response_msg = (hello, confirmation).encode(); |
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.
fancy 👀
Codecov ReportAll modified and coverable lines are covered by tests ✅
@@ Coverage Diff @@
## main #1188 +/- ##
==========================================
+ Coverage 91.22% 91.27% +0.04%
==========================================
Files 216 216
Lines 57982 58309 +327
==========================================
+ Hits 52896 53223 +327
Misses 5086 5086
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Fixes #1178
Technically only the first commit is needed, the other two clean up the code
Cleanup steps:
create_handshake_transcript()
function which duplicates the logic ofcommonware_utils::union
ListenerResponse
type and just use tuple instead. The codec already has default implementations for encoding/decoding tuplesC: PublicKey
toP: PublicKey
where appropriate to match the rest of the codebaseHello
and 2)Confirmation
hello / confirmation
. For the OTHER's hello or confirmation, used variable names likelistener_*
ordialer_*
_msg
instead of_bytes
for consistency (previously was using both for naming)