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

NAME

BN_new, BN_free, BN_clear, BN_clear_free, BN_copy, BN_dup, BN_options,
BN_CTX_new, BN_CTX_free -- BN allocation and assignment routines

SYNOPSIS

#include "bn.h"

BIGNUM *BN_new();

void BN_free(a)
BIGNUM *a;

void BN_clear(a)
BIGNUM *a;

void BN_clear_free(a)
BIGNUM *a;

BIGNUM *BN_copy(a, b)
BIGNUM *a, *b;

BIGNUM *BN_dup(a)
BIGNUM *a;

char *BN_options();

BN_CTX *BN_CTX_new();

void BN_CTX_free(c)
BN_CTX *c;

DESCRIPTION

BIGNUM *BN_new creates a new BIGNUM structure and returns a pointer to it. Its value is set to 0. NULL is returned on error.

BN_free frees the BIGNUM a. If a is NULL then no action is taken.

BN_clear Sets a to the value 0 and also zeros all unused allocated memory. This function is used to clear a variable of sensitive data.

BN_clear_free first zeros the memory used by a and then frees it. This function should be used to free BIGNUMs that have held sensitive numeric values like RSA private key values. Both this function and BN_clear are generally used only by RSA, DSA and DH routines. But see ssl/s3_srvr.c for an exception.

BN_copy copies from into to, which must have been previously allocated with BN_new. to will be expanded as needed to hold the new value. to is returned or NULL on error.

BN_dup creates a new BIGNUM and copies a into it. A pointer to the new structure is returned, or NULL on error.

BN_CTX_new creates a new BN_CTX structure and returns a pointer to it. All BIGNUMs contained in the BN_CTX are set to the value 0. A pointer to the new BN_CTX is returned or NULL on error.

BN_CTX_free frees the BN_CTX c. The BIGNUMs in c are BN_clear_free()ed.

bn_expand is an internal function that should not normally be called by the user. It ensures that b has enough room to store a bits bit number. The possinly expanded b is returnedI or NULL on error.