BN_cmp() -- SSLeay 0.9.0b -- January 1999

NAME

BN_cmp, BN_is_bit_set, BN_ucmp -- BN comparison and test routines

SYNOPSIS

#include "bn.h"

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

int BN_is_bit_set(a, n)
BIGNUM *a;
int n;

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

DESCRIPTION

BN_cmp returns -1 if a is less than b, 0 if a and b are the same and 1 if a is greater than b. This is a signed comparison.

BN_is_bit_set returns 1 if bit n is set in a else 0.

BN_ucmp acts like BN_cmp except that the comparison ignores the sign of the numbers.

The following macros are provided for the convenience of the user:

#define BN_is_word(a,w) (((a)->top == 1) && ((a)->d[0] == (BN_ULONG)(w)))
#define BN_is_zero(a)   (((a)->top %lt;= 1) && ((a)->d[0] == (BN_ULONG)0))
#define BN_is_one(a)    (BN_is_word((a),1))
#define BN_is_odd(a)    ((a)->d[0] & 1)

BN_is_word returns 1 if a == w, else 0. w is a BN_ULONG.

BN_is_zero returns 1 if a is zero, else 0.

BN_is_one returns 1 is a is one, else 0.

BN_is_odd returns 1 if a is odd, else 0.