mirror of
https://github.com/Mbed-TLS/mbedtls-framework.git
synced 2026-10-02 23:07:22 +00:00
tests: ssl: Fix session field guards
Signed-off-by: Ronald Cron <[email protected]>
This commit is contained in:
@@ -1791,30 +1791,33 @@ int mbedtls_test_ssl_tls13_populate_session(mbedtls_ssl_session *session,
|
|||||||
session->endpoint = endpoint_type == MBEDTLS_SSL_IS_CLIENT ?
|
session->endpoint = endpoint_type == MBEDTLS_SSL_IS_CLIENT ?
|
||||||
MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER;
|
MBEDTLS_SSL_IS_CLIENT : MBEDTLS_SSL_IS_SERVER;
|
||||||
session->ciphersuite = 0xabcd;
|
session->ciphersuite = 0xabcd;
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
session->ticket_age_add = 0x87654321;
|
session->ticket_age_add = 0x87654321;
|
||||||
session->ticket_flags = 0x7;
|
session->ticket_flags = 0x7;
|
||||||
|
|
||||||
session->resumption_key_len = 32;
|
session->resumption_key_len = 32;
|
||||||
memset(session->resumption_key, 0x99, sizeof(session->resumption_key));
|
memset(session->resumption_key, 0x99, sizeof(session->resumption_key));
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
|
||||||
session->max_early_data_size = 0x87654321;
|
|
||||||
#if defined(MBEDTLS_SSL_ALPN) && defined(MBEDTLS_SSL_SRV_C)
|
|
||||||
int ret = mbedtls_ssl_session_set_ticket_alpn(session, "ALPNExample");
|
|
||||||
if (ret != 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#endif /* MBEDTLS_SSL_ALPN && MBEDTLS_SSL_SRV_C */
|
|
||||||
#endif /* MBEDTLS_SSL_EARLY_DATA */
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_SRV_C)
|
|
||||||
if (session->endpoint == MBEDTLS_SSL_IS_SERVER) {
|
|
||||||
session->ticket_creation_time = mbedtls_ms_time() - 42;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_SRV_C)
|
||||||
|
if (session->endpoint == MBEDTLS_SSL_IS_SERVER) {
|
||||||
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
|
#if defined(MBEDTLS_SSL_EARLY_DATA) && defined(MBEDTLS_SSL_ALPN)
|
||||||
|
int ret = mbedtls_ssl_session_set_ticket_alpn(session, "ALPNExample");
|
||||||
|
if (ret != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_HAVE_TIME)
|
||||||
|
session->ticket_creation_time = mbedtls_ms_time() - 42;
|
||||||
|
#endif
|
||||||
|
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||||
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_SRV_C */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_CLI_C)
|
#if defined(MBEDTLS_SSL_CLI_C)
|
||||||
if (session->endpoint == MBEDTLS_SSL_IS_CLIENT) {
|
if (session->endpoint == MBEDTLS_SSL_IS_CLIENT) {
|
||||||
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
#if defined(MBEDTLS_HAVE_TIME)
|
#if defined(MBEDTLS_HAVE_TIME)
|
||||||
session->ticket_reception_time = mbedtls_ms_time() - 40;
|
session->ticket_reception_time = mbedtls_ms_time() - 40;
|
||||||
#endif
|
#endif
|
||||||
@@ -1828,9 +1831,14 @@ int mbedtls_test_ssl_tls13_populate_session(mbedtls_ssl_session *session,
|
|||||||
}
|
}
|
||||||
memset(session->ticket, 33, ticket_len);
|
memset(session->ticket, 33, ticket_len);
|
||||||
}
|
}
|
||||||
|
#endif /* MBEDTLS_SSL_SESSION_TICKETS */
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_CLI_C */
|
#endif /* MBEDTLS_SSL_CLI_C */
|
||||||
|
|
||||||
|
#if defined(MBEDTLS_SSL_EARLY_DATA)
|
||||||
|
session->max_early_data_size = 0x87654321;
|
||||||
|
#endif /* MBEDTLS_SSL_EARLY_DATA */
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT)
|
#if defined(MBEDTLS_SSL_RECORD_SIZE_LIMIT)
|
||||||
session->record_size_limit = 2048;
|
session->record_size_limit = 2048;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user