mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-10-28 18:07:34 +08:00
Opaque PSKs configured through mbedtls_ssl_conf_psk_opaque() were broken in TLS 1.3: the client computed an incorrect PSK binder, the server rejected the PSK identity, and the early key schedule exported the key with psa_export_key(), which fails for non-exportable keys. Consume non-exportable opaque PSKs directly with psa_key_derivation_input_key(). Exportable PSKs (in particular raw PSKs imported by mbedtls_ssl_set_hs_psk()) keep the byte path, which works with whatever hash the negotiated ciphersuite requires: a key imported with a concrete HKDF-Extract policy cannot be a derivation input for another hash, and PSA_ALG_ANY_HASH policies are not accepted for KDF inputs either. Also fix a NULL dereference when importing a TLS 1.3 resumption PSK before the ciphersuite is negotiated, and guard the mbedtls_ssl_get_opaque_psk() call, which only exists when MBEDTLS_SSL_HANDSHAKE_WITH_PSK_ENABLED is defined. ssl_client2/ssl_server2 now import opaque PSKs with the HKDF-Extract algorithm of the negotiated ciphersuite for TLS 1.3. Fixes Mbed-TLS#10956. Signed-off-by: v1rtu3x <149050962+v1rtu3x@users.noreply.github.com> |
||
|---|---|---|
| .. | ||
| CMakeLists.txt | ||
| dtls_client.c | ||
| dtls_server.c | ||
| mini_client.c | ||
| ssl_client1.c | ||
| ssl_client2.c | ||
| ssl_context_info.c | ||
| ssl_fork_server.c | ||
| ssl_mail_client.c | ||
| ssl_pthread_server.c | ||
| ssl_server2.c | ||
| ssl_server.c | ||
| ssl_test_common_source.c | ||
| ssl_test_lib.c | ||
| ssl_test_lib.h | ||