{
int ec;
+ i_assert(ctx->ctx == NULL);
i_assert(ctx->md != NULL);
#ifdef HAVE_HMAC_CTX_new
ctx->ctx = HMAC_CTX_new();
ec = HMAC_Init_ex(ctx->ctx, ctx->key, ctx->klen, ctx->md, NULL);
if (ec != 1) {
HMAC_CTX_free(ctx->ctx);
+ ctx->ctx = NULL;
return dcrypt_openssl_error(error_r);
}
return TRUE;
{
int ec;
+ i_assert(ctx->ctx == NULL);
i_assert(ctx->mac != NULL);
const char *name = EVP_MD_get0_name(ctx->md);
OSSL_PARAM params[] = {
ec = EVP_MAC_init(ctx->ctx, ctx->key, ctx->klen, params);
if (ec != 1) {
EVP_MAC_CTX_free(ctx->ctx);
+ ctx->ctx = NULL;
return dcrypt_openssl_error(error_r);
}
return TRUE;