Add a return value to hasher_t.reset()

This commit is contained in:
Martin Willi
2012-07-16 14:55:06 +02:00
parent 87dd205b61
commit e3b2e900e6
12 changed files with 91 additions and 68 deletions
@@ -96,10 +96,10 @@ METHOD(hasher_t, get_hash_size, size_t,
return this->hasher->md_size;
}
METHOD(hasher_t, reset, void,
METHOD(hasher_t, reset, bool,
private_openssl_hasher_t *this)
{
EVP_DigestInit_ex(this->ctx, this->hasher, NULL);
return EVP_DigestInit_ex(this->ctx, this->hasher, NULL) == 1;
}
METHOD(hasher_t, get_hash, bool,
@@ -115,7 +115,7 @@ METHOD(hasher_t, get_hash, bool,
{
return FALSE;
}
reset(this);
return reset(this);
}
return TRUE;
}
@@ -175,7 +175,11 @@ openssl_hasher_t *openssl_hasher_create(hash_algorithm_t algo)
this->ctx = EVP_MD_CTX_create();
/* initialization */
reset(this);
if (!reset(this))
{
destroy(this);
return NULL;
}
return &this->public;
}