gmp: Use helper to determine XOF type
This commit is contained in:
@@ -354,18 +354,9 @@ static bool build_emsa_pss_signature(private_gmp_rsa_private_key_t *this,
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
switch (params->mgf1_hash)
|
xof = xof_mgf1_from_hash_algorithm(params->mgf1_hash);
|
||||||
|
if (xof == XOF_UNDEFINED)
|
||||||
{
|
{
|
||||||
case HASH_SHA1:
|
|
||||||
xof = XOF_MGF1_SHA1;
|
|
||||||
break;
|
|
||||||
case HASH_SHA256:
|
|
||||||
xof = XOF_MGF1_SHA256;
|
|
||||||
break;
|
|
||||||
case HASH_SHA512:
|
|
||||||
xof = XOF_MGF1_SHA512;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DBG1(DBG_LIB, "%N is not supported for MGF1", hash_algorithm_names,
|
DBG1(DBG_LIB, "%N is not supported for MGF1", hash_algorithm_names,
|
||||||
params->mgf1_hash);
|
params->mgf1_hash);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
@@ -304,18 +304,9 @@ static bool verify_emsa_pss_signature(private_gmp_rsa_public_key_t *this,
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
switch (params->mgf1_hash)
|
xof = xof_mgf1_from_hash_algorithm(params->mgf1_hash);
|
||||||
|
if (xof == XOF_UNDEFINED)
|
||||||
{
|
{
|
||||||
case HASH_SHA1:
|
|
||||||
xof = XOF_MGF1_SHA1;
|
|
||||||
break;
|
|
||||||
case HASH_SHA256:
|
|
||||||
xof = XOF_MGF1_SHA256;
|
|
||||||
break;
|
|
||||||
case HASH_SHA512:
|
|
||||||
xof = XOF_MGF1_SHA512;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
DBG1(DBG_LIB, "%N is not supported for MGF1", hash_algorithm_names,
|
DBG1(DBG_LIB, "%N is not supported for MGF1", hash_algorithm_names,
|
||||||
params->mgf1_hash);
|
params->mgf1_hash);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|||||||
Reference in New Issue
Block a user