BN_BLINDING_new 3 2008-05-09 0.9.9-dev OpenSSL

NAME

BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, BN_BLINDING_set_thread, BN_BLINDING_cmp_thread, BN_BLINDING_get_flags, BN_BLINDING_set_flags, BN_BLINDING_create_param - blinding related BIGNUM functions.

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 



 BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai,
        BIGNUM *mod);
 void BN_BLINDING_free(BN_BLINDING *b);
 int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx);
 int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
 int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx);
 int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b,
        BN_CTX *ctx);
 int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b,
        BN_CTX *ctx);






 void BN_BLINDING_set_thread(BN_BLINDING *);
 int BN_BLINDING_cmp_thread(const BN_BLINDING *,
        const CRYPTO_THREADID *);
 unsigned long BN_BLINDING_get_flags(const BN_BLINDING *);
 void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long);
 BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
        const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
        int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
                          const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
        BN_MONT_CTX *m_ctx);

DESCRIPTION

_B_N___B_L_I_N_D_I_N_G___n_e_w_(_) allocates a new BBNN__BBLLIINNDDIINNGG structure and copies the AA and AAii values into the newly created BBNN__BBLLIINNDDIINNGG object.

_B_N___B_L_I_N_D_I_N_G___f_r_e_e_(_) frees the BBNN__BBLLIINNDDIINNGG structure.

_B_N___B_L_I_N_D_I_N_G___u_p_d_a_t_e_(_) updates the BBNN__BBLLIINNDDIINNGG parameters by squaring the AA and AAii or, after specific number of uses and if the necessary parameters are set, by re-creating the blinding parameters.

_B_N___B_L_I_N_D_I_N_G___c_o_n_v_e_r_t___e_x_(_) multiplies nn with the blinding factor AA. If rr is not NULL a copy the inverse blinding factor AAii will be returned in rr (this is useful if a RRSSAA object is shared amoung several threads). _B_N___B_L_I_N_D_I_N_G___i_n_v_e_r_t___e_x_(_) multiplies nn with the inverse blinding factor AAii. If rr is not NULL it will be used as the inverse blinding.

_B_N___B_L_I_N_D_I_N_G___c_o_n_v_e_r_t_(_) and _B_N___B_L_I_N_D_I_N_G___i_n_v_e_r_t_(_) are wrapper functions for _B_N___B_L_I_N_D_I_N_G___c_o_n_v_e_r_t___e_x_(_) and _B_N___B_L_I_N_D_I_N_G___i_n_v_e_r_t___e_x_(_) with rr set to NULL.

_B_N___B_L_I_N_D_I_N_G___s_e_t___t_h_r_e_a_d_(_) and _B_N___B_L_I_N_D_I_N_G___c_m_p___t_h_r_e_a_d_(_) set and compare the "thread id" of the BBNN__BBLLIINNDDIINNGG structure, allowing users of the BBNN__BBLLIINNDDIINNGG structure to provide proper locking if needed for multi-threaded use.

_B_N___B_L_I_N_D_I_N_G___g_e_t___f_l_a_g_s_(_) returns the BN_BLINDING flags. Currently there are two supported flags: BBNN__BBLLIINNDDIINNGG__NNOO__UUPPDDAATTEE and BBNN__BBLLIINNDDIINNGG__NNOO__RREECCRREEAATTEE. BBNN__BBLLIINNDDIINNGG__NNOO__UUPPDDAATTEE inhibits the automatic update of the BBNN__BBLLIINNDDIINNGG parameters after each use and BBNN__BBLLIINNDDIINNGG__NNOO__RREECCRREEAATTEE inhibits the automatic re-creation of the BBNN__BBLLIINNDDIINNGG parameters after a fixed number of uses (currently 32). In newly allocated BBNN__BBLLIINNDDIINNGG objects no flags are set. _B_N___B_L_I_N_D_I_N_G___s_e_t___f_l_a_g_s_(_) sets the BBNN__BBLLIINNDDIINNGG parameters flags.

_B_N___B_L_I_N_D_I_N_G___c_r_e_a_t_e___p_a_r_a_m_(_) creates new BBNN__BBLLIINNDDIINNGG parameters using the exponent ee and the modulus mm. bbnn__mmoodd__eexxpp and mm__ccttxx can be used to pass special functions for exponentiation (normally _B_N___m_o_d___e_x_p___m_o_n_t_(_) and BBNN__MMOONNTT__CCTTXX).

RETURN VALUES

_B_N___B_L_I_N_D_I_N_G___n_e_w_(_) returns the newly allocated BBNN__BBLLIINNDDIINNGG structure or NULL in case of an error.

_B_N___B_L_I_N_D_I_N_G___u_p_d_a_t_e_(_), _B_N___B_L_I_N_D_I_N_G___c_o_n_v_e_r_t_(_), _B_N___B_L_I_N_D_I_N_G___i_n_v_e_r_t_(_), _B_N___B_L_I_N_D_I_N_G___c_o_n_v_e_r_t___e_x_(_) and _B_N___B_L_I_N_D_I_N_G___i_n_v_e_r_t___e_x_(_) return 1 on success and 0 if an error occured.

_B_N___B_L_I_N_D_I_N_G___g_e_t___t_h_r_e_a_d___i_d_(_) returns the thread id (a uunnssiiggnneedd lloonngg value) or 0 if not set. _B_N___B_L_I_N_D_I_N_G___c_m_p___t_h_r_e_a_d_(_) returns 0 if the thread id associated with the BBNN__BBLLIINNDDIINNGG structure equals the provided thread id (which can be obtained by _C_R_Y_P_T_O___T_H_R_E_A_D_I_D___s_e_t_(_)), otherwise it returns -1 or +1 to indicate the thread ids are different (if the target architecture supports ordering of thread ids, this follows the traditional "cmp" semantics of _m_e_m_c_m_p_(_) or _s_t_r_c_m_p_(_)).

_B_N___B_L_I_N_D_I_N_G___g_e_t___f_l_a_g_s_(_) returns the currently set BBNN__BBLLIINNDDIINNGG flags (a uunnssiiggnneedd lloonngg value).

_B_N___B_L_I_N_D_I_N_G___c_r_e_a_t_e___p_a_r_a_m_(_) returns the newly created BBNN__BBLLIINNDDIINNGG parameters or NULL on error.

SEE ALSO

_o_p_e_n_s_s_l___b_n(3)

HISTORY

BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8

BN_BLINDING_get_thread_idptr, BN_BLINDING_set_thread_idptr were first introduced in OpenSSL 0.9.9

BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_get_thread_idptr, BN_BLINDING_set_thread_idptr were all deprecated in favour of BN_BLINDING_set_thread, BN_BLINDING_cmp_thread which were introduced in OpenSSL 0.9.9

AUTHOR

Nils Larsch for the OpenSSL project (http://www.openssl.org).