Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
external
mbedtls
Commits
d4f04dba
Commit
d4f04dba
authored
May 14, 2015
by
Manuel Pégourié-Gonnard
Browse files
net.c now depends on select() unconditionally
parent
a63bc94a
Changes
6
Hide whitespace changes
Inline
Side-by-side
ChangeLog
View file @
d4f04dba
...
...
@@ -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
...
...
include/mbedtls/net.h
View file @
d4f04dba
...
...
@@ -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
...
...
library/net.c
View file @
d4f04dba
...
...
@@ -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
...
...
library/timing.c
View file @
d4f04dba
...
...
@@ -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): "
);
...
...
programs/ssl/ssl_client2.c
View file @
d4f04dba
...
...
@@ -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
,
...
...
programs/ssl/ssl_server2.c
View file @
d4f04dba
...
...
@@ -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
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment