Add explicit integer to enumeration casts to programs/pkey/gen_key.c

Fixes #2170.
This commit is contained in:
Hanno Becker 2018-11-05 16:54:40 +00:00
parent 06f88e9c42
commit e2dae7e1f5

View File

@ -322,7 +322,8 @@ int main( int argc, char *argv[] )
mbedtls_printf( "\n . Generating the private key ..." );
fflush( stdout );
if( ( ret = mbedtls_pk_setup( &key, mbedtls_pk_info_from_type( opt.type ) ) ) != 0 )
if( ( ret = mbedtls_pk_setup( &key,
mbedtls_pk_info_from_type( (mbedtls_pk_type_t) opt.type ) ) ) != 0 )
{
mbedtls_printf( " failed\n ! mbedtls_pk_setup returned -0x%04x", -ret );
goto exit;
@ -344,7 +345,8 @@ int main( int argc, char *argv[] )
#if defined(MBEDTLS_ECP_C)
if( opt.type == MBEDTLS_PK_ECKEY )
{
ret = mbedtls_ecp_gen_key( opt.ec_curve, mbedtls_pk_ec( key ),
ret = mbedtls_ecp_gen_key( (mbedtls_ecp_group_id) opt.ec_curve,
mbedtls_pk_ec( key ),
mbedtls_ctr_drbg_random, &ctr_drbg );
if( ret != 0 )
{