diff options
author | schwarze <> | 2015-02-23 17:43:24 +0000 |
---|---|---|
committer | schwarze <> | 2015-02-23 17:43:24 +0000 |
commit | 9cb1a51933a1847042ee88e16d560485f682bcad (patch) | |
tree | 5a76fb973ee649bdb33c7731bc1ca457abfcec1e | |
parent | 2820d04ee847cb7bede0b25e49194c3ade7ebdbf (diff) | |
download | openbsd-9cb1a51933a1847042ee88e16d560485f682bcad.tar.gz openbsd-9cb1a51933a1847042ee88e16d560485f682bcad.tar.bz2 openbsd-9cb1a51933a1847042ee88e16d560485f682bcad.zip |
fourth batch of perlpod(1) to mdoc(7) conversion
37 files changed, 2521 insertions, 1276 deletions
diff --git a/src/lib/libcrypto/man/BN_BLINDING_new.3 b/src/lib/libcrypto/man/BN_BLINDING_new.3 new file mode 100644 index 0000000000..c65d79c3bc --- /dev/null +++ b/src/lib/libcrypto/man/BN_BLINDING_new.3 | |||
@@ -0,0 +1,269 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_BLINDING_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_BLINDING_new , | ||
6 | .Nm BN_BLINDING_free , | ||
7 | .Nm BN_BLINDING_update , | ||
8 | .Nm BN_BLINDING_convert , | ||
9 | .Nm BN_BLINDING_invert , | ||
10 | .Nm BN_BLINDING_convert_ex , | ||
11 | .Nm BN_BLINDING_invert_ex , | ||
12 | .Nm BN_BLINDING_get_thread_id , | ||
13 | .Nm BN_BLINDING_set_thread_id , | ||
14 | .Nm BN_BLINDING_thread_id , | ||
15 | .Nm BN_BLINDING_get_flags , | ||
16 | .Nm BN_BLINDING_set_flags , | ||
17 | .Nm BN_BLINDING_create_param | ||
18 | .Nd blinding related BIGNUM functions | ||
19 | .Sh SYNOPSIS | ||
20 | .In openssl/bn.h | ||
21 | .Ft BN_BLINDING * | ||
22 | .Fo BN_BLINDING_new | ||
23 | .Fa "const BIGNUM *A" | ||
24 | .Fa "const BIGNUM *Ai" | ||
25 | .Fa "BIGNUM *mod" | ||
26 | .Fc | ||
27 | .Ft void | ||
28 | .Fo BN_BLINDING_free | ||
29 | .Fa "BN_BLINDING *b" | ||
30 | .Fc | ||
31 | .Ft int | ||
32 | .Fo BN_BLINDING_update | ||
33 | .Fa "BN_BLINDING *b" | ||
34 | .Fa "BN_CTX *ctx" | ||
35 | .Fc | ||
36 | .Ft int | ||
37 | .Fo BN_BLINDING_convert | ||
38 | .Fa "BIGNUM *n" | ||
39 | .Fa "BN_BLINDING *b" | ||
40 | .Fa "BN_CTX *ctx" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo BN_BLINDING_invert | ||
44 | .Fa "BIGNUM *n" | ||
45 | .Fa "BN_BLINDING *b" | ||
46 | .Fa "BN_CTX *ctx" | ||
47 | .Fc | ||
48 | .Ft int | ||
49 | .Fo BN_BLINDING_convert_ex | ||
50 | .Fa "BIGNUM *n" | ||
51 | .Fa "BIGNUM *r" | ||
52 | .Fa "BN_BLINDING *b" | ||
53 | .Fa "BN_CTX *ctx" | ||
54 | .Fc | ||
55 | .Ft int | ||
56 | .Fo BN_BLINDING_invert_ex | ||
57 | .Fa "BIGNUM *n" | ||
58 | .Fa "const BIGNUM *r" | ||
59 | .Fa "BN_BLINDING *b" | ||
60 | .Fa "BN_CTX *ctx" | ||
61 | .Fc | ||
62 | .Fd #ifndef OPENSSL_NO_DEPRECATED | ||
63 | .Ft unsigned long | ||
64 | .Fo BN_BLINDING_get_thread_id | ||
65 | .Fa "const BN_BLINDING *" | ||
66 | .Fc | ||
67 | .Ft void | ||
68 | .Fo BN_BLINDING_set_thread_id | ||
69 | .Fa "BN_BLINDING *" | ||
70 | .Fa "unsigned long" | ||
71 | .Fc | ||
72 | .Fd #endif | ||
73 | .Ft CRYPTO_THREADID * | ||
74 | .Fo BN_BLINDING_thread_id | ||
75 | .Fa "BN_BLINDING *" | ||
76 | .Fc | ||
77 | .Ft unsigned long | ||
78 | .Fo BN_BLINDING_get_flags | ||
79 | .Fa "const BN_BLINDING *" | ||
80 | .Fc | ||
81 | .Ft void | ||
82 | .Fo BN_BLINDING_set_flags | ||
83 | .Fa "BN_BLINDING *" | ||
84 | .Fa "unsigned long" | ||
85 | .Fc | ||
86 | .Ft BN_BLINDING * | ||
87 | .Fo BN_BLINDING_create_param | ||
88 | .Fa "BN_BLINDING *b" | ||
89 | .Fa "const BIGNUM *e" | ||
90 | .Fa "BIGNUM *m" | ||
91 | .Fa "BN_CTX *ctx" | ||
92 | .Fa "int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\ | ||
93 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)" | ||
94 | .Fa "BN_MONT_CTX *m_ctx" | ||
95 | .Fc | ||
96 | .Sh DESCRIPTION | ||
97 | .Fn BN_BLINDING_new | ||
98 | allocates a new | ||
99 | .Vt BN_BLINDING | ||
100 | structure and copies the | ||
101 | .Fa A | ||
102 | and | ||
103 | .Fa \&Ai | ||
104 | values into the newly created | ||
105 | .Vt BN_BLINDING | ||
106 | object. | ||
107 | .Pp | ||
108 | .Fn BN_BLINDING_free | ||
109 | frees the | ||
110 | .Vt BN_BLINDING | ||
111 | structure. | ||
112 | .Pp | ||
113 | .Fn BN_BLINDING_update | ||
114 | updates the | ||
115 | .Vt BN_BLINDING | ||
116 | parameters by squaring the | ||
117 | .Fa A | ||
118 | and | ||
119 | .Fa \&Ai | ||
120 | or, after specific number of uses and if the necessary parameters are | ||
121 | set, by re-creating the blinding parameters. | ||
122 | .Pp | ||
123 | .Fn BN_BLINDING_convert_ex | ||
124 | multiplies | ||
125 | .Fa n | ||
126 | with the blinding factor | ||
127 | .Fa A . | ||
128 | If | ||
129 | .Fa r | ||
130 | is not | ||
131 | .Dv NULL , | ||
132 | a copy of the inverse blinding factor | ||
133 | .Fa \&Ai | ||
134 | will be returned in | ||
135 | .Fa r | ||
136 | (this is useful if a | ||
137 | .Vt RSA | ||
138 | object is shared among several threads). | ||
139 | .Fn BN_BLINDING_invert_ex | ||
140 | multiplies | ||
141 | .Fa n | ||
142 | with the inverse blinding factor | ||
143 | .Fa \&Ai . | ||
144 | If | ||
145 | .Fa r | ||
146 | is not | ||
147 | .Dv NULL , | ||
148 | it will be used as the inverse blinding. | ||
149 | .Pp | ||
150 | .Fn BN_BLINDING_convert | ||
151 | and | ||
152 | .Fn BN_BLINDING_invert | ||
153 | are wrapper functions for | ||
154 | .Fn BN_BLINDING_convert_ex | ||
155 | and | ||
156 | .Fn BN_BLINDING_invert_ex | ||
157 | with | ||
158 | .Fa r | ||
159 | set to | ||
160 | .Dv NULL . | ||
161 | .Pp | ||
162 | .Fn BN_BLINDING_thread_id | ||
163 | provides access to the | ||
164 | .Vt CRYPTO_THREADID | ||
165 | object within the | ||
166 | .Vt BN_BLINDING | ||
167 | structure. | ||
168 | This is to help users provide proper locking if needed for | ||
169 | multi-threaded use. | ||
170 | The "thread id" object of a newly allocated | ||
171 | .Vt BN_BLINDING | ||
172 | structure is initialised to the thread id in which | ||
173 | .Fn BN_BLINDING_new | ||
174 | was called. | ||
175 | .Pp | ||
176 | .Fn BN_BLINDING_get_flags | ||
177 | returns the | ||
178 | .Dv BN_BLINDING_* | ||
179 | flags. | ||
180 | Currently there are two supported flags: | ||
181 | .Dv BN_BLINDING_NO_UPDATE | ||
182 | and | ||
183 | .Dv BN_BLINDING_NO_RECREATE . | ||
184 | .Dv BN_BLINDING_NO_UPDATE | ||
185 | inhibits the automatic update of the | ||
186 | .Vt BN_BLINDING | ||
187 | parameters after each use and | ||
188 | .Dv BN_BLINDING_NO_RECREATE | ||
189 | inhibits the automatic re-creation of the | ||
190 | .Vt BN_BLINDING | ||
191 | parameters after a fixed number of uses (currently 32). | ||
192 | In newly allocated | ||
193 | .Vt BN_BLINDING | ||
194 | objects no flags are set. | ||
195 | .Fn BN_BLINDING_set_flags | ||
196 | sets the | ||
197 | .Dv BN_BLINDING_* | ||
198 | parameters flags. | ||
199 | .Pp | ||
200 | .Fn BN_BLINDING_create_param | ||
201 | creates new | ||
202 | .Vt BN_BLINDING | ||
203 | parameters using the exponent | ||
204 | .Fa e | ||
205 | and the modulus | ||
206 | .Fa m . | ||
207 | .Fa bn_mod_exp | ||
208 | and | ||
209 | .Fa m_ctx | ||
210 | can be used to pass special functions for exponentiation (normally | ||
211 | .Xr BN_mod_exp_mont 3 | ||
212 | and | ||
213 | .Vt BN_MONT_CTX Ns ). | ||
214 | .Sh RETURN VALUES | ||
215 | .Fn BN_BLINDING_new | ||
216 | returns the newly allocated | ||
217 | .Vt BN_BLINDING | ||
218 | structure or | ||
219 | .Dv NULL | ||
220 | in case of an error. | ||
221 | .Pp | ||
222 | .Fn BN_BLINDING_update , | ||
223 | .Fn BN_BLINDING_convert , | ||
224 | .Fn BN_BLINDING_invert , | ||
225 | .Fn BN_BLINDING_convert_ex | ||
226 | and | ||
227 | .Fn BN_BLINDING_invert_ex | ||
228 | return 1 on success and 0 if an error occured. | ||
229 | .Pp | ||
230 | .Fn BN_BLINDING_thread_id | ||
231 | returns a pointer to the thread id object within a | ||
232 | .Vt BN_BLINDING | ||
233 | object. | ||
234 | .Pp | ||
235 | .Fn BN_BLINDING_get_flags | ||
236 | returns the currently set | ||
237 | .Dv BN_BLINDING_* | ||
238 | flags (an | ||
239 | .Vt unsigned long | ||
240 | value). | ||
241 | .Pp | ||
242 | .Fn BN_BLINDING_create_param | ||
243 | returns the newly created | ||
244 | .Vt BN_BLINDING | ||
245 | parameters or | ||
246 | .Dv NULL | ||
247 | on error. | ||
248 | .Sh SEE ALSO | ||
249 | .Xr bn 3 | ||
250 | .Sh HISTORY | ||
251 | .Fn BN_BLINDING_thread_id | ||
252 | was first introduced in OpenSSL 1.0.0, and it deprecates | ||
253 | .Fn BN_BLINDING_set_thread_id | ||
254 | and | ||
255 | .Fn BN_BLINDING_get_thread_id . | ||
256 | .Pp | ||
257 | .Fn BN_BLINDING_convert_ex , | ||
258 | .Fn BN_BLINDIND_invert_ex , | ||
259 | .Fn BN_BLINDING_get_thread_id , | ||
260 | .Fn BN_BLINDING_set_thread_id , | ||
261 | .Fn BN_BLINDING_set_flags , | ||
262 | .Fn BN_BLINDING_get_flags | ||
263 | and | ||
264 | .Fn BN_BLINDING_create_param | ||
265 | were first introduced in OpenSSL 0.9.8 | ||
266 | .Sh AUTHORS | ||
267 | .An Nils Larsch | ||
268 | for | ||
269 | .Lk http://www.openssl.org/ "the OpenSSL project" . | ||
diff --git a/src/lib/libcrypto/man/BN_CTX_new.3 b/src/lib/libcrypto/man/BN_CTX_new.3 new file mode 100644 index 0000000000..1a77314854 --- /dev/null +++ b/src/lib/libcrypto/man/BN_CTX_new.3 | |||
@@ -0,0 +1,91 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_CTX_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_CTX_new , | ||
6 | .Nm BN_CTX_init , | ||
7 | .Nm BN_CTX_free | ||
8 | .Nd allocate and free BN_CTX structures | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/bn.h | ||
11 | .Ft BN_CTX * | ||
12 | .Fo BN_CTX_new | ||
13 | .Fa void | ||
14 | .Fc | ||
15 | .Ft void | ||
16 | .Fo BN_CTX_free | ||
17 | .Fa "BN_CTX *c" | ||
18 | .Fc | ||
19 | .Pp | ||
20 | Deprecated: | ||
21 | .Pp | ||
22 | .Ft void | ||
23 | .Fo BN_CTX_init | ||
24 | .Fa "BN_CTX *c" | ||
25 | .Fc | ||
26 | .Sh DESCRIPTION | ||
27 | A | ||
28 | .Vt BN_CTX | ||
29 | is a structure that holds | ||
30 | .Vt BIGNUM | ||
31 | temporary variables used by library functions. | ||
32 | Since dynamic memory allocation to create | ||
33 | .Vt BIGNUM Ns s | ||
34 | is rather expensive when used in conjunction with repeated subroutine | ||
35 | calls, the | ||
36 | .Vt BN_CTX | ||
37 | structure is used. | ||
38 | .Pp | ||
39 | .Fn BN_CTX_new | ||
40 | allocates and initializes a | ||
41 | .Vt BN_CTX | ||
42 | structure. | ||
43 | .Pp | ||
44 | .Fn BN_CTX_free | ||
45 | frees the components of the | ||
46 | .Vt BN_CTX , | ||
47 | and if it was created by | ||
48 | .Fn BN_CTX_new , | ||
49 | also the structure itself. | ||
50 | If | ||
51 | .Xr BN_CTX_start 3 | ||
52 | has been used on the | ||
53 | .Vt BN_CTX , | ||
54 | .Xr BN_CTX_end 3 | ||
55 | must be called before the | ||
56 | .Vt BN_CTX | ||
57 | may be freed by | ||
58 | .Fn BN_CTX_free . | ||
59 | .Pp | ||
60 | .Fn BN_CTX_init | ||
61 | (deprecated) initializes an existing uninitialized | ||
62 | .Vt BN_CTX . | ||
63 | This should not be used for new programs. | ||
64 | Use | ||
65 | .Fn BN_CTX_new | ||
66 | instead. | ||
67 | .Sh RETURN VALUES | ||
68 | .Fn BN_CTX_new | ||
69 | returns a pointer to the | ||
70 | .Vt BN_CTX . | ||
71 | If the allocation fails, it returns | ||
72 | .Dv NULL | ||
73 | and sets an error code that can be obtained by | ||
74 | .Xr ERR_get_error 3 . | ||
75 | .Pp | ||
76 | .Fn BN_CTX_init | ||
77 | and | ||
78 | .Fn BN_CTX_free | ||
79 | return no value. | ||
80 | .Sh SEE ALSO | ||
81 | .Xr bn 3 , | ||
82 | .Xr BN_add 3 , | ||
83 | .Xr BN_CTX_start 3 , | ||
84 | .Xr ERR_get_error 3 | ||
85 | .Sh HISTORY | ||
86 | .Fn BN_CTX_new | ||
87 | and | ||
88 | .Fn BN_CTX_free | ||
89 | are available in all versions on SSLeay and OpenSSL. | ||
90 | .Fn BN_CTX_init | ||
91 | was added in SSLeay 0.9.1b. | ||
diff --git a/src/lib/libcrypto/man/BN_CTX_start.3 b/src/lib/libcrypto/man/BN_CTX_start.3 new file mode 100644 index 0000000000..986208ba1a --- /dev/null +++ b/src/lib/libcrypto/man/BN_CTX_start.3 | |||
@@ -0,0 +1,85 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_CTX_START 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_CTX_start , | ||
6 | .Nm BN_CTX_get , | ||
7 | .Nm BN_CTX_end | ||
8 | .Nd use temporary BIGNUM variables | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/bn.h | ||
11 | .Ft void | ||
12 | .Fo BN_CTX_start | ||
13 | .Fa "BN_CTX *ctx" | ||
14 | .Fc | ||
15 | .Ft BIGNUM * | ||
16 | .Fo BN_CTX_get | ||
17 | .Fa "BN_CTX *ctx" | ||
18 | .Fc | ||
19 | .Ft void | ||
20 | .Fo BN_CTX_end | ||
21 | .Fa "BN_CTX *ctx" | ||
22 | .Fc | ||
23 | .Sh DESCRIPTION | ||
24 | These functions are used to obtain temporary | ||
25 | .Vt BIGNUM | ||
26 | variables from a | ||
27 | .Vt BN_CTX | ||
28 | (which can been created by using | ||
29 | .Xr BN_CTX_new 3 ) | ||
30 | in order to save the overhead of repeatedly creating and freeing | ||
31 | .Vt BIGNUM Ns s | ||
32 | in functions that are called from inside a loop. | ||
33 | .Pp | ||
34 | A function must call | ||
35 | .Fn BN_CTX_start | ||
36 | first. | ||
37 | Then, | ||
38 | .Fn BN_CTX_get | ||
39 | may be called repeatedly to obtain temporary | ||
40 | .Vt BIGNUM Ns s. | ||
41 | All | ||
42 | .Fn BN_CTX_get | ||
43 | calls must be made before calling any other functions that use the | ||
44 | .Fa ctx | ||
45 | as an argument. | ||
46 | .Pp | ||
47 | Finally, | ||
48 | .Fn BN_CTX_end | ||
49 | must be called before returning from the function. | ||
50 | When | ||
51 | .Fn BN_CTX_end | ||
52 | is called, the | ||
53 | .Vt BIGNUM | ||
54 | pointers obtained from | ||
55 | .Fn BN_CTX_get | ||
56 | become invalid. | ||
57 | .Sh RETURN VALUES | ||
58 | .Fn BN_CTX_start | ||
59 | and | ||
60 | .Fn BN_CTX_end | ||
61 | return no values. | ||
62 | .Pp | ||
63 | .Fn BN_CTX_get | ||
64 | returns a pointer to the | ||
65 | .Vt BIGNUM , | ||
66 | or | ||
67 | .Dv NULL | ||
68 | on error. | ||
69 | Once | ||
70 | .Fn BN_CTX_get | ||
71 | has failed, the subsequent calls will return | ||
72 | .Dv NULL | ||
73 | as well, so it is sufficient to check the return value of the last | ||
74 | .Fn BN_CTX_get | ||
75 | call. | ||
76 | In case of an error, an error code is set, which can be obtained by | ||
77 | .Xr ERR_get_error 3 . | ||
78 | .Sh SEE ALSO | ||
79 | .Xr BN_CTX_new 3 | ||
80 | .Sh HISTORY | ||
81 | .Fn BN_CTX_start , | ||
82 | .Fn BN_CTX_get , | ||
83 | and | ||
84 | .Fn BN_CTX_end | ||
85 | were added in OpenSSL 0.9.5. | ||
diff --git a/src/lib/libcrypto/man/BN_add.3 b/src/lib/libcrypto/man/BN_add.3 new file mode 100644 index 0000000000..d41599d8b0 --- /dev/null +++ b/src/lib/libcrypto/man/BN_add.3 | |||
@@ -0,0 +1,352 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_ADD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_add , | ||
6 | .Nm BN_sub , | ||
7 | .Nm BN_mul , | ||
8 | .Nm BN_sqr , | ||
9 | .Nm BN_div , | ||
10 | .Nm BN_mod , | ||
11 | .Nm BN_nnmod , | ||
12 | .Nm BN_mod_add , | ||
13 | .Nm BN_mod_sub , | ||
14 | .Nm BN_mod_mul , | ||
15 | .Nm BN_mod_sqr , | ||
16 | .Nm BN_exp , | ||
17 | .Nm BN_mod_exp , | ||
18 | .Nm BN_gcd | ||
19 | .Nd arithmetic operations on BIGNUMs | ||
20 | .Sh SYNOPSIS | ||
21 | .In openssl/bn.h | ||
22 | .Ft int | ||
23 | .Fo BN_add | ||
24 | .Fa "BIGNUM *r" | ||
25 | .Fa "const BIGNUM *a" | ||
26 | .Fa "const BIGNUM *b" | ||
27 | .Fc | ||
28 | .Ft int | ||
29 | .Fo BN_sub | ||
30 | .Fa "BIGNUM *r" | ||
31 | .Fa "const BIGNUM *a" | ||
32 | .Fa "const BIGNUM *b" | ||
33 | .Fc | ||
34 | .Ft int | ||
35 | .Fo BN_mul | ||
36 | .Fa "BIGNUM *r" | ||
37 | .Fa "BIGNUM *a" | ||
38 | .Fa "BIGNUM *b" | ||
39 | .Fa "BN_CTX *ctx" | ||
40 | .Fc | ||
41 | .Ft int | ||
42 | .Fo BN_sqr | ||
43 | .Fa "BIGNUM *r" | ||
44 | .Fa "BIGNUM *a" | ||
45 | .Fa "BN_CTX *ctx" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo BN_div | ||
49 | .Fa "BIGNUM *dv" | ||
50 | .Fa "BIGNUM *rem" | ||
51 | .Fa "const BIGNUM *a" | ||
52 | .Fa "const BIGNUM *d" | ||
53 | .Fa "BN_CTX *ctx" | ||
54 | .Fc | ||
55 | .Ft int | ||
56 | .Fo BN_mod | ||
57 | .Fa "BIGNUM *rem" | ||
58 | .Fa "const BIGNUM *a" | ||
59 | .Fa "const BIGNUM *m" | ||
60 | .Fa "BN_CTX *ctx" | ||
61 | .Fc | ||
62 | .Ft int | ||
63 | .Fo BN_nnmod | ||
64 | .Fa "BIGNUM *r" | ||
65 | .Fa "const BIGNUM *a" | ||
66 | .Fa "const BIGNUM *m" | ||
67 | .Fa "BN_CTX *ctx" | ||
68 | .Fc | ||
69 | .Ft int | ||
70 | .Fo BN_mod_add | ||
71 | .Fa "BIGNUM *r" | ||
72 | .Fa "BIGNUM *a" | ||
73 | .Fa "BIGNUM *b" | ||
74 | .Fa "const BIGNUM *m" | ||
75 | .Fa "BN_CTX *ctx" | ||
76 | .Fc | ||
77 | .Ft int | ||
78 | .Fo BN_mod_sub | ||
79 | .Fa "BIGNUM *r" | ||
80 | .Fa "BIGNUM *a" | ||
81 | .Fa "BIGNUM *b" | ||
82 | .Fa "const BIGNUM *m" | ||
83 | .Fa "BN_CTX *ctx" | ||
84 | .Fc | ||
85 | .Ft int | ||
86 | .Fo BN_mod_mul | ||
87 | .Fa "BIGNUM *r" | ||
88 | .Fa "BIGNUM *a" | ||
89 | .Fa "BIGNUM *b" | ||
90 | .Fa "const BIGNUM *m" | ||
91 | .Fa "BN_CTX *ctx" | ||
92 | .Fc | ||
93 | .Ft int | ||
94 | .Fo BN_mod_sqr | ||
95 | .Fa "BIGNUM *r" | ||
96 | .Fa "BIGNUM *a" | ||
97 | .Fa "const BIGNUM *m" | ||
98 | .Fa "BN_CTX *ctx" | ||
99 | .Fc | ||
100 | .Ft int | ||
101 | .Fo BN_exp | ||
102 | .Fa "BIGNUM *r" | ||
103 | .Fa "BIGNUM *a" | ||
104 | .Fa "BIGNUM *p" | ||
105 | .Fa "BN_CTX *ctx" | ||
106 | .Fc | ||
107 | .Ft int | ||
108 | .Fo BN_mod_exp | ||
109 | .Fa "BIGNUM *r" | ||
110 | .Fa "BIGNUM *a" | ||
111 | .Fa "const BIGNUM *p" | ||
112 | .Fa "const BIGNUM *m" | ||
113 | .Fa "BN_CTX *ctx" | ||
114 | .Fc | ||
115 | .Ft int | ||
116 | .Fo BN_gcd | ||
117 | .Fa "BIGNUM *r" | ||
118 | .Fa "BIGNUM *a" | ||
119 | .Fa "BIGNUM *b" | ||
120 | .Fa "BN_CTX *ctx" | ||
121 | .Fc | ||
122 | .Sh DESCRIPTION | ||
123 | .Fn BN_add | ||
124 | adds | ||
125 | .Fa a | ||
126 | and | ||
127 | .Fa b | ||
128 | and places the result in | ||
129 | .Fa r | ||
130 | .Pq Li r=a+b . | ||
131 | .Fa r | ||
132 | may be the same | ||
133 | .Vt BIGNUM | ||
134 | as | ||
135 | .Fa a | ||
136 | or | ||
137 | .Fa b . | ||
138 | .Pp | ||
139 | .Fn BN_sub | ||
140 | subtracts | ||
141 | .Fa b | ||
142 | from | ||
143 | .Fa a | ||
144 | and places the result in | ||
145 | .Fa r | ||
146 | .Pq Li r=a-b . | ||
147 | .Pp | ||
148 | .Fn BN_mul | ||
149 | multiplies | ||
150 | .Fa a | ||
151 | and | ||
152 | .Fa b | ||
153 | and places the result in | ||
154 | .Fa r | ||
155 | .Pq Li r=a*b . | ||
156 | .Fa r | ||
157 | may be the same | ||
158 | .Vt BIGNUM | ||
159 | as | ||
160 | .Fa a | ||
161 | or | ||
162 | .Fa b . | ||
163 | For multiplication by powers of 2, use | ||
164 | .Xr BN_lshift 3 . | ||
165 | .Pp | ||
166 | .Fn BN_sqr | ||
167 | takes the square of | ||
168 | .Fa a | ||
169 | and places the result in | ||
170 | .Fa r | ||
171 | .Pq Li r=a^2 . | ||
172 | .Fa r | ||
173 | and | ||
174 | .Fa a | ||
175 | may be the same | ||
176 | .Vt BIGNUM . | ||
177 | This function is faster than | ||
178 | .Fn BN_mul r a a . | ||
179 | .Pp | ||
180 | .Fn BN_div | ||
181 | divides | ||
182 | .Fa a | ||
183 | by | ||
184 | .Fa d | ||
185 | and places the result in | ||
186 | .Fa dv | ||
187 | and the remainder in | ||
188 | .Fa rem | ||
189 | .Pq Li dv=a/d , rem=a%d . | ||
190 | Either of | ||
191 | .Fa dv | ||
192 | and | ||
193 | .Fa rem | ||
194 | may be | ||
195 | .Dv NULL , | ||
196 | in which case the respective value is not returned. | ||
197 | The result is rounded towards zero; thus if | ||
198 | .Fa a | ||
199 | is negative, the remainder will be zero or negative. | ||
200 | For division by powers of 2, use | ||
201 | .Fn BN_rshift 3 . | ||
202 | .Pp | ||
203 | .Fn BN_mod | ||
204 | corresponds to | ||
205 | .Fn BN_div | ||
206 | with | ||
207 | .Fa dv | ||
208 | set to | ||
209 | .Dv NULL . | ||
210 | .Pp | ||
211 | .Fn BN_nnmod | ||
212 | reduces | ||
213 | .Fa a | ||
214 | modulo | ||
215 | .Fa m | ||
216 | and places the non-negative remainder in | ||
217 | .Fa r . | ||
218 | .Pp | ||
219 | .Fn BN_mod_add | ||
220 | adds | ||
221 | .Fa a | ||
222 | to | ||
223 | .Fa b | ||
224 | modulo | ||
225 | .Fa m | ||
226 | and places the non-negative result in | ||
227 | .Fa r . | ||
228 | .Pp | ||
229 | .Fn BN_mod_sub | ||
230 | subtracts | ||
231 | .Fa b | ||
232 | from | ||
233 | .Fa a | ||
234 | modulo | ||
235 | .Fa m | ||
236 | and places the non-negative result in | ||
237 | .Fa r . | ||
238 | .Pp | ||
239 | .Fn BN_mod_mul | ||
240 | multiplies | ||
241 | .Fa a | ||
242 | by | ||
243 | .Fa b | ||
244 | and finds the non-negative remainder respective to modulus | ||
245 | .Fa m | ||
246 | .Pq Li r=(a*b)%m . | ||
247 | .Fa r | ||
248 | may be the same | ||
249 | .Vt BIGNUM | ||
250 | as | ||
251 | .Fa a | ||
252 | or | ||
253 | .Fa b . | ||
254 | For more efficient algorithms for repeated computations using the same | ||
255 | modulus, see | ||
256 | .Xr BN_mod_mul_montgomery 3 | ||
257 | and | ||
258 | .Xr BN_mod_mul_reciprocal 3 . | ||
259 | .Pp | ||
260 | .Fn BN_mod_sqr | ||
261 | takes the square of | ||
262 | .Fa a | ||
263 | modulo | ||
264 | .Fa m | ||
265 | and places the result in | ||
266 | .Fa r . | ||
267 | .Pp | ||
268 | .Fn BN_exp | ||
269 | raises | ||
270 | .Fa a | ||
271 | to the | ||
272 | .Fa p Ns -th | ||
273 | power and places the result in | ||
274 | .Fa r | ||
275 | .Pq Li r=a^p . | ||
276 | This function is faster than repeated applications of | ||
277 | .Fn BN_mul . | ||
278 | .Pp | ||
279 | .Fn BN_mod_exp | ||
280 | computes | ||
281 | .Fa a | ||
282 | to the | ||
283 | .Fa p Ns -th | ||
284 | power modulo | ||
285 | .Fa m | ||
286 | .Pq Li r=(a^p)%m . | ||
287 | This function uses less time and space than | ||
288 | .Fn BN_exp . | ||
289 | .Pp | ||
290 | .Fn BN_gcd | ||
291 | computes the greatest common divisor of | ||
292 | .Fa a | ||
293 | and | ||
294 | .Fa b | ||
295 | and places the result in | ||
296 | .Fa r . | ||
297 | .Fa r | ||
298 | may be the same | ||
299 | .Vt BIGNUM | ||
300 | as | ||
301 | .Fa a | ||
302 | or | ||
303 | .Fa b . | ||
304 | .Pp | ||
305 | For all functions, | ||
306 | .Fa ctx | ||
307 | is a previously allocated | ||
308 | .Vt BN_CTX | ||
309 | used for temporary variables; see | ||
310 | .Xr BN_CTX_new 3 . | ||
311 | .Pp | ||
312 | Unless noted otherwise, the result | ||
313 | .Vt BIGNUM | ||
314 | must be different from the arguments. | ||
315 | .Sh RETURN VALUES | ||
316 | For all functions, 1 is returned for success, 0 on error. | ||
317 | The return value should always be checked, for example: | ||
318 | .Pp | ||
319 | .Dl if (!BN_add(r,a,b)) goto err; | ||
320 | .Pp | ||
321 | The error codes can be obtained by | ||
322 | .Xr ERR_get_error 3 . | ||
323 | .Sh SEE ALSO | ||
324 | .Xr bn 3 , | ||
325 | .Xr BN_add_word 3 , | ||
326 | .Xr BN_CTX_new 3 , | ||
327 | .Xr BN_set_bit 3 , | ||
328 | .Xr ERR_get_error 3 | ||
329 | .Sh HISTORY | ||
330 | .Fn BN_add , | ||
331 | .Fn BN_sub , | ||
332 | .Fn BN_sqr , | ||
333 | .Fn BN_div , | ||
334 | .Fn BN_mod , | ||
335 | .Fn BN_mod_mul , | ||
336 | .Fn BN_mod_exp , | ||
337 | and | ||
338 | .Fn BN_gcd | ||
339 | are available in all versions of SSLeay and OpenSSL. | ||
340 | The | ||
341 | .Fa ctx | ||
342 | argument to | ||
343 | .Fn BN_mul | ||
344 | was added in SSLeay 0.9.1b. | ||
345 | .Fn BN_exp | ||
346 | appeared in SSLeay 0.9.0. | ||
347 | .Fn BN_nnmod , | ||
348 | .Fn BN_mod_add , | ||
349 | .Fn BN_mod_sub , | ||
350 | and | ||
351 | .Fn BN_mod_sqr | ||
352 | were added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libcrypto/man/BN_add_word.3 b/src/lib/libcrypto/man/BN_add_word.3 new file mode 100644 index 0000000000..930aae4d32 --- /dev/null +++ b/src/lib/libcrypto/man/BN_add_word.3 | |||
@@ -0,0 +1,123 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_ADD_WORD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_add_word , | ||
6 | .Nm BN_sub_word , | ||
7 | .Nm BN_mul_word , | ||
8 | .Nm BN_div_word , | ||
9 | .Nm BN_mod_word | ||
10 | .Nd arithmetic functions on BIGNUMs with integers | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/bn.h | ||
13 | .Ft int | ||
14 | .Fo BN_add_word | ||
15 | .Fa "BIGNUM *a" | ||
16 | .Fa "BN_ULONG w" | ||
17 | .Fc | ||
18 | .Ft int | ||
19 | .Fo BN_sub_word | ||
20 | .Fa "BIGNUM *a" | ||
21 | .Fa "BN_ULONG w" | ||
22 | .Fc | ||
23 | .Ft int | ||
24 | .Fo BN_mul_word | ||
25 | .Fa "BIGNUM *a" | ||
26 | .Fa "BN_ULONG w" | ||
27 | .Fc | ||
28 | .Ft BN_ULONG | ||
29 | .Fo BN_div_word | ||
30 | .Fa "BIGNUM *a" | ||
31 | .Fa "BN_ULONG w" | ||
32 | .Fc | ||
33 | .Ft BN_ULONG | ||
34 | .Fo BN_mod_word | ||
35 | .Fa "const BIGNUM *a" | ||
36 | .Fa "BN_ULONG w" | ||
37 | .Fc | ||
38 | .Sh DESCRIPTION | ||
39 | These functions perform arithmetic operations on BIGNUMs with unsigned | ||
40 | integers. | ||
41 | They are much more efficient than the normal BIGNUM arithmetic | ||
42 | operations. | ||
43 | .Pp | ||
44 | .Fn BN_add_word | ||
45 | adds | ||
46 | .Fa w | ||
47 | to | ||
48 | .Fa a | ||
49 | .Pq Li a+=w . | ||
50 | .Pp | ||
51 | .Fn BN_sub_word | ||
52 | subtracts | ||
53 | .Fa w | ||
54 | from | ||
55 | .Fa a | ||
56 | .Pq Li a-=w . | ||
57 | .Pp | ||
58 | .Fn BN_mul_word | ||
59 | multiplies | ||
60 | .Fa a | ||
61 | and | ||
62 | .Fa w | ||
63 | .Pq Li a*=w . | ||
64 | .Pp | ||
65 | .Fn BN_div_word | ||
66 | divides | ||
67 | .Fa a | ||
68 | by | ||
69 | .Fa w | ||
70 | .Pq Li a/=w | ||
71 | and returns the remainder. | ||
72 | .Pp | ||
73 | .Fn BN_mod_word | ||
74 | returns the remainder of | ||
75 | .Fa a | ||
76 | divided by | ||
77 | .Fa w | ||
78 | .Pq Li a%w . | ||
79 | .Pp | ||
80 | For | ||
81 | .Fn BN_div_word | ||
82 | and | ||
83 | .Fn BN_mod_word , | ||
84 | .Fa w | ||
85 | must not be 0. | ||
86 | .Sh RETURN VALUES | ||
87 | .Fn BN_add_word , | ||
88 | .Fn BN_sub_word , | ||
89 | and | ||
90 | .Fn BN_mul_word | ||
91 | return 1 for success, 0 on error. | ||
92 | The error codes can be obtained by | ||
93 | .Xr ERR_get_error 3 . | ||
94 | .Pp | ||
95 | .Fn BN_mod_word | ||
96 | and | ||
97 | .Fn BN_div_word | ||
98 | return | ||
99 | .Fa a Ns % Ns Fa w | ||
100 | on success and | ||
101 | .Pq Vt BN_ULONG Ns -1 | ||
102 | if an error occurred. | ||
103 | .Sh SEE ALSO | ||
104 | .Xr bn 3 , | ||
105 | .Xr BN_add 3 , | ||
106 | .Xr ERR_get_error 3 | ||
107 | .Sh HISTORY | ||
108 | .Fn BN_add_word | ||
109 | and | ||
110 | .Fn BN_mod_word | ||
111 | are available in all versions of SSLeay and OpenSSL. | ||
112 | .Fn BN_div_word | ||
113 | was added in SSLeay 0.8, and | ||
114 | .Fn BN_sub_word | ||
115 | and | ||
116 | .Fn BN_mul_word | ||
117 | in SSLeay 0.9.0. | ||
118 | .Pp | ||
119 | Before 0.9.8a, the return value for | ||
120 | .Fn BN_div_word | ||
121 | and | ||
122 | .Fn BN_mod_word | ||
123 | in case of an error was 0. | ||
diff --git a/src/lib/libcrypto/man/BN_bn2bin.3 b/src/lib/libcrypto/man/BN_bn2bin.3 new file mode 100644 index 0000000000..02d6b2c8b8 --- /dev/null +++ b/src/lib/libcrypto/man/BN_bn2bin.3 | |||
@@ -0,0 +1,237 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_BN2BIN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_bn2bin , | ||
6 | .Nm BN_bin2bn , | ||
7 | .Nm BN_bn2hex , | ||
8 | .Nm BN_bn2dec , | ||
9 | .Nm BN_hex2bn , | ||
10 | .Nm BN_dec2bn , | ||
11 | .Nm BN_print , | ||
12 | .Nm BN_print_fp , | ||
13 | .Nm BN_bn2mpi , | ||
14 | .Nm BN_mpi2bn | ||
15 | .Nd format conversions | ||
16 | .Sh SYNOPSIS | ||
17 | .In openssl/bn.h | ||
18 | .Ft int | ||
19 | .Fo BN_bn2bin | ||
20 | .Fa "const BIGNUM *a" | ||
21 | .Fa "unsigned char *to" | ||
22 | .Fc | ||
23 | .Ft BIGNUM * | ||
24 | .Fo BN_bin2bn | ||
25 | .Fa "const unsigned char *s" | ||
26 | .Fa "int len" | ||
27 | .Fa "BIGNUM *ret" | ||
28 | .Fc | ||
29 | .Ft char * | ||
30 | .Fo BN_bn2hex | ||
31 | .Fa "const BIGNUM *a" | ||
32 | .Fc | ||
33 | .Ft char * | ||
34 | .Fo BN_bn2dec | ||
35 | .Fa "const BIGNUM *a" | ||
36 | .Fc | ||
37 | .Ft int | ||
38 | .Fo BN_hex2bn | ||
39 | .Fa "BIGNUM **a" | ||
40 | .Fa "const char *str" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo BN_dec2bn | ||
44 | .Fa "BIGNUM **a" | ||
45 | .Fa "const char *str" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo BN_print | ||
49 | .Fa "BIO *fp" | ||
50 | .Fa "const BIGNUM *a" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fo BN_print_fp | ||
54 | .Fa "FILE *fp" | ||
55 | .Fa "const BIGNUM *a" | ||
56 | .Fc | ||
57 | .Ft int | ||
58 | .Fo BN_bn2mpi | ||
59 | .Fa "const BIGNUM *a" | ||
60 | .Fa "unsigned char *to" | ||
61 | .Fc | ||
62 | .Ft BIGNUM * | ||
63 | .Fo BN_mpi2bn | ||
64 | .Fa "unsigned char *s" | ||
65 | .Fa "int len" | ||
66 | .Fa "BIGNUM *ret" | ||
67 | .Fc | ||
68 | .Sh DESCRIPTION | ||
69 | .Fn BN_bn2bin | ||
70 | converts the absolute value of | ||
71 | .Fa a | ||
72 | into big-endian form and stores it at | ||
73 | .Fa to . | ||
74 | .Fa to | ||
75 | must point to | ||
76 | .Fn BN_num_bytes a | ||
77 | bytes of memory. | ||
78 | .Pp | ||
79 | .Fn BN_bin2bn | ||
80 | converts the positive integer in big-endian form of length | ||
81 | .Fa len | ||
82 | at | ||
83 | .Fa s | ||
84 | into a | ||
85 | .Vt BIGNUM | ||
86 | and places it in | ||
87 | .Fa ret . | ||
88 | If | ||
89 | .Fa ret | ||
90 | is | ||
91 | .Dv NULL , | ||
92 | a new | ||
93 | .Vt BIGNUM | ||
94 | is created. | ||
95 | .Pp | ||
96 | .Fn BN_bn2hex | ||
97 | and | ||
98 | .Fn BN_bn2dec | ||
99 | return printable strings containing the hexadecimal and decimal encoding of | ||
100 | .Fa a | ||
101 | respectively. | ||
102 | For negative numbers, the string is prefaced with a leading minus sign. | ||
103 | The string must be freed later using | ||
104 | .Xr free 3 . | ||
105 | .Pp | ||
106 | .Fn BN_hex2bn | ||
107 | converts the string | ||
108 | .Fa str | ||
109 | containing a hexadecimal number to a | ||
110 | .Vt BIGNUM | ||
111 | and stores it in | ||
112 | .Pf * Fa a . | ||
113 | If | ||
114 | .Pf * Fa a | ||
115 | is | ||
116 | .Dv NULL , | ||
117 | a new | ||
118 | .Vt BIGNUM | ||
119 | is created. | ||
120 | If | ||
121 | .Fa a | ||
122 | is | ||
123 | .Dv NULL , | ||
124 | it only computes the number's length in hexadecimal digits. | ||
125 | If the string starts with a minus sign, the number is negative. | ||
126 | .Fn BN_dec2bn | ||
127 | is the same using the decimal system. | ||
128 | .Pp | ||
129 | .Fn BN_print | ||
130 | and | ||
131 | .Fn BN_print_fp | ||
132 | write the hexadecimal encoding of | ||
133 | .Fa a , | ||
134 | with a leading minus sign for negative numbers, to the | ||
135 | .Vt BIO | ||
136 | or | ||
137 | .Vt FILE | ||
138 | .Fa fp . | ||
139 | .Pp | ||
140 | .Fn BN_bn2mpi | ||
141 | and | ||
142 | .Fn BN_mpi2bn | ||
143 | convert | ||
144 | .Vt BIGNUM Ns s | ||
145 | from and to a format that consists of the number's length in bytes | ||
146 | represented as a 4-byte big-endian number, and the number itself in | ||
147 | big-endian format, where the most significant bit signals a negative | ||
148 | number (the representation of numbers with the MSB set is prefixed with | ||
149 | a NUL byte). | ||
150 | .Pp | ||
151 | .Fn BN_bn2mpi | ||
152 | stores the representation of | ||
153 | .Fa a | ||
154 | at | ||
155 | .Fa to , | ||
156 | where | ||
157 | .Fa to | ||
158 | must be large enough to hold the result. | ||
159 | The size can be determined by calling | ||
160 | .Fn BN_bn2mpi a , NULL . | ||
161 | .Pp | ||
162 | .Fn BN_mpi2bn | ||
163 | converts the | ||
164 | .Fa len | ||
165 | bytes long representation at | ||
166 | .Fa s | ||
167 | to a | ||
168 | .Vt BIGNUM | ||
169 | and stores it at | ||
170 | .Fa ret , | ||
171 | or in a newly allocated | ||
172 | .Vt BIGNUM | ||
173 | if | ||
174 | .Fa ret | ||
175 | is | ||
176 | .Dv NULL . | ||
177 | .Sh RETURN VALUES | ||
178 | .Fn BN_bn2bin | ||
179 | returns the length of the big-endian number placed at | ||
180 | .Fa to . | ||
181 | .Fn BN_bin2bn | ||
182 | returns the | ||
183 | .Vt BIGNUM , | ||
184 | or | ||
185 | .Dv NULL | ||
186 | on error. | ||
187 | .Pp | ||
188 | .Fn BN_bn2hex | ||
189 | and | ||
190 | .Fn BN_bn2dec | ||
191 | return a NUL-terminated string, or | ||
192 | .Dv NULL | ||
193 | on error. | ||
194 | .Fn BN_hex2bn | ||
195 | and | ||
196 | .Fn BN_dec2bn | ||
197 | return the number's length in hexadecimal or decimal digits, and 0 on | ||
198 | error. | ||
199 | .Pp | ||
200 | .Fn BN_print_fp | ||
201 | and | ||
202 | .Fn BN_print | ||
203 | return 1 on success, 0 on write errors. | ||
204 | .Pp | ||
205 | .Fn BN_bn2mpi | ||
206 | returns the length of the representation. | ||
207 | .Fn BN_mpi2bn | ||
208 | returns the | ||
209 | .Vt BIGNUM , | ||
210 | or | ||
211 | .Dv NULL | ||
212 | on error. | ||
213 | .Pp | ||
214 | The error codes can be obtained by | ||
215 | .Xr ERR_get_error 3 . | ||
216 | .Sh SEE ALSO | ||
217 | .Xr ASN1_INTEGER_to_BN 3 , | ||
218 | .Xr bn 3 , | ||
219 | .Xr BN_num_bytes 3 , | ||
220 | .Xr BN_zero 3 , | ||
221 | .Xr ERR_get_error 3 | ||
222 | .Sh HISTORY | ||
223 | .Fn BN_bn2bin , | ||
224 | .Fn BN_bin2bn , | ||
225 | .Fn BN_print_fp , | ||
226 | and | ||
227 | .Fn BN_print | ||
228 | are available in all versions of SSLeay and OpenSSL. | ||
229 | .Pp | ||
230 | .Fn BN_bn2hex , | ||
231 | .Fn BN_bn2dec , | ||
232 | .Fn BN_hex2bn , | ||
233 | .Fn BN_dec2bn , | ||
234 | .Fn BN_bn2mpi , | ||
235 | and | ||
236 | .Fn BN_mpi2bn | ||
237 | were added in SSLeay 0.9.0. | ||
diff --git a/src/lib/libcrypto/man/BN_cmp.3 b/src/lib/libcrypto/man/BN_cmp.3 new file mode 100644 index 0000000000..b0a03b25ce --- /dev/null +++ b/src/lib/libcrypto/man/BN_cmp.3 | |||
@@ -0,0 +1,99 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_CMP 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_cmp , | ||
6 | .Nm BN_ucmp , | ||
7 | .Nm BN_is_zero , | ||
8 | .Nm BN_is_one , | ||
9 | .Nm BN_is_word , | ||
10 | .Nm BN_is_odd | ||
11 | .Nd BIGNUM comparison and test functions | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/bn.h | ||
14 | .Ft int | ||
15 | .Fo BN_cmp | ||
16 | .Fa "BIGNUM *a" | ||
17 | .Fa "BIGNUM *b" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo BN_ucmp | ||
21 | .Fa "BIGNUM *a" | ||
22 | .Fa "BIGNUM *b" | ||
23 | .Fc | ||
24 | .Ft int | ||
25 | .Fo BN_is_zero | ||
26 | .Fa "BIGNUM *a" | ||
27 | .Fc | ||
28 | .Ft int | ||
29 | .Fo BN_is_one | ||
30 | .Fa "BIGNUM *a" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo BN_is_word | ||
34 | .Fa "BIGNUM *a" | ||
35 | .Fa "BN_ULONG w" | ||
36 | .Fc | ||
37 | .Ft int | ||
38 | .Fo BN_is_odd | ||
39 | .Fa "BIGNUM *a" | ||
40 | .Fc | ||
41 | .Sh DESCRIPTION | ||
42 | .Fn BN_cmp | ||
43 | compares the numbers | ||
44 | .Fa a | ||
45 | and | ||
46 | .Fa b . | ||
47 | .Fn BN_ucmp | ||
48 | compares their absolute values. | ||
49 | .Pp | ||
50 | .Fn BN_is_zero , | ||
51 | .Fn BN_is_one | ||
52 | and | ||
53 | .Fn BN_is_word | ||
54 | test if | ||
55 | .Fa a | ||
56 | equals 0, 1, or | ||
57 | .Fa w | ||
58 | respectively. | ||
59 | .Fn BN_is_odd | ||
60 | tests if a is odd. | ||
61 | .Pp | ||
62 | .Fn BN_is_zero , | ||
63 | .Fn BN_is_one , | ||
64 | .Fn BN_is_word , | ||
65 | and | ||
66 | .Fn BN_is_odd | ||
67 | are macros. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn BN_cmp | ||
70 | returns -1 if | ||
71 | .Fa a Ns < Ns Fa b , | ||
72 | 0 if | ||
73 | .Fa a Ns == Ns Fa b , | ||
74 | and 1 if | ||
75 | .Fa a Ns > Ns Fa b . | ||
76 | .Fn BN_ucmp | ||
77 | is the same using the absolute values of | ||
78 | .Fa a | ||
79 | and | ||
80 | .Fa b . | ||
81 | .Pp | ||
82 | .Fn BN_is_zero , | ||
83 | .Fn BN_is_one , | ||
84 | .Fn BN_is_word , | ||
85 | and | ||
86 | .Fn BN_is_odd | ||
87 | return 1 if the condition is true, 0 otherwise. | ||
88 | .Sh SEE ALSO | ||
89 | .Xr bn 3 | ||
90 | .Sh HISTORY | ||
91 | .Fn BN_cmp , | ||
92 | .Fn BN_ucmp , | ||
93 | .Fn BN_is_zero , | ||
94 | .Fn BN_is_one | ||
95 | and | ||
96 | .Fn BN_is_word | ||
97 | are available in all versions of SSLeay and OpenSSL. | ||
98 | .Fn BN_is_odd | ||
99 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libcrypto/man/BN_copy.3 b/src/lib/libcrypto/man/BN_copy.3 new file mode 100644 index 0000000000..765e46c01c --- /dev/null +++ b/src/lib/libcrypto/man/BN_copy.3 | |||
@@ -0,0 +1,52 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_COPY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_copy , | ||
6 | .Nm BN_dup | ||
7 | .Nd copy BIGNUMs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/bn.h | ||
10 | .Ft BIGNUM * | ||
11 | .Fo BN_copy | ||
12 | .Fa "BIGNUM *to" | ||
13 | .Fa "const BIGNUM *from" | ||
14 | .Fc | ||
15 | .Ft BIGNUM * | ||
16 | .Fo BN_dup | ||
17 | .Fa "const BIGNUM *from" | ||
18 | .Fc | ||
19 | .Sh DESCRIPTION | ||
20 | .Fn BN_copy | ||
21 | copies | ||
22 | .Fa from | ||
23 | to | ||
24 | .Fa to . | ||
25 | .Fn BN_dup | ||
26 | creates a new | ||
27 | .Vt BIGNUM | ||
28 | containing the value | ||
29 | .Fa from . | ||
30 | .Sh RETURN VALUES | ||
31 | .Fn BN_copy | ||
32 | returns | ||
33 | .Fa to | ||
34 | on success, | ||
35 | .Dv NULL | ||
36 | on error. | ||
37 | .Fn BN_dup | ||
38 | returns the new | ||
39 | .Vt BIGNUM , | ||
40 | or | ||
41 | .Dv NULL | ||
42 | on error. | ||
43 | The error codes can be obtained by | ||
44 | .Xr ERR_get_error 3 . | ||
45 | .Sh SEE ALSO | ||
46 | .Xr bn 3 , | ||
47 | .Xr ERR_get_error 3 | ||
48 | .Sh HISTORY | ||
49 | .Fn BN_copy | ||
50 | and | ||
51 | .Fn BN_dup | ||
52 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/BN_generate_prime.3 b/src/lib/libcrypto/man/BN_generate_prime.3 new file mode 100644 index 0000000000..e269571914 --- /dev/null +++ b/src/lib/libcrypto/man/BN_generate_prime.3 | |||
@@ -0,0 +1,289 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_GENERATE_PRIME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_generate_prime_ex , | ||
6 | .Nm BN_is_prime_ex , | ||
7 | .Nm BN_is_prime_fasttest_ex , | ||
8 | .Nm BN_GENCB_call , | ||
9 | .Nm BN_GENCB_set_old , | ||
10 | .Nm BN_GENCB_set , | ||
11 | .Nm BN_generate_prime , | ||
12 | .Nm BN_is_prime , | ||
13 | .Nm BN_is_prime_fasttest | ||
14 | .Nd generate primes and test for primality | ||
15 | .Sh SYNOPSIS | ||
16 | .In openssl/bn.h | ||
17 | .Ft int | ||
18 | .Fo BN_generate_prime_ex | ||
19 | .Fa "BIGNUM *ret" | ||
20 | .Fa "int bits" | ||
21 | .Fa "int safe" | ||
22 | .Fa "const BIGNUM *add" | ||
23 | .Fa "const BIGNUM *rem" | ||
24 | .Fa "BN_GENCB *cb" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo BN_is_prime_ex | ||
28 | .Fa "const BIGNUM *p" | ||
29 | .Fa "int nchecks" | ||
30 | .Fa "BN_CTX *ctx" | ||
31 | .Fa "BN_GENCB *cb" | ||
32 | .Fc | ||
33 | .Ft int | ||
34 | .Fo BN_is_prime_fasttest_ex | ||
35 | .Fa "const BIGNUM *p" | ||
36 | .Fa "int nchecks" | ||
37 | .Fa "BN_CTX *ctx" | ||
38 | .Fa "int do_trial_division" | ||
39 | .Fa "BN_GENCB *cb" | ||
40 | .Fc | ||
41 | .Ft int | ||
42 | .Fo BN_GENCB_call | ||
43 | .Fa "BN_GENCB *cb" | ||
44 | .Fa "int a" | ||
45 | .Fa "int b" | ||
46 | .Fc | ||
47 | .Fd #define BN_GENCB_set_old(gencb, callback, cb_arg) ... | ||
48 | .Fd #define BN_GENCB_set(gencb, callback, cb_arg) ... | ||
49 | .Pp | ||
50 | Deprecated: | ||
51 | .Pp | ||
52 | .Ft BIGNUM * | ||
53 | .Fo BN_generate_prime | ||
54 | .Fa "BIGNUM *ret" | ||
55 | .Fa "int num" | ||
56 | .Fa "int safe" | ||
57 | .Fa "BIGNUM *add" | ||
58 | .Fa "BIGNUM *rem" | ||
59 | .Fa "void (*callback)(int, int, void *)" | ||
60 | .Fa "void *cb_arg" | ||
61 | .Fc | ||
62 | .Ft int | ||
63 | .Fo BN_is_prime | ||
64 | .Fa "const BIGNUM *a" | ||
65 | .Fa "int checks" | ||
66 | .Fa "void (*callback)(int, int, void *)" | ||
67 | .Fa "BN_CTX *ctx" | ||
68 | .Fa "void *cb_arg" | ||
69 | .Fc | ||
70 | .Ft int | ||
71 | .Fo BN_is_prime_fasttest | ||
72 | .Fa "const BIGNUM *a" | ||
73 | .Fa "int checks" | ||
74 | .Fa "void (*callback)(int, int, void *)" | ||
75 | .Fa "BN_CTX *ctx" | ||
76 | .Fa "void *cb_arg" | ||
77 | .Fa "int do_trial_division" | ||
78 | .Fc | ||
79 | .Sh DESCRIPTION | ||
80 | .Fn BN_generate_prime_ex | ||
81 | generates a pseudo-random prime number of bit length | ||
82 | .Fa bits . | ||
83 | If | ||
84 | .Fa ret | ||
85 | is not | ||
86 | .Dv NULL , | ||
87 | it will be used to store the number. | ||
88 | .Pp | ||
89 | If | ||
90 | .Fa cb | ||
91 | is not | ||
92 | .Dv NULL , | ||
93 | it is used as follows: | ||
94 | .Bl -bullet | ||
95 | .It | ||
96 | .Fn BN_GENCB_call cb 0 i | ||
97 | is called after generating the i-th potential prime number. | ||
98 | .It | ||
99 | While the number is being tested for primality, | ||
100 | .Fn BN_GENCB_call cb 1 j | ||
101 | is called as described below. | ||
102 | .It | ||
103 | When a prime has been found, | ||
104 | .Fn BN_GENCB_call cb 2 i | ||
105 | is called. | ||
106 | .El | ||
107 | .Pp | ||
108 | The prime may have to fulfill additional requirements for use in | ||
109 | Diffie-Hellman key exchange: | ||
110 | .Pp | ||
111 | If | ||
112 | .Fa add | ||
113 | is not | ||
114 | .Dv NULL , | ||
115 | the prime will fulfill the condition p % | ||
116 | .Fa add | ||
117 | == | ||
118 | .Fa rem | ||
119 | (p % | ||
120 | .Fa add | ||
121 | == 1 if | ||
122 | .Fa rem | ||
123 | == | ||
124 | .Dv NULL ) | ||
125 | in order to suit a given generator. | ||
126 | .Pp | ||
127 | If | ||
128 | .Fa safe | ||
129 | is true, it will be a safe prime (i.e. a prime p so that (p-1)/2 | ||
130 | is also prime). | ||
131 | .Pp | ||
132 | The prime number generation has a negligible error probability. | ||
133 | .Pp | ||
134 | .Fn BN_is_prime_ex | ||
135 | and | ||
136 | .Fn BN_is_prime_fasttest_ex | ||
137 | test if the number | ||
138 | .Fa p | ||
139 | is prime. | ||
140 | The following tests are performed until one of them shows that | ||
141 | .Fa p | ||
142 | is composite; if | ||
143 | .Fa p | ||
144 | passes all these tests, it is considered prime. | ||
145 | .Pp | ||
146 | .Fn BN_is_prime_fasttest_ex , | ||
147 | when called with | ||
148 | .Fa do_trial_division | ||
149 | == 1, first attempts trial division by a number of small primes; | ||
150 | if no divisors are found by this test and | ||
151 | .Fa cb | ||
152 | is not | ||
153 | .Dv NULL , | ||
154 | .Sy BN_GENCB_call(cb, 1, -1) | ||
155 | is called. | ||
156 | If | ||
157 | .Fa do_trial_division | ||
158 | == 0, this test is skipped. | ||
159 | .Pp | ||
160 | Both | ||
161 | .Fn BN_is_prime_ex | ||
162 | and | ||
163 | .Fn BN_is_prime_fasttest_ex | ||
164 | perform a Miller-Rabin probabilistic primality test with | ||
165 | .Fa nchecks | ||
166 | iterations. | ||
167 | If | ||
168 | .Fa nchecks | ||
169 | == | ||
170 | .Dv BN_prime_checks , | ||
171 | a number of iterations is used that yields a false positive rate of at | ||
172 | most 2^-80 for random input. | ||
173 | .Pp | ||
174 | If | ||
175 | .Fa cb | ||
176 | is not | ||
177 | .Dv NULL , | ||
178 | .Fa BN_GENCB_call cb 1 j | ||
179 | is called after the j-th iteration (j = 0, 1, ...). | ||
180 | .Fa ctx | ||
181 | is a pre-allocated | ||
182 | .Vt BN_CTX | ||
183 | (to save the overhead of allocating and freeing the structure in a | ||
184 | loop), or | ||
185 | .Dv NULL . | ||
186 | .Pp | ||
187 | .Fn BN_GENCB_call | ||
188 | calls the callback function held in the | ||
189 | .Vt BN_GENCB | ||
190 | structure and passes the ints | ||
191 | .Fa a | ||
192 | and | ||
193 | .Fa b | ||
194 | as arguments. | ||
195 | There are two types of | ||
196 | .Vt BN_GENCB | ||
197 | structures that are supported: "new" style and "old" style. | ||
198 | New programs should prefer the "new" style, whilst the "old" style is | ||
199 | provided for backwards compatibility purposes. | ||
200 | .Pp | ||
201 | For "new" style callbacks a | ||
202 | .Vt BN_GENCB | ||
203 | structure should be initialised with a call to | ||
204 | .Fn BN_GENCB_set , | ||
205 | where | ||
206 | .Fa gencb | ||
207 | is a | ||
208 | .Vt BN_GENCB * , | ||
209 | .Fa callback | ||
210 | is of type | ||
211 | .Vt int (*callback)(int, int, BN_GENCB *) | ||
212 | and | ||
213 | .Fa cb_arg | ||
214 | is a | ||
215 | .Vt void * . | ||
216 | "Old" style callbacks are the same except they are initialised with a | ||
217 | call to | ||
218 | .Fn BN_GENCB_set_old | ||
219 | and | ||
220 | .Fa callback | ||
221 | is of type | ||
222 | .Vt void (*callback)(int, int, void *) . | ||
223 | .Pp | ||
224 | A callback is invoked through a call to | ||
225 | .Fn BN_GENCB_call . | ||
226 | This will check the type of the callback and will invoke | ||
227 | .Fn callback a b gencb | ||
228 | for new style callbacks or | ||
229 | .Fn callback a b cb_arg | ||
230 | for old style. | ||
231 | .Pp | ||
232 | .Fn BN_generate_prime | ||
233 | (deprecated) works in the same way as | ||
234 | .Fn BN_generate_prime_ex | ||
235 | but expects an old style callback function directly in the | ||
236 | .Fa callback | ||
237 | parameter, and an argument to pass to it in the | ||
238 | .Fa cb_arg . | ||
239 | Similarly | ||
240 | .Fn BN_is_prime | ||
241 | and | ||
242 | .Fn BN_is_prime_fasttest | ||
243 | are deprecated and can be compared to | ||
244 | .Fn BN_is_prime_ex | ||
245 | and | ||
246 | .Fn BN_is_prime_fasttest_ex | ||
247 | respectively. | ||
248 | .Sh RETURN VALUES | ||
249 | .Fn BN_generate_prime_ex | ||
250 | returns 1 on success or 0 on error. | ||
251 | .Pp | ||
252 | .Fn BN_is_prime_ex , | ||
253 | .Fn BN_is_prime_fasttest_ex , | ||
254 | .Fn BN_is_prime , | ||
255 | and | ||
256 | .Fn BN_is_prime_fasttest | ||
257 | return 0 if the number is composite, 1 if it is prime with an error | ||
258 | probability of less than | ||
259 | .Pf 0.25^ Fa nchecks , | ||
260 | and -1 on error. | ||
261 | .Pp | ||
262 | .Fn BN_generate_prime | ||
263 | returns the prime number on success, | ||
264 | .Dv NULL | ||
265 | otherwise. | ||
266 | .Pp | ||
267 | Callback functions should return 1 on success or 0 on error. | ||
268 | .Pp | ||
269 | The error codes can be obtained by | ||
270 | .Xr ERR_get_error 3 . | ||
271 | .Sh SEE ALSO | ||
272 | .Xr bn 3 , | ||
273 | .Xr ERR_get_error 3 , | ||
274 | .Xr rand 3 | ||
275 | .Sh HISTORY | ||
276 | The | ||
277 | .Fa cb_arg | ||
278 | arguments to | ||
279 | .Fn BN_generate_prime | ||
280 | and to | ||
281 | .Fn BN_is_prime | ||
282 | were added in SSLeay 0.9.0. | ||
283 | The | ||
284 | .Fa ret | ||
285 | argument to | ||
286 | .Fn BN_generate_prime | ||
287 | was added in SSLeay 0.9.1. | ||
288 | .Fn BN_is_prime_fasttest | ||
289 | was added in OpenSSL 0.9.5. | ||
diff --git a/src/lib/libcrypto/man/BN_mod_inverse.3 b/src/lib/libcrypto/man/BN_mod_inverse.3 new file mode 100644 index 0000000000..db63269fb8 --- /dev/null +++ b/src/lib/libcrypto/man/BN_mod_inverse.3 | |||
@@ -0,0 +1,59 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_MOD_INVERSE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_mod_inverse | ||
6 | .Nd compute inverse modulo n | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/bn.h | ||
9 | .Ft BIGNUM * | ||
10 | .Fo BN_mod_inverse | ||
11 | .Fa "BIGNUM *r" | ||
12 | .Fa "BIGNUM *a" | ||
13 | .Fa "const BIGNUM *n" | ||
14 | .Fa "BN_CTX *ctx" | ||
15 | .Fc | ||
16 | .Sh DESCRIPTION | ||
17 | .Fn BN_mod_inverse | ||
18 | computes the inverse of | ||
19 | .Fa a | ||
20 | modulo | ||
21 | .Fa n | ||
22 | add places the result in | ||
23 | .Fa r | ||
24 | .Pq Li (a*r)%n==1 . | ||
25 | If | ||
26 | .Fa r | ||
27 | is | ||
28 | .Dv NULL , | ||
29 | a new | ||
30 | .Vt BIGNUM | ||
31 | is created. | ||
32 | .Pp | ||
33 | .Fa ctx | ||
34 | is a previously allocated | ||
35 | .Vt BN_CTX | ||
36 | used for temporary variables. | ||
37 | .Fa r | ||
38 | may be the same | ||
39 | .Vt BIGNUM | ||
40 | as | ||
41 | .Fa a | ||
42 | or | ||
43 | .Fa n . | ||
44 | .Sh RETURN VALUES | ||
45 | .Fn BN_mod_inverse | ||
46 | returns the | ||
47 | .Vt BIGNUM | ||
48 | containing the inverse, or | ||
49 | .Dv NULL | ||
50 | on error. | ||
51 | The error codes can be obtained by | ||
52 | .Xr ERR_get_error 3 . | ||
53 | .Sh SEE ALSO | ||
54 | .Xr bn 3 , | ||
55 | .Xr BN_add 3 , | ||
56 | .Xr ERR_get_error 3 | ||
57 | .Sh HISTORY | ||
58 | .Fn BN_mod_inverse | ||
59 | is available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 new file mode 100644 index 0000000000..ac120f3c02 --- /dev/null +++ b/src/lib/libcrypto/man/BN_mod_mul_montgomery.3 | |||
@@ -0,0 +1,181 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_MOD_MUL_MONTGOMERY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_mod_mul_montgomery , | ||
6 | .Nm BN_MONT_CTX_new , | ||
7 | .Nm BN_MONT_CTX_init , | ||
8 | .Nm BN_MONT_CTX_free , | ||
9 | .Nm BN_MONT_CTX_set , | ||
10 | .Nm BN_MONT_CTX_copy , | ||
11 | .Nm BN_from_montgomery , | ||
12 | .Nm BN_to_montgomery | ||
13 | .Nd Montgomery multiplication | ||
14 | .Sh SYNOPSIS | ||
15 | .In openssl/bn.h | ||
16 | .Ft BN_MONT_CTX * | ||
17 | .Fo BN_MONT_CTX_new | ||
18 | .Fa void | ||
19 | .Fc | ||
20 | .Ft void | ||
21 | .Fo BN_MONT_CTX_init | ||
22 | .Fa "BN_MONT_CTX *ctx" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fo BN_MONT_CTX_free | ||
26 | .Fa "BN_MONT_CTX *mont" | ||
27 | .Fc | ||
28 | .Ft int | ||
29 | .Fo BN_MONT_CTX_set | ||
30 | .Fa "BN_MONT_CTX *mont" | ||
31 | .Fa "const BIGNUM *m" | ||
32 | .Fa "BN_CTX *ctx" | ||
33 | .Fc | ||
34 | .Ft BN_MONT_CTX * | ||
35 | .Fo BN_MONT_CTX_copy | ||
36 | .Fa "BN_MONT_CTX *to" | ||
37 | .Fa "BN_MONT_CTX *from" | ||
38 | .Fc | ||
39 | .Ft int | ||
40 | .Fo BN_mod_mul_montgomery | ||
41 | .Fa "BIGNUM *r" | ||
42 | .Fa "BIGNUM *a" | ||
43 | .Fa "BIGNUM *b" | ||
44 | .Fa "BN_MONT_CTX *mont" | ||
45 | .Fa "BN_CTX *ctx" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo BN_from_montgomery | ||
49 | .Fa "BIGNUM *r" | ||
50 | .Fa "BIGNUM *a" | ||
51 | .Fa "BN_MONT_CTX *mont" | ||
52 | .Fa "BN_CTX *ctx" | ||
53 | .Fc | ||
54 | .Ft int | ||
55 | .Fo BN_to_montgomery | ||
56 | .Fa "BIGNUM *r" | ||
57 | .Fa "BIGNUM *a" | ||
58 | .Fa "BN_MONT_CTX *mont" | ||
59 | .Fa "BN_CTX *ctx" | ||
60 | .Fc | ||
61 | .Sh DESCRIPTION | ||
62 | These functions implement Montgomery multiplication. | ||
63 | They are used automatically when | ||
64 | .Xr BN_mod_exp 3 | ||
65 | is called with suitable input, but they may be useful when several | ||
66 | operations are to be performed using the same modulus. | ||
67 | .Pp | ||
68 | .Fn BN_MONT_CTX_new | ||
69 | allocates and initializes a | ||
70 | .Vt BN_MONT_CTX | ||
71 | structure. | ||
72 | .Fn BN_MONT_CTX_init | ||
73 | initializes an existing uninitialized | ||
74 | .Vt BN_MONT_CTX . | ||
75 | .Pp | ||
76 | .Fn BN_MONT_CTX_set | ||
77 | sets up the | ||
78 | .Fa mont | ||
79 | structure from the modulus | ||
80 | .Fa m | ||
81 | by precomputing its inverse and a value R. | ||
82 | .Pp | ||
83 | .Fn BN_MONT_CTX_copy | ||
84 | copies the | ||
85 | .Vt BN_MONT_CTX | ||
86 | .Fa from | ||
87 | to | ||
88 | .Fa to . | ||
89 | .Pp | ||
90 | .Fn BN_MONT_CTX_free | ||
91 | frees the components of the | ||
92 | .Vt BN_MONT_CTX , | ||
93 | and, if it was created by | ||
94 | .Fn BN_MONT_CTX_new , | ||
95 | also the structure itself. | ||
96 | .Pp | ||
97 | .Fn BN_mod_mul_montgomery | ||
98 | computes | ||
99 | .Pp | ||
100 | .D1 Mont Ns Po Fa a , Fa b Pc := Fa a No * Fa b No * R^-1 | ||
101 | .Pp | ||
102 | and places the result in | ||
103 | .Fa r . | ||
104 | .Pp | ||
105 | .Fn BN_from_montgomery | ||
106 | performs the Montgomery reduction | ||
107 | .Pp | ||
108 | .D1 Fa r No = Fa a No * R^-1. | ||
109 | .Pp | ||
110 | .Fn BN_to_montgomery | ||
111 | computes | ||
112 | .Pp | ||
113 | .D1 Mont Ns Po Fa a , No R^2 Pc = Fa a No * R . | ||
114 | .Pp | ||
115 | Note that | ||
116 | .Fa a | ||
117 | must be non-negative and smaller than the modulus. | ||
118 | .Pp | ||
119 | For all functions, | ||
120 | .Fa ctx | ||
121 | is a previously allocated | ||
122 | .Vt BN_CTX | ||
123 | used for temporary variables. | ||
124 | .Pp | ||
125 | The | ||
126 | .Vt BN_MONT_CTX | ||
127 | structure is defined as follows: | ||
128 | .Bd -literal | ||
129 | typedef struct bn_mont_ctx_st { | ||
130 | int ri; /* number of bits in R */ | ||
131 | BIGNUM RR; /* R^2 (used to convert to Montgomery form) */ | ||
132 | BIGNUM N; /* The modulus */ | ||
133 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | ||
134 | * (Ni is only stored for bignum algorithm) */ | ||
135 | BN_ULONG n0; /* least significant word of Ni */ | ||
136 | int flags; | ||
137 | } BN_MONT_CTX; | ||
138 | .Ed | ||
139 | .Pp | ||
140 | .Fn BN_to_montgomery | ||
141 | is a macro. | ||
142 | .Pp | ||
143 | .Sy Warning: | ||
144 | The inputs must be reduced modulo | ||
145 | .Fa m , | ||
146 | otherwise the result will be outside the expected range. | ||
147 | .Sh RETURN VALUES | ||
148 | .Fn BN_MONT_CTX_new | ||
149 | returns the newly allocated | ||
150 | .Vt BN_MONT_CTX , | ||
151 | and | ||
152 | .Dv NULL | ||
153 | on error. | ||
154 | .Pp | ||
155 | .Fn BN_MONT_CTX_init | ||
156 | and | ||
157 | .Fn BN_MONT_CTX_free | ||
158 | return no values. | ||
159 | .Pp | ||
160 | For the other functions, 1 is returned for success, 0 on error. | ||
161 | The error codes can be obtained by | ||
162 | .Xr ERR_get_error 3 . | ||
163 | .Sh SEE ALSO | ||
164 | .Xr bn 3 , | ||
165 | .Xr BN_add 3 , | ||
166 | .Xr BN_CTX_new 3 , | ||
167 | .Xr ERR_get_error 3 | ||
168 | .Sh HISTORY | ||
169 | .Fn BN_MONT_CTX_new , | ||
170 | .Fn BN_MONT_CTX_free , | ||
171 | .Fn BN_MONT_CTX_set , | ||
172 | .Fn BN_mod_mul_montgomery , | ||
173 | .Fn BN_from_montgomery | ||
174 | and | ||
175 | .Fn BN_to_montgomery | ||
176 | are available in all versions of SSLeay and OpenSSL. | ||
177 | .Pp | ||
178 | .Fn BN_MONT_CTX_init | ||
179 | and | ||
180 | .Fn BN_MONT_CTX_copy | ||
181 | were added in SSLeay 0.9.1b. | ||
diff --git a/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 new file mode 100644 index 0000000000..ceb1ffae5b --- /dev/null +++ b/src/lib/libcrypto/man/BN_mod_mul_reciprocal.3 | |||
@@ -0,0 +1,147 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_MOD_MUL_RECIPROCAL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_mod_mul_reciprocal , | ||
6 | .Nm BN_div_recp , | ||
7 | .Nm BN_RECP_CTX_new , | ||
8 | .Nm BN_RECP_CTX_init , | ||
9 | .Nm BN_RECP_CTX_free , | ||
10 | .Nm BN_RECP_CTX_set | ||
11 | .Nd modular multiplication using reciprocal | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/bn.h | ||
14 | .Ft BN_RECP_CTX * | ||
15 | .Fo BN_RECP_CTX_new | ||
16 | .Fa void | ||
17 | .Fc | ||
18 | .Ft void | ||
19 | .Fo BN_RECP_CTX_init | ||
20 | .Fa "BN_RECP_CTX *recp" | ||
21 | .Fc | ||
22 | .Ft void | ||
23 | .Fo BN_RECP_CTX_free | ||
24 | .Fa "BN_RECP_CTX *recp" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo BN_RECP_CTX_set | ||
28 | .Fa "BN_RECP_CTX *recp" | ||
29 | .Fa "const BIGNUM *m" | ||
30 | .Fa "BN_CTX *ctx" | ||
31 | .Fc | ||
32 | .Ft int | ||
33 | .Fo BN_div_recp | ||
34 | .Fa "BIGNUM *dv" | ||
35 | .Fa "BIGNUM *rem" | ||
36 | .Fa "BIGNUM *a" | ||
37 | .Fa "BN_RECP_CTX *recp" | ||
38 | .Fa "BN_CTX *ctx" | ||
39 | .Fc | ||
40 | .Ft int | ||
41 | .Fo BN_mod_mul_reciprocal | ||
42 | .Fa "BIGNUM *r" | ||
43 | .Fa "BIGNUM *a" | ||
44 | .Fa "BIGNUM *b" | ||
45 | .Fa "BN_RECP_CTX *recp" | ||
46 | .Fa "BN_CTX *ctx" | ||
47 | .Fc | ||
48 | .Sh DESCRIPTION | ||
49 | .Fn BN_mod_mul_reciprocal | ||
50 | can be used to perform an efficient | ||
51 | .Xr BN_mod_mul 3 | ||
52 | operation when the operation will be performed repeatedly with the same | ||
53 | modulus. | ||
54 | It computes | ||
55 | .Fa r Ns =( Ns Fa a Ns * Ns Fa b Ns )% Ns Fa m | ||
56 | using | ||
57 | .Fa recp Ns =1/ Ns Fa m , | ||
58 | which is set as described below. | ||
59 | .Fa ctx | ||
60 | is a previously allocated | ||
61 | .Vt BN_CTX | ||
62 | used for temporary variables. | ||
63 | .Pp | ||
64 | .Fn BN_RECP_CTX_new | ||
65 | allocates and initializes a | ||
66 | .Vt BN_RECP_CTX | ||
67 | structure. | ||
68 | .Fn BN_RECP_CTX_init | ||
69 | initializes an existing uninitialized | ||
70 | .Vt BN_RECP_CTX . | ||
71 | .Pp | ||
72 | .Fn BN_RECP_CTX_free | ||
73 | frees the components of the | ||
74 | .Vt BN_RECP_CTX , | ||
75 | and, if it was created by | ||
76 | .Fn BN_RECP_CTX_new , | ||
77 | also the structure itself. | ||
78 | .Pp | ||
79 | .Fn BN_RECP_CTX_set | ||
80 | stores | ||
81 | .Fa m | ||
82 | in | ||
83 | .Fa recp | ||
84 | and sets it up for computing | ||
85 | .Pf 1/ Fa m | ||
86 | and shifting it left by | ||
87 | .Fn BN_num_bits m Ns +1 | ||
88 | to make it an integer. | ||
89 | The result and the number of bits it was shifted left will later be | ||
90 | stored in | ||
91 | .Fa recp . | ||
92 | .Pp | ||
93 | .Fn BN_div_recp | ||
94 | divides | ||
95 | .Fa a | ||
96 | by | ||
97 | .Fa m | ||
98 | using | ||
99 | .Fa recp . | ||
100 | It places the quotient in | ||
101 | .Fa dv | ||
102 | and the remainder in | ||
103 | .Fa rem . | ||
104 | .Pp | ||
105 | The | ||
106 | .Vt BN_RECP_CTX | ||
107 | structure is defined as follows: | ||
108 | .Bd -literal | ||
109 | typedef struct bn_recp_ctx_st { | ||
110 | BIGNUM N; /* the divisor */ | ||
111 | BIGNUM Nr; /* the reciprocal */ | ||
112 | int num_bits; | ||
113 | int shift; | ||
114 | int flags; | ||
115 | } BN_RECP_CTX; | ||
116 | .Ed | ||
117 | .Pp | ||
118 | It cannot be shared between threads. | ||
119 | .Sh RETURN VALUES | ||
120 | .Fn BN_RECP_CTX_new | ||
121 | returns the newly allocated | ||
122 | .Vt BN_RECP_CTX , | ||
123 | or | ||
124 | .Dv NULL | ||
125 | on error. | ||
126 | .Pp | ||
127 | .Fn BN_RECP_CTX_init | ||
128 | and | ||
129 | .Fn BN_RECP_CTX_free | ||
130 | return no values. | ||
131 | .Pp | ||
132 | For the other functions, 1 is returned for success, 0 on error. | ||
133 | The error codes can be obtained by | ||
134 | .Xr ERR_get_error 3 . | ||
135 | .Sh SEE ALSO | ||
136 | .Xr bn 3 , | ||
137 | .Xr BN_add 3 , | ||
138 | .Xr BN_CTX_new 3 , | ||
139 | .Xr ERR_get_error 3 | ||
140 | .Sh HISTORY | ||
141 | .Vt BN_RECP_CTX | ||
142 | was added in SSLeay 0.9.0. | ||
143 | Before that, a function | ||
144 | .Fn BN_reciprocal | ||
145 | was used instead, and the | ||
146 | .Fn BN_mod_mul_reciprocal | ||
147 | arguments were different. | ||
diff --git a/src/lib/libcrypto/man/BN_new.3 b/src/lib/libcrypto/man/BN_new.3 new file mode 100644 index 0000000000..ad8ce886d9 --- /dev/null +++ b/src/lib/libcrypto/man/BN_new.3 | |||
@@ -0,0 +1,84 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_new , | ||
6 | .Nm BN_init , | ||
7 | .Nm BN_clear , | ||
8 | .Nm BN_free , | ||
9 | .Nm BN_clear_free | ||
10 | .Nd allocate and free BIGNUMs | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/bn.h | ||
13 | .Ft BIGNUM * | ||
14 | .Fo BN_new | ||
15 | .Fa void | ||
16 | .Fc | ||
17 | .Ft void | ||
18 | .Fo BN_init | ||
19 | .Fa "BIGNUM *" | ||
20 | .Fc | ||
21 | .Ft void | ||
22 | .Fo BN_clear | ||
23 | .Fa "BIGNUM *a" | ||
24 | .Fc | ||
25 | .Ft void | ||
26 | .Fo BN_free | ||
27 | .Fa "BIGNUM *a" | ||
28 | .Fc | ||
29 | .Ft void | ||
30 | .Fo BN_clear_free | ||
31 | .Fa "BIGNUM *a" | ||
32 | .Fc | ||
33 | .Sh DESCRIPTION | ||
34 | .Fn BN_new | ||
35 | allocates and initializes a | ||
36 | .Vt BIGNUM | ||
37 | structure. | ||
38 | .Fn BN_init | ||
39 | initializes an existing uninitialized | ||
40 | .Vt BIGNUM . | ||
41 | .Pp | ||
42 | .Fn BN_clear | ||
43 | is used to destroy sensitive data such as keys when they are no longer | ||
44 | needed. | ||
45 | It erases the memory used by | ||
46 | .Fa a | ||
47 | and sets it to the value 0. | ||
48 | .Pp | ||
49 | .Fn BN_free | ||
50 | frees the components of the | ||
51 | .Vt BIGNUM , | ||
52 | and if it was created by | ||
53 | .Fn BN_new , | ||
54 | also the structure itself. | ||
55 | .Fn BN_clear_free | ||
56 | additionally overwrites the data before the memory is returned to the | ||
57 | system. | ||
58 | .Sh RETURN VALUES | ||
59 | .Fn BN_new | ||
60 | returns a pointer to the | ||
61 | .Vt BIGNUM . | ||
62 | If the allocation fails, it returns | ||
63 | .Dv NULL | ||
64 | and sets an error code that can be obtained by | ||
65 | .Xr ERR_get_error 3 . | ||
66 | .Pp | ||
67 | .Fn BN_init , | ||
68 | .Fn BN_clear , | ||
69 | .Fn BN_free , | ||
70 | and | ||
71 | .Fn BN_clear_free | ||
72 | return no values. | ||
73 | .Sh SEE ALSO | ||
74 | .Xr bn 3 , | ||
75 | .Xr ERR_get_error 3 | ||
76 | .Sh HISTORY | ||
77 | .Fn BN_new , | ||
78 | .Fn BN_clear , | ||
79 | .Fn BN_free , | ||
80 | and | ||
81 | .Fn BN_clear_free | ||
82 | are available in all versions on SSLeay and OpenSSL. | ||
83 | .Fn BN_init | ||
84 | was added in SSLeay 0.9.1b. | ||
diff --git a/src/lib/libcrypto/man/BN_num_bytes.3 b/src/lib/libcrypto/man/BN_num_bytes.3 new file mode 100644 index 0000000000..2d7be7e443 --- /dev/null +++ b/src/lib/libcrypto/man/BN_num_bytes.3 | |||
@@ -0,0 +1,76 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_NUM_BYTES 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_num_bits , | ||
6 | .Nm BN_num_bytes , | ||
7 | .Nm BN_num_bits_word | ||
8 | .Nd get BIGNUM size | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/bn.h | ||
11 | .Ft int | ||
12 | .Fo BN_num_bytes | ||
13 | .Fa "const BIGNUM *a" | ||
14 | .Fc | ||
15 | .Ft int | ||
16 | .Fo BN_num_bits | ||
17 | .Fa "const BIGNUM *a" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo BN_num_bits_word | ||
21 | .Fa "BN_ULONG w" | ||
22 | .Fc | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn BN_num_bytes | ||
25 | returns the size of a | ||
26 | .Sy BIGNUM | ||
27 | in bytes. | ||
28 | .Pp | ||
29 | .Fn BN_num_bits_word | ||
30 | returns the number of significant bits in a word. | ||
31 | If we take 0x00000432 as an example, it returns 11, not 16, not 32. | ||
32 | Basically, except for a zero, it returns | ||
33 | .Pp | ||
34 | .D1 floor(log2( Ns Fa w ) ) No + 1 . | ||
35 | .Pp | ||
36 | .Fn BN_num_bits | ||
37 | returns the number of significant bits in a | ||
38 | .Sy BIGNUM , | ||
39 | following the same principle as | ||
40 | .Fn BN_num_bits_word . | ||
41 | .Pp | ||
42 | .Fn BN_num_bytes | ||
43 | is a macro. | ||
44 | .Sh RETURN VALUES | ||
45 | The size. | ||
46 | .Sh NOTES | ||
47 | Some have tried using | ||
48 | .Fn BN_num_bits | ||
49 | on individual numbers in RSA keys, DH keys and DSA keys, and found that | ||
50 | they don't always come up with the number of bits they expected | ||
51 | (something like 512, 1024, 2048, ...). This is because generating a | ||
52 | number with some specific number of bits doesn't always set the highest | ||
53 | bits, thereby making the number of | ||
54 | .Em significant | ||
55 | bits a little lower. | ||
56 | If you want to know the "key size" of such a key, either use functions | ||
57 | like | ||
58 | .Xr RSA_size 3 , | ||
59 | .Xr DH_size 3 , | ||
60 | and | ||
61 | .Xr DSA_size 3 , | ||
62 | or use | ||
63 | .Fn BN_num_bytes | ||
64 | and multiply with 8 (although there's no real guarantee that will match | ||
65 | the "key size", just a lot more probability). | ||
66 | .Sh SEE ALSO | ||
67 | .Xr bn 3 , | ||
68 | .Xr DH_size 3 , | ||
69 | .Xr DSA_size 3 , | ||
70 | .Xr RSA_size 3 | ||
71 | .Sh HISTORY | ||
72 | .Fn BN_num_bytes , | ||
73 | .Fn BN_num_bits , | ||
74 | and | ||
75 | .Fn BN_num_bits_word | ||
76 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/BN_rand.3 b/src/lib/libcrypto/man/BN_rand.3 new file mode 100644 index 0000000000..5ae9e9d791 --- /dev/null +++ b/src/lib/libcrypto/man/BN_rand.3 | |||
@@ -0,0 +1,93 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_RAND 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_rand , | ||
6 | .Nm BN_pseudo_rand , | ||
7 | .Nm BN_rand_range , | ||
8 | .Nm BN_pseudo_rand_range | ||
9 | .Nd generate pseudo-random number | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/bn.h | ||
12 | .Ft int | ||
13 | .Fo BN_rand | ||
14 | .Fa "BIGNUM *rnd" | ||
15 | .Fa "int bits" | ||
16 | .Fa "int top" | ||
17 | .Fa "int bottom" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fo BN_pseudo_rand | ||
21 | .Fa "BIGNUM *rnd" | ||
22 | .Fa "int bits" | ||
23 | .Fa "int top" | ||
24 | .Fa "int bottom" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo BN_rand_range | ||
28 | .Fa "BIGNUM *rnd" | ||
29 | .Fa "BIGNUM *range" | ||
30 | .Fc | ||
31 | .Ft int | ||
32 | .Fo BN_pseudo_rand_range | ||
33 | .Fa "BIGNUM *rnd" | ||
34 | .Fa "BIGNUM *range" | ||
35 | .Fc | ||
36 | .Sh DESCRIPTION | ||
37 | .Fn BN_rand | ||
38 | generates a cryptographically strong pseudo-random number of | ||
39 | .Fa bits | ||
40 | bits in length and stores it in | ||
41 | .Fa rnd . | ||
42 | If | ||
43 | .Fa top | ||
44 | is -1, the most significant bit of the random number can be zero. | ||
45 | If | ||
46 | .Fa top | ||
47 | is 0, it is set to 1, and if | ||
48 | .Fa top | ||
49 | is 1, the two most significant bits of the number will be set to 1, so | ||
50 | that the product of two such random numbers will always have | ||
51 | .Pf 2* Fa bits | ||
52 | length. | ||
53 | If | ||
54 | .Fa bottom | ||
55 | is true, the number will be odd. | ||
56 | .Pp | ||
57 | .Fn BN_pseudo_rand | ||
58 | does the same, but pseudo-random numbers generated by this function are | ||
59 | not necessarily unpredictable. | ||
60 | They can be used for non-cryptographic purposes and for certain purposes | ||
61 | in cryptographic protocols, but usually not for key generation etc. | ||
62 | .Pp | ||
63 | .Fn BN_rand_range | ||
64 | generates a cryptographically strong pseudo-random number | ||
65 | .Fa rnd | ||
66 | in the range 0 <= | ||
67 | .Fa rnd No < Fa range . | ||
68 | .Fn BN_pseudo_rand_range | ||
69 | does the same, but is based on | ||
70 | .Fn BN_pseudo_rand , | ||
71 | and hence numbers generated by it are not necessarily unpredictable. | ||
72 | .Sh RETURN VALUES | ||
73 | The functions return 1 on success, 0 on error. | ||
74 | The error codes can be obtained by | ||
75 | .Xr ERR_get_error 3 . | ||
76 | .Sh SEE ALSO | ||
77 | .Xr bn 3 , | ||
78 | .Xr ERR_get_error 3 , | ||
79 | .Xr rand 3 , | ||
80 | .Xr RAND_add 3 , | ||
81 | .Xr RAND_bytes 3 | ||
82 | .Sh HISTORY | ||
83 | .Fn BN_rand | ||
84 | is available in all versions of SSLeay and OpenSSL. | ||
85 | .Fn BN_pseudo_rand | ||
86 | was added in OpenSSL 0.9.5. | ||
87 | The | ||
88 | .Fa top | ||
89 | == -1 case and the function | ||
90 | .Fn BN_rand_range | ||
91 | were added in OpenSSL 0.9.6a. | ||
92 | .Fn BN_pseudo_rand_range | ||
93 | was added in OpenSSL 0.9.6c. | ||
diff --git a/src/lib/libcrypto/man/BN_set_bit.3 b/src/lib/libcrypto/man/BN_set_bit.3 new file mode 100644 index 0000000000..4a199cd0d0 --- /dev/null +++ b/src/lib/libcrypto/man/BN_set_bit.3 | |||
@@ -0,0 +1,157 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_SET_BIT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_set_bit , | ||
6 | .Nm BN_clear_bit , | ||
7 | .Nm BN_is_bit_set , | ||
8 | .Nm BN_mask_bits , | ||
9 | .Nm BN_lshift , | ||
10 | .Nm BN_lshift1 , | ||
11 | .Nm BN_rshift , | ||
12 | .Nm BN_rshift1 | ||
13 | .Nd bit operations on BIGNUMs | ||
14 | .Sh SYNOPSIS | ||
15 | .In openssl/bn.h | ||
16 | .Ft int | ||
17 | .Fo BN_set_bit | ||
18 | .Fa "BIGNUM *a" | ||
19 | .Fa "int n" | ||
20 | .Fc | ||
21 | .Ft int | ||
22 | .Fo BN_clear_bit | ||
23 | .Fa "BIGNUM *a" | ||
24 | .Fa "int n" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo BN_is_bit_set | ||
28 | .Fa "const BIGNUM *a" | ||
29 | .Fa "int n" | ||
30 | .Fc | ||
31 | .Ft int | ||
32 | .Fo BN_mask_bits | ||
33 | .Fa "BIGNUM *a" | ||
34 | .Fa "int n" | ||
35 | .Fc | ||
36 | .Ft int | ||
37 | .Fo BN_lshift | ||
38 | .Fa "BIGNUM *r" | ||
39 | .Fa "const BIGNUM *a" | ||
40 | .Fa "int n" | ||
41 | .Fc | ||
42 | .Ft int | ||
43 | .Fo BN_lshift1 | ||
44 | .Fa "BIGNUM *r" | ||
45 | .Fa "BIGNUM *a" | ||
46 | .Fc | ||
47 | .Ft int | ||
48 | .Fo BN_rshift | ||
49 | .Fa "BIGNUM *r" | ||
50 | .Fa "BIGNUM *a" | ||
51 | .Fa "int n" | ||
52 | .Fc | ||
53 | .Ft int | ||
54 | .Fo BN_rshift1 | ||
55 | .Fa "BIGNUM *r" | ||
56 | .Fa "BIGNUM *a" | ||
57 | .Fc | ||
58 | .Sh DESCRIPTION | ||
59 | .Fn BN_set_bit | ||
60 | sets bit | ||
61 | .Fa n | ||
62 | in | ||
63 | .Fa a | ||
64 | to 1 | ||
65 | .Pq Li a|=(1<<n) . | ||
66 | The number is expanded if necessary. | ||
67 | .Pp | ||
68 | .Fn BN_clear_bit | ||
69 | sets bit | ||
70 | .Fa n | ||
71 | in | ||
72 | .Fa a | ||
73 | to 0 | ||
74 | .Pq Li a&=~(1<<n) . | ||
75 | An error occurs if | ||
76 | .Fa a | ||
77 | is shorter than | ||
78 | .Fa n | ||
79 | bits. | ||
80 | .Pp | ||
81 | .Fn BN_is_bit_set | ||
82 | tests if bit | ||
83 | .Fa n | ||
84 | in | ||
85 | .Fa a | ||
86 | is set. | ||
87 | .Pp | ||
88 | .Fn BN_mask_bits | ||
89 | truncates | ||
90 | .Fa a | ||
91 | to an | ||
92 | .Fa n | ||
93 | bit number | ||
94 | .Pq Li a&=~((~0)>>n) . | ||
95 | An error occurs if | ||
96 | .Fa a | ||
97 | already is shorter than | ||
98 | .Fa n | ||
99 | bits. | ||
100 | .Pp | ||
101 | .Fn BN_lshift | ||
102 | shifts | ||
103 | .Fa a | ||
104 | left by | ||
105 | .Fa n | ||
106 | bits and places the result in | ||
107 | .Fa r | ||
108 | .Pq Li r=a*2^n . | ||
109 | .Fn BN_lshift1 | ||
110 | shifts | ||
111 | .Fa a | ||
112 | left by one and places the result in | ||
113 | .Fa r | ||
114 | .Pq Li r=2*a . | ||
115 | .Pp | ||
116 | .Fn BN_rshift | ||
117 | shifts | ||
118 | .Fa a | ||
119 | right by | ||
120 | .Fa n | ||
121 | bits and places the result in | ||
122 | .Fa r | ||
123 | .Pq Li r=a/2^n . | ||
124 | .Fn BN_rshift1 | ||
125 | shifts | ||
126 | .Fa a | ||
127 | right by one and places the result in | ||
128 | .Fa r | ||
129 | .Pq Li r=a/2 . | ||
130 | .Pp | ||
131 | For the shift functions, | ||
132 | .Fa r | ||
133 | and | ||
134 | .Fa a | ||
135 | may be the same variable. | ||
136 | .Sh RETURN VALUES | ||
137 | .Fn BN_is_bit_set | ||
138 | returns 1 if the bit is set, 0 otherwise. | ||
139 | .Pp | ||
140 | All other functions return 1 for success, 0 on error. | ||
141 | The error codes can be obtained by | ||
142 | .Xr ERR_get_error 3 . | ||
143 | .Sh SEE ALSO | ||
144 | .Xr bn 3 , | ||
145 | .Xr BN_add 3 , | ||
146 | .Xr BN_num_bytes 3 | ||
147 | .Sh HISTORY | ||
148 | .Fn BN_set_bit , | ||
149 | .Fn BN_clear_bit , | ||
150 | .Fn BN_is_bit_set , | ||
151 | .Fn BN_mask_bits , | ||
152 | .Fn BN_lshift , | ||
153 | .Fn BN_lshift1 , | ||
154 | .Fn BN_rshift , | ||
155 | and | ||
156 | .Fn BN_rshift1 | ||
157 | are available in all versions of SSLeay and OpenSSL. | ||
diff --git a/src/lib/libcrypto/man/BN_swap.3 b/src/lib/libcrypto/man/BN_swap.3 new file mode 100644 index 0000000000..b252261067 --- /dev/null +++ b/src/lib/libcrypto/man/BN_swap.3 | |||
@@ -0,0 +1,23 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_SWAP 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_swap | ||
6 | .Nd exchange BIGNUMs | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/bn.h | ||
9 | .Ft void | ||
10 | .Fo BN_swap | ||
11 | .Fa "BIGNUM *a" | ||
12 | .Fa "BIGNUM *b" | ||
13 | .Fc | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn BN_swap | ||
16 | exchanges the values of | ||
17 | .Fa a | ||
18 | and | ||
19 | .Fa b . | ||
20 | .Sh SEE ALSO | ||
21 | .Xr bn 3 | ||
22 | .Sh HISTORY | ||
23 | BN_swap was added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libcrypto/man/BN_zero.3 b/src/lib/libcrypto/man/BN_zero.3 new file mode 100644 index 0000000000..adfd6a0c65 --- /dev/null +++ b/src/lib/libcrypto/man/BN_zero.3 | |||
@@ -0,0 +1,101 @@ | |||
1 | .Dd $Mdocdate: February 23 2015 $ | ||
2 | .Dt BN_ZERO 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BN_zero , | ||
6 | .Nm BN_one , | ||
7 | .Nm BN_value_one , | ||
8 | .Nm BN_set_word , | ||
9 | .Nm BN_get_word | ||
10 | .Nd BIGNUM assignment operations | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/bn.h | ||
13 | .Ft int | ||
14 | .Fo BN_zero | ||
15 | .Fa "BIGNUM *a" | ||
16 | .Fc | ||
17 | .Ft int | ||
18 | .Fo BN_one | ||
19 | .Fa "BIGNUM *a" | ||
20 | .Fc | ||
21 | .Ft const BIGNUM * | ||
22 | .Fo BN_value_one | ||
23 | .Fa void | ||
24 | .Fc | ||
25 | .Ft int | ||
26 | .Fo BN_set_word | ||
27 | .Fa "BIGNUM *a" | ||
28 | .Fa "unsigned long w" | ||
29 | .Fc | ||
30 | .Ft unsigned long | ||
31 | .Fo BN_get_word | ||
32 | .Fa "BIGNUM *a" | ||
33 | .Fc | ||
34 | .Sh DESCRIPTION | ||
35 | .Fn BN_zero , | ||
36 | .Fn BN_one , | ||
37 | and | ||
38 | .Fn BN_set_word | ||
39 | set | ||
40 | .Fa a | ||
41 | to the values 0, 1 and | ||
42 | .Fa w | ||
43 | respectively. | ||
44 | .Fn BN_zero | ||
45 | and | ||
46 | .Fn BN_one | ||
47 | are macros. | ||
48 | .Pp | ||
49 | .Fn BN_value_one | ||
50 | returns a | ||
51 | .Vt BIGNUM | ||
52 | constant of value 1. | ||
53 | This constant is useful for use in comparisons and assignment. | ||
54 | .Pp | ||
55 | .Fn BN_get_word | ||
56 | returns | ||
57 | .Fa a | ||
58 | if it can be represented as an | ||
59 | .Vt unsigned long . | ||
60 | .Sh RETURN VALUES | ||
61 | .Fn BN_get_word | ||
62 | returns the value | ||
63 | .Fa a , | ||
64 | or 0xffffffffL if | ||
65 | .Fa a | ||
66 | cannot be represented as an | ||
67 | .Vt unsigned long . | ||
68 | .Pp | ||
69 | .Fn BN_zero , | ||
70 | .Fn BN_one , | ||
71 | and | ||
72 | .Fn BN_set_word | ||
73 | return 1 on success, 0 otherwise. | ||
74 | .Fn BN_value_one | ||
75 | returns the constant. | ||
76 | .Sh SEE ALSO | ||
77 | .Xr bn 3 , | ||
78 | .Xr BN_bn2bin 3 | ||
79 | .Sh HISTORY | ||
80 | .Fn BN_zero , | ||
81 | .Fn BN_one , | ||
82 | and | ||
83 | .Fn BN_set_word | ||
84 | are available in all versions of SSLeay and OpenSSL. | ||
85 | .Fn BN_value_one | ||
86 | and | ||
87 | .Fn BN_get_word | ||
88 | were added in SSLeay 0.8. | ||
89 | .Pp | ||
90 | .Fn BN_value_one | ||
91 | was changed to return a true | ||
92 | .Vt const BIGNUM * | ||
93 | in OpenSSL 0.9.7. | ||
94 | .Sh BUGS | ||
95 | Someone might change the constant. | ||
96 | .Pp | ||
97 | If a | ||
98 | .Vt BIGNUM | ||
99 | is equal to 0xffffffffL it can be represented as an | ||
100 | .Vt unsigned long | ||
101 | but this value is also returned on error. | ||
diff --git a/src/lib/libcrypto/man/Makefile b/src/lib/libcrypto/man/Makefile index 2ac6e5b6f6..bce02f647f 100644 --- a/src/lib/libcrypto/man/Makefile +++ b/src/lib/libcrypto/man/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | # $OpenBSD: Makefile,v 1.18 2015/02/16 16:42:14 schwarze Exp $ | 1 | # $OpenBSD: Makefile,v 1.19 2015/02/23 17:43:24 schwarze Exp $ |
2 | 2 | ||
3 | .include <bsd.own.mk> # for NOMAN | 3 | .include <bsd.own.mk> # for NOMAN |
4 | 4 | ||
@@ -33,8 +33,6 @@ MAN= \ | |||
33 | BIO_s_socket.3 \ | 33 | BIO_s_socket.3 \ |
34 | BIO_set_callback.3 \ | 34 | BIO_set_callback.3 \ |
35 | BIO_should_retry.3 \ | 35 | BIO_should_retry.3 \ |
36 | |||
37 | GENMAN= \ | ||
38 | BN_BLINDING_new.3 \ | 36 | BN_BLINDING_new.3 \ |
39 | BN_CTX_new.3 \ | 37 | BN_CTX_new.3 \ |
40 | BN_CTX_start.3 \ | 38 | BN_CTX_start.3 \ |
@@ -53,6 +51,8 @@ GENMAN= \ | |||
53 | BN_set_bit.3 \ | 51 | BN_set_bit.3 \ |
54 | BN_swap.3 \ | 52 | BN_swap.3 \ |
55 | BN_zero.3 \ | 53 | BN_zero.3 \ |
54 | |||
55 | GENMAN= \ | ||
56 | BUF_MEM_new.3 \ | 56 | BUF_MEM_new.3 \ |
57 | CONF_modules_free.3 \ | 57 | CONF_modules_free.3 \ |
58 | CONF_modules_load_file.3 \ | 58 | CONF_modules_load_file.3 \ |
diff --git a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod b/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod deleted file mode 100644 index 1c586ac54e..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_BLINDING_new.pod +++ /dev/null | |||
@@ -1,115 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_BLINDING_new, BN_BLINDING_free, BN_BLINDING_update, BN_BLINDING_convert, | ||
6 | BN_BLINDING_invert, BN_BLINDING_convert_ex, BN_BLINDING_invert_ex, | ||
7 | BN_BLINDING_get_thread_id, BN_BLINDING_set_thread_id, BN_BLINDING_thread_id, | ||
8 | BN_BLINDING_get_flags, BN_BLINDING_set_flags, | ||
9 | BN_BLINDING_create_param - blinding related BIGNUM functions. | ||
10 | |||
11 | =head1 SYNOPSIS | ||
12 | |||
13 | #include <openssl/bn.h> | ||
14 | |||
15 | BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, | ||
16 | BIGNUM *mod); | ||
17 | void BN_BLINDING_free(BN_BLINDING *b); | ||
18 | int BN_BLINDING_update(BN_BLINDING *b,BN_CTX *ctx); | ||
19 | int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | ||
20 | int BN_BLINDING_invert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx); | ||
21 | int BN_BLINDING_convert_ex(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, | ||
22 | BN_CTX *ctx); | ||
23 | int BN_BLINDING_invert_ex(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, | ||
24 | BN_CTX *ctx); | ||
25 | #ifndef OPENSSL_NO_DEPRECATED | ||
26 | unsigned long BN_BLINDING_get_thread_id(const BN_BLINDING *); | ||
27 | void BN_BLINDING_set_thread_id(BN_BLINDING *, unsigned long); | ||
28 | #endif | ||
29 | CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); | ||
30 | unsigned long BN_BLINDING_get_flags(const BN_BLINDING *); | ||
31 | void BN_BLINDING_set_flags(BN_BLINDING *, unsigned long); | ||
32 | BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, | ||
33 | const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, | ||
34 | int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, | ||
35 | const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), | ||
36 | BN_MONT_CTX *m_ctx); | ||
37 | |||
38 | =head1 DESCRIPTION | ||
39 | |||
40 | BN_BLINDING_new() allocates a new B<BN_BLINDING> structure and copies | ||
41 | the B<A> and B<Ai> values into the newly created B<BN_BLINDING> object. | ||
42 | |||
43 | BN_BLINDING_free() frees the B<BN_BLINDING> structure. | ||
44 | |||
45 | BN_BLINDING_update() updates the B<BN_BLINDING> parameters by squaring | ||
46 | the B<A> and B<Ai> or, after specific number of uses and if the | ||
47 | necessary parameters are set, by re-creating the blinding parameters. | ||
48 | |||
49 | BN_BLINDING_convert_ex() multiplies B<n> with the blinding factor B<A>. | ||
50 | If B<r> is not NULL a copy the inverse blinding factor B<Ai> will be | ||
51 | returned in B<r> (this is useful if a B<RSA> object is shared among | ||
52 | several threads). BN_BLINDING_invert_ex() multiplies B<n> with the | ||
53 | inverse blinding factor B<Ai>. If B<r> is not NULL it will be used as | ||
54 | the inverse blinding. | ||
55 | |||
56 | BN_BLINDING_convert() and BN_BLINDING_invert() are wrapper | ||
57 | functions for BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() | ||
58 | with B<r> set to NULL. | ||
59 | |||
60 | BN_BLINDING_thread_id() provides access to the B<CRYPTO_THREADID> | ||
61 | object within the B<BN_BLINDING> structure. This is to help users | ||
62 | provide proper locking if needed for multi-threaded use. The "thread | ||
63 | id" object of a newly allocated B<BN_BLINDING> structure is | ||
64 | initialised to the thread id in which BN_BLINDING_new() was called. | ||
65 | |||
66 | BN_BLINDING_get_flags() returns the BN_BLINDING flags. Currently | ||
67 | there are two supported flags: B<BN_BLINDING_NO_UPDATE> and | ||
68 | B<BN_BLINDING_NO_RECREATE>. B<BN_BLINDING_NO_UPDATE> inhibits the | ||
69 | automatic update of the B<BN_BLINDING> parameters after each use | ||
70 | and B<BN_BLINDING_NO_RECREATE> inhibits the automatic re-creation | ||
71 | of the B<BN_BLINDING> parameters after a fixed number of uses (currently | ||
72 | 32). In newly allocated B<BN_BLINDING> objects no flags are set. | ||
73 | BN_BLINDING_set_flags() sets the B<BN_BLINDING> parameters flags. | ||
74 | |||
75 | BN_BLINDING_create_param() creates new B<BN_BLINDING> parameters | ||
76 | using the exponent B<e> and the modulus B<m>. B<bn_mod_exp> and | ||
77 | B<m_ctx> can be used to pass special functions for exponentiation | ||
78 | (normally BN_mod_exp_mont() and B<BN_MONT_CTX>). | ||
79 | |||
80 | =head1 RETURN VALUES | ||
81 | |||
82 | BN_BLINDING_new() returns the newly allocated B<BN_BLINDING> structure | ||
83 | or NULL in case of an error. | ||
84 | |||
85 | BN_BLINDING_update(), BN_BLINDING_convert(), BN_BLINDING_invert(), | ||
86 | BN_BLINDING_convert_ex() and BN_BLINDING_invert_ex() return 1 on | ||
87 | success and 0 if an error occured. | ||
88 | |||
89 | BN_BLINDING_thread_id() returns a pointer to the thread id object | ||
90 | within a B<BN_BLINDING> object. | ||
91 | |||
92 | BN_BLINDING_get_flags() returns the currently set B<BN_BLINDING> flags | ||
93 | (a B<unsigned long> value). | ||
94 | |||
95 | BN_BLINDING_create_param() returns the newly created B<BN_BLINDING> | ||
96 | parameters or NULL on error. | ||
97 | |||
98 | =head1 SEE ALSO | ||
99 | |||
100 | L<bn(3)|bn(3)> | ||
101 | |||
102 | =head1 HISTORY | ||
103 | |||
104 | BN_BLINDING_thread_id was first introduced in OpenSSL 1.0.0, and it | ||
105 | deprecates BN_BLINDING_set_thread_id and BN_BLINDING_get_thread_id. | ||
106 | |||
107 | BN_BLINDING_convert_ex, BN_BLINDIND_invert_ex, BN_BLINDING_get_thread_id, | ||
108 | BN_BLINDING_set_thread_id, BN_BLINDING_set_flags, BN_BLINDING_get_flags | ||
109 | and BN_BLINDING_create_param were first introduced in OpenSSL 0.9.8 | ||
110 | |||
111 | =head1 AUTHOR | ||
112 | |||
113 | Nils Larsch for the OpenSSL project (http://www.openssl.org). | ||
114 | |||
115 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod b/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod deleted file mode 100644 index bbedbb1778..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_CTX_new.pod +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_CTX_new, BN_CTX_init, BN_CTX_free - allocate and free BN_CTX structures | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BN_CTX *BN_CTX_new(void); | ||
12 | |||
13 | void BN_CTX_free(BN_CTX *c); | ||
14 | |||
15 | Deprecated: | ||
16 | |||
17 | void BN_CTX_init(BN_CTX *c); | ||
18 | |||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | A B<BN_CTX> is a structure that holds B<BIGNUM> temporary variables used by | ||
23 | library functions. Since dynamic memory allocation to create B<BIGNUM>s | ||
24 | is rather expensive when used in conjunction with repeated subroutine | ||
25 | calls, the B<BN_CTX> structure is used. | ||
26 | |||
27 | BN_CTX_new() allocates and initializes a B<BN_CTX> | ||
28 | structure. | ||
29 | |||
30 | BN_CTX_free() frees the components of the B<BN_CTX>, and if it was | ||
31 | created by BN_CTX_new(), also the structure itself. | ||
32 | If L<BN_CTX_start(3)|BN_CTX_start(3)> has been used on the B<BN_CTX>, | ||
33 | L<BN_CTX_end(3)|BN_CTX_end(3)> must be called before the B<BN_CTX> | ||
34 | may be freed by BN_CTX_free(). | ||
35 | |||
36 | BN_CTX_init() (deprecated) initializes an existing uninitialized B<BN_CTX>. | ||
37 | This should not be used for new programs. Use BN_CTX_new() instead. | ||
38 | |||
39 | =head1 RETURN VALUES | ||
40 | |||
41 | BN_CTX_new() returns a pointer to the B<BN_CTX>. If the allocation fails, | ||
42 | it returns B<NULL> and sets an error code that can be obtained by | ||
43 | L<ERR_get_error(3)|ERR_get_error(3)>. | ||
44 | |||
45 | BN_CTX_init() and BN_CTX_free() have no return values. | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, | ||
50 | L<BN_CTX_start(3)|BN_CTX_start(3)> | ||
51 | |||
52 | =head1 HISTORY | ||
53 | |||
54 | BN_CTX_new() and BN_CTX_free() are available in all versions on SSLeay | ||
55 | and OpenSSL. BN_CTX_init() was added in SSLeay 0.9.1b. | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod b/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod deleted file mode 100644 index dfcefe1a88..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_CTX_start.pod +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_CTX_start, BN_CTX_get, BN_CTX_end - use temporary BIGNUM variables | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | void BN_CTX_start(BN_CTX *ctx); | ||
12 | |||
13 | BIGNUM *BN_CTX_get(BN_CTX *ctx); | ||
14 | |||
15 | void BN_CTX_end(BN_CTX *ctx); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | These functions are used to obtain temporary B<BIGNUM> variables from | ||
20 | a B<BN_CTX> (which can been created by using L<BN_CTX_new(3)|BN_CTX_new(3)>) | ||
21 | in order to save the overhead of repeatedly creating and | ||
22 | freeing B<BIGNUM>s in functions that are called from inside a loop. | ||
23 | |||
24 | A function must call BN_CTX_start() first. Then, BN_CTX_get() may be | ||
25 | called repeatedly to obtain temporary B<BIGNUM>s. All BN_CTX_get() | ||
26 | calls must be made before calling any other functions that use the | ||
27 | B<ctx> as an argument. | ||
28 | |||
29 | Finally, BN_CTX_end() must be called before returning from the function. | ||
30 | When BN_CTX_end() is called, the B<BIGNUM> pointers obtained from | ||
31 | BN_CTX_get() become invalid. | ||
32 | |||
33 | =head1 RETURN VALUES | ||
34 | |||
35 | BN_CTX_start() and BN_CTX_end() return no values. | ||
36 | |||
37 | BN_CTX_get() returns a pointer to the B<BIGNUM>, or B<NULL> on error. | ||
38 | Once BN_CTX_get() has failed, the subsequent calls will return B<NULL> | ||
39 | as well, so it is sufficient to check the return value of the last | ||
40 | BN_CTX_get() call. In case of an error, an error code is set, which | ||
41 | can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
42 | |||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
47 | |||
48 | =head1 HISTORY | ||
49 | |||
50 | BN_CTX_start(), BN_CTX_get() and BN_CTX_end() were added in OpenSSL 0.9.5. | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_add.pod b/src/lib/libssl/src/doc/crypto/BN_add.pod deleted file mode 100644 index 15b28d8334..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_add.pod +++ /dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_add, BN_sub, BN_mul, BN_sqr, BN_div, BN_mod, BN_nnmod, BN_mod_add, | ||
6 | BN_mod_sub, BN_mod_mul, BN_mod_sqr, BN_exp, BN_mod_exp, BN_gcd - | ||
7 | arithmetic operations on BIGNUMs | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | int BN_add(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | ||
14 | |||
15 | int BN_sub(BIGNUM *r, const BIGNUM *a, const BIGNUM *b); | ||
16 | |||
17 | int BN_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
18 | |||
19 | int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx); | ||
20 | |||
21 | int BN_div(BIGNUM *dv, BIGNUM *rem, const BIGNUM *a, const BIGNUM *d, | ||
22 | BN_CTX *ctx); | ||
23 | |||
24 | int BN_mod(BIGNUM *rem, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
25 | |||
26 | int BN_nnmod(BIGNUM *r, const BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
27 | |||
28 | int BN_mod_add(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
29 | BN_CTX *ctx); | ||
30 | |||
31 | int BN_mod_sub(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
32 | BN_CTX *ctx); | ||
33 | |||
34 | int BN_mod_mul(BIGNUM *r, BIGNUM *a, BIGNUM *b, const BIGNUM *m, | ||
35 | BN_CTX *ctx); | ||
36 | |||
37 | int BN_mod_sqr(BIGNUM *r, BIGNUM *a, const BIGNUM *m, BN_CTX *ctx); | ||
38 | |||
39 | int BN_exp(BIGNUM *r, BIGNUM *a, BIGNUM *p, BN_CTX *ctx); | ||
40 | |||
41 | int BN_mod_exp(BIGNUM *r, BIGNUM *a, const BIGNUM *p, | ||
42 | const BIGNUM *m, BN_CTX *ctx); | ||
43 | |||
44 | int BN_gcd(BIGNUM *r, BIGNUM *a, BIGNUM *b, BN_CTX *ctx); | ||
45 | |||
46 | =head1 DESCRIPTION | ||
47 | |||
48 | BN_add() adds I<a> and I<b> and places the result in I<r> (C<r=a+b>). | ||
49 | I<r> may be the same B<BIGNUM> as I<a> or I<b>. | ||
50 | |||
51 | BN_sub() subtracts I<b> from I<a> and places the result in I<r> (C<r=a-b>). | ||
52 | |||
53 | BN_mul() multiplies I<a> and I<b> and places the result in I<r> (C<r=a*b>). | ||
54 | I<r> may be the same B<BIGNUM> as I<a> or I<b>. | ||
55 | For multiplication by powers of 2, use L<BN_lshift(3)|BN_lshift(3)>. | ||
56 | |||
57 | BN_sqr() takes the square of I<a> and places the result in I<r> | ||
58 | (C<r=a^2>). I<r> and I<a> may be the same B<BIGNUM>. | ||
59 | This function is faster than BN_mul(r,a,a). | ||
60 | |||
61 | BN_div() divides I<a> by I<d> and places the result in I<dv> and the | ||
62 | remainder in I<rem> (C<dv=a/d, rem=a%d>). Either of I<dv> and I<rem> may | ||
63 | be B<NULL>, in which case the respective value is not returned. | ||
64 | The result is rounded towards zero; thus if I<a> is negative, the | ||
65 | remainder will be zero or negative. | ||
66 | For division by powers of 2, use BN_rshift(3). | ||
67 | |||
68 | BN_mod() corresponds to BN_div() with I<dv> set to B<NULL>. | ||
69 | |||
70 | BN_nnmod() reduces I<a> modulo I<m> and places the non-negative | ||
71 | remainder in I<r>. | ||
72 | |||
73 | BN_mod_add() adds I<a> to I<b> modulo I<m> and places the non-negative | ||
74 | result in I<r>. | ||
75 | |||
76 | BN_mod_sub() subtracts I<b> from I<a> modulo I<m> and places the | ||
77 | non-negative result in I<r>. | ||
78 | |||
79 | BN_mod_mul() multiplies I<a> by I<b> and finds the non-negative | ||
80 | remainder respective to modulus I<m> (C<r=(a*b) mod m>). I<r> may be | ||
81 | the same B<BIGNUM> as I<a> or I<b>. For more efficient algorithms for | ||
82 | repeated computations using the same modulus, see | ||
83 | L<BN_mod_mul_montgomery(3)|BN_mod_mul_montgomery(3)> and | ||
84 | L<BN_mod_mul_reciprocal(3)|BN_mod_mul_reciprocal(3)>. | ||
85 | |||
86 | BN_mod_sqr() takes the square of I<a> modulo B<m> and places the | ||
87 | result in I<r>. | ||
88 | |||
89 | BN_exp() raises I<a> to the I<p>-th power and places the result in I<r> | ||
90 | (C<r=a^p>). This function is faster than repeated applications of | ||
91 | BN_mul(). | ||
92 | |||
93 | BN_mod_exp() computes I<a> to the I<p>-th power modulo I<m> (C<r=a^p % | ||
94 | m>). This function uses less time and space than BN_exp(). | ||
95 | |||
96 | BN_gcd() computes the greatest common divisor of I<a> and I<b> and | ||
97 | places the result in I<r>. I<r> may be the same B<BIGNUM> as I<a> or | ||
98 | I<b>. | ||
99 | |||
100 | For all functions, I<ctx> is a previously allocated B<BN_CTX> used for | ||
101 | temporary variables; see L<BN_CTX_new(3)|BN_CTX_new(3)>. | ||
102 | |||
103 | Unless noted otherwise, the result B<BIGNUM> must be different from | ||
104 | the arguments. | ||
105 | |||
106 | =head1 RETURN VALUES | ||
107 | |||
108 | For all functions, 1 is returned for success, 0 on error. The return | ||
109 | value should always be checked (e.g., C<if (!BN_add(r,a,b)) goto err;>). | ||
110 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
111 | |||
112 | =head1 SEE ALSO | ||
113 | |||
114 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, | ||
115 | L<BN_CTX_new(3)|BN_CTX_new(3)>, L<BN_add_word(3)|BN_add_word(3)>, | ||
116 | L<BN_set_bit(3)|BN_set_bit(3)> | ||
117 | |||
118 | =head1 HISTORY | ||
119 | |||
120 | BN_add(), BN_sub(), BN_sqr(), BN_div(), BN_mod(), BN_mod_mul(), | ||
121 | BN_mod_exp() and BN_gcd() are available in all versions of SSLeay and | ||
122 | OpenSSL. The I<ctx> argument to BN_mul() was added in SSLeay | ||
123 | 0.9.1b. BN_exp() appeared in SSLeay 0.9.0. | ||
124 | BN_nnmod(), BN_mod_add(), BN_mod_sub(), and BN_mod_sqr() were added in | ||
125 | OpenSSL 0.9.7. | ||
126 | |||
127 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_add_word.pod b/src/lib/libssl/src/doc/crypto/BN_add_word.pod deleted file mode 100644 index ba1026417d..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_add_word.pod +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_add_word, BN_sub_word, BN_mul_word, BN_div_word, BN_mod_word - arithmetic | ||
6 | functions on BIGNUMs with integers | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_add_word(BIGNUM *a, BN_ULONG w); | ||
13 | |||
14 | int BN_sub_word(BIGNUM *a, BN_ULONG w); | ||
15 | |||
16 | int BN_mul_word(BIGNUM *a, BN_ULONG w); | ||
17 | |||
18 | BN_ULONG BN_div_word(BIGNUM *a, BN_ULONG w); | ||
19 | |||
20 | BN_ULONG BN_mod_word(const BIGNUM *a, BN_ULONG w); | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | These functions perform arithmetic operations on BIGNUMs with unsigned | ||
25 | integers. They are much more efficient than the normal BIGNUM | ||
26 | arithmetic operations. | ||
27 | |||
28 | BN_add_word() adds B<w> to B<a> (C<a+=w>). | ||
29 | |||
30 | BN_sub_word() subtracts B<w> from B<a> (C<a-=w>). | ||
31 | |||
32 | BN_mul_word() multiplies B<a> and B<w> (C<a*=w>). | ||
33 | |||
34 | BN_div_word() divides B<a> by B<w> (C<a/=w>) and returns the remainder. | ||
35 | |||
36 | BN_mod_word() returns the remainder of B<a> divided by B<w> (C<a%w>). | ||
37 | |||
38 | For BN_div_word() and BN_mod_word(), B<w> must not be 0. | ||
39 | |||
40 | =head1 RETURN VALUES | ||
41 | |||
42 | BN_add_word(), BN_sub_word() and BN_mul_word() return 1 for success, 0 on | ||
43 | error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
44 | |||
45 | BN_mod_word() and BN_div_word() return B<a>%B<w> on success and | ||
46 | B<(BN_ULONG)-1> if an error occurred. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)> | ||
51 | |||
52 | =head1 HISTORY | ||
53 | |||
54 | BN_add_word() and BN_mod_word() are available in all versions of | ||
55 | SSLeay and OpenSSL. BN_div_word() was added in SSLeay 0.8, and | ||
56 | BN_sub_word() and BN_mul_word() in SSLeay 0.9.0. | ||
57 | |||
58 | Before 0.9.8a the return value for BN_div_word() and BN_mod_word() | ||
59 | in case of an error was 0. | ||
60 | |||
61 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod b/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod deleted file mode 100644 index 03b439c7b9..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_bn2bin.pod +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_bn2bin, BN_bin2bn, BN_bn2hex, BN_bn2dec, BN_hex2bn, BN_dec2bn, | ||
6 | BN_print, BN_print_fp, BN_bn2mpi, BN_mpi2bn - format conversions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_bn2bin(const BIGNUM *a, unsigned char *to); | ||
13 | BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret); | ||
14 | |||
15 | char *BN_bn2hex(const BIGNUM *a); | ||
16 | char *BN_bn2dec(const BIGNUM *a); | ||
17 | int BN_hex2bn(BIGNUM **a, const char *str); | ||
18 | int BN_dec2bn(BIGNUM **a, const char *str); | ||
19 | |||
20 | int BN_print(BIO *fp, const BIGNUM *a); | ||
21 | int BN_print_fp(FILE *fp, const BIGNUM *a); | ||
22 | |||
23 | int BN_bn2mpi(const BIGNUM *a, unsigned char *to); | ||
24 | BIGNUM *BN_mpi2bn(unsigned char *s, int len, BIGNUM *ret); | ||
25 | |||
26 | =head1 DESCRIPTION | ||
27 | |||
28 | BN_bn2bin() converts the absolute value of B<a> into big-endian form | ||
29 | and stores it at B<to>. B<to> must point to BN_num_bytes(B<a>) bytes of | ||
30 | memory. | ||
31 | |||
32 | BN_bin2bn() converts the positive integer in big-endian form of length | ||
33 | B<len> at B<s> into a B<BIGNUM> and places it in B<ret>. If B<ret> is | ||
34 | NULL, a new B<BIGNUM> is created. | ||
35 | |||
36 | BN_bn2hex() and BN_bn2dec() return printable strings containing the | ||
37 | hexadecimal and decimal encoding of B<a> respectively. For negative | ||
38 | numbers, the string is prefaced with a leading '-'. The string must be | ||
39 | freed later using free(). | ||
40 | |||
41 | BN_hex2bn() converts the string B<str> containing a hexadecimal number | ||
42 | to a B<BIGNUM> and stores it in **B<bn>. If *B<bn> is NULL, a new | ||
43 | B<BIGNUM> is created. If B<bn> is NULL, it only computes the number's | ||
44 | length in hexadecimal digits. If the string starts with '-', the | ||
45 | number is negative. BN_dec2bn() is the same using the decimal system. | ||
46 | |||
47 | BN_print() and BN_print_fp() write the hexadecimal encoding of B<a>, | ||
48 | with a leading '-' for negative numbers, to the B<BIO> or B<FILE> | ||
49 | B<fp>. | ||
50 | |||
51 | BN_bn2mpi() and BN_mpi2bn() convert B<BIGNUM>s from and to a format | ||
52 | that consists of the number's length in bytes represented as a 4-byte | ||
53 | big-endian number, and the number itself in big-endian format, where | ||
54 | the most significant bit signals a negative number (the representation | ||
55 | of numbers with the MSB set is prefixed with null byte). | ||
56 | |||
57 | BN_bn2mpi() stores the representation of B<a> at B<to>, where B<to> | ||
58 | must be large enough to hold the result. The size can be determined by | ||
59 | calling BN_bn2mpi(B<a>, NULL). | ||
60 | |||
61 | BN_mpi2bn() converts the B<len> bytes long representation at B<s> to | ||
62 | a B<BIGNUM> and stores it at B<ret>, or in a newly allocated B<BIGNUM> | ||
63 | if B<ret> is NULL. | ||
64 | |||
65 | =head1 RETURN VALUES | ||
66 | |||
67 | BN_bn2bin() returns the length of the big-endian number placed at B<to>. | ||
68 | BN_bin2bn() returns the B<BIGNUM>, NULL on error. | ||
69 | |||
70 | BN_bn2hex() and BN_bn2dec() return a null-terminated string, or NULL | ||
71 | on error. BN_hex2bn() and BN_dec2bn() return the number's length in | ||
72 | hexadecimal or decimal digits, and 0 on error. | ||
73 | |||
74 | BN_print_fp() and BN_print() return 1 on success, 0 on write errors. | ||
75 | |||
76 | BN_bn2mpi() returns the length of the representation. BN_mpi2bn() | ||
77 | returns the B<BIGNUM>, and NULL on error. | ||
78 | |||
79 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
80 | |||
81 | =head1 SEE ALSO | ||
82 | |||
83 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_zero(3)|BN_zero(3)>, | ||
84 | L<ASN1_INTEGER_to_BN(3)|ASN1_INTEGER_to_BN(3)>, | ||
85 | L<BN_num_bytes(3)|BN_num_bytes(3)> | ||
86 | |||
87 | =head1 HISTORY | ||
88 | |||
89 | BN_bn2bin(), BN_bin2bn(), BN_print_fp() and BN_print() are available | ||
90 | in all versions of SSLeay and OpenSSL. | ||
91 | |||
92 | BN_bn2hex(), BN_bn2dec(), BN_hex2bn(), BN_dec2bn(), BN_bn2mpi() and | ||
93 | BN_mpi2bn() were added in SSLeay 0.9.0. | ||
94 | |||
95 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_cmp.pod b/src/lib/libssl/src/doc/crypto/BN_cmp.pod deleted file mode 100644 index 29df69631e..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_cmp.pod +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_cmp, BN_ucmp, BN_is_zero, BN_is_one, BN_is_word, BN_is_odd - BIGNUM | ||
6 | comparison and test functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_cmp(BIGNUM *a, BIGNUM *b); | ||
13 | int BN_ucmp(BIGNUM *a, BIGNUM *b); | ||
14 | |||
15 | int BN_is_zero(BIGNUM *a); | ||
16 | int BN_is_one(BIGNUM *a); | ||
17 | int BN_is_word(BIGNUM *a, BN_ULONG w); | ||
18 | int BN_is_odd(BIGNUM *a); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | BN_cmp() compares the numbers B<a> and B<b>. BN_ucmp() compares their | ||
23 | absolute values. | ||
24 | |||
25 | BN_is_zero(), BN_is_one() and BN_is_word() test if B<a> equals 0, 1, | ||
26 | or B<w> respectively. BN_is_odd() tests if a is odd. | ||
27 | |||
28 | BN_is_zero(), BN_is_one(), BN_is_word() and BN_is_odd() are macros. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | BN_cmp() returns -1 if B<a> E<lt> B<b>, 0 if B<a> == B<b> and 1 if | ||
33 | B<a> E<gt> B<b>. BN_ucmp() is the same using the absolute values | ||
34 | of B<a> and B<b>. | ||
35 | |||
36 | BN_is_zero(), BN_is_one() BN_is_word() and BN_is_odd() return 1 if | ||
37 | the condition is true, 0 otherwise. | ||
38 | |||
39 | =head1 SEE ALSO | ||
40 | |||
41 | L<bn(3)|bn(3)> | ||
42 | |||
43 | =head1 HISTORY | ||
44 | |||
45 | BN_cmp(), BN_ucmp(), BN_is_zero(), BN_is_one() and BN_is_word() are | ||
46 | available in all versions of SSLeay and OpenSSL. | ||
47 | BN_is_odd() was added in SSLeay 0.8. | ||
48 | |||
49 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_copy.pod b/src/lib/libssl/src/doc/crypto/BN_copy.pod deleted file mode 100644 index 388dd7df26..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_copy.pod +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_copy, BN_dup - copy BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_copy(BIGNUM *to, const BIGNUM *from); | ||
12 | |||
13 | BIGNUM *BN_dup(const BIGNUM *from); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | BN_copy() copies B<from> to B<to>. BN_dup() creates a new B<BIGNUM> | ||
18 | containing the value B<from>. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | BN_copy() returns B<to> on success, NULL on error. BN_dup() returns | ||
23 | the new B<BIGNUM>, and NULL on error. The error codes can be obtained | ||
24 | by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
25 | |||
26 | =head1 SEE ALSO | ||
27 | |||
28 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
29 | |||
30 | =head1 HISTORY | ||
31 | |||
32 | BN_copy() and BN_dup() are available in all versions of SSLeay and OpenSSL. | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod b/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod deleted file mode 100644 index 0a95633d54..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_generate_prime.pod +++ /dev/null | |||
@@ -1,149 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_generate_prime, BN_is_prime_ex, BN_is_prime_fasttest_ex, BN_GENCB_call, | ||
6 | BN_GENCB_set_old, BN_GENCB_set, BN_generate_prime, BN_is_prime, | ||
7 | BN_is_prime_fasttest - generate primes and test for primality | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | int BN_generate_prime_ex(BIGNUM *ret,int bits,int safe, const BIGNUM *add, | ||
14 | const BIGNUM *rem, BN_GENCB *cb); | ||
15 | |||
16 | int BN_is_prime_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, BN_GENCB *cb); | ||
17 | |||
18 | int BN_is_prime_fasttest_ex(const BIGNUM *p,int nchecks, BN_CTX *ctx, | ||
19 | int do_trial_division, BN_GENCB *cb); | ||
20 | |||
21 | int BN_GENCB_call(BN_GENCB *cb, int a, int b); | ||
22 | |||
23 | #define BN_GENCB_set_old(gencb, callback, cb_arg) ... | ||
24 | |||
25 | #define BN_GENCB_set(gencb, callback, cb_arg) ... | ||
26 | |||
27 | |||
28 | Deprecated: | ||
29 | |||
30 | BIGNUM *BN_generate_prime(BIGNUM *ret, int num, int safe, BIGNUM *add, | ||
31 | BIGNUM *rem, void (*callback)(int, int, void *), void *cb_arg); | ||
32 | |||
33 | int BN_is_prime(const BIGNUM *a, int checks, void (*callback)(int, int, | ||
34 | void *), BN_CTX *ctx, void *cb_arg); | ||
35 | |||
36 | int BN_is_prime_fasttest(const BIGNUM *a, int checks, | ||
37 | void (*callback)(int, int, void *), BN_CTX *ctx, void *cb_arg, | ||
38 | int do_trial_division); | ||
39 | |||
40 | =head1 DESCRIPTION | ||
41 | |||
42 | BN_generate_prime_ex() generates a pseudo-random prime number of | ||
43 | bit length B<bits>. | ||
44 | If B<ret> is not B<NULL>, it will be used to store the number. | ||
45 | |||
46 | If B<cb> is not B<NULL>, it is used as follows: | ||
47 | |||
48 | =over 4 | ||
49 | |||
50 | =item * | ||
51 | |||
52 | B<BN_GENCB_call(cb, 0, i)> is called after generating the i-th | ||
53 | potential prime number. | ||
54 | |||
55 | =item * | ||
56 | |||
57 | While the number is being tested for primality, | ||
58 | B<BN_GENCB_call(cb, 1, j)> is called as described below. | ||
59 | |||
60 | =item * | ||
61 | |||
62 | When a prime has been found, B<BN_GENCB_call(cb, 2, i)> is called. | ||
63 | |||
64 | =back | ||
65 | |||
66 | The prime may have to fulfill additional requirements for use in | ||
67 | Diffie-Hellman key exchange: | ||
68 | |||
69 | If B<add> is not B<NULL>, the prime will fulfill the condition p % B<add> | ||
70 | == B<rem> (p % B<add> == 1 if B<rem> == B<NULL>) in order to suit a given | ||
71 | generator. | ||
72 | |||
73 | If B<safe> is true, it will be a safe prime (i.e. a prime p so | ||
74 | that (p-1)/2 is also prime). | ||
75 | |||
76 | The prime number generation has a negligible error probability. | ||
77 | |||
78 | BN_is_prime_ex() and BN_is_prime_fasttest_ex() test if the number B<p> is | ||
79 | prime. The following tests are performed until one of them shows that | ||
80 | B<p> is composite; if B<p> passes all these tests, it is considered | ||
81 | prime. | ||
82 | |||
83 | BN_is_prime_fasttest_ex(), when called with B<do_trial_division == 1>, | ||
84 | first attempts trial division by a number of small primes; | ||
85 | if no divisors are found by this test and B<cb> is not B<NULL>, | ||
86 | B<BN_GENCB_call(cb, 1, -1)> is called. | ||
87 | If B<do_trial_division == 0>, this test is skipped. | ||
88 | |||
89 | Both BN_is_prime_ex() and BN_is_prime_fasttest_ex() perform a Miller-Rabin | ||
90 | probabilistic primality test with B<nchecks> iterations. If | ||
91 | B<nchecks == BN_prime_checks>, a number of iterations is used that | ||
92 | yields a false positive rate of at most 2^-80 for random input. | ||
93 | |||
94 | If B<cb> is not B<NULL>, B<BN_GENCB_call(cb, 1, j)> is called | ||
95 | after the j-th iteration (j = 0, 1, ...). B<ctx> is a | ||
96 | pre-allocated B<BN_CTX> (to save the overhead of allocating and | ||
97 | freeing the structure in a loop), or B<NULL>. | ||
98 | |||
99 | BN_GENCB_call calls the callback function held in the B<BN_GENCB> structure | ||
100 | and passes the ints B<a> and B<b> as arguments. There are two types of | ||
101 | B<BN_GENCB> structure that are supported: "new" style and "old" style. New | ||
102 | programs should prefer the "new" style, whilst the "old" style is provided | ||
103 | for backwards compatibility purposes. | ||
104 | |||
105 | For "new" style callbacks a BN_GENCB structure should be initialised with a | ||
106 | call to BN_GENCB_set, where B<gencb> is a B<BN_GENCB *>, B<callback> is of | ||
107 | type B<int (*callback)(int, int, BN_GENCB *)> and B<cb_arg> is a B<void *>. | ||
108 | "Old" style callbacks are the same except they are initialised with a call | ||
109 | to BN_GENCB_set_old and B<callback> is of type | ||
110 | B<void (*callback)(int, int, void *)>. | ||
111 | |||
112 | A callback is invoked through a call to B<BN_GENCB_call>. This will check | ||
113 | the type of the callback and will invoke B<callback(a, b, gencb)> for new | ||
114 | style callbacks or B<callback(a, b, cb_arg)> for old style. | ||
115 | |||
116 | BN_generate_prime (deprecated) works in the same way as | ||
117 | BN_generate_prime_ex but expects an old style callback function | ||
118 | directly in the B<callback> parameter, and an argument to pass to it in | ||
119 | the B<cb_arg>. Similarly BN_is_prime and BN_is_prime_fasttest are | ||
120 | deprecated and can be compared to BN_is_prime_ex and | ||
121 | BN_is_prime_fasttest_ex respectively. | ||
122 | |||
123 | =head1 RETURN VALUES | ||
124 | |||
125 | BN_generate_prime_ex() returns 1 on success or 0 on error. | ||
126 | |||
127 | BN_is_prime_ex(), BN_is_prime_fasttest_ex(), BN_is_prime() and | ||
128 | BN_is_prime_fasttest() return 0 if the number is composite, 1 if it is | ||
129 | prime with an error probability of less than 0.25^B<nchecks>, and | ||
130 | -1 on error. | ||
131 | |||
132 | BN_generate_prime() returns the prime number on success, B<NULL> otherwise. | ||
133 | |||
134 | Callback functions should return 1 on success or 0 on error. | ||
135 | |||
136 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
137 | |||
138 | =head1 SEE ALSO | ||
139 | |||
140 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)> | ||
141 | |||
142 | =head1 HISTORY | ||
143 | |||
144 | The B<cb_arg> arguments to BN_generate_prime() and to BN_is_prime() | ||
145 | were added in SSLeay 0.9.0. The B<ret> argument to BN_generate_prime() | ||
146 | was added in SSLeay 0.9.1. | ||
147 | BN_is_prime_fasttest() was added in OpenSSL 0.9.5. | ||
148 | |||
149 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod b/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod deleted file mode 100644 index aefb1d27dd..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_mod_inverse.pod +++ /dev/null | |||
@@ -1,36 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_inverse - compute inverse modulo n | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_mod_inverse(BIGNUM *r, BIGNUM *a, const BIGNUM *n, | ||
12 | BN_CTX *ctx); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | BN_mod_inverse() computes the inverse of B<a> modulo B<n> | ||
17 | places the result in B<r> (C<(a*r)%n==1>). If B<r> is NULL, | ||
18 | a new B<BIGNUM> is created. | ||
19 | |||
20 | B<ctx> is a previously allocated B<BN_CTX> used for temporary | ||
21 | variables. B<r> may be the same B<BIGNUM> as B<a> or B<n>. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | BN_mod_inverse() returns the B<BIGNUM> containing the inverse, and NULL on | ||
26 | error. The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)> | ||
31 | |||
32 | =head1 HISTORY | ||
33 | |||
34 | BN_mod_inverse() is available in all versions of SSLeay and OpenSSL. | ||
35 | |||
36 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod b/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod deleted file mode 100644 index 6b16351b92..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_mod_mul_montgomery.pod +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_mul_montgomery, BN_MONT_CTX_new, BN_MONT_CTX_init, | ||
6 | BN_MONT_CTX_free, BN_MONT_CTX_set, BN_MONT_CTX_copy, | ||
7 | BN_from_montgomery, BN_to_montgomery - Montgomery multiplication | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | BN_MONT_CTX *BN_MONT_CTX_new(void); | ||
14 | void BN_MONT_CTX_init(BN_MONT_CTX *ctx); | ||
15 | void BN_MONT_CTX_free(BN_MONT_CTX *mont); | ||
16 | |||
17 | int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *m, BN_CTX *ctx); | ||
18 | BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from); | ||
19 | |||
20 | int BN_mod_mul_montgomery(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
21 | BN_MONT_CTX *mont, BN_CTX *ctx); | ||
22 | |||
23 | int BN_from_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
24 | BN_CTX *ctx); | ||
25 | |||
26 | int BN_to_montgomery(BIGNUM *r, BIGNUM *a, BN_MONT_CTX *mont, | ||
27 | BN_CTX *ctx); | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | These functions implement Montgomery multiplication. They are used | ||
32 | automatically when L<BN_mod_exp(3)|BN_mod_exp(3)> is called with suitable input, | ||
33 | but they may be useful when several operations are to be performed | ||
34 | using the same modulus. | ||
35 | |||
36 | BN_MONT_CTX_new() allocates and initializes a B<BN_MONT_CTX> structure. | ||
37 | BN_MONT_CTX_init() initializes an existing uninitialized B<BN_MONT_CTX>. | ||
38 | |||
39 | BN_MONT_CTX_set() sets up the I<mont> structure from the modulus I<m> | ||
40 | by precomputing its inverse and a value R. | ||
41 | |||
42 | BN_MONT_CTX_copy() copies the B<BN_MONT_CTX> I<from> to I<to>. | ||
43 | |||
44 | BN_MONT_CTX_free() frees the components of the B<BN_MONT_CTX>, and, if | ||
45 | it was created by BN_MONT_CTX_new(), also the structure itself. | ||
46 | |||
47 | BN_mod_mul_montgomery() computes Mont(I<a>,I<b>):=I<a>*I<b>*R^-1 and places | ||
48 | the result in I<r>. | ||
49 | |||
50 | BN_from_montgomery() performs the Montgomery reduction I<r> = I<a>*R^-1. | ||
51 | |||
52 | BN_to_montgomery() computes Mont(I<a>,R^2), i.e. I<a>*R. | ||
53 | Note that I<a> must be non-negative and smaller than the modulus. | ||
54 | |||
55 | For all functions, I<ctx> is a previously allocated B<BN_CTX> used for | ||
56 | temporary variables. | ||
57 | |||
58 | The B<BN_MONT_CTX> structure is defined as follows: | ||
59 | |||
60 | typedef struct bn_mont_ctx_st | ||
61 | { | ||
62 | int ri; /* number of bits in R */ | ||
63 | BIGNUM RR; /* R^2 (used to convert to Montgomery form) */ | ||
64 | BIGNUM N; /* The modulus */ | ||
65 | BIGNUM Ni; /* R*(1/R mod N) - N*Ni = 1 | ||
66 | * (Ni is only stored for bignum algorithm) */ | ||
67 | BN_ULONG n0; /* least significant word of Ni */ | ||
68 | int flags; | ||
69 | } BN_MONT_CTX; | ||
70 | |||
71 | BN_to_montgomery() is a macro. | ||
72 | |||
73 | =head1 RETURN VALUES | ||
74 | |||
75 | BN_MONT_CTX_new() returns the newly allocated B<BN_MONT_CTX>, and NULL | ||
76 | on error. | ||
77 | |||
78 | BN_MONT_CTX_init() and BN_MONT_CTX_free() have no return values. | ||
79 | |||
80 | For the other functions, 1 is returned for success, 0 on error. | ||
81 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
82 | |||
83 | =head1 WARNING | ||
84 | |||
85 | The inputs must be reduced modulo B<m>, otherwise the result will be | ||
86 | outside the expected range. | ||
87 | |||
88 | =head1 SEE ALSO | ||
89 | |||
90 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, | ||
91 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
92 | |||
93 | =head1 HISTORY | ||
94 | |||
95 | BN_MONT_CTX_new(), BN_MONT_CTX_free(), BN_MONT_CTX_set(), | ||
96 | BN_mod_mul_montgomery(), BN_from_montgomery() and BN_to_montgomery() | ||
97 | are available in all versions of SSLeay and OpenSSL. | ||
98 | |||
99 | BN_MONT_CTX_init() and BN_MONT_CTX_copy() were added in SSLeay 0.9.1b. | ||
100 | |||
101 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod b/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod deleted file mode 100644 index 74a216ddc2..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_mod_mul_reciprocal.pod +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_mod_mul_reciprocal, BN_div_recp, BN_RECP_CTX_new, BN_RECP_CTX_init, | ||
6 | BN_RECP_CTX_free, BN_RECP_CTX_set - modular multiplication using | ||
7 | reciprocal | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/bn.h> | ||
12 | |||
13 | BN_RECP_CTX *BN_RECP_CTX_new(void); | ||
14 | void BN_RECP_CTX_init(BN_RECP_CTX *recp); | ||
15 | void BN_RECP_CTX_free(BN_RECP_CTX *recp); | ||
16 | |||
17 | int BN_RECP_CTX_set(BN_RECP_CTX *recp, const BIGNUM *m, BN_CTX *ctx); | ||
18 | |||
19 | int BN_div_recp(BIGNUM *dv, BIGNUM *rem, BIGNUM *a, BN_RECP_CTX *recp, | ||
20 | BN_CTX *ctx); | ||
21 | |||
22 | int BN_mod_mul_reciprocal(BIGNUM *r, BIGNUM *a, BIGNUM *b, | ||
23 | BN_RECP_CTX *recp, BN_CTX *ctx); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | BN_mod_mul_reciprocal() can be used to perform an efficient | ||
28 | L<BN_mod_mul(3)|BN_mod_mul(3)> operation when the operation will be performed | ||
29 | repeatedly with the same modulus. It computes B<r>=(B<a>*B<b>)%B<m> | ||
30 | using B<recp>=1/B<m>, which is set as described below. B<ctx> is a | ||
31 | previously allocated B<BN_CTX> used for temporary variables. | ||
32 | |||
33 | BN_RECP_CTX_new() allocates and initializes a B<BN_RECP> structure. | ||
34 | BN_RECP_CTX_init() initializes an existing uninitialized B<BN_RECP>. | ||
35 | |||
36 | BN_RECP_CTX_free() frees the components of the B<BN_RECP>, and, if it | ||
37 | was created by BN_RECP_CTX_new(), also the structure itself. | ||
38 | |||
39 | BN_RECP_CTX_set() stores B<m> in B<recp> and sets it up for computing | ||
40 | 1/B<m> and shifting it left by BN_num_bits(B<m>)+1 to make it an | ||
41 | integer. The result and the number of bits it was shifted left will | ||
42 | later be stored in B<recp>. | ||
43 | |||
44 | BN_div_recp() divides B<a> by B<m> using B<recp>. It places the quotient | ||
45 | in B<dv> and the remainder in B<rem>. | ||
46 | |||
47 | The B<BN_RECP_CTX> structure is defined as follows: | ||
48 | |||
49 | typedef struct bn_recp_ctx_st | ||
50 | { | ||
51 | BIGNUM N; /* the divisor */ | ||
52 | BIGNUM Nr; /* the reciprocal */ | ||
53 | int num_bits; | ||
54 | int shift; | ||
55 | int flags; | ||
56 | } BN_RECP_CTX; | ||
57 | |||
58 | It cannot be shared between threads. | ||
59 | |||
60 | =head1 RETURN VALUES | ||
61 | |||
62 | BN_RECP_CTX_new() returns the newly allocated B<BN_RECP_CTX>, and NULL | ||
63 | on error. | ||
64 | |||
65 | BN_RECP_CTX_init() and BN_RECP_CTX_free() have no return values. | ||
66 | |||
67 | For the other functions, 1 is returned for success, 0 on error. | ||
68 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
69 | |||
70 | =head1 SEE ALSO | ||
71 | |||
72 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<BN_add(3)|BN_add(3)>, | ||
73 | L<BN_CTX_new(3)|BN_CTX_new(3)> | ||
74 | |||
75 | =head1 HISTORY | ||
76 | |||
77 | B<BN_RECP_CTX> was added in SSLeay 0.9.0. Before that, the function | ||
78 | BN_reciprocal() was used instead, and the BN_mod_mul_reciprocal() | ||
79 | arguments were different. | ||
80 | |||
81 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_new.pod b/src/lib/libssl/src/doc/crypto/BN_new.pod deleted file mode 100644 index ab7a105e3a..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_new.pod +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_new, BN_init, BN_clear, BN_free, BN_clear_free - allocate and free BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | BIGNUM *BN_new(void); | ||
12 | |||
13 | void BN_init(BIGNUM *); | ||
14 | |||
15 | void BN_clear(BIGNUM *a); | ||
16 | |||
17 | void BN_free(BIGNUM *a); | ||
18 | |||
19 | void BN_clear_free(BIGNUM *a); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | BN_new() allocates and initializes a B<BIGNUM> structure. BN_init() | ||
24 | initializes an existing uninitialized B<BIGNUM>. | ||
25 | |||
26 | BN_clear() is used to destroy sensitive data such as keys when they | ||
27 | are no longer needed. It erases the memory used by B<a> and sets it | ||
28 | to the value 0. | ||
29 | |||
30 | BN_free() frees the components of the B<BIGNUM>, and if it was created | ||
31 | by BN_new(), also the structure itself. BN_clear_free() additionally | ||
32 | overwrites the data before the memory is returned to the system. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | BN_new() returns a pointer to the B<BIGNUM>. If the allocation fails, | ||
37 | it returns B<NULL> and sets an error code that can be obtained | ||
38 | by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
39 | |||
40 | BN_init(), BN_clear(), BN_free() and BN_clear_free() have no return | ||
41 | values. | ||
42 | |||
43 | =head1 SEE ALSO | ||
44 | |||
45 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)> | ||
46 | |||
47 | =head1 HISTORY | ||
48 | |||
49 | BN_new(), BN_clear(), BN_free() and BN_clear_free() are available in | ||
50 | all versions on SSLeay and OpenSSL. BN_init() was added in SSLeay | ||
51 | 0.9.1b. | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod b/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod deleted file mode 100644 index a6a2e3f819..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_num_bytes.pod +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_num_bits, BN_num_bytes, BN_num_bits_word - get BIGNUM size | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_num_bytes(const BIGNUM *a); | ||
12 | |||
13 | int BN_num_bits(const BIGNUM *a); | ||
14 | |||
15 | int BN_num_bits_word(BN_ULONG w); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | BN_num_bytes() returns the size of a B<BIGNUM> in bytes. | ||
20 | |||
21 | BN_num_bits_word() returns the number of significant bits in a word. | ||
22 | If we take 0x00000432 as an example, it returns 11, not 16, not 32. | ||
23 | Basically, except for a zero, it returns I<floor(log2(w))+1>. | ||
24 | |||
25 | BN_num_bits() returns the number of significant bits in a B<BIGNUM>, | ||
26 | following the same principle as BN_num_bits_word(). | ||
27 | |||
28 | BN_num_bytes() is a macro. | ||
29 | |||
30 | =head1 RETURN VALUES | ||
31 | |||
32 | The size. | ||
33 | |||
34 | =head1 NOTES | ||
35 | |||
36 | Some have tried using BN_num_bits() on individual numbers in RSA keys, | ||
37 | DH keys and DSA keys, and found that they don't always come up with | ||
38 | the number of bits they expected (something like 512, 1024, 2048, | ||
39 | ...). This is because generating a number with some specific number | ||
40 | of bits doesn't always set the highest bits, thereby making the number | ||
41 | of I<significant> bits a little lower. If you want to know the "key | ||
42 | size" of such a key, either use functions like RSA_size(), DH_size() | ||
43 | and DSA_size(), or use BN_num_bytes() and multiply with 8 (although | ||
44 | there's no real guarantee that will match the "key size", just a lot | ||
45 | more probability). | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<bn(3)|bn(3)>, L<DH_size(3)|DH_size(3)>, L<DSA_size(3)|DSA_size(3)>, | ||
50 | L<RSA_size(3)|RSA_size(3)> | ||
51 | |||
52 | =head1 HISTORY | ||
53 | |||
54 | BN_num_bytes(), BN_num_bits() and BN_num_bits_word() are available in | ||
55 | all versions of SSLeay and OpenSSL. | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_rand.pod b/src/lib/libssl/src/doc/crypto/BN_rand.pod deleted file mode 100644 index 856f310077..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_rand.pod +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_rand, BN_pseudo_rand, BN_rand_range, BN_pseudo_rand_range - generate pseudo-random number | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | int BN_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
12 | |||
13 | int BN_pseudo_rand(BIGNUM *rnd, int bits, int top, int bottom); | ||
14 | |||
15 | int BN_rand_range(BIGNUM *rnd, BIGNUM *range); | ||
16 | |||
17 | int BN_pseudo_rand_range(BIGNUM *rnd, BIGNUM *range); | ||
18 | |||
19 | =head1 DESCRIPTION | ||
20 | |||
21 | BN_rand() generates a cryptographically strong pseudo-random number of | ||
22 | B<bits> bits in length and stores it in B<rnd>. If B<top> is -1, the | ||
23 | most significant bit of the random number can be zero. If B<top> is 0, | ||
24 | it is set to 1, and if B<top> is 1, the two most significant bits of | ||
25 | the number will be set to 1, so that the product of two such random | ||
26 | numbers will always have 2*B<bits> length. If B<bottom> is true, the | ||
27 | number will be odd. | ||
28 | |||
29 | BN_pseudo_rand() does the same, but pseudo-random numbers generated by | ||
30 | this function are not necessarily unpredictable. They can be used for | ||
31 | non-cryptographic purposes and for certain purposes in cryptographic | ||
32 | protocols, but usually not for key generation etc. | ||
33 | |||
34 | BN_rand_range() generates a cryptographically strong pseudo-random | ||
35 | number B<rnd> in the range 0 E<lt>= B<rnd> E<lt> B<range>. | ||
36 | BN_pseudo_rand_range() does the same, but is based on BN_pseudo_rand(), | ||
37 | and hence numbers generated by it are not necessarily unpredictable. | ||
38 | |||
39 | =head1 RETURN VALUES | ||
40 | |||
41 | The functions return 1 on success, 0 on error. | ||
42 | The error codes can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
43 | |||
44 | =head1 SEE ALSO | ||
45 | |||
46 | L<bn(3)|bn(3)>, L<ERR_get_error(3)|ERR_get_error(3)>, L<rand(3)|rand(3)>, | ||
47 | L<RAND_add(3)|RAND_add(3)>, L<RAND_bytes(3)|RAND_bytes(3)> | ||
48 | |||
49 | =head1 HISTORY | ||
50 | |||
51 | BN_rand() is available in all versions of SSLeay and OpenSSL. | ||
52 | BN_pseudo_rand() was added in OpenSSL 0.9.5. The B<top> == -1 case | ||
53 | and the function BN_rand_range() were added in OpenSSL 0.9.6a. | ||
54 | BN_pseudo_rand_range() was added in OpenSSL 0.9.6c. | ||
55 | |||
56 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_set_bit.pod b/src/lib/libssl/src/doc/crypto/BN_set_bit.pod deleted file mode 100644 index b7c47b9b01..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_set_bit.pod +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_set_bit, BN_clear_bit, BN_is_bit_set, BN_mask_bits, BN_lshift, | ||
6 | BN_lshift1, BN_rshift, BN_rshift1 - bit operations on BIGNUMs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_set_bit(BIGNUM *a, int n); | ||
13 | int BN_clear_bit(BIGNUM *a, int n); | ||
14 | |||
15 | int BN_is_bit_set(const BIGNUM *a, int n); | ||
16 | |||
17 | int BN_mask_bits(BIGNUM *a, int n); | ||
18 | |||
19 | int BN_lshift(BIGNUM *r, const BIGNUM *a, int n); | ||
20 | int BN_lshift1(BIGNUM *r, BIGNUM *a); | ||
21 | |||
22 | int BN_rshift(BIGNUM *r, BIGNUM *a, int n); | ||
23 | int BN_rshift1(BIGNUM *r, BIGNUM *a); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | BN_set_bit() sets bit B<n> in B<a> to 1 (C<a|=(1E<lt>E<lt>n)>). The | ||
28 | number is expanded if necessary. | ||
29 | |||
30 | BN_clear_bit() sets bit B<n> in B<a> to 0 (C<a&=~(1E<lt>E<lt>n)>). An | ||
31 | error occurs if B<a> is shorter than B<n> bits. | ||
32 | |||
33 | BN_is_bit_set() tests if bit B<n> in B<a> is set. | ||
34 | |||
35 | BN_mask_bits() truncates B<a> to an B<n> bit number | ||
36 | (C<a&=~((~0)E<gt>E<gt>n)>). An error occurs if B<a> already is | ||
37 | shorter than B<n> bits. | ||
38 | |||
39 | BN_lshift() shifts B<a> left by B<n> bits and places the result in | ||
40 | B<r> (C<r=a*2^n>). BN_lshift1() shifts B<a> left by one and places | ||
41 | the result in B<r> (C<r=2*a>). | ||
42 | |||
43 | BN_rshift() shifts B<a> right by B<n> bits and places the result in | ||
44 | B<r> (C<r=a/2^n>). BN_rshift1() shifts B<a> right by one and places | ||
45 | the result in B<r> (C<r=a/2>). | ||
46 | |||
47 | For the shift functions, B<r> and B<a> may be the same variable. | ||
48 | |||
49 | =head1 RETURN VALUES | ||
50 | |||
51 | BN_is_bit_set() returns 1 if the bit is set, 0 otherwise. | ||
52 | |||
53 | All other functions return 1 for success, 0 on error. The error codes | ||
54 | can be obtained by L<ERR_get_error(3)|ERR_get_error(3)>. | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<bn(3)|bn(3)>, L<BN_num_bytes(3)|BN_num_bytes(3)>, L<BN_add(3)|BN_add(3)> | ||
59 | |||
60 | =head1 HISTORY | ||
61 | |||
62 | BN_set_bit(), BN_clear_bit(), BN_is_bit_set(), BN_mask_bits(), | ||
63 | BN_lshift(), BN_lshift1(), BN_rshift(), and BN_rshift1() are available | ||
64 | in all versions of SSLeay and OpenSSL. | ||
65 | |||
66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_swap.pod b/src/lib/libssl/src/doc/crypto/BN_swap.pod deleted file mode 100644 index 14097ca357..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_swap.pod +++ /dev/null | |||
@@ -1,25 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_swap - exchange BIGNUMs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/bn.h> | ||
10 | |||
11 | void BN_swap(BIGNUM *a, BIGNUM *b); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | BN_swap() exchanges the values of I<a> and I<b>. | ||
16 | |||
17 | =head1 SEE ALSO | ||
18 | |||
19 | L<bn(3)|bn(3)> | ||
20 | |||
21 | =head1 HISTORY | ||
22 | |||
23 | BN_swap was added in OpenSSL 0.9.7. | ||
24 | |||
25 | =cut | ||
diff --git a/src/lib/libssl/src/doc/crypto/BN_zero.pod b/src/lib/libssl/src/doc/crypto/BN_zero.pod deleted file mode 100644 index b555ec3988..0000000000 --- a/src/lib/libssl/src/doc/crypto/BN_zero.pod +++ /dev/null | |||
@@ -1,59 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BN_zero, BN_one, BN_value_one, BN_set_word, BN_get_word - BIGNUM assignment | ||
6 | operations | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/bn.h> | ||
11 | |||
12 | int BN_zero(BIGNUM *a); | ||
13 | int BN_one(BIGNUM *a); | ||
14 | |||
15 | const BIGNUM *BN_value_one(void); | ||
16 | |||
17 | int BN_set_word(BIGNUM *a, unsigned long w); | ||
18 | unsigned long BN_get_word(BIGNUM *a); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | BN_zero(), BN_one() and BN_set_word() set B<a> to the values 0, 1 and | ||
23 | B<w> respectively. BN_zero() and BN_one() are macros. | ||
24 | |||
25 | BN_value_one() returns a B<BIGNUM> constant of value 1. This constant | ||
26 | is useful for use in comparisons and assignment. | ||
27 | |||
28 | BN_get_word() returns B<a>, if it can be represented as an unsigned | ||
29 | long. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | BN_get_word() returns the value B<a>, and 0xffffffffL if B<a> cannot | ||
34 | be represented as an unsigned long. | ||
35 | |||
36 | BN_zero(), BN_one() and BN_set_word() return 1 on success, 0 otherwise. | ||
37 | BN_value_one() returns the constant. | ||
38 | |||
39 | =head1 BUGS | ||
40 | |||
41 | Someone might change the constant. | ||
42 | |||
43 | If a B<BIGNUM> is equal to 0xffffffffL it can be represented as an | ||
44 | unsigned long but this value is also returned on error. | ||
45 | |||
46 | =head1 SEE ALSO | ||
47 | |||
48 | L<bn(3)|bn(3)>, L<BN_bn2bin(3)|BN_bn2bin(3)> | ||
49 | |||
50 | =head1 HISTORY | ||
51 | |||
52 | BN_zero(), BN_one() and BN_set_word() are available in all versions of | ||
53 | SSLeay and OpenSSL. BN_value_one() and BN_get_word() were added in | ||
54 | SSLeay 0.8. | ||
55 | |||
56 | BN_value_one() was changed to return a true const BIGNUM * in OpenSSL | ||
57 | 0.9.7. | ||
58 | |||
59 | =cut | ||