-
Notifications
You must be signed in to change notification settings - Fork 2.8k
mbedtls_ssl_get_alert(): getter for fatal alerts #10514
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
base: development
Are you sure you want to change the base?
Conversation
Even though the TLS RFCs do not mandate libraries to expose *Error Alerts* (as defined in RFC8446 6.2 for TLS 1.3 and in RFC5246 7.2.2 for TLS 1.2) to the user, there are use cases when it is handy to get the actual last received fatal error instead of a generic one. For instance this enables the user to differ between received fatal errors in case `mbedtls_ssl_handshake()`, `mbedtls_ssl_handshake_step()` or `mbedtls_ssl_read()` returned `MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE`. This changesets stores the last incoming fatal alert in `mbedtls_ssl_context` and provides `mbedtls_ssl_get_alert()` as a getter for retrieving it. Another option would be to provide a callback mechanisms for all kinds of alerts (not only fatals) but for simplicity I discarded this option. Signed-off-by: Nico Geyso <[email protected]>
|
Hi @ng-gsmk, thanks for uploading this. There are currently CI failures, are you able to look into them? |
|
I removed What are the best practices in mbedtls when adding a new fields to mbedtls_ssl_context. I grouped it with the other alert stuff but this report indicates I should add it to the end? |
Signed-off-by: Nico Geyso <[email protected]>
|
It's ok to change structures in the development branch and there's no particular reason to add new fields at the end. In Mbed TLS, struct types that are public are usually caller-allocated, so adding a field is an ABI change, but fields are usually private, and moving a private field isn't an ABI change. The tool we use for ABI comparison is not aware of how we use structures and which fields we consider to be private. We tend to use the following considerations to order fields:
|
Signed-off-by: Nico Geyso <[email protected]>
Signed-off-by: Nico Geyso <[email protected]>
|
@bjwtaylor: PR tests seem to pass. The interface stability tests fail but this is expected I would say. |
Description
Even though the TLS RFCs do not mandate libraries to expose Error Alerts (as defined in RFC8446 6.2 for TLS 1.3 and in RFC5246 7.2.2 for TLS 1.2) to the user, there are use cases when it is handy to get the actual last received fatal error instead of a generic one. For instance this enables the user to differ between received fatal errors in case
mbedtls_ssl_handshake(),mbedtls_ssl_handshake_step()ormbedtls_ssl_read()returnedMBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE.This changesets stores the last incoming fatal alert in
mbedtls_ssl_contextand providesmbedtls_ssl_get_alert()as a getter for retrieving it. Another option would be to provide a callback mechanisms for all kinds of alerts (not only fatals) but for simplicity I discarded this option.PR checklist