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

binding: Add s2n_connection_get_session on the Connection #4522

Merged
merged 6 commits into from
Apr 29, 2024

Conversation

mathpal
Copy link
Contributor

@mathpal mathpal commented Apr 25, 2024

Resolved issues:

N/A

Description of changes:

The change adds a new method in the Connection for the rust bindings to expose the session state. This allows clients/servers to capture the most recent session outside of the SessionTicketCallback callback.

Until #4264 is addressed, this allows sessions for TLS1.2 or lower to be cached with data other than a servername.

Call-outs:

The C api requires an allocation for writing the session, In order to provide a simpler rust API, and be consistent with some of the other apis in Connection, the buffer allocation is performed within the connection::session method itself.

Testing:

Unit tests

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

bindings/rust/s2n-tls/src/testing/resumption.rs Outdated Show resolved Hide resolved
bindings/rust/s2n-tls/src/connection.rs Outdated Show resolved Hide resolved
bindings/rust/s2n-tls/src/testing/resumption.rs Outdated Show resolved Hide resolved
Comment on lines 682 to 683
/// Retrieves the size of the session ticket.
pub fn session_ticket_length(&mut self) -> Result<usize, Error> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be &mut self or just &self? Is this mutating?

Same for session_ticket

Copy link
Contributor Author

@mathpal mathpal Apr 27, 2024

Choose a reason for hiding this comment

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

No, it doesn't. Reading the c side, I think it should be safe to make it &self.

I was mainly unsure initially because of tls1.3, where these tickets can change if io is in progress.

@jmayclin jmayclin enabled auto-merge (squash) April 29, 2024 19:02
@jmayclin jmayclin merged commit 97a45a2 into aws:main Apr 29, 2024
32 checks passed
@mathpal mathpal deleted the main branch April 29, 2024 21:34
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.

None yet

4 participants