crypto/rsa/rsa_gen.c:186: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 91 could be null and is dereferenced by call to `BN_CTX_end()` at line 186, column 2.
Showing all 56 steps of the trace


crypto/rsa/rsa_gen.c:85:1: start of procedure rsa_builtin_keygen()
83.   	}
84.   
85. > static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
86.   	{
87.   	BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;

crypto/rsa/rsa_gen.c:87:2: 
85.   static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
86.   	{
87. > 	BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
88.   	int bitsp,bitsq,ok= -1,n=0;
89.   	BN_CTX *ctx=NULL;

crypto/rsa/rsa_gen.c:88:2: 
86.   	{
87.   	BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
88. > 	int bitsp,bitsq,ok= -1,n=0;
89.   	BN_CTX *ctx=NULL;
90.   

crypto/rsa/rsa_gen.c:89:2: 
87.   	BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
88.   	int bitsp,bitsq,ok= -1,n=0;
89. > 	BN_CTX *ctx=NULL;
90.   
91.   	ctx=BN_CTX_new();

crypto/rsa/rsa_gen.c:91:2: 
89.   	BN_CTX *ctx=NULL;
90.   
91. > 	ctx=BN_CTX_new();
92.   	if (ctx == NULL) goto err;
93.   	BN_CTX_start(ctx);

crypto/bn/bn_ctx.c:214:1: start of procedure BN_CTX_new()
  212.   #endif
  213.   
  214. > BN_CTX *BN_CTX_new(void)
  215.   	{
  216.   	BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));

crypto/bn/bn_ctx.c:216:2: 
  214.   BN_CTX *BN_CTX_new(void)
  215.   	{
  216. > 	BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));
  217.   	if(!ret)
  218.   		{

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/bn/bn_ctx.c:217:6: Taking true branch
  215.   	{
  216.   	BN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));
  217.   	if(!ret)
              ^
  218.   		{
  219.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_ctx.c:219:3: 
  217.   	if(!ret)
  218.   		{
  219. > 		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
  220.   		return NULL;
  221.   		}

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

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

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

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

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

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

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

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

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

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

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

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

crypto/bn/bn_ctx.c:220:3: 
  218.   		{
  219.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);
  220. > 		return NULL;
  221.   		}
  222.   	/* Initialise the structure */

crypto/bn/bn_ctx.c:229:2: return from a call to BN_CTX_new
  227.   	ret->too_many = 0;
  228.   	return ret;
  229.   	}
          ^
  230.   
  231.   void BN_CTX_free(BN_CTX *ctx)

crypto/rsa/rsa_gen.c:92:6: Taking true branch
90.   
91.   	ctx=BN_CTX_new();
92.   	if (ctx == NULL) goto err;
           ^
93.   	BN_CTX_start(ctx);
94.   	r0 = BN_CTX_get(ctx);

crypto/rsa/rsa_gen.c:180:1: 
178.   
179.   	ok=1;
180. > err:
181.   	if (ok == -1)
182.   		{

crypto/rsa/rsa_gen.c:181:6: Taking true branch
179.   	ok=1;
180.   err:
181.   	if (ok == -1)
            ^
182.   		{
183.   		RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);

crypto/rsa/rsa_gen.c:183:3: 
181.   	if (ok == -1)
182.   		{
183. > 		RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);
184.   		ok=0;
185.   		}

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

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

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

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

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

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

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

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

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

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

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

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

crypto/rsa/rsa_gen.c:184:3: 
182.   		{
183.   		RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);
184. > 		ok=0;
185.   		}
186.   	BN_CTX_end(ctx);

crypto/rsa/rsa_gen.c:186:2: 
184.   		ok=0;
185.   		}
186. > 	BN_CTX_end(ctx);
187.   	BN_CTX_free(ctx);
188.   

crypto/bn/bn_ctx.c:270:1: start of procedure BN_CTX_end()
  268.   	}
  269.   
  270. > void BN_CTX_end(BN_CTX *ctx)
  271.   	{
  272.   	CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:273:5: Taking true branch
  271.   	{
  272.   	CTXDBG_ENTRY("BN_CTX_end", ctx);
  273.   	if(ctx->err_stack)
             ^
  274.   		ctx->err_stack--;
  275.   	else

static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)
	{
	BIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;
	int bitsp,bitsq,ok= -1,n=0;
	BN_CTX *ctx=NULL;
	ctx=BN_CTX_new();
	if (ctx == NULL) goto err;
	BN_CTX_start(ctx);
	r0 = BN_CTX_get(ctx);
	r1 = BN_CTX_get(ctx);
	r2 = BN_CTX_get(ctx);
	r3 = BN_CTX_get(ctx);
	if (r3 == NULL) goto err;
	bitsp=(bits+1)/2;
	bitsq=bits-bitsp;
	if(!rsa->n && ((rsa->n=BN_new()) == NULL)) goto err;
	if(!rsa->d && ((rsa->d=BN_new()) == NULL)) goto err;
	if(!rsa->e && ((rsa->e=BN_new()) == NULL)) goto err;
	if(!rsa->p && ((rsa->p=BN_new()) == NULL)) goto err;
	if(!rsa->q && ((rsa->q=BN_new()) == NULL)) goto err;
	if(!rsa->dmp1 && ((rsa->dmp1=BN_new()) == NULL)) goto err;
	if(!rsa->dmq1 && ((rsa->dmq1=BN_new()) == NULL)) goto err;
	if(!rsa->iqmp && ((rsa->iqmp=BN_new()) == NULL)) goto err;
	BN_copy(rsa->e, e_value);
	for (;;)
		{
		if(!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb))
			goto err;
		if (!BN_sub(r2,rsa->p,BN_value_one())) goto err;
		if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
		if (BN_is_one(r1)) break;
		if(!BN_GENCB_call(cb, 2, n++))
			goto err;
		}
	if(!BN_GENCB_call(cb, 3, 0))
		goto err;
	for (;;)
		{
		unsigned int degenerate = 0;
		do
			{
			if(!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))
				goto err;
			} while((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3));
		if(degenerate == 3)
			{
			ok = 0;
			RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,RSA_R_KEY_SIZE_TOO_SMALL);
			goto err;
			}
		if (!BN_sub(r2,rsa->q,BN_value_one())) goto err;
		if (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;
		if (BN_is_one(r1))
			break;
		if(!BN_GENCB_call(cb, 2, n++))
			goto err;
		}
	if(!BN_GENCB_call(cb, 3, 1))
		goto err;
	if (BN_cmp(rsa->p,rsa->q) < 0)
		{
		tmp=rsa->p;
		rsa->p=rsa->q;
		rsa->q=tmp;
		}
	if (!BN_mul(rsa->n,rsa->p,rsa->q,ctx)) goto err;
	if (!BN_sub(r1,rsa->p,BN_value_one())) goto err;
	if (!BN_sub(r2,rsa->q,BN_value_one())) goto err;
	if (!BN_mul(r0,r1,r2,ctx)) goto err;
	if (!BN_mod_inverse(rsa->d,rsa->e,r0,ctx)) goto err;
	if (!BN_mod(rsa->dmp1,rsa->d,r1,ctx)) goto err;
	if (!BN_mod(rsa->dmq1,rsa->d,r2,ctx)) goto err;
	if (!BN_mod_inverse(rsa->iqmp,rsa->q,rsa->p,ctx)) goto err;
	ok=1;
err:
	if (ok == -1)
		{
		RSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);
		ok=0;
		}
	BN_CTX_end(ctx);
	BN_CTX_free(ctx);
	return ok;
	}
['static int rsa_builtin_keygen(RSA *rsa, int bits, BIGNUM *e_value, BN_GENCB *cb)\n\t{\n\tBIGNUM *r0=NULL,*r1=NULL,*r2=NULL,*r3=NULL,*tmp;\n\tint bitsp,bitsq,ok= -1,n=0;\n\tBN_CTX *ctx=NULL;\n\tctx=BN_CTX_new();\n\tif (ctx == NULL) goto err;\n\tBN_CTX_start(ctx);\n\tr0 = BN_CTX_get(ctx);\n\tr1 = BN_CTX_get(ctx);\n\tr2 = BN_CTX_get(ctx);\n\tr3 = BN_CTX_get(ctx);\n\tif (r3 == NULL) goto err;\n\tbitsp=(bits+1)/2;\n\tbitsq=bits-bitsp;\n\tif(!rsa->n && ((rsa->n=BN_new()) == NULL)) goto err;\n\tif(!rsa->d && ((rsa->d=BN_new()) == NULL)) goto err;\n\tif(!rsa->e && ((rsa->e=BN_new()) == NULL)) goto err;\n\tif(!rsa->p && ((rsa->p=BN_new()) == NULL)) goto err;\n\tif(!rsa->q && ((rsa->q=BN_new()) == NULL)) goto err;\n\tif(!rsa->dmp1 && ((rsa->dmp1=BN_new()) == NULL)) goto err;\n\tif(!rsa->dmq1 && ((rsa->dmq1=BN_new()) == NULL)) goto err;\n\tif(!rsa->iqmp && ((rsa->iqmp=BN_new()) == NULL)) goto err;\n\tBN_copy(rsa->e, e_value);\n\tfor (;;)\n\t\t{\n\t\tif(!BN_generate_prime_ex(rsa->p, bitsp, 0, NULL, NULL, cb))\n\t\t\tgoto err;\n\t\tif (!BN_sub(r2,rsa->p,BN_value_one())) goto err;\n\t\tif (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;\n\t\tif (BN_is_one(r1)) break;\n\t\tif(!BN_GENCB_call(cb, 2, n++))\n\t\t\tgoto err;\n\t\t}\n\tif(!BN_GENCB_call(cb, 3, 0))\n\t\tgoto err;\n\tfor (;;)\n\t\t{\n\t\tunsigned int degenerate = 0;\n\t\tdo\n\t\t\t{\n\t\t\tif(!BN_generate_prime_ex(rsa->q, bitsq, 0, NULL, NULL, cb))\n\t\t\t\tgoto err;\n\t\t\t} while((BN_cmp(rsa->p, rsa->q) == 0) && (++degenerate < 3));\n\t\tif(degenerate == 3)\n\t\t\t{\n\t\t\tok = 0;\n\t\t\tRSAerr(RSA_F_RSA_BUILTIN_KEYGEN,RSA_R_KEY_SIZE_TOO_SMALL);\n\t\t\tgoto err;\n\t\t\t}\n\t\tif (!BN_sub(r2,rsa->q,BN_value_one())) goto err;\n\t\tif (!BN_gcd(r1,r2,rsa->e,ctx)) goto err;\n\t\tif (BN_is_one(r1))\n\t\t\tbreak;\n\t\tif(!BN_GENCB_call(cb, 2, n++))\n\t\t\tgoto err;\n\t\t}\n\tif(!BN_GENCB_call(cb, 3, 1))\n\t\tgoto err;\n\tif (BN_cmp(rsa->p,rsa->q) < 0)\n\t\t{\n\t\ttmp=rsa->p;\n\t\trsa->p=rsa->q;\n\t\trsa->q=tmp;\n\t\t}\n\tif (!BN_mul(rsa->n,rsa->p,rsa->q,ctx)) goto err;\n\tif (!BN_sub(r1,rsa->p,BN_value_one())) goto err;\n\tif (!BN_sub(r2,rsa->q,BN_value_one())) goto err;\n\tif (!BN_mul(r0,r1,r2,ctx)) goto err;\n\tif (!BN_mod_inverse(rsa->d,rsa->e,r0,ctx)) goto err;\n\tif (!BN_mod(rsa->dmp1,rsa->d,r1,ctx)) goto err;\n\tif (!BN_mod(rsa->dmq1,rsa->d,r2,ctx)) goto err;\n\tif (!BN_mod_inverse(rsa->iqmp,rsa->q,rsa->p,ctx)) goto err;\n\tok=1;\nerr:\n\tif (ok == -1)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_BUILTIN_KEYGEN,ERR_LIB_BN);\n\t\tok=0;\n\t\t}\n\tBN_CTX_end(ctx);\n\tBN_CTX_free(ctx);\n\treturn ok;\n\t}', 'BN_CTX *BN_CTX_new(void)\n\t{\n\tBN_CTX *ret = OPENSSL_malloc(sizeof(BN_CTX));\n\tif(!ret)\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn NULL;\n\t\t}\n\tBN_POOL_init(&ret->pool);\n\tBN_STACK_init(&ret->stack);\n\tret->used = 0;\n\tret->err_stack = 0;\n\tret->too_many = 0;\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}', 'void BN_CTX_end(BN_CTX *ctx)\n\t{\n\tCTXDBG_ENTRY("BN_CTX_end", ctx);\n\tif(ctx->err_stack)\n\t\tctx->err_stack--;\n\telse\n\t\t{\n\t\tunsigned int fp = BN_STACK_pop(&ctx->stack);\n\t\tif(fp < ctx->used)\n\t\t\tBN_POOL_release(&ctx->pool, ctx->used - fp);\n\t\tctx->used = fp;\n\t\tctx->too_many = 0;\n\t\t}\n\tCTXDBG_EXIT(ctx);\n\t}']