3bbf4c058f
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
1.5 KiB
1.5 KiB
Modified semantics of mbedtls_ssl_{get,set}_session()
This affects users who call mbedtls_ssl_get_session()
or
mbedtls_ssl_set_session()
multiple times on the same SSL context
representing an established TLS 1.2 connection.
Those users will now observe the second call to fail with
MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE
.
Migration path:
- Exporting the same TLS 1.2 connection multiple times via
mbedtls_ssl_get_session()
leads to multiple copies of the same session. This use ofmbedtls_ssl_get_session()
is discouraged, and the following should be considered:- If the various session copies are later loaded into
fresh SSL contexts via
mbedtls_ssl_set_session()
, export viambedtls_ssl_get_session()
only once and load the same session into different contexts viambedtls_ssl_set_session()
. Sincembedtls_ssl_set_session()
makes a copy of the session that's being loaded, this is functionally equivalent. - If the various session copies are later serialized
via
mbedtls_ssl_session_save()
, export and serialize the session only once viambedtls_ssl_get_session()
andmbedtls_ssl_session_save()
and make copies of the raw data instead.
- If the various session copies are later loaded into
fresh SSL contexts via
- Calling
mbedtls_ssl_set_session()
multiple times in Mbed TLS 2.x is not useful since subsequent calls overwrite the effect of previous calls. Applications achieve equivalent functional behaviour by issuing only the very last call tombedtls_ssl_set_session()
.