Skip to content
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

Test TLS connections in Mbed TLS 3.6.0 without psa_crypto_init #9215

Conversation

gilles-peskine-arm
Copy link
Contributor

@gilles-peskine-arm gilles-peskine-arm commented May 31, 2024

When using Mbed TLS 3.6.0 in the default configuration, and not calling psa_crypto_init(), TLS connections fail if they end up negotiating TLS 1.3. See #9210.

Status: work in progress — I'm setting up some testing. This is just at the proof-of-concept stage for now: the final form will depend both on how the tests evolve and how we decide to fix the library. My plan:

  1. In TLS tests (both unit tests and ssl_client2/ssl_server2), call psa_crypto_init only when needed according to the documentation (including Mbed TLS 3.5 documentation, for backward compatibility). This will cause some test failures in the default configuration when we end up negotiating TLS 1.3 without having called psa_crypto_init.
  2. Add test cases for the case of a default TLS connection without selecting the protocol version explicitly.
  3. Fix the failures somehow, in a way that remains backward compatible with both Mbed TLS 3.x with x ≤ 5 and, as much as possible, 3.6.0.

PR checklist

  • changelog TODO
  • development TODO: this isn't a bug in 4.0, since it will have PSA always on. But we may want to forward-port some test refactoring.
  • 2.28 backport N/A
  • tests provided

Revise the PSA initialization for TLS with respect to TLS 1.3 enablement.
For backward compatibility with Mbed TLS < 3.6.0, in the default
compile-time configuration, users do not need to call psa_crypto_init()
unless they have taken some affirmative step to enable TLS 1.3 support.
Mbed TLS changed the default compile-time configuration to enable TLS 1.3
support by default (MBEDTLS_SSL_PROTO_TLS1_3 enabled by default), but users
are free to ignore that.

In Mbed TLS 3.6.0, as soon as MBEDTLS_SSL_PROTO_TLS1_3 is enabled, users
need to call psa_crypto_init() before starting a TLS connection that may
use TLS 1.3. This commit makes this call explicit. Later commits will adjust
the conditions of this call to skip it when mimicking a user of Mbed TLS <3.6
who did not cal psa_crypto_init().

Signed-off-by: Gilles Peskine <[email protected]>
@gilles-peskine-arm gilles-peskine-arm added needs-work component-tls needs-ci Needs to pass CI tests component-tls13 size-s Estimated task size: small (~2d) priority-high High priority - will be reviewed soon labels May 31, 2024
@gilles-peskine-arm
Copy link
Contributor Author

Superseded by #9501.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component-tls component-tls13 needs-ci Needs to pass CI tests needs-work priority-high High priority - will be reviewed soon size-s Estimated task size: small (~2d)
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

1 participant