Go to main content

man pages section 3: Extended Library Functions, Volume 1

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

BN_cmp (3openssl)

Name

BN_cmp - BIGNUM comparison and test functions

Synopsis

#include <openssl/bn.h>

int BN_cmp(BIGNUM *a, BIGNUM *b);
int BN_ucmp(BIGNUM *a, BIGNUM *b);

int BN_is_zero(BIGNUM *a);
int BN_is_one(BIGNUM *a);
int BN_is_word(BIGNUM *a, BN_ULONG w);
int BN_is_odd(BIGNUM *a);

Description

BN_cmp(3openssl)                    OpenSSL                   BN_cmp(3openssl)



NAME
       BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM
       comparison and test functions

SYNOPSIS
        #include <openssl/bn.h>

        int BN_cmp(BIGNUM *a, BIGNUM *b);
        int BN_ucmp(BIGNUM *a, BIGNUM *b);

        int BN_is_zero(BIGNUM *a);
        int BN_is_one(BIGNUM *a);
        int BN_is_word(BIGNUM *a, BN_ULONG w);
        int BN_is_odd(BIGNUM *a);

DESCRIPTION
       BN_cmp() compares the numbers a and b. BN_ucmp() compares their
       absolute values.

       BN_is_zero(), BN_is_one() and BN_is_word() test if a equals 0, 1, or w
       respectively. BN_is_odd() tests if a is odd.

       BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros.

RETURN VALUES
       BN_cmp() returns -1 if a < b, 0 if a == b and 1 if a > b. BN_ucmp() is
       the same using the absolute values of a and b.

       BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if the
       condition is true, 0 otherwise.


ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:


       +---------------+--------------------------+
       |ATTRIBUTE TYPE |     ATTRIBUTE VALUE      |
       +---------------+--------------------------+
       |Availability   | library/security/openssl |
       +---------------+--------------------------+
       |Stability      | Pass-through uncommitted |
       +---------------+--------------------------+

SEE ALSO
       bn(3)

HISTORY
       BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are
       available in all versions of SSLeay and OpenSSL.  BN_is_odd() was added
       in SSLeay 0.8.



NOTES
       Source code for open source software components in Oracle Solaris can
       be found at https://www.oracle.com/downloads/opensource/solaris-source-
       code-downloads.html.

       This software was built from source available at
       https://github.com/oracle/solaris-userland.  The original community
       source was downloaded from
       https://www.openssl.org/source/openssl-1.0.2ze.tar.gz.

       Further information about this software can be found on the open source
       community website at https://www.openssl.org/.



1.0.2ze                           2022-05-03                  BN_cmp(3openssl)