mirror of
https://git.suyu.dev/suyu/mbedtls.git
synced 2026-01-06 22:49:34 +01:00
Added return value checking for correctness in programs
This commit is contained in:
parent
4f42c11846
commit
cbe3d0d5cc
4 changed files with 58 additions and 14 deletions
|
|
@ -483,11 +483,16 @@ int main( int argc, char *argv[] )
|
|||
{
|
||||
memset( &dhm, 0, sizeof( dhm_context ) );
|
||||
|
||||
mpi_read_string( &dhm.P, 16, dhm_P[i] );
|
||||
mpi_read_string( &dhm.G, 16, dhm_G[i] );
|
||||
if( mpi_read_string( &dhm.P, 16, dhm_P[i] ) != 0 ||
|
||||
mpi_read_string( &dhm.G, 16, dhm_G[i] ) != 0 )
|
||||
{
|
||||
exit( 1 );
|
||||
}
|
||||
|
||||
dhm.len = mpi_size( &dhm.P );
|
||||
dhm_make_public( &dhm, (int) dhm.len, buf, dhm.len, myrand, NULL );
|
||||
mpi_copy( &dhm.GY, &dhm.GX );
|
||||
if( mpi_copy( &dhm.GY, &dhm.GX ) != 0 )
|
||||
exit( 1 );
|
||||
|
||||
snprintf( title, sizeof( title ), "DHE-%d", dhm_sizes[i] );
|
||||
TIME_PUBLIC( title, "handshake",
|
||||
|
|
|
|||
|
|
@ -273,7 +273,13 @@ static int ssl_test( struct options *opt )
|
|||
ssl_set_ciphersuites( &ssl, opt->force_ciphersuite );
|
||||
|
||||
if( opt->iomode == IOMODE_NONBLOCK )
|
||||
net_set_nonblock( client_fd );
|
||||
{
|
||||
if( ( ret = net_set_nonblock( client_fd ) ) != 0 )
|
||||
{
|
||||
printf( " ! net_set_nonblock returned %d\n\n", ret );
|
||||
return( ret );
|
||||
}
|
||||
}
|
||||
|
||||
read_buf = (unsigned char *) malloc( opt->buffer_size );
|
||||
write_buf = (unsigned char *) malloc( opt->buffer_size );
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue