bn_check_top(r);
int BN_nist_mod_521(BIGNUM *r, const BIGNUM *a, const BIGNUM *field,	BN_CTX *ctx)	{#if BN_BITS2 == 64#define BN_NIST_521_TOP_MASK	(BN_ULONG)0x1FF#elif BN_BITS2 == 32#define BN_NIST_521_TOP_MASK	(BN_ULONG)0x1FF#elif BN_BITS2 == 16#define BN_NIST_521_TOP_MASK	(BN_ULONG)0x1FF#elif BN_BITS2 == 8#define BN_NIST_521_TOP_MASK	(BN_ULONG)0x1#endif	int	top, ret = 0;	BN_ULONG *r_d;	BIGNUM	*tmp;	/* check whether a reduction is necessary */	top = a->top;	if (top < BN_NIST_521_TOP  || ( top == BN_NIST_521_TOP &&           (!(a->d[BN_NIST_521_TOP-1] & ~(BN_NIST_521_TOP_MASK)))))		return (r == a)? 1 : (BN_copy(r ,a) != NULL);	BN_CTX_start(ctx);	tmp = BN_CTX_get(ctx);	if (!tmp)		goto err;	if (!BN_ncopy(tmp, a, BN_NIST_521_TOP))		return 0;	if (!BN_rshift(r, a, 521))		return 0;	if (tmp->top == BN_NIST_521_TOP)		tmp->d[BN_NIST_521_TOP-1]  &= BN_NIST_521_TOP_MASK;	bn_fix_top(tmp);	if (!BN_uadd(r, tmp, r))		return 0;	top = r->top;	r_d = r->d;	if (top == BN_NIST_521_TOP  &&            (r_d[BN_NIST_521_TOP-1] & ~(BN_NIST_521_TOP_MASK)))		{		BN_NIST_ADD_ONE(r_d)		r_d[BN_NIST_521_TOP-1] &= BN_NIST_521_TOP_MASK; 		}	bn_fix_top(r);	ret = 1;err:	BN_CTX_end(ctx);	return ret;	}