*/
static void reset(private_openssl_hasher_t *this)
{
- if (this->ctx)
- {
- EVP_MD_CTX_destroy(this->ctx);
- }
- this->ctx = EVP_MD_CTX_create();
EVP_DigestInit_ex(this->ctx, this->hasher, NULL);
}
*/
static void destroy (private_openssl_hasher_t *this)
{
- if (this->ctx)
- {
- EVP_MD_CTX_destroy(this->ctx);
- }
+ EVP_MD_CTX_destroy(this->ctx);
free(this);
}
this->public.hasher_interface.reset = (void (*) (hasher_t*))reset;
this->public.hasher_interface.destroy = (void (*) (hasher_t*))destroy;
- this->ctx = NULL;
+ this->ctx = EVP_MD_CTX_create();
- /* initialize */
+ /* initialization */
reset(this);
return &this->public;