xref: /openbsd-src/lib/libcrypto/man/BN_cmp.3 (revision f2da64fbbbf1b03f09f390ab01267c93dfd77c4c)
1.Dd $Mdocdate: February 23 2015 $
2.Dt BN_CMP 3
3.Os
4.Sh NAME
5.Nm BN_cmp ,
6.Nm BN_ucmp ,
7.Nm BN_is_zero ,
8.Nm BN_is_one ,
9.Nm BN_is_word ,
10.Nm BN_is_odd
11.Nd BIGNUM comparison and test functions
12.Sh SYNOPSIS
13.In openssl/bn.h
14.Ft int
15.Fo BN_cmp
16.Fa "BIGNUM *a"
17.Fa "BIGNUM *b"
18.Fc
19.Ft int
20.Fo BN_ucmp
21.Fa "BIGNUM *a"
22.Fa "BIGNUM *b"
23.Fc
24.Ft int
25.Fo BN_is_zero
26.Fa "BIGNUM *a"
27.Fc
28.Ft int
29.Fo BN_is_one
30.Fa "BIGNUM *a"
31.Fc
32.Ft int
33.Fo BN_is_word
34.Fa "BIGNUM *a"
35.Fa "BN_ULONG w"
36.Fc
37.Ft int
38.Fo BN_is_odd
39.Fa "BIGNUM *a"
40.Fc
41.Sh DESCRIPTION
42.Fn BN_cmp
43compares the numbers
44.Fa a
45and
46.Fa b .
47.Fn BN_ucmp
48compares their absolute values.
49.Pp
50.Fn BN_is_zero ,
51.Fn BN_is_one
52and
53.Fn BN_is_word
54test if
55.Fa a
56equals 0, 1, or
57.Fa w
58respectively.
59.Fn BN_is_odd
60tests if a is odd.
61.Pp
62.Fn BN_is_zero ,
63.Fn BN_is_one ,
64.Fn BN_is_word ,
65and
66.Fn BN_is_odd
67are macros.
68.Sh RETURN VALUES
69.Fn BN_cmp
70returns -1 if
71.Fa a Ns < Ns Fa b ,
720 if
73.Fa a Ns == Ns Fa b ,
74and 1 if
75.Fa a Ns > Ns Fa b .
76.Fn BN_ucmp
77is the same using the absolute values of
78.Fa a
79and
80.Fa b .
81.Pp
82.Fn BN_is_zero ,
83.Fn BN_is_one ,
84.Fn BN_is_word ,
85and
86.Fn BN_is_odd
87return 1 if the condition is true, 0 otherwise.
88.Sh SEE ALSO
89.Xr bn 3
90.Sh HISTORY
91.Fn BN_cmp ,
92.Fn BN_ucmp ,
93.Fn BN_is_zero ,
94.Fn BN_is_one
95and
96.Fn BN_is_word
97are available in all versions of SSLeay and OpenSSL.
98.Fn BN_is_odd
99was added in SSLeay 0.8.
100