crypto/rsa/rsa_eay.c:300: error: NULL_DEREFERENCE
  pointer `meth` last assigned on line 260 could be null and is dereferenced at line 300, column 8.
Showing all 71 steps of the trace


crypto/rsa/rsa_eay.c:250:1: start of procedure RSA_eay_private_decrypt()
248.   	}
249.   
250. > static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
251.   	     unsigned char *to, RSA *rsa, int padding)
252.   	{

crypto/rsa/rsa_eay.c:255:2: 
253.   	const RSA_METHOD *meth;
254.   	BIGNUM f,ret;
255. > 	int j,num=0,r= -1;
256.   	unsigned char *p;
257.   	unsigned char *buf=NULL;

crypto/rsa/rsa_eay.c:257:2: 
255.   	int j,num=0,r= -1;
256.   	unsigned char *p;
257. > 	unsigned char *buf=NULL;
258.   	BN_CTX *ctx=NULL;
259.   

crypto/rsa/rsa_eay.c:258:2: 
256.   	unsigned char *p;
257.   	unsigned char *buf=NULL;
258. > 	BN_CTX *ctx=NULL;
259.   
260.   	meth = ENGINE_get_RSA(rsa->engine);

crypto/rsa/rsa_eay.c:260:2: 
258.   	BN_CTX *ctx=NULL;
259.   
260. > 	meth = ENGINE_get_RSA(rsa->engine);
261.   	BN_init(&f);
262.   	BN_init(&ret);

crypto/engine/engine_list.c:563:1: start of procedure ENGINE_get_RSA()
  561.   	}
  562.   
  563. > const RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  564.   	{
  565.   	if(e == NULL)

crypto/engine/engine_list.c:565:5: Taking true branch
  563.   const RSA_METHOD *ENGINE_get_RSA(ENGINE *e)
  564.   	{
  565.   	if(e == NULL)
             ^
  566.   		{
  567.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,

crypto/engine/engine_list.c:567:3: 
  565.   	if(e == NULL)
  566.   		{
  567. > 		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  568.   			ERR_R_PASSED_NULL_PARAMETER);
  569.   		return NULL;

crypto/err/err.c:355:1: start of procedure ERR_put_error()
    353.   /********************************************************/
    354.   
    355. > void ERR_put_error(int lib, int func, int reason, const char *file,
    356.   	     int line)
    357.   	{

crypto/err/err.c:379:2: Skipping ERR_get_state(): empty list of specs
    377.   	}
    378.   #endif
    379.   	es=ERR_get_state();
            ^
    380.   
    381.   	es->top=(es->top+1)%ERR_NUM_ERRORS;

crypto/err/err.c:381:2: 
    379.   	es=ERR_get_state();
    380.   
    381. > 	es->top=(es->top+1)%ERR_NUM_ERRORS;
    382.   	if (es->top == es->bottom)
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;

crypto/err/err.c:382:6: Taking false branch
    380.   
    381.   	es->top=(es->top+1)%ERR_NUM_ERRORS;
    382.   	if (es->top == es->bottom)
                ^
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);

crypto/err/err.c:384:2: 
    382.   	if (es->top == es->bottom)
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384. > 	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;

crypto/err/err.c:385:2: 
    383.   		es->bottom=(es->bottom+1)%ERR_NUM_ERRORS;
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385. > 	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);

crypto/err/err.c:386:2: 
    384.   	es->err_buffer[es->top]=ERR_PACK(lib,func,reason);
    385.   	es->err_file[es->top]=file;
    386. > 	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
    388.   	}

crypto/err/err.c:387:2: Taking true branch
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
            ^
    388.   	}
    389.   

crypto/err/err.c:387:2: Taking false branch
    385.   	es->err_file[es->top]=file;
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
            ^
    388.   	}
    389.   

crypto/err/err.c:388:2: return from a call to ERR_put_error
    386.   	es->err_line[es->top]=line;
    387.   	err_clear_data(es,es->top);
    388.   	}
            ^
    389.   
    390.   void ERR_clear_error(void)

crypto/engine/engine_list.c:569:3: 
  567.   		ENGINEerr(ENGINE_F_ENGINE_GET_RSA,
  568.   			ERR_R_PASSED_NULL_PARAMETER);
  569. > 		return NULL;
  570.   		}
  571.   	return e->rsa_meth;

crypto/engine/engine_list.c:572:2: return from a call to ENGINE_get_RSA
  570.   		}
  571.   	return e->rsa_meth;
  572.   	}
          ^
  573.   
  574.   const DSA_METHOD *ENGINE_get_DSA(ENGINE *e)

crypto/rsa/rsa_eay.c:261:2: 
259.   
260.   	meth = ENGINE_get_RSA(rsa->engine);
261. > 	BN_init(&f);
262.   	BN_init(&ret);
263.   	ctx=BN_CTX_new();

crypto/bn/bn_lib.c:285:1: start of procedure BN_init()
  283.   	}
  284.   
  285. > void BN_init(BIGNUM *a)
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));

crypto/bn/bn_lib.c:287:2: 
  285.   void BN_init(BIGNUM *a)
  286.   	{
  287. > 	memset(a,0,sizeof(BIGNUM));
  288.   	}
  289.   

crypto/bn/bn_lib.c:288:2: return from a call to BN_init
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));
  288.   	}
          ^
  289.   
  290.   BIGNUM *BN_new(void)

crypto/rsa/rsa_eay.c:262:2: 
260.   	meth = ENGINE_get_RSA(rsa->engine);
261.   	BN_init(&f);
262. > 	BN_init(&ret);
263.   	ctx=BN_CTX_new();
264.   	if (ctx == NULL) goto err;

crypto/bn/bn_lib.c:285:1: start of procedure BN_init()
  283.   	}
  284.   
  285. > void BN_init(BIGNUM *a)
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));

crypto/bn/bn_lib.c:287:2: 
  285.   void BN_init(BIGNUM *a)
  286.   	{
  287. > 	memset(a,0,sizeof(BIGNUM));
  288.   	}
  289.   

crypto/bn/bn_lib.c:288:2: return from a call to BN_init
  286.   	{
  287.   	memset(a,0,sizeof(BIGNUM));
  288.   	}
          ^
  289.   
  290.   BIGNUM *BN_new(void)

crypto/rsa/rsa_eay.c:263:2: 
261.   	BN_init(&f);
262.   	BN_init(&ret);
263. > 	ctx=BN_CTX_new();
264.   	if (ctx == NULL) goto err;
265.   

crypto/bn/bn_ctx.c:68:1: start of procedure BN_CTX_new()
  66.   
  67.   
  68. > BN_CTX *BN_CTX_new(void)
  69.   	{
  70.   	BN_CTX *ret;

crypto/bn/bn_ctx.c:72:2: 
  70.   	BN_CTX *ret;
  71.   
  72. > 	ret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
  73.   	if (ret == NULL)
  74.   		{

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
    203.   	}
    204.   
    205. > void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207.   	void *ret = NULL;

crypto/mem.c:207:2: 
    205.   void *CRYPTO_malloc(int num, const char *file, int line)
    206.   	{
    207. > 	void *ret = NULL;
    208.   
    209.   	allow_customize = 0;

crypto/mem.c:209:2: 
    207.   	void *ret = NULL;
    208.   
    209. > 	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
    211.   		{

crypto/mem.c:210:6: Taking false branch
    208.   
    209.   	allow_customize = 0;
    210.   	if (malloc_debug_func != NULL)
                ^
    211.   		{
    212.   		allow_customize_debug = 0;

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

crypto/mem.c:219:6: Taking false branch
    217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
    218.   #endif
    219.   	if (malloc_debug_func != NULL)
                ^
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   

crypto/mem.c:222:2: 
    220.   		malloc_debug_func(ret, num, file, line, 1);
    221.   
    222. > 	return ret;
    223.   	}
    224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
    221.   
    222.   	return ret;
    223.   	}
            ^
    224.   
    225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/bn/bn_ctx.c:73:6: Taking false branch
  71.   
  72.   	ret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));
  73.   	if (ret == NULL)
             ^
  74.   		{
  75.   		BNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);

crypto/bn/bn_ctx.c:79:2: Skipping BN_CTX_init(): empty list of specs
  77.   		}
  78.   
  79.   	BN_CTX_init(ret);
         ^
  80.   	ret->flags=BN_FLG_MALLOCED;
  81.   	return(ret);

crypto/bn/bn_ctx.c:80:2: 
  78.   
  79.   	BN_CTX_init(ret);
  80. > 	ret->flags=BN_FLG_MALLOCED;
  81.   	return(ret);
  82.   	}

crypto/bn/bn_ctx.c:81:2: 
  79.   	BN_CTX_init(ret);
  80.   	ret->flags=BN_FLG_MALLOCED;
  81. > 	return(ret);
  82.   	}
  83.   

crypto/bn/bn_ctx.c:82:2: return from a call to BN_CTX_new
  80.   	ret->flags=BN_FLG_MALLOCED;
  81.   	return(ret);
  82.   	}
         ^
  83.   
  84.   void BN_CTX_init(BN_CTX *ctx)

crypto/rsa/rsa_eay.c:264:6: Taking false branch
262.   	BN_init(&ret);
263.   	ctx=BN_CTX_new();
264.   	if (ctx == NULL) goto err;
            ^
265.   
266.   	num=BN_num_bytes(rsa->n);

crypto/rsa/rsa_eay.c:266:2: 
264.   	if (ctx == NULL) goto err;
265.   
266. > 	num=BN_num_bytes(rsa->n);
267.   
268.   	if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)

crypto/bn/bn_lib.c:244:1: start of procedure BN_num_bits()
  242.   	}
  243.   
  244. > int BN_num_bits(const BIGNUM *a)
  245.   	{
  246.   	BN_ULONG l;

crypto/bn/bn_lib.c:251:6: Taking false branch
  249.   	bn_check_top(a);
  250.   
  251.   	if (a->top == 0) return(0);
              ^
  252.   	l=a->d[a->top-1];
  253.   	assert(l != 0);

crypto/bn/bn_lib.c:252:2: 
  250.   
  251.   	if (a->top == 0) return(0);
  252. > 	l=a->d[a->top-1];
  253.   	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;

crypto/bn/bn_lib.c:253:2: 
  251.   	if (a->top == 0) return(0);
  252.   	l=a->d[a->top-1];
  253. > 	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));

crypto/bn/bn_lib.c:254:2: 
  252.   	l=a->d[a->top-1];
  253.   	assert(l != 0);
  254. > 	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
  256.   	}

crypto/bn/bn_lib.c:255:2: Skipping BN_num_bits_word(): empty list of specs
  253.   	assert(l != 0);
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
          ^
  256.   	}
  257.   

crypto/bn/bn_lib.c:256:2: return from a call to BN_num_bits
  254.   	i=(a->top-1)*BN_BITS2;
  255.   	return(i+BN_num_bits_word(l));
  256.   	}
          ^
  257.   
  258.   void BN_clear_free(BIGNUM *a)

crypto/rsa/rsa_eay.c:268:6: 
266.   	num=BN_num_bytes(rsa->n);
267.   
268. > 	if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
269.   		{
270.   		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);

crypto/mem.c:205:1: start of procedure CRYPTO_malloc()
  203.   	}
  204.   
  205. > void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207.   	void *ret = NULL;

crypto/mem.c:207:2: 
  205.   void *CRYPTO_malloc(int num, const char *file, int line)
  206.   	{
  207. > 	void *ret = NULL;
  208.   
  209.   	allow_customize = 0;

crypto/mem.c:209:2: 
  207.   	void *ret = NULL;
  208.   
  209. > 	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
  211.   		{

crypto/mem.c:210:6: Taking false branch
  208.   
  209.   	allow_customize = 0;
  210.   	if (malloc_debug_func != NULL)
              ^
  211.   		{
  212.   		allow_customize_debug = 0;

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

crypto/mem.c:219:6: Taking false branch
  217.   	fprintf(stderr, "LEVITTE_DEBUG:         > 0x%p (%d)\n", ret, num);
  218.   #endif
  219.   	if (malloc_debug_func != NULL)
              ^
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   

crypto/mem.c:222:2: 
  220.   		malloc_debug_func(ret, num, file, line, 1);
  221.   
  222. > 	return ret;
  223.   	}
  224.   

crypto/mem.c:223:2: return from a call to CRYPTO_malloc
  221.   
  222.   	return ret;
  223.   	}
          ^
  224.   
  225.   void *CRYPTO_realloc(void *str, int num, const char *file, int line)

crypto/rsa/rsa_eay.c:268:6: Taking false branch
266.   	num=BN_num_bytes(rsa->n);
267.   
268.   	if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
            ^
269.   		{
270.   		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);

crypto/rsa/rsa_eay.c:276:6: Taking false branch
274.   	/* This check was for equality but PGP does evil things
275.   	 * and chops off the top '0' bytes */
276.   	if (flen > num)
            ^
277.   		{
278.   		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);

crypto/rsa/rsa_eay.c:283:6: Taking false branch
281.   
282.   	/* make data into a big number */
283.   	if (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;
            ^
284.   
285.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))

crypto/rsa/rsa_eay.c:285:7: Taking true branch
283.   	if (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;
284.   
285.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
             ^
286.   		RSA_blinding_on(rsa,ctx);
287.   	if (rsa->flags & RSA_FLAG_BLINDING)

crypto/rsa/rsa_eay.c:285:43: Taking false branch
283.   	if (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;
284.   
285.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
                                                 ^
286.   		RSA_blinding_on(rsa,ctx);
287.   	if (rsa->flags & RSA_FLAG_BLINDING)

crypto/rsa/rsa_eay.c:287:6: Taking false branch
285.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
286.   		RSA_blinding_on(rsa,ctx);
287.   	if (rsa->flags & RSA_FLAG_BLINDING)
            ^
288.   		if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
289.   

crypto/rsa/rsa_eay.c:291:8: Taking false branch
289.   
290.   	/* do the decrypt */
291.   	if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
              ^
292.   		((rsa->p != NULL) &&
293.   		(rsa->q != NULL) &&

crypto/rsa/rsa_eay.c:292:5: Taking false branch
290.   	/* do the decrypt */
291.   	if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
292.   		((rsa->p != NULL) &&
           ^
293.   		(rsa->q != NULL) &&
294.   		(rsa->dmp1 != NULL) &&

crypto/rsa/rsa_eay.c:300:8: 
298.   	else
299.   		{
300. > 		if (!meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL))
301.   			goto err;
302.   		}

static int RSA_eay_private_decrypt(int flen, const unsigned char *from,
	     unsigned char *to, RSA *rsa, int padding)
	{
	const RSA_METHOD *meth;
	BIGNUM f,ret;
	int j,num=0,r= -1;
	unsigned char *p;
	unsigned char *buf=NULL;
	BN_CTX *ctx=NULL;
	meth = ENGINE_get_RSA(rsa->engine);
	BN_init(&f);
	BN_init(&ret);
	ctx=BN_CTX_new();
	if (ctx == NULL) goto err;
	num=BN_num_bytes(rsa->n);
	if ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)
		{
		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);
		goto err;
		}
	if (flen > num)
		{
		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);
		goto err;
		}
	if (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;
	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))
		RSA_blinding_on(rsa,ctx);
	if (rsa->flags & RSA_FLAG_BLINDING)
		if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
	if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||
		((rsa->p != NULL) &&
		(rsa->q != NULL) &&
		(rsa->dmp1 != NULL) &&
		(rsa->dmq1 != NULL) &&
		(rsa->iqmp != NULL)) )
		{ if (!meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }
	else
		{
		if (!meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL))
			goto err;
		}
	if (rsa->flags & RSA_FLAG_BLINDING)
		if (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;
	p=buf;
	j=BN_bn2bin(&ret,p);
	switch (padding)
		{
	case RSA_PKCS1_PADDING:
		r=RSA_padding_check_PKCS1_type_2(to,num,buf,j,num);
		break;
#ifndef NO_SHA
        case RSA_PKCS1_OAEP_PADDING:
	        r=RSA_padding_check_PKCS1_OAEP(to,num,buf,j,num,NULL,0);
                break;
#endif
 	case RSA_SSLV23_PADDING:
		r=RSA_padding_check_SSLv23(to,num,buf,j,num);
		break;
	case RSA_NO_PADDING:
		r=RSA_padding_check_none(to,num,buf,j,num);
		break;
	default:
		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_UNKNOWN_PADDING_TYPE);
		goto err;
		}
	if (r < 0)
		RSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_PADDING_CHECK_FAILED);
err:
	if (ctx != NULL) BN_CTX_free(ctx);
	BN_clear_free(&f);
	BN_clear_free(&ret);
	if (buf != NULL)
		{
		memset(buf,0,num);
		OPENSSL_free(buf);
		}
	return(r);
	}
['static int RSA_eay_private_decrypt(int flen, const unsigned char *from,\n\t     unsigned char *to, RSA *rsa, int padding)\n\t{\n\tconst RSA_METHOD *meth;\n\tBIGNUM f,ret;\n\tint j,num=0,r= -1;\n\tunsigned char *p;\n\tunsigned char *buf=NULL;\n\tBN_CTX *ctx=NULL;\n\tmeth = ENGINE_get_RSA(rsa->engine);\n\tBN_init(&f);\n\tBN_init(&ret);\n\tctx=BN_CTX_new();\n\tif (ctx == NULL) goto err;\n\tnum=BN_num_bytes(rsa->n);\n\tif ((buf=(unsigned char *)OPENSSL_malloc(num)) == NULL)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tif (flen > num)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_DATA_GREATER_THAN_MOD_LEN);\n\t\tgoto err;\n\t\t}\n\tif (BN_bin2bn(from,(int)flen,&f) == NULL) goto err;\n\tif ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))\n\t\tRSA_blinding_on(rsa,ctx);\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;\n\tif ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||\n\t\t((rsa->p != NULL) &&\n\t\t(rsa->q != NULL) &&\n\t\t(rsa->dmp1 != NULL) &&\n\t\t(rsa->dmq1 != NULL) &&\n\t\t(rsa->iqmp != NULL)) )\n\t\t{ if (!meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }\n\telse\n\t\t{\n\t\tif (!meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL))\n\t\t\tgoto err;\n\t\t}\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;\n\tp=buf;\n\tj=BN_bn2bin(&ret,p);\n\tswitch (padding)\n\t\t{\n\tcase RSA_PKCS1_PADDING:\n\t\tr=RSA_padding_check_PKCS1_type_2(to,num,buf,j,num);\n\t\tbreak;\n#ifndef NO_SHA\n        case RSA_PKCS1_OAEP_PADDING:\n\t        r=RSA_padding_check_PKCS1_OAEP(to,num,buf,j,num,NULL,0);\n                break;\n#endif\n \tcase RSA_SSLV23_PADDING:\n\t\tr=RSA_padding_check_SSLv23(to,num,buf,j,num);\n\t\tbreak;\n\tcase RSA_NO_PADDING:\n\t\tr=RSA_padding_check_none(to,num,buf,j,num);\n\t\tbreak;\n\tdefault:\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_UNKNOWN_PADDING_TYPE);\n\t\tgoto err;\n\t\t}\n\tif (r < 0)\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_DECRYPT,RSA_R_PADDING_CHECK_FAILED);\nerr:\n\tif (ctx != NULL) BN_CTX_free(ctx);\n\tBN_clear_free(&f);\n\tBN_clear_free(&ret);\n\tif (buf != NULL)\n\t\t{\n\t\tmemset(buf,0,num);\n\t\tOPENSSL_free(buf);\n\t\t}\n\treturn(r);\n\t}', 'const RSA_METHOD *ENGINE_get_RSA(ENGINE *e)\n\t{\n\tif(e == NULL)\n\t\t{\n\t\tENGINEerr(ENGINE_F_ENGINE_GET_RSA,\n\t\t\tERR_R_PASSED_NULL_PARAMETER);\n\t\treturn NULL;\n\t\t}\n\treturn e->rsa_meth;\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}', 'void BN_init(BIGNUM *a)\n\t{\n\tmemset(a,0,sizeof(BIGNUM));\n\t}', 'BN_CTX *BN_CTX_new(void)\n\t{\n\tBN_CTX *ret;\n\tret=(BN_CTX *)OPENSSL_malloc(sizeof(BN_CTX));\n\tif (ret == NULL)\n\t\t{\n\t\tBNerr(BN_F_BN_CTX_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tBN_CTX_init(ret);\n\tret->flags=BN_FLG_MALLOCED;\n\treturn(ret);\n\t}', 'void *CRYPTO_malloc(int num, const char *file, int line)\n\t{\n\tvoid *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}', 'int BN_num_bits(const BIGNUM *a)\n\t{\n\tBN_ULONG l;\n\tint i;\n\tbn_check_top(a);\n\tif (a->top == 0) return(0);\n\tl=a->d[a->top-1];\n\tassert(l != 0);\n\ti=(a->top-1)*BN_BITS2;\n\treturn(i+BN_num_bits_word(l));\n\t}']