-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
[Backport 3.6] Defragment incoming TLS handshake messages (reuse badmac_seen) #9981
[Backport 3.6] Defragment incoming TLS handshake messages (reuse badmac_seen) #9981
Conversation
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Co-authored-by: minosgalanakis <30719586+minosgalanakis@users.noreply.github.com> Signed-off-by: Deomid Ryabkov <rojer@rojer.me>
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Except the first Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
The first fragment of a fragmented handshake message always starts at the beginning of the buffer so there's no need to store it. Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
No behavior change. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Prepare to unify two fields of the `mbedtls_ssl_context` structure: `badmac_seen` (always present but only used in DTLS) and `in_hsfraglen` (always present but only used in non-DTLS TLS). Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
In the `mbedtls_ssl_context` structure, change the type of `in_hsfraglen` from `size_t` to `unsigned`. This is in preparation for merging `in_hsfraglen` into `badmac_seen_or_in_hsfraglen`, which has the type `unsigned` and cannot change since we do not want to change the ABI. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
In the `mbedtls_ssl_context` structure, merge the field `in_hsfraglen` into `badmac_seen_or_in_hsfraglen`. This restores the ABI of `libmbedtls` as it was in Mbed TLS 3.6.0 through 3.6.2. The field `badmac_seen_or_in_hsfraglen` (formerly `badmac_seen`) was only used for DTLS (despite being present in non-DTLS builds), and the field `in_hsfraglen` was only used in non-DTLS TLS. Therefore the two values can be stored in the same field. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
da8f72e
to
cb72cd2
Compare
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
Thanks for raising this backport PR and the elegant sollution. Looks good overall, but it would be good to update the programs, using |
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
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.
LGTM
@gilles-peskine-arm According to
Can you explain why? |
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.
LGTM except for the 3 missing commits.
As usual, thanks for the nice commit structure of the ABI-fixing refactoring, always appreciated as a reviewer.
tation. h/t @waleed-elmelegy-arm Mbed-TLS@909e716 Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com> Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
Signed-off-by: Waleed Elmelegy <waleed.elmelegy@arm.com> Signed-off-by: Deomid rojer Ryabkov <rojer@rojer.me>
My bad, I had started from #9949 then removed the tests and hadn't noticed the non-ssl-opt commits in the middle of the ssl-opt commits. I've cherry-picked the extra commits now. |
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.
LGTM now, thanks!
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.
LGTM
For the record, I've double-checked the report from the API/ABI compat checked, only two issues are found, both of which are about the renamed field:
|
cca140b
into
Mbed-TLS:features/tls-defragmentation/3.6
This is the 3.6 backport of #9872, with extra commits to preserve ABI compatibility in 3.6.
A simpler alternative to #9949, which wasn't possible when #9949 was made. Originally we needed room for a message size and a pointer in the SSL context. Now, after an improvement to the original PR, we only need room for a message size, and that's easier to find.
PR checklist