EC keys can have the type MBEDTLS_PK_ECKEY_DH too

This commit is contained in:
Gilles Peskine 2020-02-25 19:54:07 +01:00
parent f02b984f86
commit e60b365a5e
2 changed files with 4 additions and 2 deletions

View File

@ -44,7 +44,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
else
#endif
#if defined(MBEDTLS_ECP_C)
if( mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY )
if( mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY ||
mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY_DH )
{
mbedtls_ecp_keypair *ecp = mbedtls_pk_ec( pk );
mbedtls_ecp_group_id grp_id = ecp->grp.id;

View File

@ -39,7 +39,8 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
else
#endif
#if defined(MBEDTLS_ECP_C)
if( mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY )
if( mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY ||
mbedtls_pk_get_type( &pk ) == MBEDTLS_PK_ECKEY_DH )
{
mbedtls_ecp_keypair *ecp = mbedtls_pk_ec( pk );
mbedtls_ecp_group_id grp_id = ecp->grp.id;