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

Fix the TLS 1.3 obfuscated_ticket_age caclulation #377

Open
wants to merge 1 commit into
base: tls13-prototype
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion library/ssl_tls13_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ int mbedtls_ssl_write_pre_shared_key_ext( mbedtls_ssl_context *ssl,
}

obfuscated_ticket_age =
(uint32_t)( now - ssl->session_negotiate->ticket_received ) +
(uint32_t)( ( now - ssl->session_negotiate->ticket_received ) * 1000 ) +
Copy link
Collaborator

Choose a reason for hiding this comment

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

It seems a fix is needed at line 934 as well as now - ssl->session_negotiate->ticket_received (age in seconds) seems to be compared to the number of milliseconds in one week.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Agreed. The intention is to keep the fix simple.

Regarding the L934, the fix is not straightforward. If we just return MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED, the request will fail. But a better approach is to fall back to full handshake (as if there is no session ticket). What do you think on this approach?

Copy link
Owner

Choose a reason for hiding this comment

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

Falling back to the full handshake is certainly better than having the exchange fail

Copy link
Owner

Choose a reason for hiding this comment

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

I agree with Ron that this change needs to be aligned with the calculation in line 934

ssl->session_negotiate->ticket_age_add;

MBEDTLS_SSL_DEBUG_MSG( 4, ( "obfuscated_ticket_age: %u",
Expand Down