if (r0->neg) if (!BN_add(r0,r0,rsa->p)) goto err;
static int RSA_eay_mod_exp(r0, I, rsa)BIGNUM *r0;BIGNUM *I;RSA *rsa;	{	BIGNUM r1,m1;	int ret=0;	BN_CTX *ctx;	if ((ctx=BN_CTX_new()) == NULL) goto err;	BN_init(&m1);	BN_init(&r1);	if (rsa->flags & RSA_FLAG_CACHE_PRIVATE)		{		if (rsa->_method_mod_p == NULL)			{			if ((rsa->_method_mod_p=BN_MONT_CTX_new()) != NULL)				if (!BN_MONT_CTX_set(rsa->_method_mod_p,rsa->p,						     ctx))					goto err;			}		if (rsa->_method_mod_q == NULL)			{			if ((rsa->_method_mod_q=BN_MONT_CTX_new()) != NULL)				if (!BN_MONT_CTX_set(rsa->_method_mod_q,rsa->q,						     ctx))					goto err;			}		}	if (!BN_mod(&r1,I,rsa->q,ctx)) goto err;	if (!rsa->meth->bn_mod_exp(&m1,&r1,rsa->dmq1,rsa->q,ctx,		rsa->_method_mod_q)) goto err;	if (!BN_mod(&r1,I,rsa->p,ctx)) goto err;	if (!rsa->meth->bn_mod_exp(r0,&r1,rsa->dmp1,rsa->p,ctx,		rsa->_method_mod_p)) goto err;	if (!BN_sub(r0,r0,&m1)) goto err;	/* This will help stop the size of r0 increasing, which does	 * affect the multiply if it optimised for a power of 2 size */	if (r0->neg)		if (!BN_add(r0,r0,rsa->p)) goto err;	if (!BN_mul(&r1,r0,rsa->iqmp,ctx)) goto err;	if (!BN_mod(r0,&r1,rsa->p,ctx)) goto err;	if (!BN_mul(&r1,r0,rsa->q,ctx)) goto err;	if (!BN_add(r0,&r1,&m1)) goto err;	ret=1;err:	BN_clear_free(&m1);	BN_clear_free(&r1);	BN_CTX_free(ctx);	return(ret);	}