#include
BN_RECP_CTX *BN_RECP_CTX_new(void); void BN_RECP_CTX_init(BN_RECP_CTX *recp); void BN_RECP_CTX_free(BN_RECP_CTX *recp);
int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx);
int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *a, BN_RECP_CTX *recp, BN_CTX *ctx);
int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_RECP_CTX *recp, BN_CTX *ctx);
_B_N___R_E_C_P___C_T_X___n_e_w_(_) allocates and initializes a BBNN__RREECCPP structure. _B_N___R_E_C_P___C_T_X___i_n_i_t_(_) initializes an existing uninitialized BBNN__RREECCPP.
_B_N___R_E_C_P___C_T_X___f_r_e_e_(_) frees the components of the BBNN__RREECCPP, and, if it was created by _B_N___R_E_C_P___C_T_X___n_e_w_(_), also the structure itself.
_B_N___R_E_C_P___C_T_X___s_e_t_(_) stores mm in rreeccpp and sets it up for computing 1/mm and shifting it left by BN_num_bits(mm)+1 to make it an integer. The result and the number of bits it was shifted left will later be stored in rreeccpp.
_B_N___d_i_v___r_e_c_p_(_) divides aa by mm using rreeccpp. It places the quotient in ddvv and the remainder in rreemm.
The BBNN__RREECCPP__CCTTXX structure is defined as follows:
typedef struct bn_recp_ctx_st { BIGNUM N; /* the divisor */ BIGNUM Nr; /* the reciprocal */ int num_bits; int shift; int flags; } BN_RECP_CTX;
It cannot be shared between threads.
_B_N___R_E_C_P___C_T_X___i_n_i_t_(_) and _B_N___R_E_C_P___C_T_X___f_r_e_e_(_) have no return values.
For the other functions, 1 is returned for success, 0 on error. The error codes can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3).