static int test_EVP_DigestSignInit(void)
{
    int ret = 0;
    EVP_PKEY *pkey = NULL;
    unsigned char *sig = NULL;
    size_t sig_len = 0;
    EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;
    if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())
            || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())
            || !TEST_ptr(pkey = load_example_rsa_key()))
        goto out;
    if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, EVP_sha256(), NULL, pkey))
            || !TEST_true(EVP_DigestSignUpdate(md_ctx, kMsg, sizeof(kMsg))))
        goto out;
    if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len))
            || !TEST_size_t_eq(sig_len, (size_t)EVP_PKEY_size(pkey)))
        goto out;
    if (!TEST_ptr(sig = OPENSSL_malloc(sig_len))
            || !TEST_true(EVP_DigestSignFinal(md_ctx, sig, &sig_len)))
        goto out;
    if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, EVP_sha256(),
                                        NULL, pkey))
            || !TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify,
                                                 kMsg, sizeof(kMsg)))
            || !TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))
        goto out;
    ret = 1;
 out:
    EVP_MD_CTX_free(md_ctx);
    EVP_MD_CTX_free(md_ctx_verify);
    EVP_PKEY_free(pkey);
    OPENSSL_free(sig);
    return ret;
}
['static int test_EVP_DigestSignInit(void)\n{\n    int ret = 0;\n    EVP_PKEY *pkey = NULL;\n    unsigned char *sig = NULL;\n    size_t sig_len = 0;\n    EVP_MD_CTX *md_ctx, *md_ctx_verify = NULL;\n    if (!TEST_ptr(md_ctx = EVP_MD_CTX_new())\n            || !TEST_ptr(md_ctx_verify = EVP_MD_CTX_new())\n            || !TEST_ptr(pkey = load_example_rsa_key()))\n        goto out;\n    if (!TEST_true(EVP_DigestSignInit(md_ctx, NULL, EVP_sha256(), NULL, pkey))\n            || !TEST_true(EVP_DigestSignUpdate(md_ctx, kMsg, sizeof(kMsg))))\n        goto out;\n    if (!TEST_true(EVP_DigestSignFinal(md_ctx, NULL, &sig_len))\n            || !TEST_size_t_eq(sig_len, (size_t)EVP_PKEY_size(pkey)))\n        goto out;\n    if (!TEST_ptr(sig = OPENSSL_malloc(sig_len))\n            || !TEST_true(EVP_DigestSignFinal(md_ctx, sig, &sig_len)))\n        goto out;\n    if (!TEST_true(EVP_DigestVerifyInit(md_ctx_verify, NULL, EVP_sha256(),\n                                        NULL, pkey))\n            || !TEST_true(EVP_DigestVerifyUpdate(md_ctx_verify,\n                                                 kMsg, sizeof(kMsg)))\n            || !TEST_true(EVP_DigestVerifyFinal(md_ctx_verify, sig, sig_len)))\n        goto out;\n    ret = 1;\n out:\n    EVP_MD_CTX_free(md_ctx);\n    EVP_MD_CTX_free(md_ctx_verify);\n    EVP_PKEY_free(pkey);\n    OPENSSL_free(sig);\n    return ret;\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 [%p] != NULL", s, p);\n    return 0;\n}', 'static void test_fail_message(const char *prefix, const char *file, int line,\n                              const char *type, const char *fmt, ...)\n{\n    va_list ap;\n    va_start(ap, fmt);\n    test_fail_message_va(prefix, file, line, type, fmt, ap);\n    va_end(ap);\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}']