openssl: Use proper EVP macro to determine size of a hash
This commit is contained in:
@@ -43,7 +43,7 @@ struct private_openssl_hasher_t {
|
|||||||
METHOD(hasher_t, get_hash_size, size_t,
|
METHOD(hasher_t, get_hash_size, size_t,
|
||||||
private_openssl_hasher_t *this)
|
private_openssl_hasher_t *this)
|
||||||
{
|
{
|
||||||
return this->hasher->md_size;
|
return EVP_MD_size(this->hasher);
|
||||||
}
|
}
|
||||||
|
|
||||||
METHOD(hasher_t, reset, bool,
|
METHOD(hasher_t, reset, bool,
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ bool openssl_hash_chunk(int hash_type, chunk_t data, chunk_t *hash)
|
|||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
*hash = chunk_alloc(hasher->md_size);
|
*hash = chunk_alloc(EVP_MD_size(hasher));
|
||||||
if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
|
if (!EVP_DigestFinal_ex(ctx, hash->ptr, NULL))
|
||||||
{
|
{
|
||||||
chunk_free(hash);
|
chunk_free(hash);
|
||||||
|
|||||||
Reference in New Issue
Block a user