BN_add_word 3 2005-11-24 0.9.9-dev OpenSSL

NAME

BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic functions on BIGNUMs with integers

LIBRARY

libcrypto, -lcrypto

SYNOPSIS


 #include 


 int BN_add_word(BIGNUM *a, BN_ULONG w);


 int BN_sub_word(BIGNUM *a, BN_ULONG w);


 int BN_mul_word(BIGNUM *a, BN_ULONG w);


 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);


 BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);

DESCRIPTION

These functions perform arithmetic operations on BIGNUMs with unsigned integers. They are much more efficient than the normal BIGNUM arithmetic operations.

_B_N___a_d_d___w_o_r_d_(_) adds ww to aa ("a+=w").

_B_N___s_u_b___w_o_r_d_(_) subtracts ww from aa ("a-=w").

_B_N___m_u_l___w_o_r_d_(_) multiplies aa and ww ("a*=w").

_B_N___d_i_v___w_o_r_d_(_) divides aa by ww ("a/=w") and returns the remainder.

_B_N___m_o_d___w_o_r_d_(_) returns the remainder of aa divided by ww ("a%w").

For _B_N___d_i_v___w_o_r_d_(_) and _B_N___m_o_d___w_o_r_d_(_), ww must not be 0.

RETURN VALUES

_B_N___a_d_d___w_o_r_d_(_), _B_N___s_u_b___w_o_r_d_(_) and _B_N___m_u_l___w_o_r_d_(_) return 1 for success, 0 on error. The error codes can be obtained by _E_R_R___g_e_t___e_r_r_o_r(3).

_B_N___m_o_d___w_o_r_d_(_) and _B_N___d_i_v___w_o_r_d_(_) return aa%ww on success and ((BBNN__UULLOONNGG))--11 if an error occurred.

SEE ALSO

_o_p_e_n_s_s_l___b_n(3), _E_R_R___g_e_t___e_r_r_o_r(3), _B_N___a_d_d(3)

HISTORY

_B_N___a_d_d___w_o_r_d_(_) and _B_N___m_o_d___w_o_r_d_(_) are available in all versions of SSLeay and OpenSSL. _B_N___d_i_v___w_o_r_d_(_) was added in SSLeay 0.8, and _B_N___s_u_b___w_o_r_d_(_) and _B_N___m_u_l___w_o_r_d_(_) in SSLeay 0.9.0.

Before 0.9.8a the return value for _B_N___d_i_v___w_o_r_d_(_) and _B_N___m_o_d___w_o_r_d_(_) in case of an error was 0.