mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-26 11:05:47 +01:00
Uniformly treat MTU as size_t
This commit is contained in:
parent
a67dee256d
commit
11682ccc78
@ -109,24 +109,24 @@ static void ssl_update_in_pointers( mbedtls_ssl_context *ssl,
|
|||||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
#if defined(MBEDTLS_SSL_PROTO_DTLS)
|
||||||
|
|
||||||
static size_t ssl_get_current_mtu( const mbedtls_ssl_context *ssl );
|
static size_t ssl_get_current_mtu( const mbedtls_ssl_context *ssl );
|
||||||
static uint16_t ssl_get_maximum_datagram_size( mbedtls_ssl_context const *ssl )
|
static size_t ssl_get_maximum_datagram_size( mbedtls_ssl_context const *ssl )
|
||||||
{
|
{
|
||||||
uint16_t mtu = ssl_get_current_mtu( ssl );
|
size_t mtu = ssl_get_current_mtu( ssl );
|
||||||
|
|
||||||
if( mtu != 0 && mtu < MBEDTLS_SSL_OUT_BUFFER_LEN )
|
if( mtu != 0 && mtu < MBEDTLS_SSL_OUT_BUFFER_LEN )
|
||||||
return( (int) mtu );
|
return( mtu );
|
||||||
|
|
||||||
return( MBEDTLS_SSL_OUT_BUFFER_LEN );
|
return( MBEDTLS_SSL_OUT_BUFFER_LEN );
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ssl_get_remaining_space_in_datagram( mbedtls_ssl_context const *ssl )
|
static int ssl_get_remaining_space_in_datagram( mbedtls_ssl_context const *ssl )
|
||||||
{
|
{
|
||||||
size_t const bytes_written = ssl->out_left;
|
size_t const bytes_written = ssl->out_left;
|
||||||
uint16_t const mtu = ssl_get_maximum_datagram_size( ssl );
|
size_t const mtu = ssl_get_maximum_datagram_size( ssl );
|
||||||
|
|
||||||
/* Double-check that the write-index hasn't gone
|
/* Double-check that the write-index hasn't gone
|
||||||
* past what we can transmit in a single datagram. */
|
* past what we can transmit in a single datagram. */
|
||||||
if( bytes_written > (size_t) mtu )
|
if( bytes_written > mtu )
|
||||||
{
|
{
|
||||||
/* Should never happen... */
|
/* Should never happen... */
|
||||||
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
|
||||||
|
Loading…
Reference in New Issue
Block a user