mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-08 17:42:09 +03:00
Adapt programs / test suites
This commit is contained in:
@@ -82,8 +82,7 @@ int main( int argc, char *argv[] )
|
||||
((void) argv);
|
||||
|
||||
memset( &rsa, 0, sizeof( rsa ) );
|
||||
memset( &dhm, 0, sizeof( dhm ) );
|
||||
|
||||
dhm_init( &dhm );
|
||||
aes_init( &aes );
|
||||
|
||||
/*
|
||||
@@ -284,6 +283,7 @@ exit:
|
||||
aes_free( &aes );
|
||||
rsa_free( &rsa );
|
||||
dhm_free( &dhm );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -154,6 +154,7 @@ int main( int argc, char *argv[] )
|
||||
exit:
|
||||
|
||||
mpi_free( &G ); mpi_free( &P ); mpi_free( &Q );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -83,7 +83,7 @@ int main( int argc, char *argv[] )
|
||||
((void) argv);
|
||||
|
||||
memset( &rsa, 0, sizeof( rsa ) );
|
||||
memset( &dhm, 0, sizeof( dhm ) );
|
||||
dhm_init( &dhm );
|
||||
aes_init( &aes );
|
||||
|
||||
/*
|
||||
@@ -284,6 +284,7 @@ exit:
|
||||
aes_free( &aes );
|
||||
rsa_free( &rsa );
|
||||
dhm_free( &dhm );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -229,6 +229,7 @@ exit:
|
||||
|
||||
ecdsa_free( &ctx_verify );
|
||||
ecdsa_free( &ctx_sign );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
return( ret );
|
||||
|
@@ -388,6 +388,7 @@ exit:
|
||||
}
|
||||
|
||||
pk_free( &key );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -140,6 +140,7 @@ int main( int argc, char *argv[] )
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(POLARSSL_ERROR_C)
|
||||
|
@@ -140,6 +140,7 @@ int main( int argc, char *argv[] )
|
||||
printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" );
|
||||
|
||||
exit:
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(POLARSSL_ERROR_C)
|
||||
|
@@ -151,6 +151,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
exit:
|
||||
pk_free( &pk );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(POLARSSL_ERROR_C)
|
||||
|
@@ -164,6 +164,7 @@ int main( int argc, char *argv[] )
|
||||
ret = 0;
|
||||
|
||||
exit:
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -152,6 +152,7 @@ int main( int argc, char *argv[] )
|
||||
printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" );
|
||||
|
||||
exit:
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -154,6 +154,7 @@ exit:
|
||||
fclose( fpriv );
|
||||
|
||||
rsa_free( &rsa );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -161,6 +161,7 @@ int main( int argc, char *argv[] )
|
||||
|
||||
exit:
|
||||
pk_free( &pk );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -115,6 +115,7 @@ cleanup:
|
||||
printf("\n");
|
||||
|
||||
fclose( f );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
return( ret );
|
||||
|
@@ -48,7 +48,7 @@ int main( int argc, char *argv[] )
|
||||
{
|
||||
FILE *f;
|
||||
time_t t;
|
||||
int i, k;
|
||||
int i, k, ret = 0;
|
||||
havege_state hs;
|
||||
unsigned char buf[1024];
|
||||
|
||||
@@ -73,8 +73,9 @@ int main( int argc, char *argv[] )
|
||||
if( havege_random( &hs, buf, sizeof( buf ) ) != 0 )
|
||||
{
|
||||
printf( "Failed to get random from source.\n" );
|
||||
fclose( f );
|
||||
return( 1 );
|
||||
|
||||
ret = 1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
fwrite( buf, sizeof( buf ), 1, f );
|
||||
@@ -89,7 +90,9 @@ int main( int argc, char *argv[] )
|
||||
|
||||
printf(" \n ");
|
||||
|
||||
exit:
|
||||
havege_free( &hs );
|
||||
fclose( f );
|
||||
return( 0 );
|
||||
return( ret );
|
||||
}
|
||||
#endif /* POLARSSL_HAVEGE_C */
|
||||
|
@@ -290,6 +290,7 @@ exit:
|
||||
|
||||
x509_crt_free( &cacert );
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
memset( &ssl, 0, sizeof( ssl ) );
|
||||
|
@@ -1209,6 +1209,7 @@ exit:
|
||||
#endif
|
||||
ssl_session_free( &saved_session );
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
memset( &ssl, 0, sizeof( ssl ) );
|
||||
|
@@ -376,6 +376,7 @@ exit:
|
||||
x509_crt_free( &srvcert );
|
||||
pk_free( &pkey );
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -816,6 +816,7 @@ exit:
|
||||
x509_crt_free( &cacert );
|
||||
pk_free( &pkey );
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -492,6 +492,7 @@ exit:
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
ssl_cache_free( &cache );
|
||||
#endif
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
polarssl_mutex_free( &debug_mutex );
|
||||
|
@@ -373,6 +373,7 @@ exit:
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
ssl_cache_free( &cache );
|
||||
#endif
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -626,7 +626,7 @@ int main( int argc, char *argv[] )
|
||||
pk_init( &pkey2 );
|
||||
#endif
|
||||
#if defined(POLARSSL_DHM_C) && defined(POLARSSL_FS_IO)
|
||||
memset( &dhm, 0, sizeof( dhm_context ) );
|
||||
dhm_init( &dhm );
|
||||
#endif
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
ssl_cache_init( &cache );
|
||||
@@ -1655,6 +1655,9 @@ exit:
|
||||
if( client_fd != -1 )
|
||||
net_close( client_fd );
|
||||
|
||||
#if defined(POLARSSL_DHM_C) && defined(POLARSSL_FS_IO)
|
||||
dhm_free( &dhm );
|
||||
#endif
|
||||
#if defined(POLARSSL_X509_CRT_PARSE_C)
|
||||
x509_crt_free( &cacert );
|
||||
x509_crt_free( &srvcert );
|
||||
@@ -1673,6 +1676,7 @@ exit:
|
||||
#endif
|
||||
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(POLARSSL_SSL_CACHE_C)
|
||||
|
@@ -414,6 +414,7 @@ int main( int argc, char *argv[] )
|
||||
havege_state hs;
|
||||
havege_init( &hs );
|
||||
TIME_AND_TSC( "HAVEGE", havege_random( &hs, buf, BUFSIZE ) );
|
||||
havege_free( &hs );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -434,6 +435,7 @@ int main( int argc, char *argv[] )
|
||||
TIME_AND_TSC( "CTR_DRBG (PR)",
|
||||
if( ctr_drbg_random( &ctr_drbg, buf, BUFSIZE ) != 0 )
|
||||
exit(1) );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -531,7 +533,7 @@ int main( int argc, char *argv[] )
|
||||
size_t olen;
|
||||
for( i = 0; i < DHM_SIZES; i++ )
|
||||
{
|
||||
memset( &dhm, 0, sizeof( dhm_context ) );
|
||||
dhm_init( &dhm );
|
||||
|
||||
if( mpi_read_string( &dhm.P, 16, dhm_P[i] ) != 0 ||
|
||||
mpi_read_string( &dhm.G, 16, dhm_G[i] ) != 0 )
|
||||
|
@@ -258,6 +258,7 @@ int main( int argc, char *argv[] )
|
||||
printf( "String value (PolarSSL Private Encrypt, OpenSSL Public Decrypt): '%s'\n", o_priv_decrypted );
|
||||
|
||||
exit:
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#ifdef WIN32
|
||||
|
@@ -417,6 +417,7 @@ exit:
|
||||
x509_crt_free( &srvcert );
|
||||
pk_free( &pkey );
|
||||
ssl_free( &ssl );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
if( client_fd != -1 )
|
||||
|
@@ -492,6 +492,7 @@ exit:
|
||||
x509_crl_free( &cacrl );
|
||||
#endif
|
||||
pk_free( &pkey );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -329,6 +329,7 @@ exit:
|
||||
|
||||
x509write_csr_free( &req );
|
||||
pk_free( &key );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
@@ -652,6 +652,7 @@ exit:
|
||||
pk_free( &loaded_subject_key );
|
||||
pk_free( &loaded_issuer_key );
|
||||
mpi_free( &serial );
|
||||
ctr_drbg_free( &ctr_drbg );
|
||||
entropy_free( &entropy );
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
Reference in New Issue
Block a user