aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilles Peskine <Gilles.Peskine@arm.com>2019-02-11 18:41:27 +0100
committerJanos Follath <janos.follath@arm.com>2019-08-29 16:12:38 +0100
commitc6c7c49fd6a5daea203ef8e86a91bb59eeef663b (patch)
treeeab3e49c3bdf72ec0f45716ebccf42fa8540c7e7
parentb14c4a533da1a433e2f354753b3e7429ef475d61 (diff)
downloadmbedtls-c6c7c49fd6a5daea203ef8e86a91bb59eeef663b.zip
mbedtls-c6c7c49fd6a5daea203ef8e86a91bb59eeef663b.tar.gz
mbedtls-c6c7c49fd6a5daea203ef8e86a91bb59eeef663b.tar.bz2
Add mbedtls_ecdh_can_do
All curves can currently do ECDH, but to make the API symmetric and future-proof, add mbedtls_ecdh_can_do() to go with mbedtls_ecdsa_can_do().
-rw-r--r--programs/test/benchmark.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/programs/test/benchmark.c b/programs/test/benchmark.c
index 7524f5c..502b15d 100644
--- a/programs/test/benchmark.c
+++ b/programs/test/benchmark.c
@@ -911,6 +911,9 @@ int main( int argc, char *argv[] )
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
+ if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
+ continue;
+
mbedtls_ecdh_init( &ecdh );
CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
@@ -956,6 +959,9 @@ int main( int argc, char *argv[] )
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
+ if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
+ continue;
+
mbedtls_ecdh_init( &ecdh );
CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
@@ -1012,6 +1018,9 @@ int main( int argc, char *argv[] )
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
curve_info++ )
{
+ if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
+ continue;
+
mbedtls_ecdh_init( &ecdh_srv );
mbedtls_ecdh_init( &ecdh_cli );
CHECK_AND_CONTINUE( mbedtls_ecdh_setup( &ecdh_srv, curve_info->grp_id ) );