Move flight and message buffering functions to public namespace

This commit is contained in:
Hanno Becker 2020-02-05 10:49:13 +00:00
parent 40cdaa1263
commit 533ab5f5c2
2 changed files with 11 additions and 7 deletions

View file

@ -1095,4 +1095,9 @@ void mbedtls_ssl_handshake_wrapup_free_hs_transform( mbedtls_ssl_context *ssl );
int mbedtls_ssl_start_renegotiation( mbedtls_ssl_context *ssl ); int mbedtls_ssl_start_renegotiation( mbedtls_ssl_context *ssl );
#if defined(MBEDTLS_SSL_PROTO_DTLS)
void mbedtls_ssl_buffering_free( mbedtls_ssl_context *ssl );
void mbedtls_ssl_flight_free( mbedtls_ssl_flight_item *flight );
#endif /* MBEDTLS_SSL_PROTO_DTLS */
#endif /* ssl_internal.h */ #endif /* ssl_internal.h */

View file

@ -258,7 +258,6 @@ int mbedtls_ssl_get_peer_cid( mbedtls_ssl_context *ssl,
#endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */ #endif /* MBEDTLS_SSL_DTLS_CONNECTION_ID */
/* Forward declarations for functions related to message buffering. */ /* Forward declarations for functions related to message buffering. */
static void ssl_buffering_free( mbedtls_ssl_context *ssl );
static void ssl_buffering_free_slot( mbedtls_ssl_context *ssl, static void ssl_buffering_free_slot( mbedtls_ssl_context *ssl,
uint8_t slot ); uint8_t slot );
static void ssl_free_buffered_record( mbedtls_ssl_context *ssl ); static void ssl_free_buffered_record( mbedtls_ssl_context *ssl );
@ -3921,7 +3920,7 @@ static int ssl_flight_append( mbedtls_ssl_context *ssl )
/* /*
* Free the current flight of handshake messages * Free the current flight of handshake messages
*/ */
static void ssl_flight_free( mbedtls_ssl_flight_item *flight ) void mbedtls_ssl_flight_free( mbedtls_ssl_flight_item *flight )
{ {
mbedtls_ssl_flight_item *cur = flight; mbedtls_ssl_flight_item *cur = flight;
mbedtls_ssl_flight_item *next; mbedtls_ssl_flight_item *next;
@ -4161,7 +4160,7 @@ int mbedtls_ssl_flight_transmit( mbedtls_ssl_context *ssl )
void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl ) void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl )
{ {
/* We won't need to resend that one any more */ /* We won't need to resend that one any more */
ssl_flight_free( ssl->handshake->flight ); mbedtls_ssl_flight_free( ssl->handshake->flight );
ssl->handshake->flight = NULL; ssl->handshake->flight = NULL;
ssl->handshake->cur_msg = NULL; ssl->handshake->cur_msg = NULL;
@ -4172,7 +4171,7 @@ void mbedtls_ssl_recv_flight_completed( mbedtls_ssl_context *ssl )
ssl->handshake->buffering.seen_ccs = 0; ssl->handshake->buffering.seen_ccs = 0;
/* Clear future message buffering structure. */ /* Clear future message buffering structure. */
ssl_buffering_free( ssl ); mbedtls_ssl_buffering_free( ssl );
/* Cancel timer */ /* Cancel timer */
mbedtls_ssl_set_timer( ssl, 0 ); mbedtls_ssl_set_timer( ssl, 0 );
@ -11212,7 +11211,7 @@ static void ssl_key_cert_free( mbedtls_ssl_key_cert *key_cert )
#if defined(MBEDTLS_SSL_PROTO_DTLS) #if defined(MBEDTLS_SSL_PROTO_DTLS)
static void ssl_buffering_free( mbedtls_ssl_context *ssl ) void mbedtls_ssl_buffering_free( mbedtls_ssl_context *ssl )
{ {
unsigned offset; unsigned offset;
mbedtls_ssl_handshake_params * const hs = ssl->handshake; mbedtls_ssl_handshake_params * const hs = ssl->handshake;
@ -11347,8 +11346,8 @@ void mbedtls_ssl_handshake_free( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_SSL_PROTO_DTLS) #if defined(MBEDTLS_SSL_PROTO_DTLS)
mbedtls_free( handshake->verify_cookie ); mbedtls_free( handshake->verify_cookie );
ssl_flight_free( handshake->flight ); mbedtls_ssl_flight_free( handshake->flight );
ssl_buffering_free( ssl ); mbedtls_ssl_buffering_free( ssl );
#endif #endif
#if defined(MBEDTLS_ECDH_C) && \ #if defined(MBEDTLS_ECDH_C) && \