Add endpoint in TLS 1.2 session serialization data

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 8c1e372..9fabda4 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -8942,6 +8942,7 @@
  *
  * struct {
  *    uint64 start_time;
+ *    uint8 endpoint;
  *    uint8 ciphersuite[2];           // defined by the standard
  *    uint8 session_id_len;           // at most 32
  *    opaque session_id[32];
@@ -8988,13 +8989,15 @@
     /*
      * Basic mandatory fields
      */
-    used += 2   /* ciphersuite */
+    used += 1   /* endpoint */
+            + 2 /* ciphersuite */
             + 1 /* id_len */
             + sizeof(session->id)
             + sizeof(session->master)
             + 4; /* verify_result */
 
     if (used <= buf_len) {
+        *p++ = session->endpoint;
         MBEDTLS_PUT_UINT16_BE(session->ciphersuite, p, 0);
         p += 2;
 
@@ -9129,10 +9132,11 @@
     /*
      * Basic mandatory fields
      */
-    if (2 + 1 + 32 + 48 + 4 > (size_t) (end - p)) {
+    if (1 + 2 + 1 + 32 + 48 + 4 > (size_t) (end - p)) {
         return MBEDTLS_ERR_SSL_BAD_INPUT_DATA;
     }
 
+    session->endpoint = *p++;
     session->ciphersuite = MBEDTLS_GET_UINT16_BE(p, 0);
     p += 2;