apps/verify.c:128: error: NULL_DEREFERENCE
  pointer `xptmp` last assigned on line 127 could be null and is dereferenced by call to `X509_PURPOSE_get_id()` at line 128, column 15.
Showing all 69 steps of the trace


apps/verify.c:79:1: start of procedure verify_main()
77.   int MAIN(int, char **);
78.   
79. > int MAIN(int argc, char **argv)
80.   	{
81.   	int i,ret=1;

apps/verify.c:81:2: 
79.   int MAIN(int argc, char **argv)
80.   	{
81. > 	int i,ret=1;
82.   	int purpose = -1;
83.   	char *CApath=NULL,*CAfile=NULL;

apps/verify.c:82:2: 
80.   	{
81.   	int i,ret=1;
82. > 	int purpose = -1;
83.   	char *CApath=NULL,*CAfile=NULL;
84.   	char *untfile = NULL;

apps/verify.c:83:2: 
81.   	int i,ret=1;
82.   	int purpose = -1;
83. > 	char *CApath=NULL,*CAfile=NULL;
84.   	char *untfile = NULL;
85.   	STACK_OF(X509) *untrusted = NULL;

apps/verify.c:84:2: 
82.   	int purpose = -1;
83.   	char *CApath=NULL,*CAfile=NULL;
84. > 	char *untfile = NULL;
85.   	STACK_OF(X509) *untrusted = NULL;
86.   	X509_STORE *cert_ctx=NULL;

apps/verify.c:85:2: 
83.   	char *CApath=NULL,*CAfile=NULL;
84.   	char *untfile = NULL;
85. > 	STACK_OF(X509) *untrusted = NULL;
86.   	X509_STORE *cert_ctx=NULL;
87.   	X509_LOOKUP *lookup=NULL;

apps/verify.c:86:2: 
84.   	char *untfile = NULL;
85.   	STACK_OF(X509) *untrusted = NULL;
86. > 	X509_STORE *cert_ctx=NULL;
87.   	X509_LOOKUP *lookup=NULL;
88.   

apps/verify.c:87:2: 
85.   	STACK_OF(X509) *untrusted = NULL;
86.   	X509_STORE *cert_ctx=NULL;
87. > 	X509_LOOKUP *lookup=NULL;
88.   
89.   	cert_ctx=X509_STORE_new();

apps/verify.c:89:2: Skipping X509_STORE_new(): empty list of specs
87.   	X509_LOOKUP *lookup=NULL;
88.   
89.   	cert_ctx=X509_STORE_new();
       ^
90.   	if (cert_ctx == NULL) goto end;
91.   	X509_STORE_set_verify_cb_func(cert_ctx,cb);

apps/verify.c:90:6: Taking false branch
88.   
89.   	cert_ctx=X509_STORE_new();
90.   	if (cert_ctx == NULL) goto end;
           ^
91.   	X509_STORE_set_verify_cb_func(cert_ctx,cb);
92.   

apps/verify.c:91:2: 
89.   	cert_ctx=X509_STORE_new();
90.   	if (cert_ctx == NULL) goto end;
91. > 	X509_STORE_set_verify_cb_func(cert_ctx,cb);
92.   
93.   	ERR_load_crypto_strings();

apps/verify.c:93:2: Skipping ERR_load_crypto_strings(): empty list of specs
91.   	X509_STORE_set_verify_cb_func(cert_ctx,cb);
92.   
93.   	ERR_load_crypto_strings();
       ^
94.   
95.   	apps_startup();

apps/verify.c:95:2: 
93.   	ERR_load_crypto_strings();
94.   
95. > 	apps_startup();
96.   
97.   	if (bio_err == NULL)

apps/verify.c:97:6: Taking true branch
95.   	apps_startup();
96.   
97.   	if (bio_err == NULL)
            ^
98.   		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
99.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);

apps/verify.c:98:7: 
96.   
97.   	if (bio_err == NULL)
98. > 		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
99.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
100.   

crypto/bio/bss_file.c:127:1: start of procedure BIO_s_file()
  125.   	}
  126.   
  127. > BIO_METHOD *BIO_s_file(void)
  128.   	{
  129.   	return(&methods_filep);

crypto/bio/bss_file.c:129:2: 
  127.   BIO_METHOD *BIO_s_file(void)
  128.   	{
  129. > 	return(&methods_filep);
  130.   	}
  131.   

crypto/bio/bss_file.c:130:2: return from a call to BIO_s_file
  128.   	{
  129.   	return(&methods_filep);
  130.   	}
          ^
  131.   
  132.   static int MS_CALLBACK file_new(BIO *bi)

crypto/bio/bio_lib.c:69:1: start of procedure BIO_new()
  67.   static int bio_meth_num=0;
  68.   
  69. > BIO *BIO_new(BIO_METHOD *method)
  70.   	{
  71.   	BIO *ret=NULL;

crypto/bio/bio_lib.c:71:2: 
  69.   BIO *BIO_new(BIO_METHOD *method)
  70.   	{
  71. > 	BIO *ret=NULL;
  72.   
  73.   	ret=(BIO *)Malloc(sizeof(BIO));

crypto/bio/bio_lib.c:73:2: 
  71.   	BIO *ret=NULL;
  72.   
  73. > 	ret=(BIO *)Malloc(sizeof(BIO));
  74.   	if (ret == NULL)
  75.   		{

crypto/mem.c:194:1: start of procedure CRYPTO_malloc()
    192.   	}
    193.   
    194. > void *CRYPTO_malloc(int num, const char *file, int line)
    195.   	{
    196.   	char *ret = NULL;

crypto/mem.c:196:2: 
    194.   void *CRYPTO_malloc(int num, const char *file, int line)
    195.   	{
    196. > 	char *ret = NULL;
    197.   
    198.   	allow_customize = 0;

crypto/mem.c:198:2: 
    196.   	char *ret = NULL;
    197.   
    198. > 	allow_customize = 0;
    199.   	if (malloc_debug_func != NULL)
    200.   		{

crypto/mem.c:199:6: Taking false branch
    197.   
    198.   	allow_customize = 0;
    199.   	if (malloc_debug_func != NULL)
                ^
    200.   		{
    201.   		allow_customize_debug = 0;

crypto/mem.c:204:2: Skipping __function_pointer__(): unresolved function pointer
    202.   		malloc_debug_func(NULL, num, file, line, 0);
    203.   		}
    204.   	ret = malloc_func(num);
            ^
    205.   #ifdef LEVITTE_DEBUG
    206.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);

crypto/mem.c:208:6: Taking false branch
    206.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
    207.   #endif
    208.   	if (malloc_debug_func != NULL)
                ^
    209.   		malloc_debug_func(ret, num, file, line, 1);
    210.   

crypto/mem.c:211:2: 
    209.   		malloc_debug_func(ret, num, file, line, 1);
    210.   
    211. > 	return ret;
    212.   	}
    213.   

crypto/mem.c:212:2: return from a call to CRYPTO_malloc
    210.   
    211.   	return ret;
    212.   	}
            ^
    213.   
    214.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bio/bio_lib.c:74:6: Taking true branch
  72.   
  73.   	ret=(BIO *)Malloc(sizeof(BIO));
  74.   	if (ret == NULL)
             ^
  75.   		{
  76.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);

crypto/bio/bio_lib.c:76:3: 
  74.   	if (ret == NULL)
  75.   		{
  76. > 		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  77.   		return(NULL);
  78.   		}

crypto/err/err.c:246:1: start of procedure ERR_put_error()
    244.   /********************************************************/
    245.   
    246. > void ERR_put_error(int lib, int func, int reason, const char *file,
    247.   	     int line)
    248.   	{

crypto/err/err.c:270:2: Skipping ERR_get_state(): empty list of specs
    268.   	}
    269.   #endif
    270.   	es=ERR_get_state();
            ^
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:272:2: 
    270.   	es=ERR_get_state();
    271.   
    272. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:273:6: Taking false branch
    271.   
    272.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    273.   	if (es->top == es->bottom)
                ^
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:275:2: 
    273.   	if (es->top == es->bottom)
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;

crypto/err/err.c:276:2: 
    274.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276. > 	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);

crypto/err/err.c:277:2: 
    275.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    276.   	es->err_file[es->top]=file;
    277. > 	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}

crypto/err/err.c:278:2: Taking true branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:278:2: Taking false branch
    276.   	es->err_file[es->top]=file;
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
            ^
    279.   	}
    280.   

crypto/err/err.c:279:2: return from a call to ERR_put_error
    277.   	es->err_line[es->top]=line;
    278.   	err_clear_data(es,es->top);
    279.   	}
            ^
    280.   
    281.   void ERR_clear_error(void)

crypto/bio/bio_lib.c:77:3: 
  75.   		{
  76.   		BIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);
  77. > 		return(NULL);
  78.   		}
  79.   	if (!BIO_set(ret,method))

crypto/bio/bio_lib.c:85:2: return from a call to BIO_new
  83.   		}
  84.   	return(ret);
  85.   	}
         ^
  86.   
  87.   int BIO_set(BIO *bio, BIO_METHOD *method)

apps/verify.c:98:7: Taking false branch
96.   
97.   	if (bio_err == NULL)
98.   		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
             ^
99.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
100.   

apps/verify.c:101:2: 
99.   			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
100.   
101. > 	argc--;
102.   	argv++;
103.   	for (;;)

apps/verify.c:102:2: 
100.   
101.   	argc--;
102. > 	argv++;
103.   	for (;;)
104.   		{

apps/verify.c:148:3: Loop condition is true. Entering loop body
146.   		else
147.   			break;
148.   		}
         ^
149.   
150.   	lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());

apps/verify.c:105:7: Taking true branch
103.   	for (;;)
104.   		{
105.   		if (argc >= 1)
             ^
106.   			{
107.   			if (strcmp(*argv,"-CApath") == 0)

apps/verify.c:107:8: Taking false branch
105.   		if (argc >= 1)
106.   			{
107.   			if (strcmp(*argv,"-CApath") == 0)
              ^
108.   				{
109.   				if (argc-- < 1) goto end;

apps/verify.c:112:13: Taking false branch
110.   				CApath= *(++argv);
111.   				}
112.   			else if (strcmp(*argv,"-CAfile") == 0)
                   ^
113.   				{
114.   				if (argc-- < 1) goto end;

apps/verify.c:117:13: Taking true branch
115.   				CAfile= *(++argv);
116.   				}
117.   			else if (strcmp(*argv,"-purpose") == 0)
                   ^
118.   				{
119.   				X509_PURPOSE *xptmp;

apps/verify.c:120:9: Taking false branch
118.   				{
119.   				X509_PURPOSE *xptmp;
120.   				if (argc-- < 1) goto end;
               ^
121.   				i = X509_PURPOSE_get_by_sname(*(++argv));
122.   				if(i < 0)

apps/verify.c:121:5: Skipping X509_PURPOSE_get_by_sname(): empty list of specs
119.   				X509_PURPOSE *xptmp;
120.   				if (argc-- < 1) goto end;
121.   				i = X509_PURPOSE_get_by_sname(*(++argv));
           ^
122.   				if(i < 0)
123.   					{

apps/verify.c:122:8: Taking false branch
120.   				if (argc-- < 1) goto end;
121.   				i = X509_PURPOSE_get_by_sname(*(++argv));
122.   				if(i < 0)
              ^
123.   					{
124.   					BIO_printf(bio_err, "unrecognized purpose\n");

apps/verify.c:127:5: 
125.   					goto end;
126.   					}
127. > 				xptmp = X509_PURPOSE_get0(i);
128.   				purpose = X509_PURPOSE_get_id(xptmp);
129.   				}

crypto/x509v3/v3_purp.c:120:1: start of procedure X509_PURPOSE_get0()
  118.   }
  119.   
  120. > X509_PURPOSE * X509_PURPOSE_get0(int idx)
  121.   {
  122.   	if(idx < 0) return NULL;

crypto/x509v3/v3_purp.c:122:5: Taking false branch
  120.   X509_PURPOSE * X509_PURPOSE_get0(int idx)
  121.   {
  122.   	if(idx < 0) return NULL;
             ^
  123.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  124.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);

crypto/x509v3/v3_purp.c:123:5: Taking false branch
  121.   {
  122.   	if(idx < 0) return NULL;
  123.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
             ^
  124.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  125.   }

crypto/x509v3/v3_purp.c:124:2: 
  122.   	if(idx < 0) return NULL;
  123.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  124. > 	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  125.   }
  126.   

crypto/x509v3/v3_purp.c:89:1: start of procedure sk_X509_PURPOSE_value()
    87.   #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
    88.   
    89. > IMPLEMENT_STACK_OF(X509_PURPOSE)
    90.   
    91.   static STACK_OF(X509_PURPOSE) *xptable = NULL;

crypto/stack/stack.c:289:1: start of procedure sk_value()
      287.   }
      288.   
      289. > char *sk_value(STACK *st, int i)
      290.   {
      291.   	if(st == NULL) return NULL;

crypto/stack/stack.c:291:5: Taking true branch
      289.   char *sk_value(STACK *st, int i)
      290.   {
      291.   	if(st == NULL) return NULL;
                 ^
      292.   	return st->data[i];
      293.   }

crypto/stack/stack.c:291:17: 
      289.   char *sk_value(STACK *st, int i)
      290.   {
      291. > 	if(st == NULL) return NULL;
      292.   	return st->data[i];
      293.   }

crypto/stack/stack.c:293:1: return from a call to sk_value
      291.   	if(st == NULL) return NULL;
      292.   	return st->data[i];
      293. > }
      294.   
      295.   char *sk_set(STACK *st, int i, char *value)

crypto/x509v3/v3_purp.c:89:1: return from a call to sk_X509_PURPOSE_value
    87.   #define X509_PURPOSE_COUNT (sizeof(xstandard)/sizeof(X509_PURPOSE))
    88.   
    89. > IMPLEMENT_STACK_OF(X509_PURPOSE)
    90.   
    91.   static STACK_OF(X509_PURPOSE) *xptable = NULL;

crypto/x509v3/v3_purp.c:125:1: return from a call to X509_PURPOSE_get0
  123.   	if(idx < X509_PURPOSE_COUNT) return xstandard + idx;
  124.   	return sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);
  125. > }
  126.   
  127.   int X509_PURPOSE_get_by_sname(char *sname)

apps/verify.c:128:5: 
126.   					}
127.   				xptmp = X509_PURPOSE_get0(i);
128. > 				purpose = X509_PURPOSE_get_id(xptmp);
129.   				}
130.   			else if (strcmp(*argv,"-untrusted") == 0)

crypto/x509v3/v3_purp.c:230:1: start of procedure X509_PURPOSE_get_id()
  228.   }
  229.   
  230. > int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  231.   {
  232.   	return xp->purpose;

crypto/x509v3/v3_purp.c:232:2: 
  230.   int X509_PURPOSE_get_id(X509_PURPOSE *xp)
  231.   {
  232. > 	return xp->purpose;
  233.   }
  234.   

int MAIN(int argc, char **argv)
	{
	int i,ret=1;
	int purpose = -1;
	char *CApath=NULL,*CAfile=NULL;
	char *untfile = NULL;
	STACK_OF(X509) *untrusted = NULL;
	X509_STORE *cert_ctx=NULL;
	X509_LOOKUP *lookup=NULL;
	cert_ctx=X509_STORE_new();
	if (cert_ctx == NULL) goto end;
	X509_STORE_set_verify_cb_func(cert_ctx,cb);
	ERR_load_crypto_strings();
	apps_startup();
	if (bio_err == NULL)
		if ((bio_err=BIO_new(BIO_s_file())) != NULL)
			BIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);
	argc--;
	argv++;
	for (;;)
		{
		if (argc >= 1)
			{
			if (strcmp(*argv,"-CApath") == 0)
				{
				if (argc-- < 1) goto end;
				CApath= *(++argv);
				}
			else if (strcmp(*argv,"-CAfile") == 0)
				{
				if (argc-- < 1) goto end;
				CAfile= *(++argv);
				}
			else if (strcmp(*argv,"-purpose") == 0)
				{
				X509_PURPOSE *xptmp;
				if (argc-- < 1) goto end;
				i = X509_PURPOSE_get_by_sname(*(++argv));
				if(i < 0)
					{
					BIO_printf(bio_err, "unrecognized purpose\n");
					goto end;
					}
				xptmp = X509_PURPOSE_get0(i);
				purpose = X509_PURPOSE_get_id(xptmp);
				}
			else if (strcmp(*argv,"-untrusted") == 0)
				{
				if (argc-- < 1) goto end;
				untfile= *(++argv);
				}
			else if (strcmp(*argv,"-help") == 0)
				goto end;
			else if (strcmp(*argv,"-verbose") == 0)
				v_verbose=1;
			else if (argv[0][0] == '-')
				goto end;
			else
				break;
			argc--;
			argv++;
			}
		else
			break;
		}
	lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());
	if (lookup == NULL) abort();
	if (CAfile) {
		i=X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM);
		if(!i) {
			BIO_printf(bio_err, "Error loading file %s\n", CAfile);
			ERR_print_errors(bio_err);
			goto end;
		}
	} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);
	lookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_hash_dir());
	if (lookup == NULL) abort();
	if (CApath) {
		i=X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM);
		if(!i) {
			BIO_printf(bio_err, "Error loading directory %s\n", CApath);
			ERR_print_errors(bio_err);
			goto end;
		}
	} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);
	ERR_clear_error();
	if(untfile) {
		if(!(untrusted = load_untrusted(untfile))) {
			BIO_printf(bio_err, "Error loading untrusted file %s\n", untfile);
			ERR_print_errors(bio_err);
			goto end;
		}
	}
	if (argc < 1) check(cert_ctx, NULL, untrusted, purpose);
	else
		for (i=0; i<argc; i++)
			check(cert_ctx,argv[i], untrusted, purpose);
	ret=0;
end:
	if (ret == 1) {
		BIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] cert1 cert2 ...\n");
		BIO_printf(bio_err,"recognized usages:\n");
		for(i = 0; i < X509_PURPOSE_get_count(); i++) {
			X509_PURPOSE *ptmp;
			ptmp = X509_PURPOSE_get0(i);
			BIO_printf(bio_err, "\t%-10s\t%s\n", X509_PURPOSE_get0_sname(ptmp),
								X509_PURPOSE_get0_name(ptmp));
		}
	}
	if (cert_ctx != NULL) X509_STORE_free(cert_ctx);
	sk_X509_pop_free(untrusted, X509_free);
	EXIT(ret);
	}
['int MAIN(int argc, char **argv)\n\t{\n\tint i,ret=1;\n\tint purpose = -1;\n\tchar *CApath=NULL,*CAfile=NULL;\n\tchar *untfile = NULL;\n\tSTACK_OF(X509) *untrusted = NULL;\n\tX509_STORE *cert_ctx=NULL;\n\tX509_LOOKUP *lookup=NULL;\n\tcert_ctx=X509_STORE_new();\n\tif (cert_ctx == NULL) goto end;\n\tX509_STORE_set_verify_cb_func(cert_ctx,cb);\n\tERR_load_crypto_strings();\n\tapps_startup();\n\tif (bio_err == NULL)\n\t\tif ((bio_err=BIO_new(BIO_s_file())) != NULL)\n\t\t\tBIO_set_fp(bio_err,stderr,BIO_NOCLOSE|BIO_FP_TEXT);\n\targc--;\n\targv++;\n\tfor (;;)\n\t\t{\n\t\tif (argc >= 1)\n\t\t\t{\n\t\t\tif (strcmp(*argv,"-CApath") == 0)\n\t\t\t\t{\n\t\t\t\tif (argc-- < 1) goto end;\n\t\t\t\tCApath= *(++argv);\n\t\t\t\t}\n\t\t\telse if (strcmp(*argv,"-CAfile") == 0)\n\t\t\t\t{\n\t\t\t\tif (argc-- < 1) goto end;\n\t\t\t\tCAfile= *(++argv);\n\t\t\t\t}\n\t\t\telse if (strcmp(*argv,"-purpose") == 0)\n\t\t\t\t{\n\t\t\t\tX509_PURPOSE *xptmp;\n\t\t\t\tif (argc-- < 1) goto end;\n\t\t\t\ti = X509_PURPOSE_get_by_sname(*(++argv));\n\t\t\t\tif(i < 0)\n\t\t\t\t\t{\n\t\t\t\t\tBIO_printf(bio_err, "unrecognized purpose\\n");\n\t\t\t\t\tgoto end;\n\t\t\t\t\t}\n\t\t\t\txptmp = X509_PURPOSE_get0(i);\n\t\t\t\tpurpose = X509_PURPOSE_get_id(xptmp);\n\t\t\t\t}\n\t\t\telse if (strcmp(*argv,"-untrusted") == 0)\n\t\t\t\t{\n\t\t\t\tif (argc-- < 1) goto end;\n\t\t\t\tuntfile= *(++argv);\n\t\t\t\t}\n\t\t\telse if (strcmp(*argv,"-help") == 0)\n\t\t\t\tgoto end;\n\t\t\telse if (strcmp(*argv,"-verbose") == 0)\n\t\t\t\tv_verbose=1;\n\t\t\telse if (argv[0][0] == \'-\')\n\t\t\t\tgoto end;\n\t\t\telse\n\t\t\t\tbreak;\n\t\t\targc--;\n\t\t\targv++;\n\t\t\t}\n\t\telse\n\t\t\tbreak;\n\t\t}\n\tlookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_file());\n\tif (lookup == NULL) abort();\n\tif (CAfile) {\n\t\ti=X509_LOOKUP_load_file(lookup,CAfile,X509_FILETYPE_PEM);\n\t\tif(!i) {\n\t\t\tBIO_printf(bio_err, "Error loading file %s\\n", CAfile);\n\t\t\tERR_print_errors(bio_err);\n\t\t\tgoto end;\n\t\t}\n\t} else X509_LOOKUP_load_file(lookup,NULL,X509_FILETYPE_DEFAULT);\n\tlookup=X509_STORE_add_lookup(cert_ctx,X509_LOOKUP_hash_dir());\n\tif (lookup == NULL) abort();\n\tif (CApath) {\n\t\ti=X509_LOOKUP_add_dir(lookup,CApath,X509_FILETYPE_PEM);\n\t\tif(!i) {\n\t\t\tBIO_printf(bio_err, "Error loading directory %s\\n", CApath);\n\t\t\tERR_print_errors(bio_err);\n\t\t\tgoto end;\n\t\t}\n\t} else X509_LOOKUP_add_dir(lookup,NULL,X509_FILETYPE_DEFAULT);\n\tERR_clear_error();\n\tif(untfile) {\n\t\tif(!(untrusted = load_untrusted(untfile))) {\n\t\t\tBIO_printf(bio_err, "Error loading untrusted file %s\\n", untfile);\n\t\t\tERR_print_errors(bio_err);\n\t\t\tgoto end;\n\t\t}\n\t}\n\tif (argc < 1) check(cert_ctx, NULL, untrusted, purpose);\n\telse\n\t\tfor (i=0; i<argc; i++)\n\t\t\tcheck(cert_ctx,argv[i], untrusted, purpose);\n\tret=0;\nend:\n\tif (ret == 1) {\n\t\tBIO_printf(bio_err,"usage: verify [-verbose] [-CApath path] [-CAfile file] cert1 cert2 ...\\n");\n\t\tBIO_printf(bio_err,"recognized usages:\\n");\n\t\tfor(i = 0; i < X509_PURPOSE_get_count(); i++) {\n\t\t\tX509_PURPOSE *ptmp;\n\t\t\tptmp = X509_PURPOSE_get0(i);\n\t\t\tBIO_printf(bio_err, "\\t%-10s\\t%s\\n", X509_PURPOSE_get0_sname(ptmp),\n\t\t\t\t\t\t\t\tX509_PURPOSE_get0_name(ptmp));\n\t\t}\n\t}\n\tif (cert_ctx != NULL) X509_STORE_free(cert_ctx);\n\tsk_X509_pop_free(untrusted, X509_free);\n\tEXIT(ret);\n\t}', 'BIO_METHOD *BIO_s_file(void)\n\t{\n\treturn(&methods_filep);\n\t}', 'BIO *BIO_new(BIO_METHOD *method)\n\t{\n\tBIO *ret=NULL;\n\tret=(BIO *)Malloc(sizeof(BIO));\n\tif (ret == NULL)\n\t\t{\n\t\tBIOerr(BIO_F_BIO_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tif (!BIO_set(ret,method))\n\t\t{\n\t\tFree(ret);\n\t\tret=NULL;\n\t\t}\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tchar *ret = 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_func(num);\n#ifdef LEVITTE_DEBUG\n\tfprintf(stderr, "LEVITTE_DEBUG:         > 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\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_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}', 'X509_PURPOSE * X509_PURPOSE_get0(int idx)\n{\n\tif(idx < 0) return NULL;\n\tif(idx < X509_PURPOSE_COUNT) return xstandard + idx;\n\treturn sk_X509_PURPOSE_value(xptable, idx - X509_PURPOSE_COUNT);\n}', 'IMPLEMENT_STACK_OF(X509_PURPOSE)', 'char *sk_value(STACK *st, int i)\n{\n\tif(st == NULL) return NULL;\n\treturn st->data[i];\n}', 'int X509_PURPOSE_get_id(X509_PURPOSE *xp)\n{\n\treturn xp->purpose;\n}']