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

feat(events): Add cipher suite to TLS Session in the TlsExporterReady event #2070

Merged
merged 6 commits into from
Dec 13, 2023

Conversation

WesleyRosenblum
Copy link
Contributor

Description of changes:

#1984 added the ability to export symmetric keys negotiated during the QUIC handshake by adding an on_tls_exporter_ready event. This change adds cipher_suite() to the TLS session exposed as part of the event for use when using the exported keys.

Call-outs:

I use CipherSuite::Unknown in place of returning an error, it seemed a little more user friendly and I wasn't sure the error would be useful

Testing:

Updated the exporter integration test to confirm the client and server ciphersuites are the same and neither of them are unknown

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@@ -88,6 +88,14 @@ impl tls::TlsSession for Session {
.tls_exporter(label, context, output)
.map_err(|_| tls::TlsExportError::failure())
}

fn cipher_suite(&self) -> CipherSuite {
if let Ok(cipher_suite) = self.connection.cipher_suite() {
Copy link
Contributor

Choose a reason for hiding this comment

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

seems better to store the expected cipher suite on the session state, rather than parsing it from the connection?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

just to make sure I'm understanding, that would be done inside of on_secret in callback.rs by changing fn get_algo_type to also return the cipher suite?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah that's what i was thinking

@@ -40,6 +43,8 @@ pub trait TlsSession: Send {
context: &[u8],
output: &mut [u8],
) -> Result<(), TlsExportError>;

fn cipher_suite(&self) -> CipherSuite;
Copy link
Contributor

Choose a reason for hiding this comment

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

makes sense to return Unknown rather than an error

@WesleyRosenblum WesleyRosenblum merged commit 729e046 into main Dec 13, 2023
137 of 138 checks passed
@WesleyRosenblum WesleyRosenblum deleted the WesleyRosenblum/tlsexport branch December 13, 2023 01:35
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.

2 participants