xref: /onnv-gate/usr/src/common/openssl/doc/crypto/BN_new.pod (revision 2175:b0b2f052a486)
1*2175Sjp161948=pod
2*2175Sjp161948
3*2175Sjp161948=head1 NAME
4*2175Sjp161948
5*2175Sjp161948BN_new, BN_init, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs
6*2175Sjp161948
7*2175Sjp161948=head1 SYNOPSIS
8*2175Sjp161948
9*2175Sjp161948 #include <openssl/bn.h>
10*2175Sjp161948
11*2175Sjp161948 BIGNUM *BN_new(void);
12*2175Sjp161948
13*2175Sjp161948 void BN_init(BIGNUM *);
14*2175Sjp161948
15*2175Sjp161948 void BN_clear(BIGNUM *a);
16*2175Sjp161948
17*2175Sjp161948 void BN_free(BIGNUM *a);
18*2175Sjp161948
19*2175Sjp161948 void BN_clear_free(BIGNUM *a);
20*2175Sjp161948
21*2175Sjp161948=head1 DESCRIPTION
22*2175Sjp161948
23*2175Sjp161948BN_new() allocates and initializes a B<BIGNUM> structure. BN_init()
24*2175Sjp161948initializes an existing uninitialized B<BIGNUM>.
25*2175Sjp161948
26*2175Sjp161948BN_clear() is used to destroy sensitive data such as keys when they
27*2175Sjp161948are no longer needed. It erases the memory used by B<a> and sets it
28*2175Sjp161948to the value 0.
29*2175Sjp161948
30*2175Sjp161948BN_free() frees the components of the B<BIGNUM>, and if it was created
31*2175Sjp161948by BN_new(), also the structure itself. BN_clear_free() additionally
32*2175Sjp161948overwrites the data before the memory is returned to the system.
33*2175Sjp161948
34*2175Sjp161948=head1 RETURN VALUES
35*2175Sjp161948
36*2175Sjp161948BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails,
37*2175Sjp161948it returns B<NULL> and sets an error code that can be obtained
38*2175Sjp161948by L<ERR_get_error(3)|ERR_get_error(3)>.
39*2175Sjp161948
40*2175Sjp161948BN_init(), BN_clear(), BN_free() and BN_clear_free() have no return
41*2175Sjp161948values.
42*2175Sjp161948
43*2175Sjp161948=head1 SEE ALSO
44*2175Sjp161948
45*2175Sjp161948L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>
46*2175Sjp161948
47*2175Sjp161948=head1 HISTORY
48*2175Sjp161948
49*2175Sjp161948BN_new(), BN_clear(), BN_free() and BN_clear_free() are available in
50*2175Sjp161948all versions on SSLeay and OpenSSL.  BN_init() was added in SSLeay
51*2175Sjp1619480.9.1b.
52*2175Sjp161948
53*2175Sjp161948=cut
54