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

Add access to some fields of mbedtls_ssl_ticket #5421

Closed
mpg opened this issue Jan 12, 2022 · 1 comment · Fixed by #5501
Closed

Add access to some fields of mbedtls_ssl_ticket #5421

mpg opened this issue Jan 12, 2022 · 1 comment · Fixed by #5501
Labels
good-first-issue Good for newcomers help-wanted This issue is not being actively worked on, but PRs welcome. size-s Estimated task size: small (~2d)

Comments

@mpg
Copy link
Contributor

mpg commented Jan 12, 2022

Since 3.0, all fields of mbedtls_ssl_ticket_key and mbedtls_ssl_ticket_context are now private. It turns out some applications where accessing them (originally reported in #5331):

lighttpd allows synchronization of session tickets
across multiple servers, and so writes into mbedtls_ssl_ticket_context to
manage mbedtls_ssl_ticket_context.
lighttpd mod_mbedtls_session_ticket_key_check()
https://git.lighttpd.net/lighttpd/lighttpd1.4/src/branch/master/src/mod_mbedtls.c#L335

It should be noted that ssl_ticket.c is only loosely coupled with the code TLS code, and applications who wish to modify how ticket protection is handled are free to write their own implementation of the callbacks passed to mbedtls_ssl_conf_session_tickets_cb(), and use their own data structures, to which they have full access.

However, in that instance it looks like the application only wants to slightly extend key management, so writing a full replacement to ssl_ticket.c would be a bit much for the task at hand, and it is desirable to allow applications to re-use most of ssl_ticket.c but just modifying the bits they need by accessing struct fields.

Adding direct read and write access to most fields of the structures involved is probably the simplest solution, with one exception: we don't want to expose the mbedtls_cipher_context_t member directly, as it's soon going to be replaced by a psa_key_id_t (as least when MBEDTLS_USE_PSA_CRYPTO is enabled), see #5203. So, instead of direct field access, we should provide setter and getter functions for the key material.

@mpg mpg added good-first-issue Good for newcomers help-wanted This issue is not being actively worked on, but PRs welcome. Product Backlog labels Jan 12, 2022
@mpg mpg added the size-s Estimated task size: small (~2d) label Jan 12, 2022
@gstrauss
Copy link
Contributor

gstrauss commented Feb 3, 2022

Submitted PR #5501 Add mbedtls_ssl_ticket_rotate() for ticket rotation

mbedtls_ssl_ticket_rotate() provides a mechanism for applications to control session ticket encryption key rotation without needing direct access to mbedtls_ssl_ticket_key struct members.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Good for newcomers help-wanted This issue is not being actively worked on, but PRs welcome. size-s Estimated task size: small (~2d)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants