xref: /netbsd-src/crypto/external/bsd/openssl/dist/doc/man3/BN_cmp.pod (revision b0d1725196a7921d003d2c66a14f186abda4176b)
113d40330Schristos=pod
213d40330Schristos
313d40330Schristos=head1 NAME
413d40330Schristos
521497c5cSchristosBN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word, BN_is_odd - BIGNUM comparison and test functions
613d40330Schristos
713d40330Schristos=head1 SYNOPSIS
813d40330Schristos
913d40330Schristos #include <openssl/bn.h>
1013d40330Schristos
1121497c5cSchristos int BN_cmp(const BIGNUM *a, const BIGNUM *b);
1221497c5cSchristos int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
1313d40330Schristos
1421497c5cSchristos int BN_is_zero(const BIGNUM *a);
1521497c5cSchristos int BN_is_one(const BIGNUM *a);
1621497c5cSchristos int BN_is_word(const BIGNUM *a, const BN_ULONG w);
1721497c5cSchristos int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
1821497c5cSchristos int BN_is_odd(const BIGNUM *a);
1913d40330Schristos
2013d40330Schristos=head1 DESCRIPTION
2113d40330Schristos
2221497c5cSchristosBN_cmp() compares the numbers I<a> and I<b>. BN_ucmp() compares their
2313d40330Schristosabsolute values.
2413d40330Schristos
2521497c5cSchristosBN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if
2621497c5cSchristosI<a> equals 0, 1, I<w>, or E<verbar>I<w>E<verbar> respectively.
2721497c5cSchristosBN_is_odd() tests if I<a> is odd.
2813d40330Schristos
2913d40330Schristos=head1 RETURN VALUES
3013d40330Schristos
3121497c5cSchristosBN_cmp() returns -1 if I<a> E<lt> I<b>, 0 if I<a> == I<b> and 1 if
3221497c5cSchristosI<a> E<gt> I<b>. BN_ucmp() is the same using the absolute values
3321497c5cSchristosof I<a> and I<b>.
3413d40330Schristos
3521497c5cSchristosBN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and
3621497c5cSchristosBN_is_odd() return 1 if the condition is true, 0 otherwise.
3721497c5cSchristos
3821497c5cSchristos=head1 HISTORY
3921497c5cSchristos
4021497c5cSchristosPrior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(),
4121497c5cSchristosBN_abs_is_word() and BN_is_odd() were macros.
4213d40330Schristos
4313d40330Schristos=head1 COPYRIGHT
4413d40330Schristos
4521497c5cSchristosCopyright 2000-2021 The OpenSSL Project Authors. All Rights Reserved.
4613d40330Schristos
47*b0d17251SchristosLicensed under the Apache License 2.0 (the "License").  You may not use
4813d40330Schristosthis file except in compliance with the License.  You can obtain a copy
4913d40330Schristosin the file LICENSE in the source distribution or at
5013d40330SchristosL<https://www.openssl.org/source/license.html>.
5113d40330Schristos
5213d40330Schristos=cut
53