Add I/O buffer resizing in handshake init and free
Add a conditional buffer resizing feature. Introduce tests exercising it in various setups (serialization, renegotiation, mfl manipulations). Signed-off-by: Andrzej Kurek <andrzej.kurek@arm.com>
This commit is contained in:
parent
aad82f9bbb
commit
0afa2a1b65
4 changed files with 309 additions and 0 deletions
|
@ -256,6 +256,32 @@
|
|||
+ ( MBEDTLS_SSL_CID_OUT_LEN_MAX ) )
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_SSL_VARIABLE_BUFFER_LENGTH)
|
||||
static inline uint32_t mbedtls_ssl_get_output_buflen( const mbedtls_ssl_context *ctx )
|
||||
{
|
||||
#if defined (MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||
return (uint32_t) mbedtls_ssl_get_max_frag_len( ctx )
|
||||
+ MBEDTLS_SSL_HEADER_LEN + MBEDTLS_SSL_PAYLOAD_OVERHEAD
|
||||
+ MBEDTLS_SSL_CID_OUT_LEN_MAX;
|
||||
#else
|
||||
return (uint32_t) mbedtls_ssl_get_max_frag_len( ctx )
|
||||
+ MBEDTLS_SSL_HEADER_LEN + MBEDTLS_SSL_PAYLOAD_OVERHEAD;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline uint32_t mbedtls_ssl_get_input_buflen( const mbedtls_ssl_context *ctx )
|
||||
{
|
||||
#if defined (MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||
return (uint32_t) mbedtls_ssl_get_max_frag_len( ctx )
|
||||
+ MBEDTLS_SSL_HEADER_LEN + MBEDTLS_SSL_PAYLOAD_OVERHEAD
|
||||
+ MBEDTLS_SSL_CID_IN_LEN_MAX;
|
||||
#else
|
||||
return (uint32_t) mbedtls_ssl_get_max_frag_len( ctx )
|
||||
+ MBEDTLS_SSL_HEADER_LEN + MBEDTLS_SSL_PAYLOAD_OVERHEAD;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef MBEDTLS_ZLIB_SUPPORT
|
||||
/* Compression buffer holds both IN and OUT buffers, so should be size of the larger */
|
||||
#define MBEDTLS_SSL_COMPRESS_BUFFER_LEN ( \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue