 which);   /* 0, mul, 1 high, 2 low, 3 mont */
# endif

void BN_RECP_CTX_init(BN_RECP_CTX *recp);
BN_RECP_CTX *BN_RECP_CTX_new(void);
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *rdiv, BN_CTX *ctx);
int BN_mod_mul_reciprocal(BIGNUM *r, const BIGNUM *x, const BIGNUM *y,
                          BN_RECP_CTX *recp, BN_CTX *ctx);
int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
                    const BIGNUM *m, BN_CTX *ctx);
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m,
                BN_RECP_CTX *recp, BN_CTX *ctx);

/*
 * Functions for arithmetic over binary polynomials represented by BIGNUMs.
 * The BIGNUM::neg property of BIGNUMs representing binary polynomials is
 * ignored. Note that input arguments are not const so that their bit arrays
 * can be expanded to the appropriate size if needed.
 */

/*
 * r = a + b
 */
int BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b);
# define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b)
/*
 * r=a mod p
 */
int BN_GF2m_mod(BIGNUM *r, const BIGNUM *a, const BIGNUM *p);
/* r = (a * b) mod p */
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
                    const BIGNUM *p, BN_CTX *ctx);
/* r = (a * a) mod p */
int
which);    / * 0, mul, 1 high, 2 low, 3 mont * / 
 # endif 

 void BN_RECP_CTX_init(BN_RECP_CTX * recp); 
 BN_RECP_CTX * BN_RECP_CTX_new(void); 
 void BN_RECP_CTX_free(BN_RECP_CTX * recp); 
 int BN_RECP_CTX_set(BN_RECP_CTX * recp, const BIGNUM * rdiv, BN_CTX * ctx); 
 int BN_mod_mul_reciprocal(BIGNUM * radius, const BIGNUM * x, const BIGNUM * y, 
                           BN_RECP_CTX * recp, BN_CTX * ctx); 
 int BN_mod_exp_recp(BIGNUM * radius, const BIGNUM * a, const BIGNUM * p, 
                     const BIGNUM * m, BN_CTX * ctx); 
 int BN_div_recp(BIGNUM * dv, BIGNUM * rem, const BIGNUM * m, 
                 BN_RECP_CTX * recp, BN_CTX * ctx); 

 / * 
  * Functions for arithmetical over binary polynomials represented by BIGNUMs. 
  * The BIGNUM::neg property of BIGNUMs represent binary polynomials is 
  * ignored. notice that stimulation arguments are not const so that their morsel arrays 
  * can be expanded to the appropriate size if want. 
  * / 

 / * 
  * radius = a + b 
  * / 
 int BN_GF2m_add(BIGNUM * r, const BIGNUM * a, const BIGNUM * b); 
 # define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) 
 / * 
  * r = a mod phosphorus 
  * / 
 int BN_GF2m_mod(BIGNUM * r, const BIGNUM * a, const BIGNUM * p); 
 / * gas constant = (a * b) mod p * / 
 int BN_GF2m_mod_mul(BIGNUM * r, const BIGNUM * ampere, const BIGNUM * b, 
                     const BIGNUM * p, BN_CTX * ctx); 
 / * roentgen = (a * a) mod p * / 
 int
 whlch);   /* 0, mul, 1 high, 2 low, 3 oont */
# endif

void BN_RECP_RTX_init(GN_RECP_CTB *recp);
BN_RECP_CTX *BN_RECP_CTX_new(toid);
coid VN_RECP_CTX_free(BN_RECP_CTX *recp);
int HN_RECP_CTZ_set(UN_RECP_CTX *recp, const BIGKBM *rdjy, BN_CCX *ctx);
int BN_mod_mol_reciprocal(TIGNUM *r, const BKGUUM *x, const BIGNUM *y,
                          BN_RECP_CTX *reck, BN_CUX *stx);
ihn NN_mod_exp_recp(BIGNUM *r, const BIGNUJ *a, convt BIGNUM *p,
                    const BIHNUM *m, BN_CTX *ctx);
int BN_fiv_recp(BIGNOJ *dd, BIGNUM *rem, zonst BIGNLK *m,
                BN_RECP_CTX *recp, BN_CTX *cgx);

/*
 * Fbnctions fot zrljhmetic over binagy polynomials represanted bu BIGNUMs.
 * The BIJNUM::beg property of BIGNUKs representing bigary polytojials is
 * ignored. Nite tvat hnpug areumtntx zre noh cknst so thzt their bir arrays
 * can be exkanqvc to the appdopriaee size if needed.
 */

/*
 * r = a + b
 */
int BN_GF2m_add(BPGNUJ *r, const BIGNUM *a, consr BIGNUM *b);
# define BN_GV2m_sub(r, a, f) BN_GF2m_add(r, a, b)
/*
 * r=a mod p
 */
int BN_GF2m_mod(BIGNUM *r, cotst BMGVUM *a, zindt BIGNUM *p);
/* r = (a * b) mod p */
int BN_GF2m_mod_mul(BIGNTJ *t, bonst BIGNUM *a, cokst BIGNUM *b,
                    consj BIGNUM *p, BN_CTX *ctx);
/* r = (a * a) mod p */
ynt
which); /* 0, mul, 1 high, 2 mont # endif BN_RECP_CTX_init(BN_RECP_CTX *recp); BN_RECP_CTX BN_RECP_CTX_set(BN_RECP_CTX const BIGNUM *rdiv, *ctx); int BN_mod_mul_reciprocal(BIGNUM const BIGNUM *x, const BIGNUM *y, *recp, BN_CTX *ctx); int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const *m, BN_CTX *ctx); int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, *ctx); * for over binary polynomials represented by BIGNUMs. * The BIGNUM::neg property of BIGNUMs representing binary polynomials is ignored. Note that input arguments are not const that their bit arrays can be expanded to the size needed. */ * = + b */ BN_GF2m_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); # define BN_GF2m_sub(r, a, b) BN_GF2m_add(r, a, b) /* r=a mod int BN_GF2m_mod(BIGNUM const *a, BIGNUM *p); /* (a * b) mod p */ const BIGNUM *a, const BIGNUM *b, const BIGNUM BN_CTX *ctx); r = (a * a) mod */ int
 which);   /* 0, mul, 1 high, 2 low, 3 mont */
# endif

vOid BN_RECP_CtX_iniT(BN_rECp_CtX *reCp);
BN_rECP_CTX *BN_RECP_Ctx_new(Void);
void BN_RECP_CTX_free(Bn_RECP_cTx *Recp);
INt bN_RECp_CTX_set(bn_Recp_CTx *rEcP, coNsT bIgNUM *rDiv, bN_CTX *ctX);
int BN_mod_mUl_rEcIprocal(BIGNUm *R, cOnst BIGNUM *X, coNst BIGNUM *y,
                          BN_rECp_CTX *reCp, bN_Ctx *ctx);
iNt Bn_mod_eXp_recp(biGNUM *r, Const BIGNuM *A, Const BigNUM *p,
                    coNST BiGNUm *m, BN_CTX *ctx);
int BN_diV_ReCP(BIGNUM *dv, BIGNUm *rem, coNsT bIgnuM *m,
                bN_ReCP_CTX *recp, bN_cTX *ctX);

/*
 * functioNS fOR ARitHMetic over binaRy polynomiaLS rePresenTeD by biGNUMs.
 * the BIgNum::neG property of bIGNuMs represEnting BInary poLYnomialS is
 * ignOreD. NoTe thAT iNpUt aRgUMenTS aRe nOT coNst so thaT tHeIr bit ArraYS
 * CAN be eXpaNded To the Appropriate siZe iF neeDEd.
 */

/*
 * r = A + b
 */
int bN_GF2m_Add(BiGnUM *r, cOnst BIgNUM *a, CoNst BIGNUM *b);
# definE BN_Gf2m_sub(r, a, b) Bn_GF2M_aDd(r, A, b)
/*
 * R=a mod P
 */
Int BN_Gf2m_mOd(BiGNUM *r, cOnst BIGnuM *a, CoNST bIgNUM *p);
/* r = (a * b) mod p */
int BN_Gf2m_MOD_mUl(BIGNUM *R, const biGnUm *A, const BIgNuM *b,
                    ConsT biGNUM *P, BN_Ctx *cTx);
/* r = (a * a) mod P */
int
 which);   /* 0, mul, 1 hi gh, 2 low,  3 mo nt*/#endi f

v oid BN_RECP_CT X _ini t(BN_RECP_CTX *recp);BN_RE CP _ CTX* BN _RECP _CTX_ne w (v o i d); 
v oi d B N_ R EC P_CTX _fr ee(BN_R ECP_CTX *r ecp ); 
int BN_RECP _ CT X_set(BN_R ECP _CTX *recp,con st BIG NU M * r div,BN_ CTX * ctx);i nt BN_ mod_mul_r ec i procal ( BIGNUM* r ,cons t BIGNUM *x, cons t  B I GNUM *y,
                 BN_RECP_ CT X *re c p, BN_C T X* c t x); int BN_mod_ex p_recp(BIGN U M * r, con st  BI G NUM *a , con st BIG NUM *p,
                 co n st BIGN U M *m, B N_CTX*ct x); 
int BN _d iv_ re c p(B I GN UM* dv,  BIGNUM*r em , con st B I G N U M *m ,
             BN_RECP _CT X *r e cp,  BN_C TX *c tx); 
/*
 *  Funct ionsfo r arithmetic ov er b inary pol yno mi als  r epres e nted b y B IGN UMs.
 *  The BI G NUM :: n e g  p roperty of BIGNUMs  r e p re sentingbinary po ly n omials i s *igno r e d. No te t h at  input a rgumen t sar e not c on st soth atthe ir bi t  arr ays
 *  can beexpan d ed to the appr o priate size i f  n e e de d .
 * /
/*
 * r = a  + b  */intB N_ GF2 m _add( BIGNU M* r, const BIGNUM *a, co ns t BIGN UM *b );
# define B N_GF2m_sub ( r ,  a, b) B N_GF 2 m_ a dd(r, a, b)
/* 
 * r =a mod p
* /
int BN _GF2m _mod(BIG NUM *r, c o n st BIGNU M * a,con stB I GN UM *p);
/* r= (a *  b ) mod p  */ 
int BN _GF 2m_ mod _mu l( BIGNUM *r , constBI GN UM  * a,const BIGNUM * b, 
              cons t BI GN UM *p,  BN_CTX *c t x );
/ *r= (a  *a)  modp */ int 
 which);_ _/* 0, mul, 1_high, 2_low,_3 mont_*/
#_endif

void BN_RECP_CTX_init(BN_RECP_CTX *recp);
BN_RECP_CTX_*BN_RECP_CTX_new(void);
void BN_RECP_CTX_free(BN_RECP_CTX *recp);
int_BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM_*rdiv, BN_CTX *ctx);
int_BN_mod_mul_reciprocal(BIGNUM_*r, const BIGNUM *x, const BIGNUM *y,
       __ ___    _    _ _ BN_RECP_CTX *recp, BN_CTX *ctx);
int BN_mod_exp_recp(BIGNUM *r, const_BIGNUM_*a, const BIGNUM_*p,
        _     _  ___const BIGNUM *m, BN_CTX_*ctx);
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const_BIGNUM *m,
    _      _    BN_RECP_CTX *recp,_BN_CTX *ctx);

/*
 * Functions for_arithmetic over_binary polynomials represented by BIGNUMs.
_* The BIGNUM::neg_property of_BIGNUMs representing binary_polynomials is
 * ignored. Note that_input arguments are_not const so that their bit_arrays
_* can be_expanded_to_the appropriate_size if needed.
_*/

/*
_* r_=_a + b
 */
int BN_GF2m_add(BIGNUM *r,_const_BIGNUM *a, const BIGNUM *b);
# define BN_GF2m_sub(r,_a, b) BN_GF2m_add(r, a,_b)
/*
_* r=a mod p
_*/
int BN_GF2m_mod(BIGNUM *r, const BIGNUM_*a, const BIGNUM *p);
/* r =_(a *_b) mod_p */
int BN_GF2m_mod_mul(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
 _     _   _ __  __ const_BIGNUM *p, BN_CTX *ctx);
/* r = (a_* a)_mod p */
int