xref: /onnv-gate/usr/src/common/openssl/doc/crypto/BN_cmp.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM comparison and test functions
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/bn.h>
10*2175Sjp161948
11*2175Sjp161948 int BN_cmp(BIGNUM *a, BIGNUM *b);
12*2175Sjp161948 int BN_ucmp(BIGNUM *a, BIGNUM *b);
13*2175Sjp161948
14*2175Sjp161948 int BN_is_zero(BIGNUM *a);
15*2175Sjp161948 int BN_is_one(BIGNUM *a);
16*2175Sjp161948 int BN_is_word(BIGNUM *a, BN_ULONG w);
17*2175Sjp161948 int BN_is_odd(BIGNUM *a);
18*2175Sjp161948
19*2175Sjp161948=head1 DESCRIPTION
20*2175Sjp161948
21*2175Sjp161948BN_cmp() compares the numbers B<a> and B<b>. BN_ucmp() compares their
22*2175Sjp161948absolute values.
23*2175Sjp161948
24*2175Sjp161948BN_is_zero(), BN_is_one() and BN_is_word() test if B<a> equals 0, 1,
25*2175Sjp161948or B<w> respectively. BN_is_odd() tests if a is odd.
26*2175Sjp161948
27*2175Sjp161948BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros.
28*2175Sjp161948
29*2175Sjp161948=head1 RETURN VALUES
30*2175Sjp161948
31*2175Sjp161948BN_cmp() returns -1 if B<a> E<lt> B<b>, 0 if B<a> == B<b> and 1 if
32*2175Sjp161948B<a> E<gt> B<b>. BN_ucmp() is the same using the absolute values
33*2175Sjp161948of B<a> and B<b>.
34*2175Sjp161948
35*2175Sjp161948BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if
36*2175Sjp161948the condition is true, 0 otherwise.
37*2175Sjp161948
38*2175Sjp161948=head1 SEE ALSO
39*2175Sjp161948
40*2175Sjp161948L<bn(3)|bn(3)>
41*2175Sjp161948
42*2175Sjp161948=head1 HISTORY
43*2175Sjp161948
44*2175Sjp161948BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are
45*2175Sjp161948available in all versions of SSLeay and OpenSSL.
46*2175Sjp161948BN_is_odd() was added in SSLeay 0.8.
47*2175Sjp161948
48*2175Sjp161948=cut
49