engines/ccgost/gost_ameth.c:623: error: NULL_DEREFERENCE
  pointer `databuf` last assigned on line 622 could be null and is dereferenced by call to `BN_bn2bin()` at line 623, column 2.
Showing all 124 steps of the trace


engines/ccgost/gost_ameth.c:604:1: start of procedure pub_encode_gost94()
602.   	}
603.   
604. > static int pub_encode_gost94(X509_PUBKEY *pub,const EVP_PKEY *pk)
605.   	{
606.   	ASN1_OBJECT *algobj = NULL;

engines/ccgost/gost_ameth.c:606:2: 
604.   static int pub_encode_gost94(X509_PUBKEY *pub,const EVP_PKEY *pk)
605.   	{
606. > 	ASN1_OBJECT *algobj = NULL;
607.   	ASN1_OCTET_STRING *octet = NULL;
608.   	void *pval = NULL;

engines/ccgost/gost_ameth.c:607:2: 
605.   	{
606.   	ASN1_OBJECT *algobj = NULL;
607. > 	ASN1_OCTET_STRING *octet = NULL;
608.   	void *pval = NULL;
609.   	unsigned char *buf=NULL,*databuf,*sptr;

engines/ccgost/gost_ameth.c:608:2: 
606.   	ASN1_OBJECT *algobj = NULL;
607.   	ASN1_OCTET_STRING *octet = NULL;
608. > 	void *pval = NULL;
609.   	unsigned char *buf=NULL,*databuf,*sptr;
610.   	int i,j,data_len,ret=0;

engines/ccgost/gost_ameth.c:609:2: 
607.   	ASN1_OCTET_STRING *octet = NULL;
608.   	void *pval = NULL;
609. > 	unsigned char *buf=NULL,*databuf,*sptr;
610.   	int i,j,data_len,ret=0;
611.   

engines/ccgost/gost_ameth.c:610:2: 
608.   	void *pval = NULL;
609.   	unsigned char *buf=NULL,*databuf,*sptr;
610. > 	int i,j,data_len,ret=0;
611.   
612.   	int ptype = V_ASN1_UNDEF;

engines/ccgost/gost_ameth.c:612:2: 
610.   	int i,j,data_len,ret=0;
611.   
612. > 	int ptype = V_ASN1_UNDEF;
613.   	DSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);
614.   	algobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));

engines/ccgost/gost_ameth.c:613:2: 
611.   
612.   	int ptype = V_ASN1_UNDEF;
613. > 	DSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);
614.   	algobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));
615.   	if (pk->save_parameters) 

crypto/evp/p_lib.c:271:1: start of procedure EVP_PKEY_get0()
  269.   	}
  270.   
  271. > void *EVP_PKEY_get0(EVP_PKEY *pkey)
  272.   	{
  273.   	return pkey->pkey.ptr;

crypto/evp/p_lib.c:273:2: 
  271.   void *EVP_PKEY_get0(EVP_PKEY *pkey)
  272.   	{
  273. > 	return pkey->pkey.ptr;
  274.   	}
  275.   

crypto/evp/p_lib.c:274:2: return from a call to EVP_PKEY_get0
  272.   	{
  273.   	return pkey->pkey.ptr;
  274.   	}
          ^
  275.   
  276.   #ifndef OPENSSL_NO_RSA

engines/ccgost/gost_ameth.c:614:2: 
612.   	int ptype = V_ASN1_UNDEF;
613.   	DSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);
614. > 	algobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));
615.   	if (pk->save_parameters) 
616.   		{

crypto/evp/p_lib.c:382:1: start of procedure EVP_PKEY_base_id()
  380.   	}
  381.   
  382. > int EVP_PKEY_base_id(const EVP_PKEY *pkey)
  383.   	{
  384.   	return EVP_PKEY_type(pkey->type);

crypto/evp/p_lib.c:384:2: 
  382.   int EVP_PKEY_base_id(const EVP_PKEY *pkey)
  383.   	{
  384. > 	return EVP_PKEY_type(pkey->type);
  385.   	}
  386.   

crypto/evp/p_lib.c:360:1: start of procedure EVP_PKEY_type()
    358.   #endif
    359.   
    360. > int EVP_PKEY_type(int type)
    361.   	{
    362.   	int ret;

crypto/evp/p_lib.c:365:2: 
    363.   	const EVP_PKEY_ASN1_METHOD *ameth;
    364.   	ENGINE *e;
    365. > 	ameth = EVP_PKEY_asn1_find(&e, type);
    366.   	if (ameth)
    367.   		ret = ameth->pkey_id;

crypto/asn1/ameth_lib.c:174:1: start of procedure EVP_PKEY_asn1_find()
      172.    */
      173.   
      174. > const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)
      175.   	{
      176.   	const EVP_PKEY_ASN1_METHOD *t;

crypto/asn1/ameth_lib.c:185:3: Loop condition is true. Entering loop body
      183.   			break;
      184.   		type = t->pkey_base_id;
      185.   		}
               ^
      186.   	if (pe)
      187.   		{

crypto/asn1/ameth_lib.c:181:3: 
      179.   	for (;;)
      180.   		{
      181. > 		t = pkey_asn1_find(type);
      182.   		if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
      183.   			break;

crypto/asn1/ameth_lib.c:148:1: start of procedure pkey_asn1_find()
        146.   	}
        147.   
        148. > static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)
        149.   	{
        150.   	EVP_PKEY_ASN1_METHOD tmp;

crypto/asn1/ameth_lib.c:151:2: 
        149.   	{
        150.   	EVP_PKEY_ASN1_METHOD tmp;
        151. > 	const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
        152.   	tmp.pkey_id = type;
        153.   	if (app_methods)

crypto/asn1/ameth_lib.c:152:2: 
        150.   	EVP_PKEY_ASN1_METHOD tmp;
        151.   	const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
        152. > 	tmp.pkey_id = type;
        153.   	if (app_methods)
        154.   		{

crypto/asn1/ameth_lib.c:153:6: Taking true branch
        151.   	const EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;
        152.   	tmp.pkey_id = type;
        153.   	if (app_methods)
                    ^
        154.   		{
        155.   		int idx;

crypto/asn1/ameth_lib.c:156:9: Condition is true
        154.   		{
        155.   		int idx;
        156.   		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
                       ^
        157.   		if (idx >= 0)
        158.   			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);

crypto/asn1/ameth_lib.c:156:9: Condition is true
        154.   		{
        155.   		int idx;
        156.   		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
                       ^
        157.   		if (idx >= 0)
        158.   			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);

crypto/asn1/ameth_lib.c:156:3: 
        154.   		{
        155.   		int idx;
        156. > 		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
        157.   		if (idx >= 0)
        158.   			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);

crypto/stack/stack.c:235:1: start of procedure sk_find()
          233.   	}
          234.   
          235. > int sk_find(_STACK *st, void *data)
          236.   	{
          237.   	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);

crypto/stack/stack.c:237:2: 
          235.   int sk_find(_STACK *st, void *data)
          236.   	{
          237. > 	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
          238.   	}
          239.   int sk_find_ex(_STACK *st, void *data)

crypto/stack/stack.c:213:1: start of procedure internal_find()
            211.   	}
            212.   
            213. > static int internal_find(_STACK *st, void *data, int ret_val_options)
            214.   	{
            215.   	const void * const *r;

crypto/stack/stack.c:218:5: Taking false branch
            216.   	int i;
            217.   
            218.   	if(st == NULL) return -1;
                       ^
            219.   
            220.   	if (st->comp == NULL)

crypto/stack/stack.c:220:6: Taking true branch
            218.   	if(st == NULL) return -1;
            219.   
            220.   	if (st->comp == NULL)
                        ^
            221.   		{
            222.   		for (i=0; i<st->num; i++)

crypto/stack/stack.c:222:8: 
            220.   	if (st->comp == NULL)
            221.   		{
            222. > 		for (i=0; i<st->num; i++)
            223.   			if (st->data[i] == data)
            224.   				return(i);

crypto/stack/stack.c:222:13: Loop condition is true. Entering loop body
            220.   	if (st->comp == NULL)
            221.   		{
            222.   		for (i=0; i<st->num; i++)
                               ^
            223.   			if (st->data[i] == data)
            224.   				return(i);

crypto/stack/stack.c:223:8: Taking true branch
            221.   		{
            222.   		for (i=0; i<st->num; i++)
            223.   			if (st->data[i] == data)
                          ^
            224.   				return(i);
            225.   		return(-1);

crypto/stack/stack.c:224:5: 
            222.   		for (i=0; i<st->num; i++)
            223.   			if (st->data[i] == data)
            224. > 				return(i);
            225.   		return(-1);
            226.   		}

crypto/stack/stack.c:233:2: return from a call to internal_find
            231.   	if (r == NULL) return(-1);
            232.   	return (int)((char **)r-st->data);
            233.   	}
                    ^
            234.   
            235.   int sk_find(_STACK *st, void *data)

crypto/stack/stack.c:238:2: return from a call to sk_find
          236.   	{
          237.   	return internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);
          238.   	}
                  ^
          239.   int sk_find_ex(_STACK *st, void *data)
          240.   	{

crypto/asn1/ameth_lib.c:157:7: Taking true branch
        155.   		int idx;
        156.   		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
        157.   		if (idx >= 0)
                     ^
        158.   			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
        159.   		}

crypto/asn1/ameth_lib.c:158:11: Condition is true
        156.   		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
        157.   		if (idx >= 0)
        158.   			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
                         ^
        159.   		}
        160.   	ret = OBJ_bsearch_ameth(&t, standard_methods,

crypto/asn1/ameth_lib.c:158:4: 
        156.   		idx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);
        157.   		if (idx >= 0)
        158. > 			return sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);
        159.   		}
        160.   	ret = OBJ_bsearch_ameth(&t, standard_methods,

crypto/stack/stack.c:300:1: start of procedure sk_value()
          298.   }
          299.   
          300. > void *sk_value(const _STACK *st, int i)
          301.   {
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;

crypto/stack/stack.c:302:6: Taking false branch
          300.   void *sk_value(const _STACK *st, int i)
          301.   {
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                      ^
          303.   	return st->data[i];
          304.   }

crypto/stack/stack.c:302:13: Taking false branch
          300.   void *sk_value(const _STACK *st, int i)
          301.   {
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                             ^
          303.   	return st->data[i];
          304.   }

crypto/stack/stack.c:302:24: Taking false branch
          300.   void *sk_value(const _STACK *st, int i)
          301.   {
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
                                        ^
          303.   	return st->data[i];
          304.   }

crypto/stack/stack.c:303:2: 
          301.   {
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
          303. > 	return st->data[i];
          304.   }
          305.   

crypto/stack/stack.c:304:1: return from a call to sk_value
          302.   	if(!st || (i < 0) || (i >= st->num)) return NULL;
          303.   	return st->data[i];
          304. > }
          305.   
          306.   void *sk_set(_STACK *st, int i, void *value)

crypto/asn1/ameth_lib.c:166:2: return from a call to pkey_asn1_find
        164.   		return NULL;
        165.   	return *ret;
        166.   	}
                ^
        167.   
        168.   /* Find an implementation of an ASN1 algorithm. If 'pe' is not NULL

crypto/asn1/ameth_lib.c:182:8: Taking false branch
      180.   		{
      181.   		t = pkey_asn1_find(type);
      182.   		if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
                    ^
      183.   			break;
      184.   		type = t->pkey_base_id;

crypto/asn1/ameth_lib.c:182:15: Taking true branch
      180.   		{
      181.   		t = pkey_asn1_find(type);
      182.   		if (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))
                           ^
      183.   			break;
      184.   		type = t->pkey_base_id;

crypto/asn1/ameth_lib.c:186:6: Taking true branch
      184.   		type = t->pkey_base_id;
      185.   		}
      186.   	if (pe)
                  ^
      187.   		{
      188.   #ifndef OPENSSL_NO_ENGINE

crypto/asn1/ameth_lib.c:190:3: 
      188.   #ifndef OPENSSL_NO_ENGINE
      189.   		/* type will contain the final unaliased type */
      190. > 		e = ENGINE_get_pkey_asn1_meth_engine(type);
      191.   		if (e)
      192.   			{

crypto/engine/tb_asnmth.c:116:1: start of procedure ENGINE_get_pkey_asn1_meth_engine()
        114.    * table (ie. try to get a functional reference from the tabled structural
        115.    * references) for a given pkey_asn1_meth 'nid' */
        116. > ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)
        117.   	{
        118.   	return engine_table_select(&pkey_asn1_meth_table, nid);

crypto/engine/tb_asnmth.c:118:2: 
        116.   ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)
        117.   	{
        118. > 	return engine_table_select(&pkey_asn1_meth_table, nid);
        119.   	}
        120.   

crypto/engine/eng_table.c:240:1: start of procedure engine_table_select()
          238.   /* return a functional reference for a given 'nid' */
          239.   #ifndef ENGINE_TABLE_DEBUG
          240. > ENGINE *engine_table_select(ENGINE_TABLE **table, int nid)
          241.   #else
          242.   ENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, int l)

crypto/engine/eng_table.c:245:2: 
          243.   #endif
          244.   	{
          245. > 	ENGINE *ret = NULL;
          246.   	ENGINE_PILE tmplate, *fnd=NULL;
          247.   	int initres, loop = 0;

crypto/engine/eng_table.c:246:2: 
          244.   	{
          245.   	ENGINE *ret = NULL;
          246. > 	ENGINE_PILE tmplate, *fnd=NULL;
          247.   	int initres, loop = 0;
          248.   

crypto/engine/eng_table.c:247:2: 
          245.   	ENGINE *ret = NULL;
          246.   	ENGINE_PILE tmplate, *fnd=NULL;
          247. > 	int initres, loop = 0;
          248.   
          249.   	if(!(*table))

crypto/engine/eng_table.c:249:7: 
          247.   	int initres, loop = 0;
          248.   
          249. > 	if(!(*table))
          250.   		{
          251.   #ifdef ENGINE_TABLE_DEBUG

crypto/engine/eng_table.c:249:6: Taking true branch
          247.   	int initres, loop = 0;
          248.   
          249.   	if(!(*table))
                      ^
          250.   		{
          251.   #ifdef ENGINE_TABLE_DEBUG

crypto/engine/eng_table.c:255:3: 
          253.   			"registered!\n", f, l, nid);
          254.   #endif
          255. > 		return NULL;
          256.   		}
          257.   	ERR_set_mark();

crypto/engine/eng_table.c:333:2: return from a call to engine_table_select
          331.   	ERR_pop_to_mark();
          332.   	return ret;
          333.   	}
                  ^
          334.   
          335.   /* Table enumeration */

crypto/engine/tb_asnmth.c:119:2: return from a call to ENGINE_get_pkey_asn1_meth_engine
        117.   	{
        118.   	return engine_table_select(&pkey_asn1_meth_table, nid);
        119.   	}
                ^
        120.   
        121.   /* Obtains a pkey_asn1_meth implementation from an ENGINE functional reference */

crypto/asn1/ameth_lib.c:191:7: Taking false branch
      189.   		/* type will contain the final unaliased type */
      190.   		e = ENGINE_get_pkey_asn1_meth_engine(type);
      191.   		if (e)
                   ^
      192.   			{
      193.   			*pe = e;

crypto/asn1/ameth_lib.c:197:3: 
      195.   			}
      196.   #endif
      197. > 		*pe = NULL;
      198.   		}
      199.   	return t;

crypto/asn1/ameth_lib.c:199:2: 
      197.   		*pe = NULL;
      198.   		}
      199. > 	return t;
      200.   	}
      201.   

crypto/asn1/ameth_lib.c:200:2: return from a call to EVP_PKEY_asn1_find
      198.   		}
      199.   	return t;
      200.   	}
              ^
      201.   
      202.   const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find_str(ENGINE **pe,

crypto/evp/p_lib.c:366:6: Taking true branch
    364.   	ENGINE *e;
    365.   	ameth = EVP_PKEY_asn1_find(&e, type);
    366.   	if (ameth)
                ^
    367.   		ret = ameth->pkey_id;
    368.   	else

crypto/evp/p_lib.c:367:3: 
    365.   	ameth = EVP_PKEY_asn1_find(&e, type);
    366.   	if (ameth)
    367. > 		ret = ameth->pkey_id;
    368.   	else
    369.   		ret = NID_undef;

crypto/evp/p_lib.c:371:6: Taking false branch
    369.   		ret = NID_undef;
    370.   #ifndef OPENSSL_NO_ENGINE
    371.   	if (e)
                ^
    372.   		ENGINE_finish(e);
    373.   #endif

crypto/evp/p_lib.c:374:2: 
    372.   		ENGINE_finish(e);
    373.   #endif
    374. > 	return ret;
    375.   	}
    376.   

crypto/evp/p_lib.c:375:2: return from a call to EVP_PKEY_type
    373.   #endif
    374.   	return ret;
    375.   	}
            ^
    376.   
    377.   int EVP_PKEY_id(const EVP_PKEY *pkey)

crypto/evp/p_lib.c:385:2: return from a call to EVP_PKEY_base_id
  383.   	{
  384.   	return EVP_PKEY_type(pkey->type);
  385.   	}
          ^
  386.   
  387.   void EVP_PKEY_free(EVP_PKEY *x)

crypto/objects/obj_dat.c:289:1: start of procedure OBJ_nid2obj()
  287.   	}
  288.   
  289. > ASN1_OBJECT *OBJ_nid2obj(int n)
  290.   	{
  291.   	ADDED_OBJ ad,*adp;

crypto/objects/obj_dat.c:294:7: Taking false branch
  292.   	ASN1_OBJECT ob;
  293.   
  294.   	if ((n >= 0) && (n < NUM_NID))
               ^
  295.   		{
  296.   		if ((n != NID_undef) && (nid_objs[n].nid == NID_undef))

crypto/objects/obj_dat.c:303:11: Taking false branch
  301.   		return((ASN1_OBJECT *)&(nid_objs[n]));
  302.   		}
  303.   	else if (added == NULL)
                   ^
  304.   		return(NULL);
  305.   	else

crypto/objects/obj_dat.c:307:3: 
  305.   	else
  306.   		{
  307. > 		ad.type=ADDED_NID;
  308.   		ad.obj= &ob;
  309.   		ob.nid=n;

crypto/objects/obj_dat.c:308:3: 
  306.   		{
  307.   		ad.type=ADDED_NID;
  308. > 		ad.obj= &ob;
  309.   		ob.nid=n;
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);

crypto/objects/obj_dat.c:309:3: 
  307.   		ad.type=ADDED_NID;
  308.   		ad.obj= &ob;
  309. > 		ob.nid=n;
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  311.   		if (adp != NULL)

crypto/objects/obj_dat.c:310:7: Condition is true
  308.   		ad.obj= &ob;
  309.   		ob.nid=n;
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
               ^
  311.   		if (adp != NULL)
  312.   			return(adp->obj);

crypto/objects/obj_dat.c:310:7: Condition is true
  308.   		ad.obj= &ob;
  309.   		ob.nid=n;
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
               ^
  311.   		if (adp != NULL)
  312.   			return(adp->obj);

crypto/objects/obj_dat.c:310:3: 
  308.   		ad.obj= &ob;
  309.   		ob.nid=n;
  310. > 		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  311.   		if (adp != NULL)
  312.   			return(adp->obj);

crypto/lhash/lhash.c:248:1: start of procedure lh_retrieve()
    246.   	}
    247.   
    248. > void *lh_retrieve(_LHASH *lh, const void *data)
    249.   	{
    250.   	unsigned long hash;

crypto/lhash/lhash.c:254:2: 
    252.   	void *ret;
    253.   
    254. > 	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
    256.   

crypto/lhash/lhash.c:255:2: Skipping getrn(): empty list of specs
    253.   
    254.   	lh->error=0;
    255.   	rn=getrn(lh,data,&hash);
            ^
    256.   
    257.   	if (*rn == NULL)

crypto/lhash/lhash.c:257:6: Taking false branch
    255.   	rn=getrn(lh,data,&hash);
    256.   
    257.   	if (*rn == NULL)
                ^
    258.   		{
    259.   		lh->num_retrieve_miss++;

crypto/lhash/lhash.c:264:3: 
    262.   	else
    263.   		{
    264. > 		ret= (*rn)->data;
    265.   		lh->num_retrieve++;
    266.   		}

crypto/lhash/lhash.c:265:3: 
    263.   		{
    264.   		ret= (*rn)->data;
    265. > 		lh->num_retrieve++;
    266.   		}
    267.   	return(ret);

crypto/lhash/lhash.c:267:2: 
    265.   		lh->num_retrieve++;
    266.   		}
    267. > 	return(ret);
    268.   	}
    269.   

crypto/lhash/lhash.c:268:2: return from a call to lh_retrieve
    266.   		}
    267.   	return(ret);
    268.   	}
            ^
    269.   
    270.   static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_dat.c:311:7: Taking true branch
  309.   		ob.nid=n;
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  311.   		if (adp != NULL)
               ^
  312.   			return(adp->obj);
  313.   		else

crypto/objects/obj_dat.c:312:4: 
  310.   		adp=lh_ADDED_OBJ_retrieve(added,&ad);
  311.   		if (adp != NULL)
  312. > 			return(adp->obj);
  313.   		else
  314.   			{

crypto/objects/obj_dat.c:319:2: return from a call to OBJ_nid2obj
  317.   			}
  318.   		}
  319.   	}
          ^
  320.   
  321.   const char *OBJ_nid2sn(int n)

engines/ccgost/gost_ameth.c:615:6: Taking false branch
613.   	DSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);
614.   	algobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));
615.   	if (pk->save_parameters) 
            ^
616.   		{
617.   		ASN1_STRING *params = encode_gost_algor_params(pk);

engines/ccgost/gost_ameth.c:621:2: 
619.   		ptype = V_ASN1_SEQUENCE;
620.   		}	
621. > 	data_len = BN_num_bytes(dsa->pub_key);
622.   	databuf = OPENSSL_malloc(data_len);
623.   	BN_bn2bin(dsa->pub_key,databuf);

crypto/bn/bn_lib.c:248:1: start of procedure BN_num_bits()
  246.   	}
  247.   
  248. > int BN_num_bits(const BIGNUM *a)
  249.   	{
  250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:250:2: 
  248.   int BN_num_bits(const BIGNUM *a)
  249.   	{
  250. > 	int i = a->top - 1;
  251.   	bn_check_top(a);
  252.   

crypto/bn/bn_lib.c:253:6: Taking false branch
  251.   	bn_check_top(a);
  252.   
  253.   	if (BN_is_zero(a)) return 0;
              ^
  254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
  255.   	}

crypto/bn/bn_lib.c:254:2: Skipping BN_num_bits_word(): empty list of specs
  252.   
  253.   	if (BN_is_zero(a)) return 0;
  254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
          ^
  255.   	}
  256.   

crypto/bn/bn_lib.c:255:2: return from a call to BN_num_bits
  253.   	if (BN_is_zero(a)) return 0;
  254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
  255.   	}
          ^
  256.   
  257.   void BN_clear_free(BIGNUM *a)

engines/ccgost/gost_ameth.c:622:2: 
620.   		}	
621.   	data_len = BN_num_bytes(dsa->pub_key);
622. > 	databuf = OPENSSL_malloc(data_len);
623.   	BN_bn2bin(dsa->pub_key,databuf);
624.   	octet = ASN1_OCTET_STRING_new();

crypto/mem.c:294:1: start of procedure CRYPTO_malloc()
  292.   	}
  293.   
  294. > void *CRYPTO_malloc(int num, const char *file, int line)
  295.   	{
  296.   	void *ret = NULL;

crypto/mem.c:296:2: 
  294.   void *CRYPTO_malloc(int num, const char *file, int line)
  295.   	{
  296. > 	void *ret = NULL;
  297.   
  298.   	if (num <= 0) return NULL;

crypto/mem.c:298:6: Taking false branch
  296.   	void *ret = NULL;
  297.   
  298.   	if (num <= 0) return NULL;
              ^
  299.   
  300.   	allow_customize = 0;

crypto/mem.c:300:2: 
  298.   	if (num <= 0) return NULL;
  299.   
  300. > 	allow_customize = 0;
  301.   	if (malloc_debug_func != NULL)
  302.   		{

crypto/mem.c:301:6: Taking true branch
  299.   
  300.   	allow_customize = 0;
  301.   	if (malloc_debug_func != NULL)
              ^
  302.   		{
  303.   		allow_customize_debug = 0;

crypto/mem.c:303:3: 
  301.   	if (malloc_debug_func != NULL)
  302.   		{
  303. > 		allow_customize_debug = 0;
  304.   		malloc_debug_func(NULL, num, file, line, 0);
  305.   		}

crypto/mem.c:304:3: Skipping __function_pointer__(): unresolved function pointer
  302.   		{
  303.   		allow_customize_debug = 0;
  304.   		malloc_debug_func(NULL, num, file, line, 0);
           ^
  305.   		}
  306.   	ret = malloc_ex_func(num,file,line);

crypto/mem.c:306:2: Skipping __function_pointer__(): unresolved function pointer
  304.   		malloc_debug_func(NULL, num, file, line, 0);
  305.   		}
  306.   	ret = malloc_ex_func(num,file,line);
          ^
  307.   #ifdef LEVITTE_DEBUG_MEM
  308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:310:6: Taking true branch
  308.   	fprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\n", ret, num);
  309.   #endif
  310.   	if (malloc_debug_func != NULL)
              ^
  311.   		malloc_debug_func(ret, num, file, line, 1);
  312.   

crypto/mem.c:311:3: Skipping __function_pointer__(): unresolved function pointer
  309.   #endif
  310.   	if (malloc_debug_func != NULL)
  311.   		malloc_debug_func(ret, num, file, line, 1);
           ^
  312.   
  313.   #ifndef OPENSSL_CPUID_OBJ

crypto/mem.c:317:12: Taking false branch
  315.            * sanitisation function can't be optimised out. NB: We only do
  316.            * this for >2Kb so the overhead doesn't bother us. */
  317.           if(ret && (num > 2048))
                    ^
  318.   	{	extern unsigned char cleanse_ctr;
  319.                   ((unsigned char *)ret)[0] = cleanse_ctr;

crypto/mem.c:323:2: 
  321.   #endif
  322.   
  323. > 	return ret;
  324.   	}
  325.   char *CRYPTO_strdup(const char *str, const char *file, int line)

crypto/mem.c:324:2: return from a call to CRYPTO_malloc
  322.   
  323.   	return ret;
  324.   	}
          ^
  325.   char *CRYPTO_strdup(const char *str, const char *file, int line)
  326.   	{

engines/ccgost/gost_ameth.c:623:2: 
621.   	data_len = BN_num_bytes(dsa->pub_key);
622.   	databuf = OPENSSL_malloc(data_len);
623. > 	BN_bn2bin(dsa->pub_key,databuf);
624.   	octet = ASN1_OCTET_STRING_new();
625.   	ASN1_STRING_set(octet,NULL,data_len);

crypto/bn/bn_lib.c:641:1: start of procedure BN_bn2bin()
  639.   
  640.   /* ignore negative */
  641. > int BN_bn2bin(const BIGNUM *a, unsigned char *to)
  642.   	{
  643.   	int n,i;

crypto/bn/bn_lib.c:647:2: 
  645.   
  646.   	bn_check_top(a);
  647. > 	n=i=BN_num_bytes(a);
  648.   	while (i--)
  649.   		{

crypto/bn/bn_lib.c:248:1: start of procedure BN_num_bits()
    246.   	}
    247.   
    248. > int BN_num_bits(const BIGNUM *a)
    249.   	{
    250.   	int i = a->top - 1;

crypto/bn/bn_lib.c:250:2: 
    248.   int BN_num_bits(const BIGNUM *a)
    249.   	{
    250. > 	int i = a->top - 1;
    251.   	bn_check_top(a);
    252.   

crypto/bn/bn_lib.c:253:6: Taking false branch
    251.   	bn_check_top(a);
    252.   
    253.   	if (BN_is_zero(a)) return 0;
                ^
    254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    255.   	}

crypto/bn/bn_lib.c:254:2: Skipping BN_num_bits_word(): empty list of specs
    252.   
    253.   	if (BN_is_zero(a)) return 0;
    254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
            ^
    255.   	}
    256.   

crypto/bn/bn_lib.c:255:2: return from a call to BN_num_bits
    253.   	if (BN_is_zero(a)) return 0;
    254.   	return ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));
    255.   	}
            ^
    256.   
    257.   void BN_clear_free(BIGNUM *a)

crypto/bn/bn_lib.c:648:9: Loop condition is true. Entering loop body
  646.   	bn_check_top(a);
  647.   	n=i=BN_num_bytes(a);
  648.   	while (i--)
                 ^
  649.   		{
  650.   		l=a->d[i/BN_BYTES];

crypto/bn/bn_lib.c:650:3: 
  648.   	while (i--)
  649.   		{
  650. > 		l=a->d[i/BN_BYTES];
  651.   		*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
  652.   		}

crypto/bn/bn_lib.c:651:3: 
  649.   		{
  650.   		l=a->d[i/BN_BYTES];
  651. > 		*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;
  652.   		}
  653.   	return(n);

static int pub_encode_gost94(X509_PUBKEY *pub,const EVP_PKEY *pk)
	{
	ASN1_OBJECT *algobj = NULL;
	ASN1_OCTET_STRING *octet = NULL;
	void *pval = NULL;
	unsigned char *buf=NULL,*databuf,*sptr;
	int i,j,data_len,ret=0;
	int ptype = V_ASN1_UNDEF;
	DSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);
	algobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));
	if (pk->save_parameters)
		{
		ASN1_STRING *params = encode_gost_algor_params(pk);
		pval = params;
		ptype = V_ASN1_SEQUENCE;
		}
	data_len = BN_num_bytes(dsa->pub_key);
	databuf = OPENSSL_malloc(data_len);
	BN_bn2bin(dsa->pub_key,databuf);
	octet = ASN1_OCTET_STRING_new();
	ASN1_STRING_set(octet,NULL,data_len);
	sptr = ASN1_STRING_data(octet);
	for (i=0,j=data_len-1; i< data_len;i++,j--)
		{
		sptr[i]=databuf[j];
		}
	OPENSSL_free(databuf);
	ret = i2d_ASN1_OCTET_STRING(octet,&buf);
	ASN1_BIT_STRING_free(octet);
	if (ret <0)  return 0;
	return X509_PUBKEY_set0_param(pub,algobj,ptype,pval,buf,ret);
	}
['static int pub_encode_gost94(X509_PUBKEY *pub,const EVP_PKEY *pk)\n\t{\n\tASN1_OBJECT *algobj = NULL;\n\tASN1_OCTET_STRING *octet = NULL;\n\tvoid *pval = NULL;\n\tunsigned char *buf=NULL,*databuf,*sptr;\n\tint i,j,data_len,ret=0;\n\tint ptype = V_ASN1_UNDEF;\n\tDSA *dsa = EVP_PKEY_get0((EVP_PKEY *)pk);\n\talgobj = OBJ_nid2obj(EVP_PKEY_base_id(pk));\n\tif (pk->save_parameters)\n\t\t{\n\t\tASN1_STRING *params = encode_gost_algor_params(pk);\n\t\tpval = params;\n\t\tptype = V_ASN1_SEQUENCE;\n\t\t}\n\tdata_len = BN_num_bytes(dsa->pub_key);\n\tdatabuf = OPENSSL_malloc(data_len);\n\tBN_bn2bin(dsa->pub_key,databuf);\n\toctet = ASN1_OCTET_STRING_new();\n\tASN1_STRING_set(octet,NULL,data_len);\n\tsptr = ASN1_STRING_data(octet);\n\tfor (i=0,j=data_len-1; i< data_len;i++,j--)\n\t\t{\n\t\tsptr[i]=databuf[j];\n\t\t}\n\tOPENSSL_free(databuf);\n\tret = i2d_ASN1_OCTET_STRING(octet,&buf);\n\tASN1_BIT_STRING_free(octet);\n\tif (ret <0)  return 0;\n\treturn X509_PUBKEY_set0_param(pub,algobj,ptype,pval,buf,ret);\n\t}', 'void *EVP_PKEY_get0(EVP_PKEY *pkey)\n\t{\n\treturn pkey->pkey.ptr;\n\t}', 'int EVP_PKEY_base_id(const EVP_PKEY *pkey)\n\t{\n\treturn EVP_PKEY_type(pkey->type);\n\t}', 'int EVP_PKEY_type(int type)\n\t{\n\tint ret;\n\tconst EVP_PKEY_ASN1_METHOD *ameth;\n\tENGINE *e;\n\tameth = EVP_PKEY_asn1_find(&e, type);\n\tif (ameth)\n\t\tret = ameth->pkey_id;\n\telse\n\t\tret = NID_undef;\n#ifndef OPENSSL_NO_ENGINE\n\tif (e)\n\t\tENGINE_finish(e);\n#endif\n\treturn ret;\n\t}', 'const EVP_PKEY_ASN1_METHOD *EVP_PKEY_asn1_find(ENGINE **pe, int type)\n\t{\n\tconst EVP_PKEY_ASN1_METHOD *t;\n\tENGINE *e;\n\tfor (;;)\n\t\t{\n\t\tt = pkey_asn1_find(type);\n\t\tif (!t || !(t->pkey_flags & ASN1_PKEY_ALIAS))\n\t\t\tbreak;\n\t\ttype = t->pkey_base_id;\n\t\t}\n\tif (pe)\n\t\t{\n#ifndef OPENSSL_NO_ENGINE\n\t\te = ENGINE_get_pkey_asn1_meth_engine(type);\n\t\tif (e)\n\t\t\t{\n\t\t\t*pe = e;\n\t\t\treturn ENGINE_get_pkey_asn1_meth(e, type);\n\t\t\t}\n#endif\n\t\t*pe = NULL;\n\t\t}\n\treturn t;\n\t}', 'static const EVP_PKEY_ASN1_METHOD *pkey_asn1_find(int type)\n\t{\n\tEVP_PKEY_ASN1_METHOD tmp;\n\tconst EVP_PKEY_ASN1_METHOD *t = &tmp, **ret;\n\ttmp.pkey_id = type;\n\tif (app_methods)\n\t\t{\n\t\tint idx;\n\t\tidx = sk_EVP_PKEY_ASN1_METHOD_find(app_methods, &tmp);\n\t\tif (idx >= 0)\n\t\t\treturn sk_EVP_PKEY_ASN1_METHOD_value(app_methods, idx);\n\t\t}\n\tret = OBJ_bsearch_ameth(&t, standard_methods,\n\t\t\t  sizeof(standard_methods)\n\t\t\t  /sizeof(EVP_PKEY_ASN1_METHOD *));\n\tif (!ret || !*ret)\n\t\treturn NULL;\n\treturn *ret;\n\t}', 'int sk_find(_STACK *st, void *data)\n\t{\n\treturn internal_find(st, data, OBJ_BSEARCH_FIRST_VALUE_ON_MATCH);\n\t}', 'static int internal_find(_STACK *st, void *data, int ret_val_options)\n\t{\n\tconst void * const *r;\n\tint i;\n\tif(st == NULL) return -1;\n\tif (st->comp == NULL)\n\t\t{\n\t\tfor (i=0; i<st->num; i++)\n\t\t\tif (st->data[i] == data)\n\t\t\t\treturn(i);\n\t\treturn(-1);\n\t\t}\n\tsk_sort(st);\n\tif (data == NULL) return(-1);\n\tr=OBJ_bsearch_ex_(&data,st->data,st->num,sizeof(void *),st->comp,\n\t\t\t  ret_val_options);\n\tif (r == NULL) return(-1);\n\treturn (int)((char **)r-st->data);\n\t}', 'void *sk_value(const _STACK *st, int i)\n{\n\tif(!st || (i < 0) || (i >= st->num)) return NULL;\n\treturn st->data[i];\n}', 'ENGINE *ENGINE_get_pkey_asn1_meth_engine(int nid)\n\t{\n\treturn engine_table_select(&pkey_asn1_meth_table, nid);\n\t}', 'ENGINE *engine_table_select(ENGINE_TABLE **table, int nid)\n#else\nENGINE *engine_table_select_tmp(ENGINE_TABLE **table, int nid, const char *f, int l)\n#endif\n\t{\n\tENGINE *ret = NULL;\n\tENGINE_PILE tmplate, *fnd=NULL;\n\tint initres, loop = 0;\n\tif(!(*table))\n\t\t{\n#ifdef ENGINE_TABLE_DEBUG\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, nothing "\n\t\t\t"registered!\\n", f, l, nid);\n#endif\n\t\treturn NULL;\n\t\t}\n\tERR_set_mark();\n\tCRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n\tif(!int_table_check(table, 0)) goto end;\n\ttmplate.nid = nid;\n\tfnd = lh_ENGINE_PILE_retrieve(&(*table)->piles, &tmplate);\n\tif(!fnd) goto end;\n\tif(fnd->funct && engine_unlocked_init(fnd->funct))\n\t\t{\n#ifdef ENGINE_TABLE_DEBUG\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, using "\n\t\t\t"ENGINE \'%s\' cached\\n", f, l, nid, fnd->funct->id);\n#endif\n\t\tret = fnd->funct;\n\t\tgoto end;\n\t\t}\n\tif(fnd->uptodate)\n\t\t{\n\t\tret = fnd->funct;\n\t\tgoto end;\n\t\t}\ntrynext:\n\tret = sk_ENGINE_value(fnd->sk, loop++);\n\tif(!ret)\n\t\t{\n#ifdef ENGINE_TABLE_DEBUG\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, no "\n\t\t\t\t"registered implementations would initialise\\n",\n\t\t\t\tf, l, nid);\n#endif\n\t\tgoto end;\n\t\t}\n\tif((ret->funct_ref > 0) || !(table_flags & ENGINE_TABLE_FLAG_NOINIT))\n\t\tinitres = engine_unlocked_init(ret);\n\telse\n\t\tinitres = 0;\n\tif(initres)\n\t\t{\n\t\tif((fnd->funct != ret) && engine_unlocked_init(ret))\n\t\t\t{\n\t\t\tif(fnd->funct)\n\t\t\t\tengine_unlocked_finish(fnd->funct, 0);\n\t\t\tfnd->funct = ret;\n#ifdef ENGINE_TABLE_DEBUG\n\t\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, "\n\t\t\t\t"setting default to \'%s\'\\n", f, l, nid, ret->id);\n#endif\n\t\t\t}\n#ifdef ENGINE_TABLE_DEBUG\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, using "\n\t\t\t\t"newly initialised \'%s\'\\n", f, l, nid, ret->id);\n#endif\n\t\tgoto end;\n\t\t}\n\tgoto trynext;\nend:\n\tif(fnd) fnd->uptodate = 1;\n#ifdef ENGINE_TABLE_DEBUG\n\tif(ret)\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "\n\t\t\t\t"ENGINE \'%s\'\\n", f, l, nid, ret->id);\n\telse\n\t\tfprintf(stderr, "engine_table_dbg: %s:%d, nid=%d, caching "\n\t\t\t\t"\'no matching ENGINE\'\\n", f, l, nid);\n#endif\n\tCRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n\tERR_pop_to_mark();\n\treturn ret;\n\t}', 'ASN1_OBJECT *OBJ_nid2obj(int n)\n\t{\n\tADDED_OBJ ad,*adp;\n\tASN1_OBJECT ob;\n\tif ((n >= 0) && (n < NUM_NID))\n\t\t{\n\t\tif ((n != NID_undef) && (nid_objs[n].nid == NID_undef))\n\t\t\t{\n\t\t\tOBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID);\n\t\t\treturn(NULL);\n\t\t\t}\n\t\treturn((ASN1_OBJECT *)&(nid_objs[n]));\n\t\t}\n\telse if (added == NULL)\n\t\treturn(NULL);\n\telse\n\t\t{\n\t\tad.type=ADDED_NID;\n\t\tad.obj= &ob;\n\t\tob.nid=n;\n\t\tadp=lh_ADDED_OBJ_retrieve(added,&ad);\n\t\tif (adp != NULL)\n\t\t\treturn(adp->obj);\n\t\telse\n\t\t\t{\n\t\t\tOBJerr(OBJ_F_OBJ_NID2OBJ,OBJ_R_UNKNOWN_NID);\n\t\t\treturn(NULL);\n\t\t\t}\n\t\t}\n\t}', 'void *lh_retrieve(_LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE **rn;\n\tvoid *ret;\n\tlh->error=0;\n\trn=getrn(lh,data,&hash);\n\tif (*rn == NULL)\n\t\t{\n\t\tlh->num_retrieve_miss++;\n\t\treturn(NULL);\n\t\t}\n\telse\n\t\t{\n\t\tret= (*rn)->data;\n\t\tlh->num_retrieve++;\n\t\t}\n\treturn(ret);\n\t}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tint i = a->top - 1;\n\tbn_check_top(a);\n\tif (BN_is_zero(a)) return 0;\n\treturn ((i*BN_BITS2) + BN_num_bits_word(a->d[i]));\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\tif (num <= 0) return NULL;\n\tallow_customize = 0;\n\tif (malloc_debug_func != NULL)\n\t\t{\n\t\tallow_customize_debug = 0;\n\t\tmalloc_debug_func(NULL, num, file, line, 0);\n\t\t}\n\tret = malloc_ex_func(num,file,line);\n#ifdef LEVITTE_DEBUG_MEM\n\tfprintf(stderr, "LEVITTE_DEBUG_MEM:         > 0x%p (%d)\\n", ret, num);\n#endif\n\tif (malloc_debug_func != NULL)\n\t\tmalloc_debug_func(ret, num, file, line, 1);\n#ifndef OPENSSL_CPUID_OBJ\n        if(ret && (num > 2048))\n\t{\textern unsigned char cleanse_ctr;\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\t}\n#endif\n\treturn ret;\n\t}', 'int BN_bn2bin(const BIGNUM *a, unsigned char *to)\n\t{\n\tint n,i;\n\tBN_ULONG l;\n\tbn_check_top(a);\n\tn=i=BN_num_bytes(a);\n\twhile (i--)\n\t\t{\n\t\tl=a->d[i/BN_BYTES];\n\t\t*(to++)=(unsigned char)(l>>(8*(i%BN_BYTES)))&0xff;\n\t\t}\n\treturn(n);\n\t}']