Store outgoing record sequence number outside record buffer
This commit is another step towards supporting the packing of multiple records within a single datagram. Previously, the incremental outgoing record sequence number was statically stored within the record buffer, at its final place within the record header. This slightly increased efficiency as it was not necessary to copy the sequence number when writing outgoing records. When allowing multiple records within a single datagram, it is necessary to allow the position of the current record within the datagram buffer to be flexible; in particular, there is no static address for the record sequence number field within the record header. This commit introduces an additional field `cur_out_ctr` within the main SSL context structure `mbedtls_ssl_context` to keep track of the outgoing record sequence number independent of the buffer used for the current record / datagram. Whenever a new record is written, this sequence number is copied to the the address `out_ctr` of the sequence number header field within the current outgoing record.
This commit is contained in:
parent
5aa4e2cedd
commit
198594709b
3 changed files with 13 additions and 8 deletions
|
@ -1116,6 +1116,8 @@ struct mbedtls_ssl_context
|
|||
size_t out_msglen; /*!< record header: message length */
|
||||
size_t out_left; /*!< amount of data not yet written */
|
||||
|
||||
unsigned char cur_out_ctr[8]; /*!< Outgoing record sequence number. */
|
||||
|
||||
#if defined(MBEDTLS_ZLIB_SUPPORT)
|
||||
unsigned char *compress_buf; /*!< zlib data buffer */
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue