crypto/cms/cms_dd.c:95: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 57, column 24 is not reachable after line 95, column 5.
Showing all 75 steps of the trace


crypto/cms/cms_dd.c:55:1: start of procedure cms_DigestedData_do_final()
53.   }
54.   
55. > int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
56.   {
57.       EVP_MD_CTX *mctx = EVP_MD_CTX_new();

crypto/cms/cms_dd.c:57:5: 
55.   int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
56.   {
57. >     EVP_MD_CTX *mctx = EVP_MD_CTX_new();
58.       unsigned char md[EVP_MAX_MD_SIZE];
59.       unsigned int mdlen;

crypto/evp/digest.c:44:1: start of procedure EVP_MD_CTX_new()
  42.   }
  43.   
  44. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:46:5: 
  44.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  45.   {
  46. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47.   }
  48.   

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

crypto/mem.c:192:1: start of procedure CRYPTO_malloc()
      190.   #endif
      191.   
      192. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194.       void *ret = NULL;

crypto/mem.c:194:5: 
      192.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      193.   {
      194. >     void *ret = NULL;
      195.   
      196.       INCREMENT(malloc_count);

crypto/mem.c:197:9: Taking false branch
      195.   
      196.       INCREMENT(malloc_count);
      197.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      198.           return malloc_impl(num, file, line);
      199.   

crypto/mem.c:200:9: Taking false branch
      198.           return malloc_impl(num, file, line);
      199.   
      200.       if (num == 0)
                     ^
      201.           return NULL;
      202.   

crypto/mem.c:204:9: Taking true branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:210:9: 
      208.            * allocation.
      209.            */
      210. >         allow_customize = 0;
      211.       }
      212.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

crypto/mem.c:226:1: return from a call to CRYPTO_malloc
      224.   
      225.       return ret;
      226. > }
      227.   
      228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:47:1: return from a call to EVP_MD_CTX_new
  45.   {
  46.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  47. > }
  48.   
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/cms/cms_dd.c:60:5: 
58.       unsigned char md[EVP_MAX_MD_SIZE];
59.       unsigned int mdlen;
60. >     int r = 0;
61.       CMS_DigestedData *dd;
62.   

crypto/cms/cms_dd.c:63:9: Taking false branch
61.       CMS_DigestedData *dd;
62.   
63.       if (mctx == NULL) {
              ^
64.           CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL, ERR_R_MALLOC_FAILURE);
65.           goto err;

crypto/cms/cms_dd.c:68:5: 
66.       }
67.   
68. >     dd = cms->d.digestedData;
69.   
70.       if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))

crypto/cms/cms_dd.c:70:10: 
68.       dd = cms->d.digestedData;
69.   
70. >     if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))
71.           goto err;
72.   

crypto/cms/cms_lib.c:311:1: start of procedure cms_DigestAlgorithm_find_ctx()
  309.   /* Locate a message digest content from a BIO chain based on SignerInfo */
  310.   
  311. > int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
  312.                                    X509_ALGOR *mdalg)
  313.   {

crypto/cms/cms_lib.c:316:5: 
  314.       int nid;
  315.       const ASN1_OBJECT *mdoid;
  316. >     X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);
  317.       nid = OBJ_obj2nid(mdoid);
  318.       /* Look for digest type to match signature */

crypto/asn1/x_algor.c:54:1: start of procedure X509_ALGOR_get0()
    52.   }
    53.   
    54. > void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,
    55.                        const void **ppval, const X509_ALGOR *algor)
    56.   {

crypto/asn1/x_algor.c:57:9: Taking true branch
    55.                        const void **ppval, const X509_ALGOR *algor)
    56.   {
    57.       if (paobj)
                  ^
    58.           *paobj = algor->algorithm;
    59.       if (pptype) {

crypto/asn1/x_algor.c:58:9: 
    56.   {
    57.       if (paobj)
    58. >         *paobj = algor->algorithm;
    59.       if (pptype) {
    60.           if (algor->parameter == NULL) {

crypto/asn1/x_algor.c:59:9: Taking false branch
    57.       if (paobj)
    58.           *paobj = algor->algorithm;
    59.       if (pptype) {
                  ^
    60.           if (algor->parameter == NULL) {
    61.               *pptype = V_ASN1_UNDEF;

crypto/asn1/x_algor.c:59:5: 
    57.       if (paobj)
    58.           *paobj = algor->algorithm;
    59. >     if (pptype) {
    60.           if (algor->parameter == NULL) {
    61.               *pptype = V_ASN1_UNDEF;

crypto/asn1/x_algor.c:68:1: return from a call to X509_ALGOR_get0
    66.               *ppval = algor->parameter->value.ptr;
    67.       }
    68. > }
    69.   
    70.   /* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */

crypto/cms/cms_lib.c:317:5: 
  315.       const ASN1_OBJECT *mdoid;
  316.       X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);
  317. >     nid = OBJ_obj2nid(mdoid);
  318.       /* Look for digest type to match signature */
  319.       for (;;) {

crypto/objects/obj_dat.c:317:1: start of procedure OBJ_obj2nid()
    315.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
    316.   
    317. > int OBJ_obj2nid(const ASN1_OBJECT *a)
    318.   {
    319.       const unsigned int *op;

crypto/objects/obj_dat.c:322:9: Taking false branch
    320.       ADDED_OBJ ad, *adp;
    321.   
    322.       if (a == NULL)
                   ^
    323.           return NID_undef;
    324.       if (a->nid != 0)

crypto/objects/obj_dat.c:324:9: Taking false branch
    322.       if (a == NULL)
    323.           return NID_undef;
    324.       if (a->nid != 0)
                   ^
    325.           return a->nid;
    326.   

crypto/objects/obj_dat.c:327:9: Taking false branch
    325.           return a->nid;
    326.   
    327.       if (a->length == 0)
                   ^
    328.           return NID_undef;
    329.   

crypto/objects/obj_dat.c:330:9: Taking true branch
    328.           return NID_undef;
    329.   
    330.       if (added != NULL) {
                   ^
    331.           ad.type = ADDED_DATA;
    332.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */

crypto/objects/obj_dat.c:331:9: 
    329.   
    330.       if (added != NULL) {
    331. >         ad.type = ADDED_DATA;
    332.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    333.           adp = lh_ADDED_OBJ_retrieve(added, &ad);

crypto/objects/obj_dat.c:332:9: 
    330.       if (added != NULL) {
    331.           ad.type = ADDED_DATA;
    332. >         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    333.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    334.           if (adp != NULL)

crypto/objects/obj_dat.c:333:9: 
    331.           ad.type = ADDED_DATA;
    332.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    333. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
    334.           if (adp != NULL)
    335.               return adp->obj->nid;

crypto/objects/obj_lcl.h:14:1: start of procedure lh_ADDED_OBJ_retrieve()
      12.   DEFINE_LHASH_OF(OBJ_NAME);
      13.   typedef struct added_obj_st ADDED_OBJ;
      14. > DEFINE_LHASH_OF(ADDED_OBJ);

crypto/lhash/lhash.c:154:1: start of procedure OPENSSL_LH_retrieve()
        152.   }
        153.   
        154. > void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)
        155.   {
        156.       unsigned long hash;

crypto/lhash/lhash.c:160:5: 
        158.       void *ret;
        159.   
        160. >     tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
        161.   
        162.       rn = getrn(lh, data, &hash);

crypto/lhash/lhash.c:162:5: Skipping getrn(): empty list of specs
        160.       tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);
        161.   
        162.       rn = getrn(lh, data, &hash);
                   ^
        163.   
        164.       if (*rn == NULL) {

crypto/lhash/lhash.c:164:9: Taking false branch
        162.       rn = getrn(lh, data, &hash);
        163.   
        164.       if (*rn == NULL) {
                       ^
        165.           tsan_counter(&lh->num_retrieve_miss);
        166.           return NULL;

crypto/lhash/lhash.c:168:9: 
        166.           return NULL;
        167.       } else {
        168. >         ret = (*rn)->data;
        169.           tsan_counter(&lh->num_retrieve);
        170.       }

crypto/lhash/lhash.c:169:9: 
        167.       } else {
        168.           ret = (*rn)->data;
        169. >         tsan_counter(&lh->num_retrieve);
        170.       }
        171.   

crypto/lhash/lhash.c:172:5: 
        170.       }
        171.   
        172. >     return ret;
        173.   }
        174.   

crypto/lhash/lhash.c:173:1: return from a call to OPENSSL_LH_retrieve
        171.   
        172.       return ret;
        173. > }
        174.   
        175.   static void doall_util_fn(OPENSSL_LHASH *lh, int use_arg,

crypto/objects/obj_lcl.h:14:1: return from a call to lh_ADDED_OBJ_retrieve
      12.   DEFINE_LHASH_OF(OBJ_NAME);
      13.   typedef struct added_obj_st ADDED_OBJ;
      14. > DEFINE_LHASH_OF(ADDED_OBJ);

crypto/objects/obj_dat.c:334:13: Taking true branch
    332.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    333.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    334.           if (adp != NULL)
                       ^
    335.               return adp->obj->nid;
    336.       }

crypto/objects/obj_dat.c:335:13: 
    333.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    334.           if (adp != NULL)
    335. >             return adp->obj->nid;
    336.       }
    337.       op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:341:1: return from a call to OBJ_obj2nid
    339.           return NID_undef;
    340.       return nid_objs[*op].nid;
    341. > }
    342.   
    343.   /*

crypto/cms/cms_lib.c:336:5: Loop condition is true. Entering loop body
  334.               return EVP_MD_CTX_copy_ex(mctx, mtmp);
  335.           chain = BIO_next(chain);
  336.       }
             ^
  337.   }
  338.   

crypto/cms/cms_lib.c:321:9: Skipping BIO_find_type(): empty list of specs
  319.       for (;;) {
  320.           EVP_MD_CTX *mtmp;
  321.           chain = BIO_find_type(chain, BIO_TYPE_MD);
                 ^
  322.           if (chain == NULL) {
  323.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,

crypto/cms/cms_lib.c:322:13: Taking true branch
  320.           EVP_MD_CTX *mtmp;
  321.           chain = BIO_find_type(chain, BIO_TYPE_MD);
  322.           if (chain == NULL) {
                     ^
  323.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
  324.                      CMS_R_NO_MATCHING_DIGEST);

crypto/cms/cms_lib.c:323:13: Skipping ERR_put_error(): empty list of specs
  321.           chain = BIO_find_type(chain, BIO_TYPE_MD);
  322.           if (chain == NULL) {
  323.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
                     ^
  324.                      CMS_R_NO_MATCHING_DIGEST);
  325.               return 0;

crypto/cms/cms_lib.c:325:13: 
  323.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
  324.                      CMS_R_NO_MATCHING_DIGEST);
  325. >             return 0;
  326.           }
  327.           BIO_get_md_ctx(chain, &mtmp);

crypto/cms/cms_lib.c:337:1: return from a call to cms_DigestAlgorithm_find_ctx
  335.           chain = BIO_next(chain);
  336.       }
  337. > }
  338.   
  339.   static STACK_OF(CMS_CertificateChoices)

crypto/cms/cms_dd.c:70:10: Taking true branch
68.       dd = cms->d.digestedData;
69.   
70.       if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))
               ^
71.           goto err;
72.   

crypto/cms/cms_dd.c:94:2: 
92.       }
93.   
94. >  err:
95.       EVP_MD_CTX_free(mctx);
96.   

crypto/cms/cms_dd.c:95:5: 
93.   
94.    err:
95. >     EVP_MD_CTX_free(mctx);
96.   
97.       return r;

crypto/evp/digest.c:49:1: start of procedure EVP_MD_CTX_free()
  47.   }
  48.   
  49. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:51:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  49.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
            ^
  52.       OPENSSL_free(ctx);
  53.   }

crypto/evp/digest.c:52:5: 
  50.   {
  51.       EVP_MD_CTX_reset(ctx);
  52. >     OPENSSL_free(ctx);
  53.   }
  54.   

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:53:1: return from a call to EVP_MD_CTX_free
  51.       EVP_MD_CTX_reset(ctx);
  52.       OPENSSL_free(ctx);
  53. > }
  54.   
  55.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)

int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
{
    EVP_MD_CTX *mctx = EVP_MD_CTX_new();
    unsigned char md[EVP_MAX_MD_SIZE];
    unsigned int mdlen;
    int r = 0;
    CMS_DigestedData *dd;
    if (mctx == NULL) {
        CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    dd = cms->d.digestedData;
    if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))
        goto err;
    if (EVP_DigestFinal_ex(mctx, md, &mdlen) <= 0)
        goto err;
    if (verify) {
        if (mdlen != (unsigned int)dd->digest->length) {
            CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL,
                   CMS_R_MESSAGEDIGEST_WRONG_LENGTH);
            goto err;
        }
        if (memcmp(md, dd->digest->data, mdlen))
            CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL,
                   CMS_R_VERIFICATION_FAILURE);
        else
            r = 1;
    } else {
        if (!ASN1_STRING_set(dd->digest, md, mdlen))
            goto err;
        r = 1;
    }
 err:
    EVP_MD_CTX_free(mctx);
    return r;
}
['int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)\n{\n    EVP_MD_CTX *mctx = EVP_MD_CTX_new();\n    unsigned char md[EVP_MAX_MD_SIZE];\n    unsigned int mdlen;\n    int r = 0;\n    CMS_DigestedData *dd;\n    if (mctx == NULL) {\n        CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    dd = cms->d.digestedData;\n    if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))\n        goto err;\n    if (EVP_DigestFinal_ex(mctx, md, &mdlen) <= 0)\n        goto err;\n    if (verify) {\n        if (mdlen != (unsigned int)dd->digest->length) {\n            CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL,\n                   CMS_R_MESSAGEDIGEST_WRONG_LENGTH);\n            goto err;\n        }\n        if (memcmp(md, dd->digest->data, mdlen))\n            CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL,\n                   CMS_R_VERIFICATION_FAILURE);\n        else\n            r = 1;\n    } else {\n        if (!ASN1_STRING_set(dd->digest, md, mdlen))\n            goto err;\n        r = 1;\n    }\n err:\n    EVP_MD_CTX_free(mctx);\n    return r;\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    INCREMENT(malloc_count);\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    if (allow_customize) {\n        allow_customize = 0;\n    }\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    (void)(file); (void)(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,\n                                 X509_ALGOR *mdalg)\n{\n    int nid;\n    const ASN1_OBJECT *mdoid;\n    X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);\n    nid = OBJ_obj2nid(mdoid);\n    for (;;) {\n        EVP_MD_CTX *mtmp;\n        chain = BIO_find_type(chain, BIO_TYPE_MD);\n        if (chain == NULL) {\n            CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,\n                   CMS_R_NO_MATCHING_DIGEST);\n            return 0;\n        }\n        BIO_get_md_ctx(chain, &mtmp);\n        if (EVP_MD_CTX_type(mtmp) == nid\n            || EVP_MD_pkey_type(EVP_MD_CTX_md(mtmp)) == nid)\n            return EVP_MD_CTX_copy_ex(mctx, mtmp);\n        chain = BIO_next(chain);\n    }\n}', 'void X509_ALGOR_get0(const ASN1_OBJECT **paobj, int *pptype,\n                     const void **ppval, const X509_ALGOR *algor)\n{\n    if (paobj)\n        *paobj = algor->algorithm;\n    if (pptype) {\n        if (algor->parameter == NULL) {\n            *pptype = V_ASN1_UNDEF;\n            return;\n        } else\n            *pptype = algor->parameter->type;\n        if (ppval)\n            *ppval = algor->parameter->value.ptr;\n    }\n}', 'int OBJ_obj2nid(const ASN1_OBJECT *a)\n{\n    const unsigned int *op;\n    ADDED_OBJ ad, *adp;\n    if (a == NULL)\n        return NID_undef;\n    if (a->nid != 0)\n        return a->nid;\n    if (a->length == 0)\n        return NID_undef;\n    if (added != NULL) {\n        ad.type = ADDED_DATA;\n        ad.obj = (ASN1_OBJECT *)a;\n        adp = lh_ADDED_OBJ_retrieve(added, &ad);\n        if (adp != NULL)\n            return adp->obj->nid;\n    }\n    op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);\n    if (op == NULL)\n        return NID_undef;\n    return nid_objs[*op].nid;\n}', 'DEFINE_LHASH_OF(ADDED_OBJ)', 'void *OPENSSL_LH_retrieve(OPENSSL_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    OPENSSL_LH_NODE **rn;\n    void *ret;\n    tsan_store((TSAN_QUALIFIER int *)&lh->error, 0);\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        tsan_counter(&lh->num_retrieve_miss);\n        return NULL;\n    } else {\n        ret = (*rn)->data;\n        tsan_counter(&lh->num_retrieve);\n    }\n    return ret;\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    INCREMENT(free_count);\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}']