static int digest_test_run(EVP_TEST *t)
{
    DIGEST_DATA *mdata = t->data;
    size_t i;
    EVP_MD_CTX *mctx;
    unsigned char md[EVP_MAX_MD_SIZE];
    unsigned int md_len;
    t->err = "TEST_FAILURE";
    if (!TEST_ptr(mctx = EVP_MD_CTX_new()))
        goto err;
    if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL)) {
        t->err = "DIGESTINIT_ERROR";
        goto err;
    }
    for (i = 0; i < mdata->nrpt; i++)
        if (!EVP_DigestUpdate(mctx, mdata->input, mdata->input_len)) {
            t->err = "DIGESTUPDATE_ERROR";
            goto err;
        }
    if (!EVP_DigestFinal(mctx, md, &md_len)) {
        t->err = "DIGESTFINAL_ERROR";
        goto err;
    }
    if (md_len != mdata->output_len) {
        t->err = "DIGEST_LENGTH_MISMATCH";
        goto err;
    }
    if (!compare_mem(mdata->output, mdata->output_len, md, md_len)) {
        t->err = "DIGEST_MISMATCH";
        goto err;
    }
    t->err = NULL;
 err:
    EVP_MD_CTX_free(mctx);
    return 1;
}
['static int digest_test_run(EVP_TEST *t)\n{\n    DIGEST_DATA *mdata = t->data;\n    size_t i;\n    EVP_MD_CTX *mctx;\n    unsigned char md[EVP_MAX_MD_SIZE];\n    unsigned int md_len;\n    t->err = "TEST_FAILURE";\n    if (!TEST_ptr(mctx = EVP_MD_CTX_new()))\n        goto err;\n    if (!EVP_DigestInit_ex(mctx, mdata->digest, NULL)) {\n        t->err = "DIGESTINIT_ERROR";\n        goto err;\n    }\n    for (i = 0; i < mdata->nrpt; i++)\n        if (!EVP_DigestUpdate(mctx, mdata->input, mdata->input_len)) {\n            t->err = "DIGESTUPDATE_ERROR";\n            goto err;\n        }\n    if (!EVP_DigestFinal(mctx, md, &md_len)) {\n        t->err = "DIGESTFINAL_ERROR";\n        goto err;\n    }\n    if (md_len != mdata->output_len) {\n        t->err = "DIGEST_LENGTH_MISMATCH";\n        goto err;\n    }\n    if (!compare_mem(mdata->output, mdata->output_len, md, md_len)) {\n        t->err = "DIGEST_MISMATCH";\n        goto err;\n    }\n    t->err = NULL;\n err:\n    EVP_MD_CTX_free(mctx);\n    return 1;\n}', 'EVP_MD_CTX *EVP_MD_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_MD_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    FAILTEST();\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num == 0)\n        return NULL;\n    FAILTEST();\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int test_ptr(const char *file, int line, const char *s, const void *p)\n{\n    if (p != NULL)\n        return 1;\n    test_fail_message(NULL, file, line, "ptr", s, "NULL", "!=", "%p", p);\n    return 0;\n}', 'void EVP_MD_CTX_free(EVP_MD_CTX *ctx)\n{\n    EVP_MD_CTX_reset(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']