Don't hardcode TLS 1.3 labels in test cases

ssl_tls1_3_keys.c exports a structure containing all labels used
in the TLS 1.3 key schedule, but the TLS 1.3 key scheduling unit
tests so far replicated those labels in the test file. In particular,
wrong label values in ssl_tls1_3_keys.c wouldn't have been caught
by the unit tests.

This commit modifies the TLS 1.3 key schedule unit tests to use
the TLS 1.3 labels as exported by ssl_tls1_3_keys.c. This not only
makes sure that those labels are correct, but also avoids hardcoding
their hex-encoding in the test file.

Signed-off-by: Hanno Becker <hanno.becker@arm.com>
diff --git a/library/ssl_tls13_keys.c b/library/ssl_tls13_keys.c
index 7befbea..1730501 100644
--- a/library/ssl_tls13_keys.c
+++ b/library/ssl_tls13_keys.c
@@ -28,7 +28,7 @@
 #include <stdint.h>
 #include <string.h>
 
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
+#define MBEDTLS_SSL_TLS1_3_LABEL( idx, name, string )       \
     .name = string,
 
 struct mbedtls_ssl_tls1_3_labels_struct const mbedtls_ssl_tls1_3_labels =
diff --git a/library/ssl_tls13_keys.h b/library/ssl_tls13_keys.h
index 64caa8a..ee6572f 100644
--- a/library/ssl_tls13_keys.h
+++ b/library/ssl_tls13_keys.h
@@ -21,30 +21,30 @@
 
 #if defined(MBEDTLS_SSL_PROTO_TLS1_3_EXPERIMENTAL)
 
-/* This requires MBEDTLS_SSL_TLS1_3_LABEL( name, string ) to be defined at
+/* This requires MBEDTLS_SSL_TLS1_3_LABEL( idx, name, string ) to be defined at
  * the point of use. See e.g. the definition of mbedtls_ssl_tls1_3_labels_union
  * below. */
 #define MBEDTLS_SSL_TLS1_3_LABEL_LIST                               \
-    MBEDTLS_SSL_TLS1_3_LABEL( finished    , "finished"     )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( resumption  , "resumption"   )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( traffic_upd , "traffic upd"  )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( exporter    , "exporter"     )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( key         , "key"          )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( iv          , "iv"           )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( sn          , "sn"           )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( c_hs_traffic, "c hs traffic" )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( c_ap_traffic, "c ap traffic" )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( c_e_traffic , "c e traffic"  )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( s_hs_traffic, "s hs traffic" )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( s_ap_traffic, "s ap traffic" )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( s_e_traffic , "s e traffic"  )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( exp_master  , "exp master"   )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( res_master  , "res master"   )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( ext_binder  , "ext binder"   )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( res_binder  , "res binder"   )        \
-    MBEDTLS_SSL_TLS1_3_LABEL( derived     , "derived"      )
+    MBEDTLS_SSL_TLS1_3_LABEL( 0,  finished    , "finished"     ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 1,  resumption  , "resumption"   ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 2,  traffic_upd , "traffic upd"  ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 3,  exporter    , "exporter"     ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 4,  key         , "key"          ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 5,  iv          , "iv"           ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 6,  sn          , "sn"           ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 7,  c_hs_traffic, "c hs traffic" ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 8,  c_ap_traffic, "c ap traffic" ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 9,  c_e_traffic , "c e traffic"  ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 10, s_hs_traffic, "s hs traffic" ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 11, s_ap_traffic, "s ap traffic" ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 12, s_e_traffic , "s e traffic"  ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 13, exp_master  , "exp master"   ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 14, res_master  , "res master"   ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 15, ext_binder  , "ext binder"   ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 16, res_binder  , "res binder"   ) \
+    MBEDTLS_SSL_TLS1_3_LABEL( 17, derived     , "derived"      )
 
-#define MBEDTLS_SSL_TLS1_3_LABEL( name, string ) \
+#define MBEDTLS_SSL_TLS1_3_LABEL( idx, name, string )       \
     const unsigned char name    [ sizeof(string) - 1 ];
 
 union mbedtls_ssl_tls1_3_labels_union