mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-25 16:55:43 +01:00
net.c now depends on select() unconditionally
This commit is contained in:
parent
a63bc94a2d
commit
d4f04dba42
@ -115,7 +115,7 @@ Default behavior changes
|
||||
|
||||
Requirement changes
|
||||
* The minimum MSVC version required is now 2010 (better C99 support).
|
||||
* The NET layer now unconditionnaly relies on getaddrinfo().
|
||||
* The NET layer now unconditionnaly relies on getaddrinfo() and select().
|
||||
* Compiler is required to support C99 types such as long long and uint32_t.
|
||||
|
||||
API changes from the 1.4 preview branch
|
||||
|
@ -126,7 +126,6 @@ int mbedtls_net_set_block( int fd );
|
||||
*/
|
||||
int mbedtls_net_set_nonblock( int fd );
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
/**
|
||||
* \brief Portable usleep helper
|
||||
*
|
||||
@ -136,7 +135,6 @@ int mbedtls_net_set_nonblock( int fd );
|
||||
* select()'s timeout granularity (typically, 10ms).
|
||||
*/
|
||||
void mbedtls_net_usleep( unsigned long usec );
|
||||
#endif
|
||||
|
||||
/**
|
||||
* \brief Read at most 'len' characters. If no error occurs,
|
||||
@ -168,7 +166,6 @@ int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len );
|
||||
*/
|
||||
int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len );
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
/**
|
||||
* \brief Read at most 'len' characters, blocking for at most
|
||||
* 'timeout' seconds. If no error occurs, the actual amount
|
||||
@ -191,7 +188,6 @@ int mbedtls_net_send( void *ctx, const unsigned char *buf, size_t len );
|
||||
*/
|
||||
int mbedtls_net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
|
||||
uint32_t timeout );
|
||||
#endif /* MBEDTLS_HAVE_TIME */
|
||||
|
||||
/**
|
||||
* \brief Gracefully shutdown the connection
|
||||
|
@ -65,9 +65,7 @@ static int wsa_init_done = 0;
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
#include <sys/time.h>
|
||||
#endif
|
||||
#include <unistd.h>
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
@ -84,9 +82,7 @@ static int wsa_init_done = 0;
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
#include <time.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && !defined(EFIX64) && !defined(EFI32)
|
||||
#include <basetsd.h>
|
||||
@ -396,7 +392,6 @@ int mbedtls_net_set_nonblock( int fd )
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
/*
|
||||
* Portable usleep helper
|
||||
*/
|
||||
@ -412,7 +407,6 @@ void mbedtls_net_usleep( unsigned long usec )
|
||||
#endif
|
||||
select( 0, NULL, NULL, NULL, &tv );
|
||||
}
|
||||
#endif /* MBEDTLS_HAVE_TIME */
|
||||
|
||||
/*
|
||||
* Read at most 'len' characters
|
||||
@ -445,7 +439,6 @@ int mbedtls_net_recv( void *ctx, unsigned char *buf, size_t len )
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
/*
|
||||
* Read at most 'len' characters, blocking for at most 'timeout' ms
|
||||
*/
|
||||
@ -486,7 +479,6 @@ int mbedtls_net_recv_timeout( void *ctx, unsigned char *buf, size_t len,
|
||||
/* This call will not block */
|
||||
return( mbedtls_net_recv( ctx, buf, len ) );
|
||||
}
|
||||
#endif /* MBEDTLS_HAVE_TIME */
|
||||
|
||||
/*
|
||||
* Write at most 'len' characters
|
||||
|
@ -352,7 +352,7 @@ int mbedtls_timing_get_delay( void *data )
|
||||
#if defined(MBEDTLS_SELF_TEST)
|
||||
|
||||
/* To test mbedtls_net_usleep against our functions */
|
||||
#if defined(MBEDTLS_NET_C) && defined(MBEDTLS_HAVE_TIME)
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
#include "mbedtls/net.h"
|
||||
#endif
|
||||
|
||||
@ -507,7 +507,7 @@ hard_test:
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( "passed\n" );
|
||||
|
||||
#if defined(MBEDTLS_NET_C) && defined(MBEDTLS_HAVE_TIME)
|
||||
#if defined(MBEDTLS_NET_C)
|
||||
if( verbose != 0 )
|
||||
mbedtls_printf( " TIMING test #4 (net_usleep/ get_timer): " );
|
||||
|
||||
|
@ -1183,12 +1183,7 @@ int main( int argc, char *argv[] )
|
||||
mbedtls_ssl_set_bio( &ssl, &server_fd, my_send, my_recv, NULL );
|
||||
else
|
||||
mbedtls_ssl_set_bio( &ssl, &server_fd, mbedtls_net_send, mbedtls_net_recv,
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
);
|
||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
||||
|
||||
#if defined(MBEDTLS_TIMING_C)
|
||||
mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay,
|
||||
|
@ -1746,12 +1746,7 @@ int main( int argc, char *argv[] )
|
||||
mbedtls_ssl_set_bio( &ssl, &client_fd, my_send, my_recv, NULL );
|
||||
else
|
||||
mbedtls_ssl_set_bio( &ssl, &client_fd, mbedtls_net_send, mbedtls_net_recv,
|
||||
#if defined(MBEDTLS_HAVE_TIME)
|
||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL
|
||||
#else
|
||||
NULL
|
||||
#endif
|
||||
);
|
||||
opt.nbio == 0 ? mbedtls_net_recv_timeout : NULL );
|
||||
|
||||
#if defined(MBEDTLS_TIMING_C)
|
||||
mbedtls_ssl_set_timer_cb( &ssl, &timer, mbedtls_timing_set_delay,
|
||||
|
Loading…
Reference in New Issue
Block a user