From d931ad2acab39415bdf27483b2cec1df6f3e4491 Mon Sep 17 00:00:00 2001 From: Hanno Becker Date: Wed, 21 Aug 2019 15:25:22 +0100 Subject: [PATCH] Implement x509_profile_check_key() for TinyCrypt-based PK context --- library/x509_crt.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/library/x509_crt.c b/library/x509_crt.c index 1c4237bda..352ed6c57 100644 --- a/library/x509_crt.c +++ b/library/x509_crt.c @@ -597,6 +597,16 @@ static int x509_profile_check_key( const mbedtls_x509_crt_profile *profile, } #endif +#if defined(MBEDTLS_USE_TINYCRYPT) + if( pk_alg == MBEDTLS_PK_ECKEY ) + { + if( ( profile->allowed_curves & MBEDTLS_UECC_DP_SECP256R1 ) != 0 ) + return( 0 ); + + return( -1 ); + } +#endif /* MBEDTLS_USE_TINYCRYPT */ + #if defined(MBEDTLS_ECP_C) if( pk_alg == MBEDTLS_PK_ECDSA || pk_alg == MBEDTLS_PK_ECKEY ||