From e60b365a5e4a991a843d85b749632628b0b585e5 Mon Sep 17 00:00:00 2001 From: Gilles Peskine Date: Tue, 25 Feb 2020 19:54:07 +0100 Subject: [PATCH] EC keys can have the type MBEDTLS_PK_ECKEY_DH too --- programs/fuzz/fuzz_privkey.c | 3 ++- programs/fuzz/fuzz_pubkey.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/programs/fuzz/fuzz_privkey.c b/programs/fuzz/fuzz_privkey.c index 8f1295e1e..2a64f57d0 100644 --- a/programs/fuzz/fuzz_privkey.c +++ b/programs/fuzz/fuzz_privkey.c @@ -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; diff --git a/programs/fuzz/fuzz_pubkey.c b/programs/fuzz/fuzz_pubkey.c index 265ee2ae6..95b75211c 100644 --- a/programs/fuzz/fuzz_pubkey.c +++ b/programs/fuzz/fuzz_pubkey.c @@ -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;