Add a return value to hasher_t.allocate_hash()
This commit is contained in:
@@ -235,11 +235,11 @@ static bool build_emsa_pkcs1_signature(private_gmp_rsa_private_key_t *this,
|
||||
}
|
||||
|
||||
hasher = lib->crypto->create_hasher(lib->crypto, hash_algorithm);
|
||||
if (hasher == NULL)
|
||||
if (!hasher || !hasher->allocate_hash(hasher, data, &hash))
|
||||
{
|
||||
DESTROY_IF(hasher);
|
||||
return FALSE;
|
||||
}
|
||||
hasher->allocate_hash(hasher, data, &hash);
|
||||
hasher->destroy(hasher);
|
||||
|
||||
/* build DER-encoded digestInfo */
|
||||
|
||||
@@ -252,7 +252,11 @@ static bool verify_emsa_pkcs1_signature(private_gmp_rsa_public_key_t *this,
|
||||
}
|
||||
|
||||
/* build our own hash and compare */
|
||||
hasher->allocate_hash(hasher, data, &hash);
|
||||
if (!hasher->allocate_hash(hasher, data, &hash))
|
||||
{
|
||||
hasher->destroy(hasher);
|
||||
goto end_parser;
|
||||
}
|
||||
hasher->destroy(hasher);
|
||||
success = memeq(object.ptr, hash.ptr, hash.len);
|
||||
free(hash.ptr);
|
||||
|
||||
Reference in New Issue
Block a user