Move WANT_READ/WANT_WRITE codes to SSL
diff --git a/programs/ssl/ssl_client2.c b/programs/ssl/ssl_client2.c
index 6503d8b..27d87cb 100644
--- a/programs/ssl/ssl_client2.c
+++ b/programs/ssl/ssl_client2.c
@@ -334,11 +334,11 @@
if( first_try )
{
first_try = 0;
- return( MBEDTLS_ERR_NET_WANT_READ );
+ return( MBEDTLS_ERR_SSL_WANT_READ );
}
ret = mbedtls_net_recv( ctx, buf, len );
- if( ret != MBEDTLS_ERR_NET_WANT_READ )
+ if( ret != MBEDTLS_ERR_SSL_WANT_READ )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
@@ -351,11 +351,11 @@
if( first_try )
{
first_try = 0;
- return( MBEDTLS_ERR_NET_WANT_WRITE );
+ return( MBEDTLS_ERR_SSL_WANT_WRITE );
}
ret = mbedtls_net_send( ctx, buf, len );
- if( ret != MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret != MBEDTLS_ERR_SSL_WANT_WRITE )
first_try = 1; /* Next call will be a new operation */
return( ret );
}
@@ -1217,7 +1217,7 @@
while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 )
{
- if( ret != MBEDTLS_ERR_NET_WANT_READ && ret != MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret != MBEDTLS_ERR_SSL_WANT_READ && ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n", -ret );
if( ret == MBEDTLS_ERR_X509_CERT_VERIFY_FAILED )
@@ -1303,8 +1303,8 @@
fflush( stdout );
while( ( ret = mbedtls_ssl_renegotiate( &ssl ) ) != 0 )
{
- if( ret != MBEDTLS_ERR_NET_WANT_READ &&
- ret != MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret != MBEDTLS_ERR_SSL_WANT_READ &&
+ ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_renegotiate returned %d\n\n", ret );
goto exit;
@@ -1355,8 +1355,8 @@
while( ( ret = mbedtls_ssl_write( &ssl, buf + written, len - written ) )
<= 0 )
{
- if( ret != MBEDTLS_ERR_NET_WANT_READ &&
- ret != MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret != MBEDTLS_ERR_SSL_WANT_READ &&
+ ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_write returned -0x%x\n\n", -ret );
goto exit;
@@ -1367,8 +1367,8 @@
else /* Not stream, so datagram */
{
do ret = mbedtls_ssl_write( &ssl, buf, len );
- while( ret == MBEDTLS_ERR_NET_WANT_READ ||
- ret == MBEDTLS_ERR_NET_WANT_WRITE );
+ while( ret == MBEDTLS_ERR_SSL_WANT_READ ||
+ ret == MBEDTLS_ERR_SSL_WANT_WRITE );
if( ret < 0 )
{
@@ -1400,8 +1400,8 @@
memset( buf, 0, sizeof( buf ) );
ret = mbedtls_ssl_read( &ssl, buf, len );
- if( ret == MBEDTLS_ERR_NET_WANT_READ ||
- ret == MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret == MBEDTLS_ERR_SSL_WANT_READ ||
+ ret == MBEDTLS_ERR_SSL_WANT_WRITE )
continue;
if( ret <= 0 )
@@ -1445,14 +1445,14 @@
memset( buf, 0, sizeof( buf ) );
do ret = mbedtls_ssl_read( &ssl, buf, len );
- while( ret == MBEDTLS_ERR_NET_WANT_READ ||
- ret == MBEDTLS_ERR_NET_WANT_WRITE );
+ while( ret == MBEDTLS_ERR_SSL_WANT_READ ||
+ ret == MBEDTLS_ERR_SSL_WANT_WRITE );
if( ret <= 0 )
{
switch( ret )
{
- case MBEDTLS_ERR_NET_TIMEOUT:
+ case MBEDTLS_ERR_SSL_TIMEOUT:
mbedtls_printf( " timeout\n" );
if( retry_left-- > 0 )
goto send_request;
@@ -1489,7 +1489,7 @@
/* No error checking, the connection might be closed already */
do ret = mbedtls_ssl_close_notify( &ssl );
- while( ret == MBEDTLS_ERR_NET_WANT_WRITE );
+ while( ret == MBEDTLS_ERR_SSL_WANT_WRITE );
ret = 0;
mbedtls_printf( " done\n" );
@@ -1545,8 +1545,8 @@
while( ( ret = mbedtls_ssl_handshake( &ssl ) ) != 0 )
{
- if( ret != MBEDTLS_ERR_NET_WANT_READ &&
- ret != MBEDTLS_ERR_NET_WANT_WRITE )
+ if( ret != MBEDTLS_ERR_SSL_WANT_READ &&
+ ret != MBEDTLS_ERR_SSL_WANT_WRITE )
{
mbedtls_printf( " failed\n ! mbedtls_ssl_handshake returned -0x%x\n\n", -ret );
goto exit;