Added a generic function to check if a DH group is an EC group

This commit is contained in:
Martin Willi 2010-09-03 16:22:10 +02:00
parent 2066918da2
commit 7d7711aba4
2 changed files with 25 additions and 0 deletions

View File

@ -442,3 +442,20 @@ diffie_hellman_params_t *diffie_hellman_get_params(diffie_hellman_group_t group)
return NULL;
}
/**
* See header.
*/
bool diffie_hellman_group_is_ec(diffie_hellman_group_t group)
{
switch (group)
{
case ECP_256_BIT:
case ECP_384_BIT:
case ECP_521_BIT:
case ECP_192_BIT:
case ECP_224_BIT:
return TRUE;
default:
return FALSE;
}
}

View File

@ -147,4 +147,12 @@ struct diffie_hellman_params_t {
*/
diffie_hellman_params_t *diffie_hellman_get_params(diffie_hellman_group_t group);
/**
* Check if a given DH group is an ECDH group
*
* @param group group to check
* @return TUE if group is an ECP group
*/
bool diffie_hellman_group_is_ec(diffie_hellman_group_t group);
#endif /** DIFFIE_HELLMAN_H_ @}*/