mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 09:35:39 +00:00
Moved allocation checks to correct place in ssl_server2.c
This commit is contained in:
parent
99082aeac7
commit
614efc268e
|
@ -2318,6 +2318,32 @@ int main( int argc, char *argv[] )
|
||||||
hmac_drbg = mbedtls_calloc( 1, sizeof( *hmac_drbg ) );
|
hmac_drbg = mbedtls_calloc( 1, sizeof( *hmac_drbg ) );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if( ssl == NULL || conf == NULL ||
|
||||||
|
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
||||||
|
cacert == NULL || srvcert == NULL ||
|
||||||
|
pkey == NULL || srvcert2 == NULL ||
|
||||||
|
pkey2 == NULL ||
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
||||||
|
ticket_ctx == NULL ||
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_SSL_CACHE_C)
|
||||||
|
cache == NULL ||
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_TIMING_C)
|
||||||
|
timer == NULL ||
|
||||||
|
#endif
|
||||||
|
#if defined(MBEDTLS_CTR_DRBG_C)
|
||||||
|
ctr_drbg == NULL ||
|
||||||
|
#else
|
||||||
|
hmac_drbg == NULL ||
|
||||||
|
#endif
|
||||||
|
entropy == NULL)
|
||||||
|
{
|
||||||
|
mbedtls_printf( "Initial allocations failed!\n" );
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure memory references are valid in case we exit early.
|
* Make sure memory references are valid in case we exit early.
|
||||||
*/
|
*/
|
||||||
|
@ -2357,33 +2383,6 @@ int main( int argc, char *argv[] )
|
||||||
mbedtls_ssl_cookie_init( &cookie_ctx );
|
mbedtls_ssl_cookie_init( &cookie_ctx );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( ssl == NULL || conf == NULL ||
|
|
||||||
#if defined(MBEDTLS_X509_CRT_PARSE_C)
|
|
||||||
cacert == NULL || srvcert == NULL ||
|
|
||||||
pkey == NULL || srvcert2 == NULL ||
|
|
||||||
pkey2 == NULL ||
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SSL_SESSION_TICKETS)
|
|
||||||
ticket_ctx == NULL ||
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_SSL_CACHE_C)
|
|
||||||
cache == NULL ||
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_TIMING_C)
|
|
||||||
timer == NULL ||
|
|
||||||
#endif
|
|
||||||
#if defined(MBEDTLS_CTR_DRBG_C)
|
|
||||||
ctr_drbg == NULL ||
|
|
||||||
#else
|
|
||||||
hmac_drbg == NULL ||
|
|
||||||
#endif
|
|
||||||
entropy == NULL)
|
|
||||||
{
|
|
||||||
mbedtls_printf( "Initial allocations failed!\n" );
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
#if defined(MBEDTLS_SSL_DTLS_CONNECTION_ID)
|
||||||
if( unhexify( cid, opt.cid_val, &cid_len ) != 0 )
|
if( unhexify( cid, opt.cid_val, &cid_len ) != 0 )
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue