xref: /freebsd/crypto/openssl/doc/man3/BN_cmp.pod (revision b077aed33b7b6aefca7b17ddb250cf521f938613)
1e71b7053SJung-uk Kim=pod
2e71b7053SJung-uk Kim
3e71b7053SJung-uk Kim=head1 NAME
4e71b7053SJung-uk Kim
59a3ae0cdSJung-uk KimBN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd - BIGNUM comparison and test functions
6e71b7053SJung-uk Kim
7e71b7053SJung-uk Kim=head1 SYNOPSIS
8e71b7053SJung-uk Kim
9e71b7053SJung-uk Kim #include <openssl/bn.h>
10e71b7053SJung-uk Kim
119a3ae0cdSJung-uk Kim int BN_cmp(const BIGNUM *a, const BIGNUM *b);
129a3ae0cdSJung-uk Kim int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
13e71b7053SJung-uk Kim
149a3ae0cdSJung-uk Kim int BN_is_zero(const BIGNUM *a);
159a3ae0cdSJung-uk Kim int BN_is_one(const BIGNUM *a);
169a3ae0cdSJung-uk Kim int BN_is_word(const BIGNUM *a, const BN_ULONG w);
179a3ae0cdSJung-uk Kim int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
189a3ae0cdSJung-uk Kim int BN_is_odd(const BIGNUM *a);
19e71b7053SJung-uk Kim
20e71b7053SJung-uk Kim=head1 DESCRIPTION
21e71b7053SJung-uk Kim
229a3ae0cdSJung-uk KimBN_cmp() compares the numbers I<a> and I<b>. BN_ucmp() compares their
23e71b7053SJung-uk Kimabsolute values.
24e71b7053SJung-uk Kim
259a3ae0cdSJung-uk KimBN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if
269a3ae0cdSJung-uk KimI<a> equals 0, 1, I<w>, or E<verbar>I<w>E<verbar> respectively.
279a3ae0cdSJung-uk KimBN_is_odd() tests if I<a> is odd.
28e71b7053SJung-uk Kim
29e71b7053SJung-uk Kim=head1 RETURN VALUES
30e71b7053SJung-uk Kim
319a3ae0cdSJung-uk KimBN_cmp() returns -1 if I<a> E<lt> I<b>, 0 if I<a> == I<b> and 1 if
329a3ae0cdSJung-uk KimI<a> E<gt> I<b>. BN_ucmp() is the same using the absolute values
339a3ae0cdSJung-uk Kimof I<a> and I<b>.
34e71b7053SJung-uk Kim
359a3ae0cdSJung-uk KimBN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and
369a3ae0cdSJung-uk KimBN_is_odd() return 1 if the condition is true, 0 otherwise.
379a3ae0cdSJung-uk Kim
389a3ae0cdSJung-uk Kim=head1 HISTORY
399a3ae0cdSJung-uk Kim
409a3ae0cdSJung-uk KimPrior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(),
419a3ae0cdSJung-uk KimBN_abs_is_word() and BN_is_odd() were macros.
42e71b7053SJung-uk Kim
43e71b7053SJung-uk Kim=head1 COPYRIGHT
44e71b7053SJung-uk Kim
459a3ae0cdSJung-uk KimCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
46e71b7053SJung-uk Kim
47*b077aed3SPierre ProncheryLicensed under the Apache License 2.0 (the "License").  You may not use
48e71b7053SJung-uk Kimthis file except in compliance with the License.  You can obtain a copy
49e71b7053SJung-uk Kimin the file LICENSE in the source distribution or at
50e71b7053SJung-uk KimL<https://www.openssl.org/source/license.html>.
51e71b7053SJung-uk Kim
52e71b7053SJung-uk Kim=cut
53