void CRYPTO_free(void *str)
{
#ifndef OPENSSL_NO_CRYPTO_MDEBUG
    if (call_malloc_debug) {
        CRYPTO_mem_debug_free(str, 0);
        free(str);
        CRYPTO_mem_debug_free(str, 1);
    } else {
        free(str);
    }
#else
    free(str);
#endif
}
['int ECDH_KDF_X9_62(unsigned char *out, size_t outlen,\n                   const unsigned char *Z, size_t Zlen,\n                   const unsigned char *sinfo, size_t sinfolen,\n                   const EVP_MD *md)\n{\n    EVP_MD_CTX *mctx = NULL;\n    int rv = 0;\n    unsigned int i;\n    size_t mdlen;\n    unsigned char ctr[4];\n    if (sinfolen > ECDH_KDF_MAX || outlen > ECDH_KDF_MAX\n        || Zlen > ECDH_KDF_MAX)\n        return 0;\n    mctx = EVP_MD_CTX_new();\n    if (mctx == NULL)\n        return 0;\n    mdlen = EVP_MD_size(md);\n    for (i = 1;; i++) {\n        unsigned char mtmp[EVP_MAX_MD_SIZE];\n        EVP_DigestInit_ex(mctx, md, NULL);\n        ctr[3] = i & 0xFF;\n        ctr[2] = (i >> 8) & 0xFF;\n        ctr[1] = (i >> 16) & 0xFF;\n        ctr[0] = (i >> 24) & 0xFF;\n        if (!EVP_DigestUpdate(mctx, Z, Zlen))\n            goto err;\n        if (!EVP_DigestUpdate(mctx, ctr, sizeof(ctr)))\n            goto err;\n        if (!EVP_DigestUpdate(mctx, sinfo, sinfolen))\n            goto err;\n        if (outlen >= mdlen) {\n            if (!EVP_DigestFinal(mctx, out, NULL))\n                goto err;\n            outlen -= mdlen;\n            if (outlen == 0)\n                break;\n            out += mdlen;\n        } else {\n            if (!EVP_DigestFinal(mctx, mtmp, NULL))\n                goto err;\n            memcpy(out, mtmp, outlen);\n            OPENSSL_cleanse(mtmp, mdlen);\n            break;\n        }\n    }\n    rv = 1;\n err:\n    EVP_MD_CTX_free(mctx);\n    return rv;\n}', 'int EVP_DigestInit_ex(EVP_MD_CTX *ctx, const EVP_MD *type, ENGINE *impl)\n{\n    EVP_MD_CTX_clear_flags(ctx, EVP_MD_CTX_FLAG_CLEANED);\n#ifndef OPENSSL_NO_ENGINE\n    if (ctx->engine && ctx->digest && (!type ||\n                                       (type\n                                        && (type->type ==\n                                            ctx->digest->type))))\n        goto skip_to_init;\n    if (type) {\n        if (ctx->engine)\n            ENGINE_finish(ctx->engine);\n        if (impl) {\n            if (!ENGINE_init(impl)) {\n                EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_INITIALIZATION_ERROR);\n                return 0;\n            }\n        } else\n            impl = ENGINE_get_digest_engine(type->type);\n        if (impl) {\n            const EVP_MD *d = ENGINE_get_digest(impl, type->type);\n            if (!d) {\n                EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_INITIALIZATION_ERROR);\n                ENGINE_finish(impl);\n                return 0;\n            }\n            type = d;\n            ctx->engine = impl;\n        } else\n            ctx->engine = NULL;\n    } else {\n        if (!ctx->digest) {\n            EVPerr(EVP_F_EVP_DIGESTINIT_EX, EVP_R_NO_DIGEST_SET);\n            return 0;\n        }\n        type = ctx->digest;\n    }\n#endif\n    if (ctx->digest != type) {\n        if (ctx->digest && ctx->digest->ctx_size)\n            OPENSSL_free(ctx->md_data);\n        ctx->digest = type;\n        if (!(ctx->flags & EVP_MD_CTX_FLAG_NO_INIT) && type->ctx_size) {\n            ctx->update = type->update;\n            ctx->md_data = OPENSSL_malloc(type->ctx_size);\n            if (ctx->md_data == NULL) {\n                EVPerr(EVP_F_EVP_DIGESTINIT_EX, ERR_R_MALLOC_FAILURE);\n                return 0;\n            }\n        }\n    }\n#ifndef OPENSSL_NO_ENGINE\n skip_to_init:\n#endif\n    if (ctx->pctx) {\n        int r;\n        r = EVP_PKEY_CTX_ctrl(ctx->pctx, -1, EVP_PKEY_OP_TYPE_SIG,\n                              EVP_PKEY_CTRL_DIGESTINIT, 0, ctx);\n        if (r <= 0 && (r != -2))\n            return 0;\n    }\n    if (ctx->flags & EVP_MD_CTX_FLAG_NO_INIT)\n        return 1;\n    return ctx->digest->init(ctx);\n}', 'void CRYPTO_free(void *str)\n{\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']