xref: /onnv-gate/usr/src/common/openssl/doc/crypto/BN_add_word.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic
6*2175Sjp161948functions on BIGNUMs with integers
7*2175Sjp161948
8*2175Sjp161948=head1 SYNOPSIS
9*2175Sjp161948
10*2175Sjp161948 #include <openssl/bn.h>
11*2175Sjp161948
12*2175Sjp161948 int BN_add_word(BIGNUM *a, BN_ULONG w);
13*2175Sjp161948
14*2175Sjp161948 int BN_sub_word(BIGNUM *a, BN_ULONG w);
15*2175Sjp161948
16*2175Sjp161948 int BN_mul_word(BIGNUM *a, BN_ULONG w);
17*2175Sjp161948
18*2175Sjp161948 BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w);
19*2175Sjp161948
20*2175Sjp161948 BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w);
21*2175Sjp161948
22*2175Sjp161948=head1 DESCRIPTION
23*2175Sjp161948
24*2175Sjp161948These functions perform arithmetic operations on BIGNUMs with unsigned
25*2175Sjp161948integers. They are much more efficient than the normal BIGNUM
26*2175Sjp161948arithmetic operations.
27*2175Sjp161948
28*2175Sjp161948BN_add_word() adds B<w> to B<a> (C<a+=w>).
29*2175Sjp161948
30*2175Sjp161948BN_sub_word() subtracts B<w> from B<a> (C<a-=w>).
31*2175Sjp161948
32*2175Sjp161948BN_mul_word() multiplies B<a> and B<w> (C<a*=w>).
33*2175Sjp161948
34*2175Sjp161948BN_div_word() divides B<a> by B<w> (C<a/=w>) and returns the remainder.
35*2175Sjp161948
36*2175Sjp161948BN_mod_word() returns the remainder of B<a> divided by B<w> (C<a%w>).
37*2175Sjp161948
38*2175Sjp161948For BN_div_word() and BN_mod_word(), B<w> must not be 0.
39*2175Sjp161948
40*2175Sjp161948=head1 RETURN VALUES
41*2175Sjp161948
42*2175Sjp161948BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0
43*2175Sjp161948on error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>.
44*2175Sjp161948
45*2175Sjp161948BN_mod_word() and BN_div_word() return B<a>%B<w> on success and
46*2175Sjp161948B<(BN_ULONG)-1> if an error occurred.
47*2175Sjp161948
48*2175Sjp161948=head1 SEE ALSO
49*2175Sjp161948
50*2175Sjp161948L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>
51*2175Sjp161948
52*2175Sjp161948=head1 HISTORY
53*2175Sjp161948
54*2175Sjp161948BN_add_word() and BN_mod_word() are available in all versions of
55*2175Sjp161948SSLeay and OpenSSL. BN_div_word() was added in SSLeay 0.8, and
56*2175Sjp161948BN_sub_word() and BN_mul_word() in SSLeay 0.9.0.
57*2175Sjp161948
58*2175Sjp161948Before 0.9.8a the return value for BN_div_word() and BN_mod_word()
59*2175Sjp161948in case of an error was 0.
60*2175Sjp161948
61*2175Sjp161948=cut
62