Function esp_idf_sys::mbedtls_ssl_set_session
source ยท pub unsafe extern "C" fn mbedtls_ssl_set_session(
ssl: *mut mbedtls_ssl_context,
session: *const mbedtls_ssl_session,
) -> c_int
Expand description
\brief Load a session for session resumption.
Sessions loaded through this call will be considered
for session resumption in the next handshake.
\note Even if this call succeeds, it is not guaranteed that the next handshake will indeed be shortened through the use of session resumption: The server is always free to reject any attempt for resumption and fall back to a full handshake.
\note This function can handle a variety of mechanisms for session resumption: For TLS 1.2, both session ID-based resumption and ticket-based resumption will be considered. For TLS 1.3, once implemented, sessions equate to tickets, and loading one or more sessions via this call will lead to their corresponding tickets being advertised as resumption PSKs by the client.
\note Calling this function multiple times will only be useful once TLS 1.3 is supported. For TLS 1.2 connections, this function should be called at most once.
\param ssl The SSL context representing the connection which should be attempted to be setup using session resumption. This must be initialized via mbedtls_ssl_init() and bound to an SSL configuration via mbedtls_ssl_setup(), but the handshake must not yet have been started. \param session The session to be considered for session resumption. This must be a session previously exported via mbedtls_ssl_get_session(), and potentially serialized and deserialized through mbedtls_ssl_session_save() and mbedtls_ssl_session_load() in the meantime.
\return \c 0 if successful. \return \c MBEDTLS_ERR_SSL_FEATURE_UNAVAILABLE if the session could not be loaded because of an implementation limitation. This error is non-fatal, and has no observable effect on the SSL context or the session that was attempted to be loaded. \return Another negative error code on other kinds of failure.
\sa mbedtls_ssl_get_session() \sa mbedtls_ssl_session_load()