-
Notifications
You must be signed in to change notification settings - Fork 8
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
Track use of extensions to avoid duplicate extensions in the same message #114
base: tls13-prototype
Are you sure you want to change the base?
Track use of extensions to avoid duplicate extensions in the same message #114
Conversation
…id writing or parsing more than one extension of the same type in a given extension block (RFC requirement)
…est, ServerHello, EncryptedExtensions and CertificateRequest
} | ||
else if( ssl->handshake->extensions_present & SUPPORTED_GROUPS_EXTENSION && ssl->handshake->extensions_present & SIGNATURE_ALGORITHM_EXTENSION ) | ||
else if( mbedtls_ssl_extensions_present( ssl, SUPPORTED_GROUPS_EXTENSION | SIGNATURE_ALGORITHM_EXTENSION, 0 ) ) |
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.
Blocker: This is functionally incorrect since the present implementaiton of mbedtls_ssl_extensions_present()
only checks whether a non-zero part of the flag is present, not whether the entire flag is present.
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.
Fixed mbedtls_ssl_extensions_present()
to support a conjunction of extensions
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 may be easier to independently call mbedtls_ssl_extensions_present()
for each extension rather than calling it once to check several extensions though...
@@ -2467,6 +2467,9 @@ static int ssl_certificate_request_parse( mbedtls_ssl_context* ssl, | |||
/* | |||
* Parse extensions | |||
*/ | |||
|
|||
mbedtls_ssl_reset_extensions_present( ssl ); |
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.
Why was this change made?
Thanks a lot @gbryant-arm for your work on this. I'm a bit uncomfortable with how we're overloading the use of a single variable here:
The danger of this overload is best seen in the clearing of the Going into more detail, I took a look at where and how
To be continued... still not sure what the best approach is here. |
…onjunction of extensions
Introduce helper functions to track extensions and detect duplicate extensions (i.e. of the same type) in the same message (RFC requirement). Send an alert if that's the case. Fixes #97.
Implemented for TLS 1.3 only to avoid conflicts with upstream Mbed TLS.
It is assumed that NewSessionTicket and Certificate don't include any extensions.
Extension tracking has not been implemented for writing extensions (yet?)