Replace `start` with `ticket_creation`
Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
diff --git a/library/ssl_ticket.c b/library/ssl_ticket.c
index c89a5cd..05249ea 100644
--- a/library/ssl_ticket.c
+++ b/library/ssl_ticket.c
@@ -498,16 +498,17 @@
#if defined(MBEDTLS_SSL_PROTO_TLS1_3)
if (session->tls_version == MBEDTLS_SSL_VERSION_TLS1_3) {
/* Check for expiration */
- mbedtls_ms_time_t ticket_age = mbedtls_ms_time() - session->start;
+ mbedtls_ms_time_t ticket_age = mbedtls_ms_time() - session->ticket_creation;
mbedtls_ms_time_t ticket_lifetime = ctx->ticket_lifetime * 1000;
if (ticket_age < 0 || ticket_age > ticket_lifetime) {
ret = MBEDTLS_ERR_SSL_SESSION_TICKET_EXPIRED;
goto cleanup;
}
- } else
+ }
#endif /* MBEDTLS_SSL_PROTO_TLS1_3 */
- {
+#if defined(MBEDTLS_SSL_PROTO_TLS1_2)
+ if (session->tls_version == MBEDTLS_SSL_VERSION_TLS1_2) {
/* Check for expiration */
mbedtls_time_t current_time = mbedtls_time(NULL);
@@ -517,6 +518,7 @@
goto cleanup;
}
}
+#endif
#endif /* MBEDTLS_HAVE_TIME */
cleanup:
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index f855576..d727636 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -2537,7 +2537,7 @@
#if defined(MBEDTLS_HAVE_TIME) && defined(MBEDTLS_SSL_SRV_C)
if (session->endpoint == MBEDTLS_SSL_IS_SERVER) {
- MBEDTLS_PUT_UINT64_BE((uint64_t) session->start, p, 0);
+ MBEDTLS_PUT_UINT64_BE((uint64_t) session->ticket_creation, p, 0);
p += 8;
}
#endif /* MBEDTLS_HAVE_TIME */
@@ -2616,7 +2616,7 @@
if (end - p < 8) {
return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
}
- session->start = MBEDTLS_GET_UINT64_BE(p, 0);
+ session->ticket_creation = MBEDTLS_GET_UINT64_BE(p, 0);
p += 8;
}
#endif /* MBEDTLS_HAVE_TIME */
diff --git a/library/ssl_tls13_server.c b/library/ssl_tls13_server.c
index 7b8cc6e..744e984 100644
--- a/library/ssl_tls13_server.c
+++ b/library/ssl_tls13_server.c
@@ -193,15 +193,15 @@
#if defined(MBEDTLS_HAVE_TIME)
now = mbedtls_ms_time();
- if (now < session->start) {
+ if (now < session->ticket_creation) {
MBEDTLS_SSL_DEBUG_MSG(
3, ("Invalid ticket start time ( now = %" MBEDTLS_PRINTF_MS_TIME
", start = %" MBEDTLS_PRINTF_MS_TIME " )",
- now, session->start));
+ now, session->ticket_creation));
goto exit;
}
- server_age = now - session->start;
+ server_age = now - session->ticket_creation;
/* RFC 8446 section 4.6.1
*
@@ -2880,7 +2880,7 @@
MBEDTLS_SSL_DEBUG_MSG(2, ("=> prepare NewSessionTicket msg"));
#if defined(MBEDTLS_HAVE_TIME)
- session->start = mbedtls_ms_time();
+ session->ticket_creation = mbedtls_ms_time();
#endif
/* Set ticket_flags depends on the advertised psk key exchange mode */