1
0
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:
Paul Bakker
2014-06-18 16:44:11 +02:00
parent 8f870b047c
commit a317a98221
33 changed files with 76 additions and 12 deletions

View File

@@ -45,6 +45,8 @@ void ctr_drbg_validate_pr( char *add_init_string, char *entropy_string,
TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add2, add2_len ) == 0 );
hexify( output_str, buf, 16 );
TEST_ASSERT( strcmp( (char *) output_str, result_str ) == 0 );
ctr_drbg_free( &ctx );
}
/* END_CASE */
@@ -79,6 +81,8 @@ void ctr_drbg_validate_nopr( char *add_init_string, char *entropy_string,
TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add2, add2_len ) == 0 );
hexify( output_str, buf, 16 );
TEST_ASSERT( strcmp( (char *) output_str, result_str ) == 0 );
ctr_drbg_free( &ctx );
}
/* END_CASE */
@@ -150,6 +154,8 @@ void ctr_drbg_entropy_usage( )
last_idx = test_offset_idx;
TEST_ASSERT( ctr_drbg_random( &ctx, out, sizeof( out ) ) == 0 );
TEST_ASSERT( test_offset_idx - last_idx == 13 );
ctr_drbg_free( &ctx );
}
/* END_CASE */
@@ -161,6 +167,8 @@ void ctr_drbg_seed_file( char *path, int ret )
TEST_ASSERT( ctr_drbg_init( &ctx, rnd_std_rand, NULL, NULL, 0 ) == 0 );
TEST_ASSERT( ctr_drbg_write_seed_file( &ctx, path ) == ret );
TEST_ASSERT( ctr_drbg_update_seed_file( &ctx, path ) == ret );
ctr_drbg_free( &ctx );
}
/* END_CASE */

View File

@@ -25,8 +25,8 @@ void dhm_do_dhm( int radix_P, char *input_P,
int x_size, i;
rnd_pseudo_info rnd_info;
memset( &ctx_srv, 0x00, sizeof( dhm_context ) );
memset( &ctx_cli, 0x00, sizeof( dhm_context ) );
dhm_init( &ctx_srv );
dhm_init( &ctx_cli );
memset( ske, 0x00, 1000 );
memset( pub_cli, 0x00, 1000 );
memset( sec_srv, 0x00, 1000 );
@@ -103,7 +103,7 @@ void dhm_file( char *filename, char *p, char *g, int len )
dhm_context ctx;
mpi P, G;
memset( &ctx, 0, sizeof ctx );
dhm_init( &ctx );
mpi_init( &P ); mpi_init( &G );
TEST_ASSERT( mpi_read_string( &P, 16, p ) == 0 );

View File

@@ -597,6 +597,7 @@ void rsa_gen_key( int nrbits, int exponent, int result)
}
rsa_free( &ctx );
ctr_drbg_free( &ctr_drbg );
entropy_free( &entropy );
}
/* END_CASE */