Introduce buffering structure for handshake messages
This commit introduces, but does not yet put to use, a sub-structure
of mbedtls_ssl_handshake_params::buffering that will be used for the
buffering and/or reassembly of handshake messages with handshake
sequence numbers that are greater or equal to the next expected
sequence number.
diff --git a/include/mbedtls/ssl_internal.h b/include/mbedtls/ssl_internal.h
index b9084b4..a34d385 100644
--- a/include/mbedtls/ssl_internal.h
+++ b/include/mbedtls/ssl_internal.h
@@ -155,6 +155,9 @@
#define MBEDTLS_SSL_OUT_PAYLOAD_LEN ( MBEDTLS_SSL_PAYLOAD_OVERHEAD + \
( MBEDTLS_SSL_OUT_CONTENT_LEN ) )
+/* The maximum number of buffered handshake messages. */
+#define MBEDTLS_SSL_MAX_BUFFERED_HS 2
+
/* Maximum length we can advertise as our max content length for
RFC 6066 max_fragment_length extension negotiation purposes
(the lesser of both sizes, if they are unequal.)
@@ -313,6 +316,14 @@
uint8_t seen_ccs; /*!< Indicates if a CCS message has
* been seen in the current flight. */
+ struct mbedtls_ssl_hs_buffer
+ {
+ uint8_t is_valid : 1;
+ uint8_t is_fragmented : 1;
+ uint8_t is_complete : 1;
+ unsigned char *data;
+ } hs[MBEDTLS_SSL_MAX_BUFFERED_HS];
+
} buffering;
#endif /* MBEDTLS_SSL_PROTO_DTLS */
@@ -372,6 +383,8 @@
#endif /* MBEDTLS_SSL_ASYNC_PRIVATE */
};
+typedef struct mbedtls_ssl_hs_buffer mbedtls_ssl_hs_buffer;
+
/*
* This structure contains a full set of runtime transform parameters
* either in negotiation or active.