mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-11-29 13:54:20 +01:00
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().
This commit is contained in:
parent
3bf192686b
commit
da510dfa08
@ -911,6 +911,9 @@ int main( int argc, char *argv[] )
|
|||||||
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
curve_info->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
curve_info++ )
|
curve_info++ )
|
||||||
{
|
{
|
||||||
|
if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
mbedtls_ecdh_init( &ecdh );
|
mbedtls_ecdh_init( &ecdh );
|
||||||
|
|
||||||
CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
|
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->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
curve_info++ )
|
curve_info++ )
|
||||||
{
|
{
|
||||||
|
if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
mbedtls_ecdh_init( &ecdh );
|
mbedtls_ecdh_init( &ecdh );
|
||||||
|
|
||||||
CHECK_AND_CONTINUE( mbedtls_ecp_group_load( &ecdh.grp, curve_info->grp_id ) );
|
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->grp_id != MBEDTLS_ECP_DP_NONE;
|
||||||
curve_info++ )
|
curve_info++ )
|
||||||
{
|
{
|
||||||
|
if( ! mbedtls_ecdh_can_do( curve_info->grp_id ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
mbedtls_ecdh_init( &ecdh_srv );
|
mbedtls_ecdh_init( &ecdh_srv );
|
||||||
mbedtls_ecdh_init( &ecdh_cli );
|
mbedtls_ecdh_init( &ecdh_cli );
|
||||||
CHECK_AND_CONTINUE( mbedtls_ecdh_setup( &ecdh_srv, curve_info->grp_id ) );
|
CHECK_AND_CONTINUE( mbedtls_ecdh_setup( &ecdh_srv, curve_info->grp_id ) );
|
||||||
|
Loading…
Reference in New Issue
Block a user