hmac: Reset the underlying hasher before doing set_key() with longer keys
The user might have done a non-complete append, having some state in the hasher. Fixes #909.
This commit is contained in:
@@ -103,7 +103,8 @@ METHOD(mac_t, set_key, bool,
|
|||||||
if (key.len > this->b)
|
if (key.len > this->b)
|
||||||
{
|
{
|
||||||
/* if key is too long, it will be hashed */
|
/* if key is too long, it will be hashed */
|
||||||
if (!this->h->get_hash(this->h, key, buffer))
|
if (!this->h->reset(this->h) ||
|
||||||
|
!this->h->get_hash(this->h, key, buffer))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user