ssl/ssl_rsa.c:197: error: NULL_DEREFERENCE
  pointer `pktmp` last assigned on line 196 could be null and is dereferenced by call to `EVP_PKEY_copy_parameters()` at line 197, column 3.
Showing all 80 steps of the trace


ssl/ssl_rsa.c:182:1: start of procedure ssl_set_pkey()
180.   #endif
181.   
182. > static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
183.   	{
184.   	int i;

ssl/ssl_rsa.c:186:2: 
184.   	int i;
185.   
186. > 	i=ssl_cert_type(NULL,pkey);
187.   	if (i < 0)
188.   		{

ssl/s3_both.c:497:1: start of procedure ssl_cert_type()
  495.   	}
  496.   
  497. > int ssl_cert_type(X509 *x, EVP_PKEY *pkey)
  498.   	{
  499.   	EVP_PKEY *pk;

ssl/s3_both.c:500:2: 
  498.   	{
  499.   	EVP_PKEY *pk;
  500. > 	int ret= -1,i;
  501.   
  502.   	if (pkey == NULL)

ssl/s3_both.c:502:6: Taking false branch
  500.   	int ret= -1,i;
  501.   
  502.   	if (pkey == NULL)
              ^
  503.   		pk=X509_get_pubkey(x);
  504.   	else

ssl/s3_both.c:505:3: 
  503.   		pk=X509_get_pubkey(x);
  504.   	else
  505. > 		pk=pkey;
  506.   	if (pk == NULL) goto err;
  507.   

ssl/s3_both.c:506:6: Taking false branch
  504.   	else
  505.   		pk=pkey;
  506.   	if (pk == NULL) goto err;
              ^
  507.   
  508.   	i=pk->type;

ssl/s3_both.c:508:2: 
  506.   	if (pk == NULL) goto err;
  507.   
  508. > 	i=pk->type;
  509.   	if (i == EVP_PKEY_RSA)
  510.   		{

ssl/s3_both.c:509:6: Taking true branch
  507.   
  508.   	i=pk->type;
  509.   	if (i == EVP_PKEY_RSA)
              ^
  510.   		{
  511.   		ret=SSL_PKEY_RSA_ENC;

ssl/s3_both.c:511:3: 
  509.   	if (i == EVP_PKEY_RSA)
  510.   		{
  511. > 		ret=SSL_PKEY_RSA_ENC;
  512.   		}
  513.   	else if (i == EVP_PKEY_DSA)

ssl/s3_both.c:524:1: 
  522.   #endif
  523.   
  524. > err:
  525.   	if(!pkey) EVP_PKEY_free(pk);
  526.   	return(ret);

ssl/s3_both.c:525:6: Taking false branch
  523.   
  524.   err:
  525.   	if(!pkey) EVP_PKEY_free(pk);
              ^
  526.   	return(ret);
  527.   	}

ssl/s3_both.c:526:2: 
  524.   err:
  525.   	if(!pkey) EVP_PKEY_free(pk);
  526. > 	return(ret);
  527.   	}
  528.   

ssl/s3_both.c:527:2: return from a call to ssl_cert_type
  525.   	if(!pkey) EVP_PKEY_free(pk);
  526.   	return(ret);
  527.   	}
          ^
  528.   
  529.   int ssl_verify_alarm_type(long type)

ssl/ssl_rsa.c:187:6: Taking false branch
185.   
186.   	i=ssl_cert_type(NULL,pkey);
187.   	if (i < 0)
            ^
188.   		{
189.   		SSLerr(SSL_F_SSL_SET_PKEY,SSL_R_UNKNOWN_CERTIFICATE_TYPE);

ssl/ssl_rsa.c:193:6: Taking true branch
191.   		}
192.   
193.   	if (c->pkeys[i].x509 != NULL)
            ^
194.   		{
195.   		EVP_PKEY *pktmp;

ssl/ssl_rsa.c:196:3: 
194.   		{
195.   		EVP_PKEY *pktmp;
196. > 		pktmp =	X509_get_pubkey(c->pkeys[i].x509);
197.   		EVP_PKEY_copy_parameters(pktmp,pkey);
198.   		EVP_PKEY_free(pktmp);

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:133:1: start of procedure X509_PUBKEY_get()
    131.   	}
    132.   
    133. > EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    134.   	{
    135.   	EVP_PKEY *ret=NULL;

crypto/asn1/x_pubkey.c:135:2: 
    133.   EVP_PKEY *X509_PUBKEY_get(X509_PUBKEY *key)
    134.   	{
    135. > 	EVP_PKEY *ret=NULL;
    136.   
    137.   	if (key == NULL) goto error;

crypto/asn1/x_pubkey.c:137:6: Taking false branch
    135.   	EVP_PKEY *ret=NULL;
    136.   
    137.   	if (key == NULL) goto error;
                ^
    138.   
    139.   	if (key->pkey != NULL)

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

crypto/asn1/x_pubkey.c:145:6: Taking false branch
    143.   		}
    144.   
    145.   	if (key->public_key == NULL) goto error;
                ^
    146.   
    147.   	if ((ret = EVP_PKEY_new()) == NULL)

crypto/asn1/x_pubkey.c:147:6: 
    145.   	if (key->public_key == NULL) goto error;
    146.   
    147. > 	if ((ret = EVP_PKEY_new()) == NULL)
    148.   		{
    149.   		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);

crypto/evp/p_lib.c:173:1: start of procedure EVP_PKEY_new()
      171.   	}
      172.   
      173. > EVP_PKEY *EVP_PKEY_new(void)
      174.   	{
      175.   	EVP_PKEY *ret;

crypto/evp/p_lib.c:177:2: 
      175.   	EVP_PKEY *ret;
      176.   
      177. > 	ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
      178.   	if (ret == NULL)
      179.   		{

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:178:6: Taking true branch
      176.   
      177.   	ret=(EVP_PKEY *)OPENSSL_malloc(sizeof(EVP_PKEY));
      178.   	if (ret == NULL)
                  ^
      179.   		{
      180.   		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);

crypto/evp/p_lib.c:180:3: 
      178.   	if (ret == NULL)
      179.   		{
      180. > 		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
      181.   		return(NULL);
      182.   		}

crypto/err/err.c:679:1: start of procedure ERR_put_error()
        677.   /********************************************************/
        678.   
        679. > void ERR_put_error(int lib, int func, int reason, const char *file,
        680.   	     int line)
        681.   	{

crypto/err/err.c:703:2: Skipping ERR_get_state(): empty list of specs
        701.   	}
        702.   #endif
        703.   	es=ERR_get_state();
                ^
        704.   
        705.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:705:2: 
        703.   	es=ERR_get_state();
        704.   
        705. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
        706.   	if (es->top == es->bottom)
        707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:6: Taking false branch
        704.   
        705.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
        706.   	if (es->top == es->bottom)
                    ^
        707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        708.   	es->err_flags[es->top]=0;

crypto/err/err.c:708:2: 
        706.   	if (es->top == es->bottom)
        707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        708. > 	es->err_flags[es->top]=0;
        709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        710.   	es->err_file[es->top]=file;

crypto/err/err.c:709:2: 
        707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
        708.   	es->err_flags[es->top]=0;
        709. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        710.   	es->err_file[es->top]=file;
        711.   	es->err_line[es->top]=line;

crypto/err/err.c:710:2: 
        708.   	es->err_flags[es->top]=0;
        709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        710. > 	es->err_file[es->top]=file;
        711.   	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);

crypto/err/err.c:711:2: 
        709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
        710.   	es->err_file[es->top]=file;
        711. > 	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);
        713.   	}

crypto/err/err.c:712:2: Taking true branch
        710.   	es->err_file[es->top]=file;
        711.   	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);
                ^
        713.   	}
        714.   

crypto/err/err.c:712:2: Taking false branch
        710.   	es->err_file[es->top]=file;
        711.   	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);
                ^
        713.   	}
        714.   

crypto/err/err.c:712:2: Loop condition is false. Leaving loop
        710.   	es->err_file[es->top]=file;
        711.   	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);
                ^
        713.   	}
        714.   

crypto/err/err.c:713:2: return from a call to ERR_put_error
        711.   	es->err_line[es->top]=line;
        712.   	err_clear_data(es,es->top);
        713.   	}
                ^
        714.   
        715.   void ERR_clear_error(void)

crypto/evp/p_lib.c:181:3: 
      179.   		{
      180.   		EVPerr(EVP_F_EVP_PKEY_NEW,ERR_R_MALLOC_FAILURE);
      181. > 		return(NULL);
      182.   		}
      183.   	ret->type=EVP_PKEY_NONE;

crypto/evp/p_lib.c:192:2: return from a call to EVP_PKEY_new
      190.   	ret->save_parameters=1;
      191.   	return(ret);
      192.   	}
              ^
      193.   
      194.   /* Setup a public key ASN1 method and ENGINE from a NID or a string.

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

crypto/asn1/x_pubkey.c:149:3: 
    147.   	if ((ret = EVP_PKEY_new()) == NULL)
    148.   		{
    149. > 		X509err(X509_F_X509_PUBKEY_GET, ERR_R_MALLOC_FAILURE);
    150.   		goto error;
    151.   		}

crypto/err/err.c:679:1: start of procedure ERR_put_error()
      677.   /********************************************************/
      678.   
      679. > void ERR_put_error(int lib, int func, int reason, const char *file,
      680.   	     int line)
      681.   	{

crypto/err/err.c:703:2: Skipping ERR_get_state(): empty list of specs
      701.   	}
      702.   #endif
      703.   	es=ERR_get_state();
              ^
      704.   
      705.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:705:2: 
      703.   	es=ERR_get_state();
      704.   
      705. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
      706.   	if (es->top == es->bottom)
      707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:706:6: Taking false branch
      704.   
      705.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
      706.   	if (es->top == es->bottom)
                  ^
      707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      708.   	es->err_flags[es->top]=0;

crypto/err/err.c:708:2: 
      706.   	if (es->top == es->bottom)
      707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      708. > 	es->err_flags[es->top]=0;
      709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      710.   	es->err_file[es->top]=file;

crypto/err/err.c:709:2: 
      707.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
      708.   	es->err_flags[es->top]=0;
      709. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      710.   	es->err_file[es->top]=file;
      711.   	es->err_line[es->top]=line;

crypto/err/err.c:710:2: 
      708.   	es->err_flags[es->top]=0;
      709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      710. > 	es->err_file[es->top]=file;
      711.   	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);

crypto/err/err.c:711:2: 
      709.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
      710.   	es->err_file[es->top]=file;
      711. > 	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);
      713.   	}

crypto/err/err.c:712:2: Taking true branch
      710.   	es->err_file[es->top]=file;
      711.   	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);
              ^
      713.   	}
      714.   

crypto/err/err.c:712:2: Taking false branch
      710.   	es->err_file[es->top]=file;
      711.   	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);
              ^
      713.   	}
      714.   

crypto/err/err.c:712:2: Loop condition is false. Leaving loop
      710.   	es->err_file[es->top]=file;
      711.   	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);
              ^
      713.   	}
      714.   

crypto/err/err.c:713:2: return from a call to ERR_put_error
      711.   	es->err_line[es->top]=line;
      712.   	err_clear_data(es,es->top);
      713.   	}
              ^
      714.   
      715.   void ERR_clear_error(void)

crypto/asn1/x_pubkey.c:179:2: 
    177.   	return ret;
    178.   
    179. > 	error:
    180.   	if (ret != NULL)
    181.   		EVP_PKEY_free(ret);

crypto/asn1/x_pubkey.c:180:6: Taking false branch
    178.   
    179.   	error:
    180.   	if (ret != NULL)
                ^
    181.   		EVP_PKEY_free(ret);
    182.   	return(NULL);

crypto/asn1/x_pubkey.c:182:2: 
    180.   	if (ret != NULL)
    181.   		EVP_PKEY_free(ret);
    182. > 	return(NULL);
    183.   	}
    184.   

crypto/asn1/x_pubkey.c:183:2: return from a call to X509_PUBKEY_get
    181.   		EVP_PKEY_free(ret);
    182.   	return(NULL);
    183.   	}
            ^
    184.   
    185.   /* 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)

ssl/ssl_rsa.c:197:3: 
195.   		EVP_PKEY *pktmp;
196.   		pktmp =	X509_get_pubkey(c->pkeys[i].x509);
197. > 		EVP_PKEY_copy_parameters(pktmp,pkey);
198.   		EVP_PKEY_free(pktmp);
199.   		ERR_clear_error();

crypto/evp/p_lib.c:124:1: start of procedure EVP_PKEY_copy_parameters()
  122.   	}
  123.   
  124. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  125.   	{
  126.   	if (to->type != from->type)

crypto/evp/p_lib.c:126:6: 
  124.   int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  125.   	{
  126. > 	if (to->type != from->type)
  127.   		{
  128.   		EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS,EVP_R_DIFFERENT_KEY_TYPES);

static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)
	{
	int i;
	i=ssl_cert_type(NULL,pkey);
	if (i < 0)
		{
		SSLerr(SSL_F_SSL_SET_PKEY,SSL_R_UNKNOWN_CERTIFICATE_TYPE);
		return(0);
		}
	if (c->pkeys[i].x509 != NULL)
		{
		EVP_PKEY *pktmp;
		pktmp =	X509_get_pubkey(c->pkeys[i].x509);
		EVP_PKEY_copy_parameters(pktmp,pkey);
		EVP_PKEY_free(pktmp);
		ERR_clear_error();
#ifndef OPENSSL_NO_RSA
		if ((pkey->type == EVP_PKEY_RSA) &&
			(RSA_flags(pkey->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK))
			;
		else
#endif
		if (!X509_check_private_key(c->pkeys[i].x509,pkey))
			{
			X509_free(c->pkeys[i].x509);
			c->pkeys[i].x509 = NULL;
			return 0;
			}
		}
	if (c->pkeys[i].privatekey != NULL)
		EVP_PKEY_free(c->pkeys[i].privatekey);
	CRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);
	c->pkeys[i].privatekey=pkey;
	c->key= &(c->pkeys[i]);
	c->valid=0;
	return(1);
	}
['static int ssl_set_pkey(CERT *c, EVP_PKEY *pkey)\n\t{\n\tint i;\n\ti=ssl_cert_type(NULL,pkey);\n\tif (i < 0)\n\t\t{\n\t\tSSLerr(SSL_F_SSL_SET_PKEY,SSL_R_UNKNOWN_CERTIFICATE_TYPE);\n\t\treturn(0);\n\t\t}\n\tif (c->pkeys[i].x509 != NULL)\n\t\t{\n\t\tEVP_PKEY *pktmp;\n\t\tpktmp =\tX509_get_pubkey(c->pkeys[i].x509);\n\t\tEVP_PKEY_copy_parameters(pktmp,pkey);\n\t\tEVP_PKEY_free(pktmp);\n\t\tERR_clear_error();\n#ifndef OPENSSL_NO_RSA\n\t\tif ((pkey->type == EVP_PKEY_RSA) &&\n\t\t\t(RSA_flags(pkey->pkey.rsa) & RSA_METHOD_FLAG_NO_CHECK))\n\t\t\t;\n\t\telse\n#endif\n\t\tif (!X509_check_private_key(c->pkeys[i].x509,pkey))\n\t\t\t{\n\t\t\tX509_free(c->pkeys[i].x509);\n\t\t\tc->pkeys[i].x509 = NULL;\n\t\t\treturn 0;\n\t\t\t}\n\t\t}\n\tif (c->pkeys[i].privatekey != NULL)\n\t\tEVP_PKEY_free(c->pkeys[i].privatekey);\n\tCRYPTO_add(&pkey->references,1,CRYPTO_LOCK_EVP_PKEY);\n\tc->pkeys[i].privatekey=pkey;\n\tc->key= &(c->pkeys[i]);\n\tc->valid=0;\n\treturn(1);\n\t}', 'int ssl_cert_type(X509 *x, EVP_PKEY *pkey)\n\t{\n\tEVP_PKEY *pk;\n\tint ret= -1,i;\n\tif (pkey == NULL)\n\t\tpk=X509_get_pubkey(x);\n\telse\n\t\tpk=pkey;\n\tif (pk == NULL) goto err;\n\ti=pk->type;\n\tif (i == EVP_PKEY_RSA)\n\t\t{\n\t\tret=SSL_PKEY_RSA_ENC;\n\t\t}\n\telse if (i == EVP_PKEY_DSA)\n\t\t{\n\t\tret=SSL_PKEY_DSA_SIGN;\n\t\t}\n#ifndef OPENSSL_NO_EC\n\telse if (i == EVP_PKEY_EC)\n\t\t{\n\t\tret = SSL_PKEY_ECC;\n\t\t}\n#endif\nerr:\n\tif(!pkey) EVP_PKEY_free(pk);\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\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\tif (!EVP_PKEY_set_type(ret, OBJ_obj2nid(key->algor->algorithm)))\n\t\t{\n\t\tX509err(X509_F_X509_PUBKEY_GET,X509_R_UNSUPPORTED_ALGORITHM);\n\t\tgoto error;\n\t\t}\n\tif (ret->ameth->pub_decode)\n\t\t{\n\t\tif (!ret->ameth->pub_decode(ret, key))\n\t\t\t{\n\t\t\tX509err(X509_F_X509_PUBKEY_GET,\n\t\t\t\t\t\tX509_R_PUBLIC_KEY_DECODE_ERROR);\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_METHOD_NOT_SUPPORTED);\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->save_type=EVP_PKEY_NONE;\n\tret->references=1;\n\tret->ameth=NULL;\n\tret->engine=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}']