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 CMS_SignerInfo_sign(CMS_SignerInfo *si)\n{\n    EVP_MD_CTX *mctx = si->mctx;\n    EVP_PKEY_CTX *pctx;\n    unsigned char *abuf = NULL;\n    int alen;\n    size_t siglen;\n    const EVP_MD *md = NULL;\n    md = EVP_get_digestbyobj(si->digestAlgorithm->algorithm);\n    if (md == NULL)\n        return 0;\n    if (CMS_signed_get_attr_by_NID(si, NID_pkcs9_signingTime, -1) < 0) {\n        if (!cms_add1_signingTime(si, NULL))\n            goto err;\n    }\n    if (si->pctx)\n        pctx = si->pctx;\n    else {\n        EVP_MD_CTX_reset(mctx);\n        if (EVP_DigestSignInit(mctx, &pctx, md, NULL, si->pkey) <= 0)\n            goto err;\n    }\n    if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,\n                          EVP_PKEY_CTRL_CMS_SIGN, 0, si) <= 0) {\n        CMSerr(CMS_F_CMS_SIGNERINFO_SIGN, CMS_R_CTRL_ERROR);\n        goto err;\n    }\n    alen = ASN1_item_i2d((ASN1_VALUE *)si->signedAttrs, &abuf,\n                         ASN1_ITEM_rptr(CMS_Attributes_Sign));\n    if (!abuf)\n        goto err;\n    if (EVP_DigestSignUpdate(mctx, abuf, alen) <= 0)\n        goto err;\n    if (EVP_DigestSignFinal(mctx, NULL, &siglen) <= 0)\n        goto err;\n    OPENSSL_free(abuf);\n    abuf = OPENSSL_malloc(siglen);\n    if (abuf == NULL)\n        goto err;\n    if (EVP_DigestSignFinal(mctx, abuf, &siglen) <= 0)\n        goto err;\n    if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_SIGN,\n                          EVP_PKEY_CTRL_CMS_SIGN, 1, si) <= 0) {\n        CMSerr(CMS_F_CMS_SIGNERINFO_SIGN, CMS_R_CTRL_ERROR);\n        goto err;\n    }\n    EVP_MD_CTX_reset(mctx);\n    ASN1_STRING_set0(si->signature, abuf, siglen);\n    return 1;\n err:\n    OPENSSL_free(abuf);\n    EVP_MD_CTX_reset(mctx);\n    return 0;\n}', 'int EVP_MD_CTX_reset(EVP_MD_CTX *ctx)\n{\n    if (ctx == NULL)\n        return 1;\n    if (ctx->digest && ctx->digest->cleanup\n        && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_CLEANED))\n        ctx->digest->cleanup(ctx);\n    if (ctx->digest && ctx->digest->ctx_size && ctx->md_data\n        && !EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_REUSE)) {\n        OPENSSL_clear_free(ctx->md_data, ctx->digest->ctx_size);\n    }\n    EVP_PKEY_CTX_free(ctx->pctx);\n#ifndef OPENSSL_NO_ENGINE\n    if (ctx->engine)\n        ENGINE_finish(ctx->engine);\n#endif\n    memset(ctx, 0, sizeof(*ctx));\n    return 1;\n}', 'void CRYPTO_clear_free(void *str, size_t num)\n{\n    if (str == NULL)\n        return;\n    if (num)\n        OPENSSL_cleanse(str, num);\n    CRYPTO_free(str);\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}']