int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *ctx)
	{
	int ret;

	bn_check_top(n);

	if (r != NULL)
		ret = BN_mod_mul(n, n, r, b->mod, ctx);
	else
		{
		if (b->Ai == NULL)
			{
			BNerr(BN_F_BN_BLINDING_INVERT_EX,BN_R_NOT_INITIALIZED);
			return(0);
			}
		ret = BN_mod_mul(n, n, b->Ai, b->mod, ctx);
		}

	bn_check_top(n);
	return(ret);
	}