mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-30 06:33:06 +00:00
improve readability
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
d84c14f80c
commit
4ac648ef20
@ -1973,17 +1973,24 @@ void ssl_serialize_session_save_load(int ticket_len, char *crt_file,
|
||||
* Make sure both session structures are identical
|
||||
*/
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
switch (tls_version) {
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3) && defined(MBEDTLS_SSL_SRV_C)
|
||||
if (tls_version == MBEDTLS_SSL_VERSION_TLS1_3) {
|
||||
TEST_ASSERT(original.ticket_creation_time == restored.ticket_creation_time);
|
||||
}
|
||||
case MBEDTLS_SSL_VERSION_TLS1_3:
|
||||
TEST_ASSERT(original.ticket_creation_time == restored.ticket_creation_time);
|
||||
break;
|
||||
#endif
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
case MBEDTLS_SSL_VERSION_TLS1_2:
|
||||
TEST_ASSERT(original.start == restored.start);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
if (tls_version == MBEDTLS_SSL_VERSION_TLS1_2) {
|
||||
TEST_ASSERT(original.start == restored.start);
|
||||
default:
|
||||
/* should never happen */
|
||||
TEST_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@ -2246,20 +2253,28 @@ void ssl_serialize_session_load_buf_size(int ticket_len, char *crt_file,
|
||||
((void) tls_version);
|
||||
((void) ticket_len);
|
||||
((void) crt_file);
|
||||
|
||||
switch (tls_version) {
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
|
||||
if (tls_version == MBEDTLS_SSL_VERSION_TLS1_3) {
|
||||
TEST_ASSERT(mbedtls_test_ssl_tls13_populate_session(
|
||||
&session, 0, endpoint_type) == 0);
|
||||
}
|
||||
case MBEDTLS_SSL_VERSION_TLS1_3:
|
||||
TEST_ASSERT(mbedtls_test_ssl_tls13_populate_session(
|
||||
&session, 0, endpoint_type) == 0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
|
||||
if (tls_version == MBEDTLS_SSL_VERSION_TLS1_2) {
|
||||
TEST_ASSERT(mbedtls_test_ssl_tls12_populate_session(
|
||||
&session, ticket_len, crt_file) == 0);
|
||||
}
|
||||
case MBEDTLS_SSL_VERSION_TLS1_2:
|
||||
TEST_ASSERT(mbedtls_test_ssl_tls12_populate_session(
|
||||
&session, ticket_len, crt_file) == 0);
|
||||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
/* should never happen */
|
||||
TEST_ASSERT(0);
|
||||
break;
|
||||
}
|
||||
|
||||
TEST_ASSERT(mbedtls_ssl_session_save(&session, NULL, 0, &good_len)
|
||||
== MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL);
|
||||
TEST_CALLOC(good_buf, good_len);
|
||||
@ -2321,6 +2336,7 @@ void ssl_session_serialize_version_check(int corrupt_major,
|
||||
case MBEDTLS_SSL_VERSION_TLS1_2:
|
||||
TEST_ASSERT(mbedtls_test_ssl_tls12_populate_session(
|
||||
&session, 0, NULL) == 0);
|
||||
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user