Adapt benchmark application to naming and binary format

This commit is contained in:
Hanno Becker 2017-10-04 13:13:34 +01:00
parent e2fcfa84ea
commit b953921a4e

View File

@ -667,14 +667,22 @@ int main( int argc, char *argv[] )
if( todo.dhm ) if( todo.dhm )
{ {
int dhm_sizes[] = { 2048, 3072 }; int dhm_sizes[] = { 2048, 3072 };
const char *dhm_P[] = { const unsigned char dhm_P_2048[] =
mbedtls_dhm_rfc3526_modp_2048_p, MBEDTLS_DHM_RFC3526_MODP_2048_P_BIN;
mbedtls_dhm_rfc3526_modp_3072_p, const unsigned char dhm_P_3072[] =
}; MBEDTLS_DHM_RFC3526_MODP_3072_P_BIN;
const char *dhm_G[] = { const unsigned char dhm_G_2048[] =
mbedtls_dhm_rfc3526_modp_2048_g, MBEDTLS_DHM_RFC3526_MODP_2048_G_BIN;
mbedtls_dhm_rfc3526_modp_3072_g, const unsigned char dhm_G_3072[] =
}; MBEDTLS_DHM_RFC3526_MODP_3072_G_BIN;
const unsigned char *dhm_P[] = { dhm_P_2048, dhm_P_3072 };
const size_t dhm_P_size[] = { sizeof( dhm_P_2048 ),
sizeof( dhm_P_3072 ) };
const unsigned char *dhm_G[] = { dhm_G_2048, dhm_G_3072 };
const size_t dhm_G_size[] = { sizeof( dhm_G_2048 ),
sizeof( dhm_G_3072 ) };
mbedtls_dhm_context dhm; mbedtls_dhm_context dhm;
size_t olen; size_t olen;
@ -682,8 +690,10 @@ int main( int argc, char *argv[] )
{ {
mbedtls_dhm_init( &dhm ); mbedtls_dhm_init( &dhm );
if( mbedtls_mpi_read_string( &dhm.P, 16, dhm_P[i] ) != 0 || if( mbedtls_mpi_read_binary( &dhm.P, dhm_P[i],
mbedtls_mpi_read_string( &dhm.G, 16, dhm_G[i] ) != 0 ) dhm_P_size[i] ) != 0 ||
mbedtls_mpi_read_binary( &dhm.G, dhm_G[i],
dhm_G_size[i] ) != 0 )
{ {
mbedtls_exit( 1 ); mbedtls_exit( 1 );
} }