mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-14 01:26:49 +00:00
tests: ssl: Add hostname checks in session serialization tests
Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
parent
1fb585492d
commit
346b81877d
@ -1831,6 +1831,14 @@ int mbedtls_test_ssl_tls13_populate_session(mbedtls_ssl_session *session,
|
||||
}
|
||||
memset(session->ticket, 33, ticket_len);
|
||||
}
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
char hostname[] = "hostname example";
|
||||
session->hostname = mbedtls_calloc(1, sizeof(hostname));
|
||||
if (session->hostname == NULL) {
|
||||
return -1;
|
||||
}
|
||||
memcpy(session->hostname, hostname, sizeof(hostname));
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_CLI_C */
|
||||
|
@ -2134,6 +2134,12 @@ void ssl_serialize_session_save_load(int ticket_len, char *crt_file,
|
||||
restored.ticket,
|
||||
original.ticket_len) == 0);
|
||||
}
|
||||
#if defined(MBEDTLS_SSL_SERVER_NAME_INDICATION)
|
||||
TEST_ASSERT(original.hostname != NULL);
|
||||
TEST_ASSERT(restored.hostname != NULL);
|
||||
TEST_MEMORY_COMPARE(original.hostname, strlen(original.hostname),
|
||||
restored.hostname, strlen(restored.hostname));
|
||||
#endif
|
||||
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_CLI_C */
|
||||
|
Loading…
x
Reference in New Issue
Block a user