Set CID pointer to default value even for TLS
There are two options:
1. Don't set it, and don't use it during record protection,
guarding the respective paths by a check whether TLS or
DTLS is used.
2. Set it to the default value even for TLS, and avoid the
protocol-dependent branch during record protection.
This commit picks option 2.
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index 43fa449..7e7d5a0 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -8082,6 +8082,9 @@
{
ssl->out_ctr = ssl->out_hdr - 8;
ssl->out_len = ssl->out_hdr + 3;
+#if defined(MBEDTLS_SSL_CID)
+ ssl->out_cid = ssl->out_len;
+#endif
ssl->out_iv = ssl->out_hdr + 5;
}
@@ -8136,6 +8139,9 @@
{
ssl->in_ctr = ssl->in_hdr - 8;
ssl->in_len = ssl->in_hdr + 3;
+#if defined(MBEDTLS_SSL_CID)
+ ssl->in_cid = ssl->in_len;
+#endif
ssl->in_iv = ssl->in_hdr + 5;
}