apps/x509.c:1227: error: NULL_DEREFERENCE
  pointer `pktmp` last assigned on line 1225 could be null and is dereferenced by call to `EVP_PKEY_save_parameters()` at line 1227, column 2.
Showing all 70 steps of the trace


apps/x509.c:1219:1: start of procedure sign()
1217.   
1218.   /* self sign */
1219. > static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest, 
1220.   						CONF *conf, char *section)
1221.   	{

apps/x509.c:1225:2: 
1223.   	EVP_PKEY *pktmp;
1224.   
1225. > 	pktmp = X509_get_pubkey(x);
1226.   	EVP_PKEY_copy_parameters(pktmp,pkey);
1227.   	EVP_PKEY_save_parameters(pktmp,1);

crypto/x509/x509_cmp.c:253:1: start of procedure X509_get_pubkey()
  251.   	}
  252.   
  253. > EVP_PKEY *X509_get_pubkey(X509 *x)
  254.   	{
  255.   	if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:255:7: Taking false branch
  253.   EVP_PKEY *X509_get_pubkey(X509 *x)
  254.   	{
  255.   	if ((x == NULL) || (x->cert_info == NULL))
               ^
  256.   		return(NULL);
  257.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:255:22: Taking false branch
  253.   EVP_PKEY *X509_get_pubkey(X509 *x)
  254.   	{
  255.   	if ((x == NULL) || (x->cert_info == NULL))
                              ^
  256.   		return(NULL);
  257.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:257:2: 
  255.   	if ((x == NULL) || (x->cert_info == NULL))
  256.   		return(NULL);
  257. > 	return(X509_PUBKEY_get(x->cert_info->key));
  258.   	}
  259.   

crypto/asn1/x_pubkey.c:166:1: start of procedure X509_PUBKEY_get()
    164.   	}
    165.   
    166. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    167.   	{
    168.   	EVP_PKEY *ret=NULL;

crypto/asn1/x_pubkey.c:168:2: 
    166.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    167.   	{
    168. > 	EVP_PKEY *ret=NULL;
    169.   	long j;
    170.   	int type;

crypto/asn1/x_pubkey.c:177:6: Taking false branch
    175.   #endif
    176.   
    177.   	if (key == NULL) goto err;
                ^
    178.   
    179.   	if (key->pkey != NULL)

crypto/asn1/x_pubkey.c:179:6: Taking false branch
    177.   	if (key == NULL) goto err;
    178.   
    179.   	if (key->pkey != NULL)
                ^
    180.   	    {
    181.   	    CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);

crypto/asn1/x_pubkey.c:185:6: Taking false branch
    183.   	    }
    184.   
    185.   	if (key->public_key == NULL) goto err;
                ^
    186.   
    187.   	type=OBJ_obj2nid(key->algor->algorithm);

crypto/asn1/x_pubkey.c:187:2: 
    185.   	if (key->public_key == NULL) goto err;
    186.   
    187. > 	type=OBJ_obj2nid(key->algor->algorithm);
    188.   	p=key->public_key->data;
    189.           j=key->public_key->length;

crypto/objects/obj_dat.c:366:1: start of procedure OBJ_obj2nid()
      364.   	}
      365.   
      366. > int OBJ_obj2nid(const ASN1_OBJECT *a)
      367.   	{
      368.   	ASN1_OBJECT **op;

crypto/objects/obj_dat.c:371:6: Taking false branch
      369.   	ADDED_OBJ ad,*adp;
      370.   
      371.   	if (a == NULL)
                  ^
      372.   		return(NID_undef);
      373.   	if (a->nid != 0)

crypto/objects/obj_dat.c:373:6: Taking false branch
      371.   	if (a == NULL)
      372.   		return(NID_undef);
      373.   	if (a->nid != 0)
                  ^
      374.   		return(a->nid);
      375.   

crypto/objects/obj_dat.c:376:6: Taking true branch
      374.   		return(a->nid);
      375.   
      376.   	if (added != NULL)
                  ^
      377.   		{
      378.   		ad.type=ADDED_DATA;

crypto/objects/obj_dat.c:378:3: 
      376.   	if (added != NULL)
      377.   		{
      378. > 		ad.type=ADDED_DATA;
      379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
      380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);

crypto/objects/obj_dat.c:379:3: 
      377.   		{
      378.   		ad.type=ADDED_DATA;
      379. > 		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
      380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
      381.   		if (adp != NULL) return (adp->obj->nid);

crypto/objects/obj_dat.c:380:3: 
      378.   		ad.type=ADDED_DATA;
      379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
      380. > 		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
      381.   		if (adp != NULL) return (adp->obj->nid);
      382.   		}

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.   	const 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((void *)ret);

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

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

crypto/objects/obj_dat.c:381:7: Taking true branch
      379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
      380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
      381.   		if (adp != NULL) return (adp->obj->nid);
                   ^
      382.   		}
      383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:381:20: 
      379.   		ad.obj=(ASN1_OBJECT *)a; /* XXX: ugly but harmless */
      380.   		adp=(ADDED_OBJ *)lh_retrieve(added,&ad);
      381. > 		if (adp != NULL) return (adp->obj->nid);
      382.   		}
      383.   	op=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,

crypto/objects/obj_dat.c:388:2: return from a call to OBJ_obj2nid
      386.   		return(NID_undef);
      387.   	return((*op)->nid);
      388.   	}
              ^
      389.   
      390.   /* Convert an object name into an ASN1_OBJECT

crypto/asn1/x_pubkey.c:188:2: 
    186.   
    187.   	type=OBJ_obj2nid(key->algor->algorithm);
    188. > 	p=key->public_key->data;
    189.           j=key->public_key->length;
    190.           if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)

crypto/asn1/x_pubkey.c:189:9: 
    187.   	type=OBJ_obj2nid(key->algor->algorithm);
    188.   	p=key->public_key->data;
    189. >         j=key->public_key->length;
    190.           if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
    191.   		{

crypto/asn1/x_pubkey.c:190:13: 
    188.   	p=key->public_key->data;
    189.           j=key->public_key->length;
    190. >         if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
    191.   		{
    192.   		X509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);

crypto/asn1/d2i_pu.c:72:1: start of procedure d2i_PublicKey()
      70.   #endif
      71.   
      72. > EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,
      73.   	     long length)
      74.   	{

crypto/asn1/d2i_pu.c:77:7: Taking true branch
      75.   	EVP_PKEY *ret;
      76.   
      77.   	if ((a == NULL) || (*a == NULL))
                  ^
      78.   		{
      79.   		if ((ret=EVP_PKEY_new()) == NULL)

crypto/asn1/d2i_pu.c:79:7: Taking true branch
      77.   	if ((a == NULL) || (*a == NULL))
      78.   		{
      79.   		if ((ret=EVP_PKEY_new()) == NULL)
                  ^
      80.   			{
      81.   			ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);

crypto/asn1/d2i_pu.c:81:4: 
      79.   		if ((ret=EVP_PKEY_new()) == NULL)
      80.   			{
      81. > 			ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);
      82.   			return(NULL);
      83.   			}

crypto/err/err.c:615:1: start of procedure ERR_put_error()
        613.   /********************************************************/
        614.   
        615. > void ERR_put_error(int lib, int func, int reason, const char *file,
        616.   	     int line)
        617.   	{

crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs
        637.   	}
        638.   #endif
        639.   	es=ERR_get_state();
                ^
        640.   
        641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:641:2: 
        639.   	es=ERR_get_state();
        640.   
        641. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
        642.   	if (es->top == es->bottom)
        643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:642:6: Taking false branch
        640.   
        641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
        642.   	if (es->top == es->bottom)
                    ^
        643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:644:2: 
        642.   	if (es->top == es->bottom)
        643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        644. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        645.   	es->err_file[es->top]=file;
        646.   	es->err_line[es->top]=line;

crypto/err/err.c:645:2: 
        643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        645. > 	es->err_file[es->top]=file;
        646.   	es->err_line[es->top]=line;
        647.   	err_clear_data(es,es->top);

crypto/err/err.c:646:2: 
        644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        645.   	es->err_file[es->top]=file;
        646. > 	es->err_line[es->top]=line;
        647.   	err_clear_data(es,es->top);
        648.   	}

crypto/err/err.c:647:2: Taking true branch
        645.   	es->err_file[es->top]=file;
        646.   	es->err_line[es->top]=line;
        647.   	err_clear_data(es,es->top);
                ^
        648.   	}
        649.   

crypto/err/err.c:647:2: Taking false branch
        645.   	es->err_file[es->top]=file;
        646.   	es->err_line[es->top]=line;
        647.   	err_clear_data(es,es->top);
                ^
        648.   	}
        649.   

crypto/err/err.c:648:2: return from a call to ERR_put_error
        646.   	es->err_line[es->top]=line;
        647.   	err_clear_data(es,es->top);
        648.   	}
                ^
        649.   
        650.   void ERR_clear_error(void)

crypto/asn1/d2i_pu.c:82:4: 
      80.   			{
      81.   			ASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);
      82. > 			return(NULL);
      83.   			}
      84.   		}

crypto/asn1/d2i_pu.c:121:2: return from a call to d2i_PublicKey
      119.   	if ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret);
      120.   	return(NULL);
      121.   	}
              ^
      122.   

crypto/asn1/x_pubkey.c:190:13: Taking true branch
    188.   	p=key->public_key->data;
    189.           j=key->public_key->length;
    190.           if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
                       ^
    191.   		{
    192.   		X509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);

crypto/asn1/x_pubkey.c:192:3: 
    190.           if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)
    191.   		{
    192. > 		X509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);
    193.   		goto err;
    194.   		}

crypto/err/err.c:615:1: start of procedure ERR_put_error()
      613.   /********************************************************/
      614.   
      615. > void ERR_put_error(int lib, int func, int reason, const char *file,
      616.   	     int line)
      617.   	{

crypto/err/err.c:639:2: Skipping ERR_get_state(): empty list of specs
      637.   	}
      638.   #endif
      639.   	es=ERR_get_state();
              ^
      640.   
      641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:641:2: 
      639.   	es=ERR_get_state();
      640.   
      641. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      642.   	if (es->top == es->bottom)
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:642:6: Taking false branch
      640.   
      641.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      642.   	if (es->top == es->bottom)
                  ^
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:644:2: 
      642.   	if (es->top == es->bottom)
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;

crypto/err/err.c:645:2: 
      643.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645. > 	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);

crypto/err/err.c:646:2: 
      644.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      645.   	es->err_file[es->top]=file;
      646. > 	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
      648.   	}

crypto/err/err.c:647:2: Taking true branch
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
              ^
      648.   	}
      649.   

crypto/err/err.c:647:2: Taking false branch
      645.   	es->err_file[es->top]=file;
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
              ^
      648.   	}
      649.   

crypto/err/err.c:648:2: return from a call to ERR_put_error
      646.   	es->err_line[es->top]=line;
      647.   	err_clear_data(es,es->top);
      648.   	}
              ^
      649.   
      650.   void ERR_clear_error(void)

crypto/asn1/x_pubkey.c:215:1: 
    213.   	CRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY);
    214.   	return(ret);
    215. > err:
    216.   	if (ret != NULL)
    217.   		EVP_PKEY_free(ret);

crypto/asn1/x_pubkey.c:216:6: Taking false branch
    214.   	return(ret);
    215.   err:
    216.   	if (ret != NULL)
                ^
    217.   		EVP_PKEY_free(ret);
    218.   	return(NULL);

crypto/asn1/x_pubkey.c:218:2: 
    216.   	if (ret != NULL)
    217.   		EVP_PKEY_free(ret);
    218. > 	return(NULL);
    219.   	}
    220.   

crypto/asn1/x_pubkey.c:219:2: return from a call to X509_PUBKEY_get
    217.   		EVP_PKEY_free(ret);
    218.   	return(NULL);
    219.   	}
            ^
    220.   
    221.   /* Now two pseudo ASN1 routines that take an EVP_PKEY structure

crypto/x509/x509_cmp.c:258:2: return from a call to X509_get_pubkey
  256.   		return(NULL);
  257.   	return(X509_PUBKEY_get(x->cert_info->key));
  258.   	}
          ^
  259.   
  260.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

apps/x509.c:1226:2: Skipping EVP_PKEY_copy_parameters(): empty list of specs
1224.   
1225.   	pktmp = X509_get_pubkey(x);
1226.   	EVP_PKEY_copy_parameters(pktmp,pkey);
         ^
1227.   	EVP_PKEY_save_parameters(pktmp,1);
1228.   	EVP_PKEY_free(pktmp);

apps/x509.c:1227:2: 
1225.   	pktmp = X509_get_pubkey(x);
1226.   	EVP_PKEY_copy_parameters(pktmp,pkey);
1227. > 	EVP_PKEY_save_parameters(pktmp,1);
1228.   	EVP_PKEY_free(pktmp);
1229.   

crypto/evp/p_lib.c:98:1: start of procedure EVP_PKEY_save_parameters()
  96.   	}
  97.   
  98. > int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)
  99.   	{
  100.   #ifndef OPENSSL_NO_DSA

crypto/evp/p_lib.c:101:6: 
  99.   	{
  100.   #ifndef OPENSSL_NO_DSA
  101. > 	if (pkey->type == EVP_PKEY_DSA)
  102.   		{
  103.   		int ret=pkey->save_parameters;

static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,
						CONF *conf, char *section)
	{
	EVP_PKEY *pktmp;
	pktmp = X509_get_pubkey(x);
	EVP_PKEY_copy_parameters(pktmp,pkey);
	EVP_PKEY_save_parameters(pktmp,1);
	EVP_PKEY_free(pktmp);
	if (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;
	if (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;
	if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
		goto err;
	if (!X509_set_pubkey(x,pkey)) goto err;
	if (clrext)
		{
		while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
		}
	if (conf)
		{
		X509V3_CTX ctx;
		X509_set_version(x,2);
                X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);
                X509V3_set_nconf(&ctx, conf);
                if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;
		}
	if (!X509_sign(x,pkey,digest)) goto err;
	return 1;
err:
	ERR_print_errors(bio_err);
	return 0;
	}
['static int sign(X509 *x, EVP_PKEY *pkey, int days, int clrext, const EVP_MD *digest,\n\t\t\t\t\t\tCONF *conf, char *section)\n\t{\n\tEVP_PKEY *pktmp;\n\tpktmp = X509_get_pubkey(x);\n\tEVP_PKEY_copy_parameters(pktmp,pkey);\n\tEVP_PKEY_save_parameters(pktmp,1);\n\tEVP_PKEY_free(pktmp);\n\tif (!X509_set_issuer_name(x,X509_get_subject_name(x))) goto err;\n\tif (X509_gmtime_adj(X509_get_notBefore(x),0) == NULL) goto err;\n\tif (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)\n\t\tgoto err;\n\tif (!X509_set_pubkey(x,pkey)) goto err;\n\tif (clrext)\n\t\t{\n\t\twhile (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);\n\t\t}\n\tif (conf)\n\t\t{\n\t\tX509V3_CTX ctx;\n\t\tX509_set_version(x,2);\n                X509V3_set_ctx(&ctx, x, x, NULL, NULL, 0);\n                X509V3_set_nconf(&ctx, conf);\n                if (!X509V3_EXT_add_nconf(conf, &ctx, section, x)) goto err;\n\t\t}\n\tif (!X509_sign(x,pkey,digest)) goto err;\n\treturn 1;\nerr:\n\tERR_print_errors(bio_err);\n\treturn 0;\n\t}', 'EVP_PKEY *X509_get_pubkey(X509 *x)\n\t{\n\tif ((x == NULL) || (x->cert_info == NULL))\n\t\treturn(NULL);\n\treturn(X509_PUBKEY_get(x->cert_info->key));\n\t}', 'EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)\n\t{\n\tEVP_PKEY *ret=NULL;\n\tlong j;\n\tint type;\n\tunsigned char *p;\n#ifndef OPENSSL_NO_DSA\n\tconst unsigned char *cp;\n\tX509_ALGOR *a;\n#endif\n\tif (key == NULL) goto err;\n\tif (key->pkey != NULL)\n\t    {\n\t    CRYPTO_add(&key->pkey->references,1,CRYPTO_LOCK_EVP_PKEY);\n\t    return(key->pkey);\n\t    }\n\tif (key->public_key == NULL) goto err;\n\ttype=OBJ_obj2nid(key->algor->algorithm);\n\tp=key->public_key->data;\n        j=key->public_key->length;\n        if ((ret=d2i_PublicKey(type,NULL,&p,(long)j)) == NULL)\n\t\t{\n\t\tX509err(X509_F_X509_PUBKEY_GET,X509_R_ERR_ASN1_LIB);\n\t\tgoto err;\n\t\t}\n\tret->save_parameters=0;\n#ifndef OPENSSL_NO_DSA\n\ta=key->algor;\n\tif (ret->type == EVP_PKEY_DSA)\n\t\t{\n\t\tif (a->parameter && (a->parameter->type == V_ASN1_SEQUENCE))\n\t\t\t{\n\t\t\tret->pkey.dsa->write_params=0;\n\t\t\tcp=p=a->parameter->value.sequence->data;\n\t\t\tj=a->parameter->value.sequence->length;\n\t\t\tif (!d2i_DSAparams(&ret->pkey.dsa,&cp,(long)j))\n\t\t\t\tgoto err;\n\t\t\t}\n\t\tret->save_parameters=1;\n\t\t}\n#endif\n\tkey->pkey=ret;\n\tCRYPTO_add(&ret->references,1,CRYPTO_LOCK_EVP_PKEY);\n\treturn(ret);\nerr:\n\tif (ret != NULL)\n\t\tEVP_PKEY_free(ret);\n\treturn(NULL);\n\t}', 'int OBJ_obj2nid(const ASN1_OBJECT *a)\n\t{\n\tASN1_OBJECT **op;\n\tADDED_OBJ ad,*adp;\n\tif (a == NULL)\n\t\treturn(NID_undef);\n\tif (a->nid != 0)\n\t\treturn(a->nid);\n\tif (added != NULL)\n\t\t{\n\t\tad.type=ADDED_DATA;\n\t\tad.obj=(ASN1_OBJECT *)a;\n\t\tadp=(ADDED_OBJ *)lh_retrieve(added,&ad);\n\t\tif (adp != NULL) return (adp->obj->nid);\n\t\t}\n\top=(ASN1_OBJECT **)OBJ_bsearch((char *)&a,(char *)obj_objs,NUM_OBJ,\n\t\tsizeof(ASN1_OBJECT *),obj_cmp);\n\tif (op == NULL)\n\t\treturn(NID_undef);\n\treturn((*op)->nid);\n\t}', 'void *lh_retrieve(LHASH *lh, const void *data)\n\t{\n\tunsigned long hash;\n\tLHASH_NODE **rn;\n\tconst void *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((void *)ret);\n\t}', 'EVP_PKEY *d2i_PublicKey(int type, EVP_PKEY **a, unsigned char **pp,\n\t     long length)\n\t{\n\tEVP_PKEY *ret;\n\tif ((a == NULL) || (*a == NULL))\n\t\t{\n\t\tif ((ret=EVP_PKEY_new()) == NULL)\n\t\t\t{\n\t\t\tASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_EVP_LIB);\n\t\t\treturn(NULL);\n\t\t\t}\n\t\t}\n\telse\tret= *a;\n\tret->save_type=type;\n\tret->type=EVP_PKEY_type(type);\n\tswitch (ret->type)\n\t\t{\n#ifndef OPENSSL_NO_RSA\n\tcase EVP_PKEY_RSA:\n\t\tif ((ret->pkey.rsa=d2i_RSAPublicKey(NULL,\n\t\t\t(const unsigned char **)pp,length)) == NULL)\n\t\t\t{\n\t\t\tASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tbreak;\n#endif\n#ifndef OPENSSL_NO_DSA\n\tcase EVP_PKEY_DSA:\n\t\tif ((ret->pkey.dsa=d2i_DSAPublicKey(NULL,\n\t\t\t(const unsigned char **)pp,length)) == NULL)\n\t\t\t{\n\t\t\tASN1err(ASN1_F_D2I_PUBLICKEY,ERR_R_ASN1_LIB);\n\t\t\tgoto err;\n\t\t\t}\n\t\tbreak;\n#endif\n\tdefault:\n\t\tASN1err(ASN1_F_D2I_PUBLICKEY,ASN1_R_UNKNOWN_PUBLIC_KEY_TYPE);\n\t\tgoto err;\n\t\t}\n\tif (a != NULL) (*a)=ret;\n\treturn(ret);\nerr:\n\tif ((ret != NULL) && ((a == NULL) || (*a != ret))) EVP_PKEY_free(ret);\n\treturn(NULL);\n\t}', 'void ERR_put_error(int lib, int func, int reason, const char *file,\n\t     int line)\n\t{\n\tERR_STATE *es;\n#ifdef _OSD_POSIX\n\tif (strncmp(file,"*POSIX(", sizeof("*POSIX(")-1) == 0) {\n\t\tchar *end;\n\t\tfile += sizeof("*POSIX(")-1;\n\t\tend = &file[strlen(file)-1];\n\t\tif (*end == \')\')\n\t\t\t*end = \'\\0\';\n\t\tif ((end = strrchr(file, \'/\')) != NULL)\n\t\t\tfile = &end[1];\n\t}\n#endif\n\tes=ERR_get_state();\n\tes->top=(es->top+1)%ERR_NUM_ERRORS;\n\tif (es->top == es->bottom)\n\t\tes->bottom=(es->bottom+1)%ERR_NUM_ERRORS;\n\tes->err_buffer[es->top]=ERR_PACK(lib,func,reason);\n\tes->err_file[es->top]=file;\n\tes->err_line[es->top]=line;\n\terr_clear_data(es,es->top);\n\t}', 'int EVP_PKEY_save_parameters(EVP_PKEY *pkey, int mode)\n\t{\n#ifndef OPENSSL_NO_DSA\n\tif (pkey->type == EVP_PKEY_DSA)\n\t\t{\n\t\tint ret=pkey->save_parameters;\n\t\tif (mode >= 0)\n\t\t\tpkey->save_parameters=mode;\n\t\treturn(ret);\n\t\t}\n#endif\n\treturn(0);\n\t}']