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


crypto/cms/cms_dd.c:99:1: start of procedure cms_DigestedData_do_final()
97.   }
98.   
99. > int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
100.   {
101.       EVP_MD_CTX *mctx = EVP_MD_CTX_new();

crypto/cms/cms_dd.c:101:5: 
99.   int cms_DigestedData_do_final(CMS_ContentInfo *cms, BIO *chain, int verify)
100.   {
101. >     EVP_MD_CTX *mctx = EVP_MD_CTX_new();
102.       unsigned char md[EVP_MAX_MD_SIZE];
103.       unsigned int mdlen;

crypto/evp/digest.c:152:1: start of procedure EVP_MD_CTX_new()
  150.   }
  151.   
  152. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:154:5: 
  152.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155.   }
  156.   

crypto/mem.c:158:1: start of procedure CRYPTO_zalloc()
    156.   }
    157.   
    158. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    159.   {
    160.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:160:5: 
    158.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    159.   {
    160. >     void *ret = CRYPTO_malloc(num, file, line);
    161.   
    162.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:155:5: 
      153.   #endif
      154.   
      155. >     return ret;
      156.   }
      157.   

crypto/mem.c:156:1: return from a call to CRYPTO_malloc
      154.   
      155.       return ret;
      156. > }
      157.   
      158.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:162:9: Taking true branch
    160.       void *ret = CRYPTO_malloc(num, file, line);
    161.   
    162.       if (ret != NULL)
                   ^
    163.           memset(ret, 0, num);
    164.       return ret;

crypto/mem.c:163:9: 
    161.   
    162.       if (ret != NULL)
    163. >         memset(ret, 0, num);
    164.       return ret;
    165.   }

crypto/mem.c:164:5: 
    162.       if (ret != NULL)
    163.           memset(ret, 0, num);
    164. >     return ret;
    165.   }
    166.   

crypto/mem.c:165:1: return from a call to CRYPTO_zalloc
    163.           memset(ret, 0, num);
    164.       return ret;
    165. > }
    166.   
    167.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:155:1: return from a call to EVP_MD_CTX_new
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155. > }
  156.   
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/cms/cms_dd.c:104:5: 
102.       unsigned char md[EVP_MAX_MD_SIZE];
103.       unsigned int mdlen;
104. >     int r = 0;
105.       CMS_DigestedData *dd;
106.   

crypto/cms/cms_dd.c:107:9: Taking false branch
105.       CMS_DigestedData *dd;
106.   
107.       if (mctx == NULL) {
               ^
108.           CMSerr(CMS_F_CMS_DIGESTEDDATA_DO_FINAL, ERR_R_MALLOC_FAILURE);
109.           goto err;

crypto/cms/cms_dd.c:112:5: 
110.       }
111.   
112. >     dd = cms->d.digestedData;
113.   
114.       if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))

crypto/cms/cms_dd.c:114:10: 
112.       dd = cms->d.digestedData;
113.   
114. >     if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))
115.           goto err;
116.   

crypto/cms/cms_lib.c:355:1: start of procedure cms_DigestAlgorithm_find_ctx()
  353.   /* Locate a message digest content from a BIO chain based on SignerInfo */
  354.   
  355. > int cms_DigestAlgorithm_find_ctx(EVP_MD_CTX *mctx, BIO *chain,
  356.                                    X509_ALGOR *mdalg)
  357.   {

crypto/cms/cms_lib.c:360:5: 
  358.       int nid;
  359.       ASN1_OBJECT *mdoid;
  360. >     X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);
  361.       nid = OBJ_obj2nid(mdoid);
  362.       /* Look for digest type to match signature */

crypto/asn1/x_algor.c:102:1: start of procedure X509_ALGOR_get0()
    100.   }
    101.   
    102. > void X509_ALGOR_get0(ASN1_OBJECT **paobj, int *pptype, void **ppval,
    103.                        X509_ALGOR *algor)
    104.   {

crypto/asn1/x_algor.c:105:9: Taking true branch
    103.                        X509_ALGOR *algor)
    104.   {
    105.       if (paobj)
                   ^
    106.           *paobj = algor->algorithm;
    107.       if (pptype) {

crypto/asn1/x_algor.c:106:9: 
    104.   {
    105.       if (paobj)
    106. >         *paobj = algor->algorithm;
    107.       if (pptype) {
    108.           if (algor->parameter == NULL) {

crypto/asn1/x_algor.c:107:9: Taking false branch
    105.       if (paobj)
    106.           *paobj = algor->algorithm;
    107.       if (pptype) {
                   ^
    108.           if (algor->parameter == NULL) {
    109.               *pptype = V_ASN1_UNDEF;

crypto/asn1/x_algor.c:107:5: 
    105.       if (paobj)
    106.           *paobj = algor->algorithm;
    107. >     if (pptype) {
    108.           if (algor->parameter == NULL) {
    109.               *pptype = V_ASN1_UNDEF;

crypto/asn1/x_algor.c:116:1: return from a call to X509_ALGOR_get0
    114.               *ppval = algor->parameter->value.ptr;
    115.       }
    116. > }
    117.   
    118.   /* Set up an X509_ALGOR DigestAlgorithmIdentifier from an EVP_MD */

crypto/cms/cms_lib.c:361:5: 
  359.       ASN1_OBJECT *mdoid;
  360.       X509_ALGOR_get0(&mdoid, NULL, NULL, mdalg);
  361. >     nid = OBJ_obj2nid(mdoid);
  362.       /* Look for digest type to match signature */
  363.       for (;;) {

crypto/objects/obj_dat.c:381:1: start of procedure OBJ_obj2nid()
    379.   IMPLEMENT_OBJ_BSEARCH_CMP_FN(const ASN1_OBJECT *, unsigned int, obj);
    380.   
    381. > int OBJ_obj2nid(const ASN1_OBJECT *a)
    382.   {
    383.       const unsigned int *op;

crypto/objects/obj_dat.c:386:9: Taking false branch
    384.       ADDED_OBJ ad, *adp;
    385.   
    386.       if (a == NULL)
                   ^
    387.           return (NID_undef);
    388.       if (a->nid != 0)

crypto/objects/obj_dat.c:388:9: Taking false branch
    386.       if (a == NULL)
    387.           return (NID_undef);
    388.       if (a->nid != 0)
                   ^
    389.           return (a->nid);
    390.   

crypto/objects/obj_dat.c:391:9: Taking false branch
    389.           return (a->nid);
    390.   
    391.       if (a->length == 0)
                   ^
    392.           return NID_undef;
    393.   

crypto/objects/obj_dat.c:394:9: Taking true branch
    392.           return NID_undef;
    393.   
    394.       if (added != NULL) {
                   ^
    395.           ad.type = ADDED_DATA;
    396.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */

crypto/objects/obj_dat.c:395:9: 
    393.   
    394.       if (added != NULL) {
    395. >         ad.type = ADDED_DATA;
    396.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    397.           adp = lh_ADDED_OBJ_retrieve(added, &ad);

crypto/objects/obj_dat.c:396:9: 
    394.       if (added != NULL) {
    395.           ad.type = ADDED_DATA;
    396. >         ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    397.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    398.           if (adp != NULL)

crypto/objects/obj_dat.c:397:9: 
    395.           ad.type = ADDED_DATA;
    396.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    397. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
    398.           if (adp != NULL)
    399.               return (adp->obj->nid);

crypto/objects/obj_lcl.h:7:1: start of procedure lh_ADDED_OBJ_retrieve()
      5.   DEFINE_LHASH_OF(OBJ_NAME);
      6.   typedef struct added_obj_st ADDED_OBJ;
      7. > DEFINE_LHASH_OF(ADDED_OBJ);

crypto/lhash/lhash.c:216:1: start of procedure lh_retrieve()
        214.   }
        215.   
        216. > void *lh_retrieve(_LHASH *lh, const void *data)
        217.   {
        218.       unsigned long hash;

crypto/lhash/lhash.c:222:5: 
        220.       void *ret;
        221.   
        222. >     lh->error = 0;
        223.       rn = getrn(lh, data, &hash);
        224.   

crypto/lhash/lhash.c:223:5: Skipping getrn(): empty list of specs
        221.   
        222.       lh->error = 0;
        223.       rn = getrn(lh, data, &hash);
                   ^
        224.   
        225.       if (*rn == NULL) {

crypto/lhash/lhash.c:225:9: Taking false branch
        223.       rn = getrn(lh, data, &hash);
        224.   
        225.       if (*rn == NULL) {
                       ^
        226.           lh->num_retrieve_miss++;
        227.           return (NULL);

crypto/lhash/lhash.c:229:9: 
        227.           return (NULL);
        228.       } else {
        229. >         ret = (*rn)->data;
        230.           lh->num_retrieve++;
        231.       }

crypto/lhash/lhash.c:230:9: 
        228.       } else {
        229.           ret = (*rn)->data;
        230. >         lh->num_retrieve++;
        231.       }
        232.       return (ret);

crypto/lhash/lhash.c:232:5: 
        230.           lh->num_retrieve++;
        231.       }
        232. >     return (ret);
        233.   }
        234.   

crypto/lhash/lhash.c:233:1: return from a call to lh_retrieve
        231.       }
        232.       return (ret);
        233. > }
        234.   
        235.   static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

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

crypto/objects/obj_dat.c:398:13: Taking true branch
    396.           ad.obj = (ASN1_OBJECT *)a; /* XXX: ugly but harmless */
    397.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    398.           if (adp != NULL)
                       ^
    399.               return (adp->obj->nid);
    400.       }

crypto/objects/obj_dat.c:399:13: 
    397.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    398.           if (adp != NULL)
    399. >             return (adp->obj->nid);
    400.       }
    401.       op = OBJ_bsearch_obj(&a, obj_objs, NUM_OBJ);

crypto/objects/obj_dat.c:405:1: return from a call to OBJ_obj2nid
    403.           return (NID_undef);
    404.       return (nid_objs[*op].nid);
    405. > }
    406.   
    407.   /*

crypto/cms/cms_lib.c:380:5: Loop condition is true. Entering loop body
  378.               return EVP_MD_CTX_copy_ex(mctx, mtmp);
  379.           chain = BIO_next(chain);
  380.       }
             ^
  381.   }
  382.   

crypto/cms/cms_lib.c:365:9: Skipping BIO_find_type(): empty list of specs
  363.       for (;;) {
  364.           EVP_MD_CTX *mtmp;
  365.           chain = BIO_find_type(chain, BIO_TYPE_MD);
                 ^
  366.           if (chain == NULL) {
  367.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,

crypto/cms/cms_lib.c:366:13: Taking true branch
  364.           EVP_MD_CTX *mtmp;
  365.           chain = BIO_find_type(chain, BIO_TYPE_MD);
  366.           if (chain == NULL) {
                     ^
  367.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
  368.                      CMS_R_NO_MATCHING_DIGEST);

crypto/cms/cms_lib.c:367:13: Skipping ERR_put_error(): empty list of specs
  365.           chain = BIO_find_type(chain, BIO_TYPE_MD);
  366.           if (chain == NULL) {
  367.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
                     ^
  368.                      CMS_R_NO_MATCHING_DIGEST);
  369.               return 0;

crypto/cms/cms_lib.c:369:13: 
  367.               CMSerr(CMS_F_CMS_DIGESTALGORITHM_FIND_CTX,
  368.                      CMS_R_NO_MATCHING_DIGEST);
  369. >             return 0;
  370.           }
  371.           BIO_get_md_ctx(chain, &mtmp);

crypto/cms/cms_lib.c:381:1: return from a call to cms_DigestAlgorithm_find_ctx
  379.           chain = BIO_next(chain);
  380.       }
  381. > }
  382.   
  383.   static STACK_OF(CMS_CertificateChoices)

crypto/cms/cms_dd.c:114:10: Taking true branch
112.       dd = cms->d.digestedData;
113.   
114.       if (!cms_DigestAlgorithm_find_ctx(mctx, chain, dd->digestAlgorithm))
                ^
115.           goto err;
116.   

crypto/cms/cms_dd.c:138:2: 
136.       }
137.   
138. >  err:
139.       EVP_MD_CTX_free(mctx);
140.   

crypto/cms/cms_dd.c:139:5: 
137.   
138.    err:
139. >     EVP_MD_CTX_free(mctx);
140.   
141.       return r;

crypto/evp/digest.c:157:1: start of procedure EVP_MD_CTX_free()
  155.   }
  156.   
  157. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:159:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
             ^
  160.       OPENSSL_free(ctx);
  161.   }

crypto/evp/digest.c:160:5: 
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
  160. >     OPENSSL_free(ctx);
  161.   }
  162.   

crypto/mem.c:222:1: start of procedure CRYPTO_free()
    220.   }
    221.   
    222. > void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:224:9: Taking true branch
    222.   void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    225.           free_impl(str, file, line);
    226.           return;

crypto/mem.c:224:30: Taking true branch
    222.   void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    225.           free_impl(str, file, line);
    226.           return;

crypto/mem.c:225:9: Skipping __function_pointer__(): unresolved function pointer
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    225.           free_impl(str, file, line);
                   ^
    226.           return;
    227.       }

crypto/mem.c:226:9: 
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    225.           free_impl(str, file, line);
    226. >         return;
    227.       }
    228.   

crypto/mem.c:240:1: return from a call to CRYPTO_free
    238.       free(str);
    239.   #endif
    240. > }
    241.   
    242.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:161:1: return from a call to EVP_MD_CTX_free
  159.       EVP_MD_CTX_reset(ctx);
  160.       OPENSSL_free(ctx);
  161. > }
  162.   
  163.   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    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    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#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\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    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(ASN1_OBJECT **paobj, int *pptype, void **ppval,\n                     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 *lh_retrieve(_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    LHASH_NODE **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_retrieve_miss++;\n        return (NULL);\n    } else {\n        ret = (*rn)->data;\n        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    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}']