diff options
Diffstat (limited to 'src/lib/libssl/src/doc/crypto/bn_internal.pod')
-rw-r--r-- | src/lib/libssl/src/doc/crypto/bn_internal.pod | 30 |
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 | ||
81 | The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>), | 88 | The integer value is stored in B<d>, a malloc()ed array of words (B<BN_ULONG>), |
82 | least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits | 89 | least significant word first. A B<BN_ULONG> can be either 16, 32 or 64 bits |
83 | in size, depending on the 'number of bits' (B<BITS2>) specified in | 90 | in size, depending on the 'number of bits' (B<BITS2>) specified in |
84 | C<openssl/bn.h>. | 91 | C<openssl/bn.h>. |
85 | 92 | ||
86 | B<max> is the size of the B<d> array that has been allocated. B<top> | 93 | B<dmax> is the size of the B<d> array that has been allocated. B<top> |
87 | is the number of words being used, so for a value of 4, bn.d[0]=4 and | 94 | is the number of words being used, so for a value of 4, bn.d[0]=4 and |
88 | bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is | 95 | bn.top=1. B<neg> is 1 if the number is negative. When a B<BIGNUM> is |
89 | B<0>, the B<d> field can be B<NULL> and B<top> == B<0>. | 96 | B<0>, the B<d> field can be B<NULL> and B<top> == B<0>. |
90 | 97 | ||
98 | B<flags> is a bit field of flags which are defined in C<openssl/bn.h>. The | ||
99 | flags begin with B<BN_FLG_>. The macros BN_set_flags(b,n) and | ||
100 | BN_get_flags(b,n) exist to enable or fetch flag(s) B<n> from B<BIGNUM> | ||
101 | structure B<b>. | ||
102 | |||
91 | Various routines in this library require the use of temporary | 103 | Various routines in this library require the use of temporary |
92 | B<BIGNUM> variables during their execution. Since dynamic memory | 104 | B<BIGNUM> variables during their execution. Since dynamic memory |
93 | allocation to create B<BIGNUM>s is rather expensive when used in | 105 | allocation 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 | ||
209 | bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top | 221 | bn_check_top() verifies that C<((a)-E<gt>top E<gt>= 0 && (a)-E<gt>top |
210 | E<lt>= (a)-E<gt>max)>. A violation will cause the program to abort. | 222 | E<lt>= (a)-E<gt>dmax)>. A violation will cause the program to abort. |
211 | 223 | ||
212 | bn_print() prints B<a> to stderr. bn_dump() prints B<n> words at B<d> | 224 | bn_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 | ||
215 | bn_set_max() makes B<a> a static number with a B<max> of its current size. | 227 | bn_set_max() makes B<a> a static number with a B<dmax> of its current size. |
216 | This is used by bn_set_low() and bn_set_high() to make B<r> a read-only | 228 | This is used by bn_set_low() and bn_set_high() to make B<r> a read-only |
217 | B<BIGNUM> that contains the B<n> low or high words of B<a>. | 229 | B<BIGNUM> that contains the B<n> low or high words of B<a>. |
218 | 230 | ||