BN_CTX_start 3 2001-04-12 0.9.9-dev OpenSSL

NAME

BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 void BN_CTX_start(BN_CTX *ctx);


 BIGNUM *BN_CTX_get(BN_CTX *ctx);


 void BN_CTX_end(BN_CTX *ctx);

DESCRIPTION

These functions are used to obtain temporary BBIIGGNNUUMM variables from a BBNN__CCTTXX (which can been created by using _B_N___C_T_X___n_e_w(3)) in order to save the overhead of repeatedly creating and freeing BBIIGGNNUUMMs in functions that are called from inside a loop.

A function must call _B_N___C_T_X___s_t_a_r_t_(_) first. Then, _B_N___C_T_X___g_e_t_(_) may be called repeatedly to obtain temporary BBIIGGNNUUMMs. All _B_N___C_T_X___g_e_t_(_) calls must be made before calling any other functions that use the ccttxx as an argument.

Finally, _B_N___C_T_X___e_n_d_(_) must be called before returning from the function. When _B_N___C_T_X___e_n_d_(_) is called, the BBIIGGNNUUMM pointers obtained from _B_N___C_T_X___g_e_t_(_) become invalid.

RETURN VALUES

_B_N___C_T_X___s_t_a_r_t_(_) and _B_N___C_T_X___e_n_d_(_) return no values.

_B_N___C_T_X___g_e_t_(_) returns a pointer to the BBIIGGNNUUMM, or NNUULLLL on error. Once _B_N___C_T_X___g_e_t_(_) has failed, the subsequent calls will return NNUULLLL as well, so it is sufficient to check the return value of the last _B_N___C_T_X___g_e_t_(_) call. In case of an error, an error code is set, which can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3).

SEE ALSO

_B_N___C_T_X___n_e_w(3)

HISTORY

_B_N___C_T_X___s_t_a_r_t_(_), _B_N___C_T_X___g_e_t_(_) and _B_N___C_T_X___e_n_d_(_) were added in OpenSSL 0.9.5.