Remove unreachable branches in pkparse.c

This commit is contained in:
Hanno Becker 2017-09-28 16:49:40 +01:00
parent 1f30fa162b
commit 1d233391a6

View file

@ -1067,12 +1067,7 @@ int pk_parse_key( pk_context *pk,
key, pwd, pwdlen, &len ); key, pwd, pwdlen, &len );
if( ret == 0 ) if( ret == 0 )
{ {
if( ( pk_info = pk_info_from_type( POLARSSL_PK_RSA ) ) == NULL ) pk_info = pk_info_from_type( POLARSSL_PK_RSA );
{
pem_free( &pem );
return( POLARSSL_ERR_PK_UNKNOWN_PK_ALG );
}
if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 || if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 ||
( ret = pk_parse_key_pkcs1_der( pk_rsa( *pk ), ( ret = pk_parse_key_pkcs1_der( pk_rsa( *pk ),
pem.buf, pem.buflen ) ) != 0 ) pem.buf, pem.buflen ) ) != 0 )
@ -1098,12 +1093,7 @@ int pk_parse_key( pk_context *pk,
key, pwd, pwdlen, &len ); key, pwd, pwdlen, &len );
if( ret == 0 ) if( ret == 0 )
{ {
if( ( pk_info = pk_info_from_type( POLARSSL_PK_ECKEY ) ) == NULL ) pk_info = pk_info_from_type( POLARSSL_PK_ECKEY );
{
pem_free( &pem );
return( POLARSSL_ERR_PK_UNKNOWN_PK_ALG );
}
if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 || if( ( ret = pk_init_ctx( pk, pk_info ) ) != 0 ||
( ret = pk_parse_key_sec1_der( pk_ec( *pk ), ( ret = pk_parse_key_sec1_der( pk_ec( *pk ),
pem.buf, pem.buflen ) ) != 0 ) pem.buf, pem.buflen ) ) != 0 )