-
Notifications
You must be signed in to change notification settings - Fork 2.8k
[Backport 3.6] Defragment incoming TLS handshake messages (reuse badmac_seen) #9981
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
Conversation
Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Co-authored-by: minosgalanakis <[email protected]> Signed-off-by: Deomid Ryabkov <[email protected]>
Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Except the first Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Signed-off-by: Deomid rojer Ryabkov <[email protected]>
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 <[email protected]>
No behavior change. Signed-off-by: Gilles Peskine <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
Signed-off-by: Gilles Peskine <[email protected]>
da8f72e to
cb72cd2
Compare
Signed-off-by: Gilles Peskine <[email protected]>
|
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 <[email protected]>
minosgalanakis
left a comment
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? |
mpg
left a comment
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 <[email protected]> Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Signed-off-by: Deomid rojer Ryabkov <[email protected]>
Signed-off-by: Waleed Elmelegy <[email protected]> Signed-off-by: Deomid rojer Ryabkov <[email protected]>
|
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. |
mpg
left a comment
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!
minosgalanakis
left a comment
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
|
Hi! This patch seems to drop a publicly exposed ABI symbol ( |
|
Hi! The symbol being removed was only declared in |
|
Got it. Thanks for the fast reply :)
|
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