1BN_CMP(3ossl)                       OpenSSL                      BN_CMP(3ossl)
2
3
4

NAME

6       BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_abs_is_word,
7       BN_is_odd, BN_are_coprime - BIGNUM comparison and test functions
8

SYNOPSIS

10        #include <openssl/bn.h>
11
12        int BN_cmp(const BIGNUM *a, const BIGNUM *b);
13        int BN_ucmp(const BIGNUM *a, const BIGNUM *b);
14
15        int BN_is_zero(const BIGNUM *a);
16        int BN_is_one(const BIGNUM *a);
17        int BN_is_word(const BIGNUM *a, const BN_ULONG w);
18        int BN_abs_is_word(const BIGNUM *a, const BN_ULONG w);
19        int BN_is_odd(const BIGNUM *a);
20
21        int BN_are_coprime(BIGNUM *a, const BIGNUM *b, BN_CTX *ctx);
22

DESCRIPTION

24       BN_cmp() compares the numbers a and b. BN_ucmp() compares their
25       absolute values.
26
27       BN_is_zero(), BN_is_one(), BN_is_word() and BN_abs_is_word() test if a
28       equals 0, 1, w, or |w| respectively.  BN_is_odd() tests if a is odd.
29
30       BN_are_coprime() determines if a and b are coprime.  ctx is used
31       internally for storing temporary variables.  The values of a and b and
32       ctx must not be NULL.
33

RETURN VALUES

35       BN_cmp() returns -1 if a < b, 0 if a == b and 1 if a > b. BN_ucmp() is
36       the same using the absolute values of a and b.
37
38       BN_is_zero(), BN_is_one() BN_is_word(), BN_abs_is_word() and
39       BN_is_odd() return 1 if the condition is true, 0 otherwise.
40
41       BN_are_coprime() returns 1 if the BIGNUM's are coprime, otherwise it
42       returns 0.
43

HISTORY

45       Prior to OpenSSL 1.1.0, BN_is_zero(), BN_is_one(), BN_is_word(),
46       BN_abs_is_word() and BN_is_odd() were macros.
47
48       The function BN_are_coprime() was added in OpenSSL 3.1.
49
51       Copyright 2000-2022 The OpenSSL Project Authors. All Rights Reserved.
52
53       Licensed under the Apache License 2.0 (the "License").  You may not use
54       this file except in compliance with the License.  You can obtain a copy
55       in the file LICENSE in the source distribution or at
56       <https://www.openssl.org/source/license.html>.
57
58
59
603.1.1                             2023-08-31                     BN_CMP(3ossl)
Impressum