TinyCrypt PK parse: Remove MBEDTLS_PK_ECDSA during pubkey parsing

The PK type MBEDTLS_PK_ECDSA is never returned from
`mbedtls_pk_info_from_type()`. Instead, EC keys either
are identified as MBEDTLS_PK_ECKEY_DH (in case they
must only be used for ECDHE) or MBEDTLS_PK_ECKEY (in
case they can be used for any algorithm).
This commit is contained in:
Hanno Becker 2019-08-20 14:31:50 +01:00
parent e65697c351
commit 75f8d3276f

View file

@ -716,7 +716,7 @@ int mbedtls_pk_parse_subpubkey( unsigned char **p, const unsigned char *end,
return( ret );
#if defined(MBEDTLS_USE_TINYCRYPT)
if( pk_alg == MBEDTLS_PK_ECDSA )
if( pk_alg == MBEDTLS_PK_ECKEY )
{
ret = pk_get_ueccpubkey( p, end, (uint8_t*) pk->pk_ctx );
} else
@ -1204,7 +1204,7 @@ static int pk_parse_key_pkcs8_unencrypted_der(
} else
#endif /* MBEDTLS_RSA_C */
#if defined(MBEDTLS_USE_TINYCRYPT)
if( pk_alg == MBEDTLS_PK_ECDSA)
if( pk_alg == MBEDTLS_PK_ECKEY )
{
if( ( ret = pk_use_ecparams( &params ) ) != 0 ||
( ret = pk_parse_key_sec1_der( mbedtls_uecc_pk( *pk ), p, len ) ) != 0)