Move WANT_READ/WANT_WRITE codes to SSL
diff --git a/programs/ssl/ssl_server2.c b/programs/ssl/ssl_server2.c
index 7b85ce8..6f6836d 100644
--- a/programs/ssl/ssl_server2.c
+++ b/programs/ssl/ssl_server2.c
@@ -409,11 +409,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 );
}
@@ -426,11 +426,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 );
}
@@ -1874,8 +1874,8 @@
fflush( stdout );
do ret = mbedtls_ssl_handshake( &ssl );
- 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 == MBEDTLS_ERR_SSL_HELLO_VERIFY_REQUIRED )
{
@@ -1959,8 +1959,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 )
@@ -2050,8 +2050,8 @@
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 )
{
@@ -2086,8 +2086,8 @@
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 reset;
@@ -2120,8 +2120,8 @@
goto reset;
}
- 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 %d\n\n", ret );
goto reset;
@@ -2132,8 +2132,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 )
{
@@ -2163,7 +2163,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" );