tls13: Introduce early_data_state SSL context field

Introduce early_data_state SSL context field to
distinguish better this internal state from
the status values defined for the
mbedtls_ssl_get_early_data_status() API.
Distinguish also between the client and
server states. Note that the client state
are going to be documented and reworked
as part of the implementation of
mbedtls_ssl_write_early_data().

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/ssl_msg.c b/library/ssl_msg.c
index 825ca8f..c6ba115 100644
--- a/library/ssl_msg.c
+++ b/library/ssl_msg.c
@@ -5888,8 +5888,10 @@
         return MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA;
     }
 
-    if ((ssl->early_data_status != MBEDTLS_SSL_EARLY_DATA_STATUS_UNKNOWN) &&
-        (ssl->early_data_status != MBEDTLS_SSL_EARLY_DATA_STATUS_ACCEPTED)) {
+    if ((ssl->early_data_state.srv !=
+         MBEDTLS_SSL_SRV_EARLY_DATA_STATE_WAITING_CH) &&
+        (ssl->early_data_state.srv !=
+         MBEDTLS_SSL_SRV_EARLY_DATA_STATE_ACCEPTING)) {
         return MBEDTLS_ERR_SSL_CANNOT_READ_EARLY_DATA;
     }