Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Comply with the received Record Size Limit extension #7455
Comply with the received Record Size Limit extension #7455
Changes from 12 commits
f482dcc
9aec1c7
419f841
05d670b
26e3698
049cd30
65e3046
6a971fd
87a373e
ea03183
bae705c
3d46b7f
60f0f72
e2d3db5
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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'd like to think that if someone was using Mbed TLS just before this PR, and had a saved session, then recompiled with this PR, and tried to resume, they'd get an
MBEDTLS_ERR_SSL_VERSION_MISMATCH
(considering it the version of the data, rather than just the version of the library) error, not aMBEDTLS_ERR_SSL_BAD_INPUT_DATA
error, although I suspect the caller would treat both identically.That would suggest that
MBEDTLS_SSL_RECORD_SIZE_LIMIT
should be incorporated inSSL_SERIALIZED_SESSION_CONFIG_BITFLAG
However, the same reasoning applies to
MBEDTLS_SSL_EARLY_DATA
, so this looks like pre-existing, rather than anything else, and I'm mainly making the observation here, rather than asking for a change.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.
That's a good point. I think we overlooked this aspect of serialized sessions while working on new session tickets, early data and now record size limit. I am creating an issue to address that: #8686.
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.
It's not clear to me under what circumstances we would put a value <
MBEDTLS_SSL_RECORD_SIZE_LIMIT_MIN
into the session. Would it make more sense to verify when populatingssl->session->record_size_limit
and then be able to skip the check here?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.
If we do not receive any record size limit extension then
ssl->session->record_size_limit
is equal to zero. Thus to me this check is to detect if the peer sent a record size limit or not.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.
Ah - if this test had been for
> 0
then I might have thought that.Would (in the future, not this PR) it make more sense to set this to the value to use for record size and use it unconditionally?
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.
Yes that would be an improvement.
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.
It's not immediately clear why this is not within the
MBEDTLS_SSL_RECORD_SIZE_LIMIT
block. Some of the text in Ronald's comment might help hereThere 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.
What if
MBEDTLS_SSL_RECORD_SIZE_LIMIT_MIN
> 2048?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.
MBEDTLS_SSL_RECORD_SIZE_LIMIT_MIN is defined by RFC 8449 to be equal to 64. We should probably add a comment where MBEDTLS_SSL_RECORD_SIZE_LIMIT_MIN is defined to make that clear.