summaryrefslogtreecommitdiff
path: root/src/lib/libssl/src/doc/crypto/bn_internal.pod
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/src/doc/crypto/bn_internal.pod')
-rw-r--r--src/lib/libssl/src/doc/crypto/bn_internal.pod30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/lib/libssl/src/doc/crypto/bn_internal.pod b/src/lib/libssl/src/doc/crypto/bn_internal.pod
index 891914678c..91840b0f0d 100644
--- a/src/lib/libssl/src/doc/crypto/bn_internal.pod
+++ b/src/lib/libssl/src/doc/crypto/bn_internal.pod
@@ -13,6 +13,8 @@ library internal functions
13 13
14=head1 SYNOPSIS 14=head1 SYNOPSIS
15 15
16 #include <openssl/bn.h>
17
16 BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w); 18 BN_ULONG bn_mul_words(BN_ULONG *rp, BN_ULONG *ap, int num, BN_ULONG w);
17 BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num, 19 BN_ULONG bn_mul_add_words(BN_ULONG *rp, BN_ULONG *ap, int num,
18 BN_ULONG w); 20 BN_ULONG w);
@@ -70,24 +72,34 @@ applications.
70 72
71=head2 The BIGNUM structure 73=head2 The BIGNUM structure
72 74
73 typedef struct bignum_st 75 typedef struct bignum_st BIGNUM;
76
77 struct bignum_st
74 { 78 {
75 int top; /* number of words used in d */ 79 BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks. */
76 BN_ULONG *d; /* pointer to an array containing the integer value */ 80 int top; /* Index of last used d +1. */
77 int max; /* size of the d array */ 81 /* The next are internal book keeping for bn_expand. */
78 int neg; /* sign */ 82 int dmax; /* Size of the d array. */
79 } BIGNUM; 83 int neg; /* one if the number is negative */
84 int flags;
85 };
86
80 87
81The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>), 88The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>),
82least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits 89least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits
83in size, depending on the 'number of bits' (B<BITS2>) specified in 90in size, depending on the 'number of bits' (B<BITS2>) specified in
84C<openssl/bn.h>. 91C<openssl/bn.h>.
85 92
86B<max> is the size of the B<d> array that has been allocated. B<top> 93B<dmax> is the size of the B<d> array that has been allocated. B<top>
87is the number of words being used, so for a value of 4, bn.d[0]=4 and 94is the number of words being used, so for a value of 4, bn.d[0]=4 and
88bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is 95bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is
89B<0>, the B<d> field can be B<NULL> and B<top> == B<0>. 96B<0>, the B<d> field can be B<NULL> and B<top> == B<0>.
90 97
98B<flags> is a bit field of flags which are defined in C<openssl/bn.h>. The
99flags begin with B<BN_FLG_>. The macros BN_set_flags(b,n) and
100BN_get_flags(b,n) exist to enable or fetch flag(s) B<n> from B<BIGNUM>
101structure B<b>.
102
91Various routines in this library require the use of temporary 103Various routines in this library require the use of temporary
92B<BIGNUM> variables during their execution. Since dynamic memory 104B<BIGNUM> variables during their execution. Since dynamic memory
93allocation to create B<BIGNUM>s is rather expensive when used in 105allocation to create B<BIGNUM>s is rather expensive when used in
@@ -207,12 +219,12 @@ significant non-zero word plus one when B<a> has shrunk.
207=head2 Debugging 219=head2 Debugging
208 220
209bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top 221bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top
210E<lt>= (a)-E<gt>max)>. A violation will cause the program to abort. 222E<lt>= (a)-E<gt>dmax)>. A violation will cause the program to abort.
211 223
212bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d> 224bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d>
213(in reverse order, i.e. most significant word first) to stderr. 225(in reverse order, i.e. most significant word first) to stderr.
214 226
215bn_set_max() makes B<a> a static number with a B<max> of its current size. 227bn_set_max() makes B<a> a static number with a B<dmax> of its current size.
216This is used by bn_set_low() and bn_set_high() to make B<r> a read-only 228This is used by bn_set_low() and bn_set_high() to make B<r> a read-only
217B<BIGNUM> that contains the B<n> low or high words of B<a>. 229B<BIGNUM> that contains the B<n> low or high words of B<a>.
218 230