Use ssl_set_psk() only when a psk is given

This commit is contained in:
Manuel Pégourié-Gonnard 2014-06-10 15:24:51 +02:00
parent fdee74b8d6
commit dc019b9559

View file

@ -1210,8 +1210,18 @@ int main( int argc, char *argv[] )
#endif #endif
#if defined(POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED) #if defined(POLARSSL_KEY_EXCHANGE__SOME__PSK_ENABLED)
ssl_set_psk( &ssl, psk, psk_len, (const unsigned char *) opt.psk_identity, if( strlen( opt.psk ) != 0 && strlen( opt.psk_identity ) != 0 )
strlen( opt.psk_identity ) ); {
ret = ssl_set_psk( &ssl, psk, psk_len,
(const unsigned char *) opt.psk_identity,
strlen( opt.psk_identity ) );
if( ret != 0 )
{
printf( " failed\n ssl_set_psk returned -0x%04X\n\n", - ret );
goto exit;
}
}
if( opt.psk_list != NULL ) if( opt.psk_list != NULL )
ssl_set_psk_cb( &ssl, psk_callback, psk_info ); ssl_set_psk_cb( &ssl, psk_callback, psk_info );
#endif #endif