mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2025-01-10 08:05:34 +00:00
Add ssl_close_notify() to servers that missed it
This commit is contained in:
parent
875548ce67
commit
3cbaf1e379
|
@ -42,6 +42,7 @@ Bugfix
|
||||||
* ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc
|
* ssl_handshake_init() was leaving dirty pointers in subcontexts if malloc
|
||||||
of one of them failed
|
of one of them failed
|
||||||
* x509_get_current_time() uses localtime_r() to prevent thread issues
|
* x509_get_current_time() uses localtime_r() to prevent thread issues
|
||||||
|
* Some example server programs were not sending the close_notify alert.
|
||||||
|
|
||||||
= Version 1.2.10 released 2013-10-07
|
= Version 1.2.10 released 2013-10-07
|
||||||
Changes
|
Changes
|
||||||
|
|
|
@ -616,6 +616,7 @@ int main( int argc, char *argv[] )
|
||||||
if( ret == 0 )
|
if( ret == 0 )
|
||||||
{
|
{
|
||||||
printf("\n\nEOF\n\n");
|
printf("\n\nEOF\n\n");
|
||||||
|
ssl_close_notify( &ssl );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -624,9 +625,9 @@ int main( int argc, char *argv[] )
|
||||||
}
|
}
|
||||||
while( 1 );
|
while( 1 );
|
||||||
|
|
||||||
ssl_close_notify( &ssl );
|
|
||||||
|
|
||||||
exit:
|
exit:
|
||||||
|
if( ret == POLARSSL_ERR_SSL_PEER_CLOSE_NOTIFY )
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
#ifdef POLARSSL_ERROR_C
|
#ifdef POLARSSL_ERROR_C
|
||||||
if( ret != 0 )
|
if( ret != 0 )
|
||||||
|
|
|
@ -325,6 +325,20 @@ reset:
|
||||||
len = ret;
|
len = ret;
|
||||||
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
||||||
|
|
||||||
|
printf( " . Closing the connection..." );
|
||||||
|
|
||||||
|
while( ( ret = ssl_close_notify( &ssl ) ) < 0 )
|
||||||
|
{
|
||||||
|
if( ret != POLARSSL_ERR_NET_WANT_READ &&
|
||||||
|
ret != POLARSSL_ERR_NET_WANT_WRITE )
|
||||||
|
{
|
||||||
|
printf( " failed\n ! ssl_close_notify returned %d\n\n", ret );
|
||||||
|
goto reset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( " ok\n" );
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto reset;
|
goto reset;
|
||||||
|
|
||||||
|
|
|
@ -684,6 +684,20 @@ reset:
|
||||||
len = ret;
|
len = ret;
|
||||||
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
printf( " %d bytes written\n\n%s\n", len, (char *) buf );
|
||||||
|
|
||||||
|
printf( " . Closing the connection..." );
|
||||||
|
|
||||||
|
while( ( ret = ssl_close_notify( &ssl ) ) < 0 )
|
||||||
|
{
|
||||||
|
if( ret != POLARSSL_ERR_NET_WANT_READ &&
|
||||||
|
ret != POLARSSL_ERR_NET_WANT_WRITE )
|
||||||
|
{
|
||||||
|
printf( " failed\n ! ssl_close_notify returned %d\n\n", ret );
|
||||||
|
goto reset;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
printf( " ok\n" );
|
||||||
|
|
||||||
ret = 0;
|
ret = 0;
|
||||||
goto reset;
|
goto reset;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue