apps/x509.c:1129: error: NULL_DEREFERENCE
  pointer `upkey` last assigned on line 1128 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 1129, column 2.
Showing all 67 steps of the trace


apps/x509.c:1119:1: start of procedure x509_certify()
1117.   	}
1118.   
1119. > static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
1120.   	     X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
1121.   	     int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)

apps/x509.c:1123:2: 
1121.   	     int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
1122.   	{
1123. > 	int ret=0;
1124.   	ASN1_INTEGER *bs=NULL;
1125.   	X509_STORE_CTX xsc;

apps/x509.c:1124:2: 
1122.   	{
1123.   	int ret=0;
1124. > 	ASN1_INTEGER *bs=NULL;
1125.   	X509_STORE_CTX xsc;
1126.   	EVP_PKEY *upkey;

apps/x509.c:1128:2: 
1126.   	EVP_PKEY *upkey;
1127.   
1128. > 	upkey = X509_get_pubkey(xca);
1129.   	EVP_PKEY_copy_parameters(upkey,pkey);
1130.   	EVP_PKEY_free(upkey);

crypto/x509/x509_cmp.c:374:1: start of procedure X509_get_pubkey()
  372.   	}
  373.   
  374. > EVP_PKEY *X509_get_pubkey(X509 *x)
  375.   	{
  376.   	if ((x == NULL) || (x->cert_info == NULL))

crypto/x509/x509_cmp.c:376:7: Taking false branch
  374.   EVP_PKEY *X509_get_pubkey(X509 *x)
  375.   	{
  376.   	if ((x == NULL) || (x->cert_info == NULL))
               ^
  377.   		return(NULL);
  378.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:376:22: Taking false branch
  374.   EVP_PKEY *X509_get_pubkey(X509 *x)
  375.   	{
  376.   	if ((x == NULL) || (x->cert_info == NULL))
                              ^
  377.   		return(NULL);
  378.   	return(X509_PUBKEY_get(x->cert_info->key));

crypto/x509/x509_cmp.c:378:2: 
  376.   	if ((x == NULL) || (x->cert_info == NULL))
  377.   		return(NULL);
  378. > 	return(X509_PUBKEY_get(x->cert_info->key));
  379.   	}
  380.   

crypto/asn1/x_pubkey.c:136:1: start of procedure X509_PUBKEY_get()
    134.   	}
    135.   
    136. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    137.   	{
    138.   	EVP_PKEY *ret=NULL;

crypto/asn1/x_pubkey.c:138:2: 
    136.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    137.   	{
    138. > 	EVP_PKEY *ret=NULL;
    139.   	const EVP_PKEY_ASN1_METHOD *meth;
    140.   

crypto/asn1/x_pubkey.c:141:6: Taking false branch
    139.   	const EVP_PKEY_ASN1_METHOD *meth;
    140.   
    141.   	if (key == NULL) goto error;
                ^
    142.   
    143.   	if (key->pkey != NULL)

crypto/asn1/x_pubkey.c:143:6: Taking false branch
    141.   	if (key == NULL) goto error;
    142.   
    143.   	if (key->pkey != NULL)
                ^
    144.   		{
    145.   		CRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);

crypto/asn1/x_pubkey.c:149:6: Taking false branch
    147.   		}
    148.   
    149.   	if (key->public_key == NULL) goto error;
                ^
    150.   
    151.   	if ((ret = EVP_PKEY_new()) == NULL)

crypto/asn1/x_pubkey.c:151:6: 
    149.   	if (key->public_key == NULL) goto error;
    150.   
    151. > 	if ((ret = EVP_PKEY_new()) == NULL)
    152.   		{
    153.   		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);

crypto/evp/p_lib.c:169:1: start of procedure EVP_PKEY_new()
      167.   	}
      168.   
      169. > EVP_PKEY *EVP_PKEY_new(void)
      170.   	{
      171.   	EVP_PKEY *ret;

crypto/evp/p_lib.c:173:2: 
      171.   	EVP_PKEY *ret;
      172.   
      173. > 	ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
      174.   	if (ret == NULL)
      175.   		{

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

crypto/mem.c:293:2: 
        291.   void *CRYPTO_malloc(int num, const char *file, int line)
        292.   	{
        293. > 	void *ret = NULL;
        294.   	extern unsigned char cleanse_ctr;
        295.   

crypto/mem.c:296:6: Taking false branch
        294.   	extern unsigned char cleanse_ctr;
        295.   
        296.   	if (num <= 0) return NULL;
                    ^
        297.   
        298.   	allow_customize = 0;

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

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

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

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

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

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

crypto/mem.c:309:3: Skipping __function_pointer__(): unresolved function pointer
        307.   #endif
        308.   	if (malloc_debug_func != NULL)
        309.   		malloc_debug_func(ret, num, file, line, 1);
                 ^
        310.   
        311.           /* Create a dependency on the value of 'cleanse_ctr' so our memory

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

crypto/mem.c:317:2: 
        315.                   ((unsigned char *)ret)[0] = cleanse_ctr;
        316.   
        317. > 	return ret;
        318.   	}
        319.   

crypto/mem.c:318:2: return from a call to CRYPTO_malloc
        316.   
        317.   	return ret;
        318.   	}
                ^
        319.   
        320.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/evp/p_lib.c:174:6: Taking true branch
      172.   
      173.   	ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
      174.   	if (ret == NULL)
                  ^
      175.   		{
      176.   		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);

crypto/evp/p_lib.c:176:3: 
      174.   	if (ret == NULL)
      175.   		{
      176. > 		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
      177.   		return(NULL);
      178.   		}

crypto/err/err.c:668:1: start of procedure ERR_put_error()
        666.   /********************************************************/
        667.   
        668. > void ERR_put_error(int lib, int func, int reason, const char *file,
        669.   	     int line)
        670.   	{

crypto/err/err.c:692:2: Skipping ERR_get_state(): empty list of specs
        690.   	}
        691.   #endif
        692.   	es=ERR_get_state();
                ^
        693.   
        694.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:694:2: 
        692.   	es=ERR_get_state();
        693.   
        694. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
        695.   	if (es->top == es->bottom)
        696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:695:6: Taking false branch
        693.   
        694.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
        695.   	if (es->top == es->bottom)
                    ^
        696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        697.   	es->err_flags[es->top]=0;

crypto/err/err.c:697:2: 
        695.   	if (es->top == es->bottom)
        696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        697. > 	es->err_flags[es->top]=0;
        698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        699.   	es->err_file[es->top]=file;

crypto/err/err.c:698:2: 
        696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        697.   	es->err_flags[es->top]=0;
        698. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        699.   	es->err_file[es->top]=file;
        700.   	es->err_line[es->top]=line;

crypto/err/err.c:699:2: 
        697.   	es->err_flags[es->top]=0;
        698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        699. > 	es->err_file[es->top]=file;
        700.   	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);

crypto/err/err.c:700:2: 
        698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        699.   	es->err_file[es->top]=file;
        700. > 	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);
        702.   	}

crypto/err/err.c:701:2: Taking true branch
        699.   	es->err_file[es->top]=file;
        700.   	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);
                ^
        702.   	}
        703.   

crypto/err/err.c:701:2: Taking false branch
        699.   	es->err_file[es->top]=file;
        700.   	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);
                ^
        702.   	}
        703.   

crypto/err/err.c:701:2: Loop condition is false. Leaving loop
        699.   	es->err_file[es->top]=file;
        700.   	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);
                ^
        702.   	}
        703.   

crypto/err/err.c:702:2: return from a call to ERR_put_error
        700.   	es->err_line[es->top]=line;
        701.   	err_clear_data(es,es->top);
        702.   	}
                ^
        703.   
        704.   void ERR_clear_error(void)

crypto/evp/p_lib.c:177:3: 
      175.   		{
      176.   		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
      177. > 		return(NULL);
      178.   		}
      179.   	ret->type=EVP_PKEY_NONE;

crypto/evp/p_lib.c:186:2: return from a call to EVP_PKEY_new
      184.   	ret->save_parameters=1;
      185.   	return(ret);
      186.   	}
              ^
      187.   
      188.   int EVP_PKEY_assign(EVP_PKEY *pkey, int type, void *key)

crypto/asn1/x_pubkey.c:151:6: Taking true branch
    149.   	if (key->public_key == NULL) goto error;
    150.   
    151.   	if ((ret = EVP_PKEY_new()) == NULL)
                ^
    152.   		{
    153.   		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);

crypto/asn1/x_pubkey.c:153:3: 
    151.   	if ((ret = EVP_PKEY_new()) == NULL)
    152.   		{
    153. > 		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
    154.   		goto error;
    155.   		}

crypto/err/err.c:668:1: start of procedure ERR_put_error()
      666.   /********************************************************/
      667.   
      668. > void ERR_put_error(int lib, int func, int reason, const char *file,
      669.   	     int line)
      670.   	{

crypto/err/err.c:692:2: Skipping ERR_get_state(): empty list of specs
      690.   	}
      691.   #endif
      692.   	es=ERR_get_state();
              ^
      693.   
      694.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:694:2: 
      692.   	es=ERR_get_state();
      693.   
      694. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      695.   	if (es->top == es->bottom)
      696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:695:6: Taking false branch
      693.   
      694.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      695.   	if (es->top == es->bottom)
                  ^
      696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      697.   	es->err_flags[es->top]=0;

crypto/err/err.c:697:2: 
      695.   	if (es->top == es->bottom)
      696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      697. > 	es->err_flags[es->top]=0;
      698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      699.   	es->err_file[es->top]=file;

crypto/err/err.c:698:2: 
      696.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      697.   	es->err_flags[es->top]=0;
      698. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      699.   	es->err_file[es->top]=file;
      700.   	es->err_line[es->top]=line;

crypto/err/err.c:699:2: 
      697.   	es->err_flags[es->top]=0;
      698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      699. > 	es->err_file[es->top]=file;
      700.   	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);

crypto/err/err.c:700:2: 
      698.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      699.   	es->err_file[es->top]=file;
      700. > 	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);
      702.   	}

crypto/err/err.c:701:2: Taking true branch
      699.   	es->err_file[es->top]=file;
      700.   	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);
              ^
      702.   	}
      703.   

crypto/err/err.c:701:2: Taking false branch
      699.   	es->err_file[es->top]=file;
      700.   	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);
              ^
      702.   	}
      703.   

crypto/err/err.c:701:2: Loop condition is false. Leaving loop
      699.   	es->err_file[es->top]=file;
      700.   	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);
              ^
      702.   	}
      703.   

crypto/err/err.c:702:2: return from a call to ERR_put_error
      700.   	es->err_line[es->top]=line;
      701.   	err_clear_data(es,es->top);
      702.   	}
              ^
      703.   
      704.   void ERR_clear_error(void)

crypto/asn1/x_pubkey.c:188:2: 
    186.   	return ret;
    187.   
    188. > 	error:
    189.   	if (ret != NULL)
    190.   		EVP_PKEY_free(ret);

crypto/asn1/x_pubkey.c:189:6: Taking false branch
    187.   
    188.   	error:
    189.   	if (ret != NULL)
                ^
    190.   		EVP_PKEY_free(ret);
    191.   	return(NULL);

crypto/asn1/x_pubkey.c:191:2: 
    189.   	if (ret != NULL)
    190.   		EVP_PKEY_free(ret);
    191. > 	return(NULL);
    192.   	}
    193.   

crypto/asn1/x_pubkey.c:192:2: return from a call to X509_PUBKEY_get
    190.   		EVP_PKEY_free(ret);
    191.   	return(NULL);
    192.   	}
            ^
    193.   
    194.   /* Now two pseudo ASN1 routines that take an EVP_PKEY structure

crypto/x509/x509_cmp.c:379:2: return from a call to X509_get_pubkey
  377.   		return(NULL);
  378.   	return(X509_PUBKEY_get(x->cert_info->key));
  379.   	}
          ^
  380.   
  381.   ASN1_BIT_STRING *X509_get0_pubkey_bitstr(const X509 *x)

apps/x509.c:1129:2: 
1127.   
1128.   	upkey = X509_get_pubkey(xca);
1129. > 	EVP_PKEY_copy_parameters(upkey,pkey);
1130.   	EVP_PKEY_free(upkey);
1131.   

crypto/evp/p_lib.c:120:1: start of procedure EVP_PKEY_copy_parameters()
  118.   	}
  119.   
  120. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  121.   	{
  122.   	if (to->type != from->type)

crypto/evp/p_lib.c:122:6: 
  120.   int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  121.   	{
  122. > 	if (to->type != from->type)
  123.   		{
  124.   		EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES);

static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,
	     X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,
	     int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)
	{
	int ret=0;
	ASN1_INTEGER *bs=NULL;
	X509_STORE_CTX xsc;
	EVP_PKEY *upkey;
	upkey = X509_get_pubkey(xca);
	EVP_PKEY_copy_parameters(upkey,pkey);
	EVP_PKEY_free(upkey);
	if(!X509_STORE_CTX_init(&xsc,ctx,x,NULL))
		{
		BIO_printf(bio_err,"Error initialising X509 store\n");
		goto end;
		}
	if (sno) bs = sno;
	else if (!(bs = x509_load_serial(CAfile, serialfile, create)))
		goto end;
	X509_STORE_CTX_set_cert(&xsc,x);
	if (!reqfile && !X509_verify_cert(&xsc))
		goto end;
	if (!X509_check_private_key(xca,pkey))
		{
		BIO_printf(bio_err,"CA certificate and CA private key do not match\n");
		goto end;
		}
	if (!X509_set_issuer_name(x,X509_get_subject_name(xca))) goto end;
	if (!X509_set_serialNumber(x,bs)) goto end;
	if (X509_gmtime_adj(X509_get_notBefore(x),0L) == NULL)
		goto end;
	if (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)
		goto end;
	if (clrext)
		{
		while (X509_get_ext_count(x) > 0) X509_delete_ext(x, 0);
		}
	if (conf)
		{
		X509V3_CTX ctx2;
		X509_set_version(x,2);
                X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);
                X509V3_set_nconf(&ctx2, conf);
                if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;
		}
	if (!X509_sign(x,pkey,digest)) goto end;
	ret=1;
end:
	X509_STORE_CTX_cleanup(&xsc);
	if (!ret)
		ERR_print_errors(bio_err);
	if (!sno) ASN1_INTEGER_free(bs);
	return ret;
	}
['static int x509_certify(X509_STORE *ctx, char *CAfile, const EVP_MD *digest,\n\t     X509 *x, X509 *xca, EVP_PKEY *pkey, char *serialfile, int create,\n\t     int days, int clrext, CONF *conf, char *section, ASN1_INTEGER *sno)\n\t{\n\tint ret=0;\n\tASN1_INTEGER *bs=NULL;\n\tX509_STORE_CTX xsc;\n\tEVP_PKEY *upkey;\n\tupkey = X509_get_pubkey(xca);\n\tEVP_PKEY_copy_parameters(upkey,pkey);\n\tEVP_PKEY_free(upkey);\n\tif(!X509_STORE_CTX_init(&xsc,ctx,x,NULL))\n\t\t{\n\t\tBIO_printf(bio_err,"Error initialising X509 store\\n");\n\t\tgoto end;\n\t\t}\n\tif (sno) bs = sno;\n\telse if (!(bs = x509_load_serial(CAfile, serialfile, create)))\n\t\tgoto end;\n\tX509_STORE_CTX_set_cert(&xsc,x);\n\tif (!reqfile && !X509_verify_cert(&xsc))\n\t\tgoto end;\n\tif (!X509_check_private_key(xca,pkey))\n\t\t{\n\t\tBIO_printf(bio_err,"CA certificate and CA private key do not match\\n");\n\t\tgoto end;\n\t\t}\n\tif (!X509_set_issuer_name(x,X509_get_subject_name(xca))) goto end;\n\tif (!X509_set_serialNumber(x,bs)) goto end;\n\tif (X509_gmtime_adj(X509_get_notBefore(x),0L) == NULL)\n\t\tgoto end;\n\tif (X509_gmtime_adj(X509_get_notAfter(x),(long)60*60*24*days) == NULL)\n\t\tgoto end;\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 ctx2;\n\t\tX509_set_version(x,2);\n                X509V3_set_ctx(&ctx2, xca, x, NULL, NULL, 0);\n                X509V3_set_nconf(&ctx2, conf);\n                if (!X509V3_EXT_add_nconf(conf, &ctx2, section, x)) goto end;\n\t\t}\n\tif (!X509_sign(x,pkey,digest)) goto end;\n\tret=1;\nend:\n\tX509_STORE_CTX_cleanup(&xsc);\n\tif (!ret)\n\t\tERR_print_errors(bio_err);\n\tif (!sno) ASN1_INTEGER_free(bs);\n\treturn ret;\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\tconst EVP_PKEY_ASN1_METHOD *meth;\n\tif (key == NULL) goto error;\n\tif (key->pkey != NULL)\n\t\t{\n\t\tCRYPTO_add(&key->pkey->references, 1, CRYPTO_LOCK_EVP_PKEY);\n\t\treturn key->pkey;\n\t\t}\n\tif (key->public_key == NULL) goto error;\n\tif ((ret = EVP_PKEY_new()) == NULL)\n\t\t{\n\t\tX509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);\n\t\tgoto error;\n\t\t}\n\tmeth = EVP_PKEY_asn1_find(OBJ_obj2nid(key->algor->algorithm));\n\tif (meth)\n\t\t{\n\t\tif (meth->pub_decode)\n\t\t\t{\n\t\t\tif (!meth->pub_decode(ret, key))\n\t\t\t\t{\n\t\t\t\tX509err(X509_F_X509_PUBKEY_GET,\n\t\t\t\t\t\tX509_R_PUBLIC_KEY_DECODE_ERROR);\n\t\t\t\tgoto error;\n\t\t\t\t}\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tX509err(X509_F_X509_PUBKEY_GET,\n\t\t\t\tX509_R_METHOD_NOT_SUPPORTED);\n\t\t\tgoto error;\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\tX509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM);\n\t\tgoto error;\n\t\t}\n\tkey->pkey = ret;\n\tCRYPTO_add(&ret->references, 1, CRYPTO_LOCK_EVP_PKEY);\n\treturn ret;\n\terror:\n\tif (ret != NULL)\n\t\tEVP_PKEY_free(ret);\n\treturn(NULL);\n\t}', 'EVP_PKEY *EVP_PKEY_new(void)\n\t{\n\tEVP_PKEY *ret;\n\tret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));\n\tif (ret == NULL)\n\t\t{\n\t\tEVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->type=EVP_PKEY_NONE;\n\tret->references=1;\n\tret->ameth=NULL;\n\tret->pkey.ptr=NULL;\n\tret->attributes=NULL;\n\tret->save_parameters=1;\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *ret = NULL;\n\textern unsigned char cleanse_ctr;\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        if(ret && (num > 2048))\n                ((unsigned char *)ret)[0] = cleanse_ctr;\n\treturn ret;\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_flags[es->top]=0;\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_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)\n\t{\n\tif (to->type != from->type)\n\t\t{\n\t\tEVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES);\n\t\tgoto err;\n\t\t}\n\tif (EVP_PKEY_missing_parameters(from))\n\t\t{\n\t\tEVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_MISSING_PARAMETERS);\n\t\tgoto err;\n\t\t}\n\tif (from->ameth && from->ameth->param_copy)\n\t\treturn from->ameth->param_copy(to, from);\nerr:\n\treturn 0;\n\t}']