mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2026-08-13 22:57:51 +00:00
tests: ssl_helpers: run ssl_context reset check only when the SSL context is setup
Signed-off-by: Valerio Setti <[email protected]>
This commit is contained in:
@@ -1035,14 +1035,17 @@ int mbedtls_test_ssl_endpoint_init(
|
||||
void mbedtls_test_ssl_endpoint_free(
|
||||
mbedtls_test_ssl_endpoint *ep)
|
||||
{
|
||||
mbedtls_ssl_context ssl_before;
|
||||
// mbedtls_ssl_session_reset() requires the SSL to be setup.
|
||||
if (ep->ssl.conf != NULL) {
|
||||
mbedtls_ssl_context ssl_before;
|
||||
|
||||
/* Dump the SSL context before resetting it */
|
||||
memcpy(&ssl_before, &(ep->ssl), sizeof(mbedtls_ssl_context));
|
||||
/* Dump the SSL context before resetting it */
|
||||
memcpy(&ssl_before, &(ep->ssl), sizeof(mbedtls_ssl_context));
|
||||
|
||||
mbedtls_ssl_session_reset(&(ep->ssl));
|
||||
/* Check that required fields were properly reset */
|
||||
mbedtls_test_ssl_check_context_after_session_reset(&ssl_before, &(ep->ssl));
|
||||
mbedtls_ssl_session_reset(&(ep->ssl));
|
||||
/* Check that required fields were properly reset */
|
||||
mbedtls_test_ssl_check_context_after_session_reset(&ssl_before, &(ep->ssl));
|
||||
}
|
||||
mbedtls_ssl_free(&(ep->ssl));
|
||||
mbedtls_ssl_config_free(&(ep->conf));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user