diff options
author | bentley <> | 2014-10-12 09:33:04 +0000 |
---|---|---|
committer | bentley <> | 2014-10-12 09:33:04 +0000 |
commit | 82b7f378b6907ab315a6e50322d2a0a8794a0aa9 (patch) | |
tree | a5087bf8d016a6041c2b6822fbecfd8f6c5e70b1 | |
parent | 0a63f0cf49369e1926567ab62e04e3355cedf0cd (diff) | |
download | openbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.tar.gz openbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.tar.bz2 openbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.zip |
Convert libssl manpages from pod to mdoc(7).
libcrypto has not been started yet.
ok schwarze@ miod@
249 files changed, 19938 insertions, 7737 deletions
diff --git a/src/lib/libssl/doc/BIO_f_ssl.3 b/src/lib/libssl/doc/BIO_f_ssl.3 new file mode 100644 index 0000000000..31c9963edb --- /dev/null +++ b/src/lib/libssl/doc/BIO_f_ssl.3 | |||
@@ -0,0 +1,475 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt BIO_F_SSL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BIO_f_ssl , | ||
6 | .Nm BIO_set_ssl , | ||
7 | .Nm BIO_get_ssl , | ||
8 | .Nm BIO_set_ssl_mode , | ||
9 | .Nm BIO_set_ssl_renegotiate_bytes , | ||
10 | .Nm BIO_get_num_renegotiates , | ||
11 | .Nm BIO_set_ssl_renegotiate_timeout , | ||
12 | .Nm BIO_new_ssl , | ||
13 | .Nm BIO_new_ssl_connect , | ||
14 | .Nm BIO_new_buffer_ssl_connect , | ||
15 | .Nm BIO_ssl_copy_session_id , | ||
16 | .Nm BIO_ssl_shutdown | ||
17 | .Nd SSL BIO | ||
18 | .Sh SYNOPSIS | ||
19 | .In openssl/bio.h | ||
20 | .In openssl/ssl.h | ||
21 | .Ft BIO_METHOD * | ||
22 | .Fn BIO_f_ssl void | ||
23 | .Fd #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) | ||
24 | .Fd #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) | ||
25 | .Fd #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) | ||
26 | .Fd #define BIO_set_ssl_renegotiate_bytes(b,num) \ | ||
27 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) | ||
28 | .Fd #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ | ||
29 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) | ||
30 | .Fd #define BIO_get_num_renegotiates(b) \ | ||
31 | BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL) | ||
32 | .Ft BIO * | ||
33 | .Fn BIO_new_ssl "SSL_CTX *ctx" "int client" | ||
34 | .Ft BIO * | ||
35 | .Fn BIO_new_ssl_connect "SSL_CTX *ctx" | ||
36 | .Ft BIO * | ||
37 | .Fn BIO_new_buffer_ssl_connect "SSL_CTX *ctx" | ||
38 | .Ft int | ||
39 | .Fn BIO_ssl_copy_session_id "BIO *to" "BIO *from" | ||
40 | .Ft void | ||
41 | .Fn BIO_ssl_shutdown "BIO *bio" | ||
42 | .Fd #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | ||
43 | .Sh DESCRIPTION | ||
44 | .Fn BIO_f_ssl | ||
45 | returns the | ||
46 | .Vt SSL | ||
47 | .Vt BIO | ||
48 | method. | ||
49 | This is a filter | ||
50 | .Vt BIO | ||
51 | which is a wrapper around the OpenSSL | ||
52 | .Vt SSL | ||
53 | routines adding a | ||
54 | .Vt BIO | ||
55 | .Dq flavor | ||
56 | to SSL I/O. | ||
57 | .Pp | ||
58 | I/O performed on an | ||
59 | .Vt SSL | ||
60 | .Vt BIO | ||
61 | communicates using the SSL protocol with | ||
62 | the | ||
63 | .Vt SSL Ns 's | ||
64 | read and write | ||
65 | .Vt BIO Ns s. | ||
66 | If an SSL connection is not established then an attempt is made to establish | ||
67 | one on the first I/O call. | ||
68 | .Pp | ||
69 | If a | ||
70 | .Vt BIO | ||
71 | is appended to an | ||
72 | .Vt SSL | ||
73 | .Vt BIO | ||
74 | using | ||
75 | .Xr BIO_push 3 | ||
76 | it is automatically used as the | ||
77 | .Vt SSL | ||
78 | .Vt BIO Ns 's read and write | ||
79 | .Vt BIO Ns s. | ||
80 | .Pp | ||
81 | Calling | ||
82 | .Xr BIO_reset 3 | ||
83 | on an | ||
84 | .Vt SSL | ||
85 | .Vt BIO | ||
86 | closes down any current SSL connection by calling | ||
87 | .Xr SSL_shutdown 3 . | ||
88 | .Xr BIO_reset | ||
89 | is then sent to the next | ||
90 | .Vt BIO | ||
91 | in the chain; this will typically disconnect the underlying transport. | ||
92 | The | ||
93 | .Vt SSL | ||
94 | .Vt BIO | ||
95 | is then reset to the initial accept or connect state. | ||
96 | .Pp | ||
97 | If the close flag is set when an | ||
98 | .Vt SSL | ||
99 | .Vt BIO | ||
100 | is freed then the internal | ||
101 | .Vt SSL | ||
102 | structure is also freed using | ||
103 | .Xr SSL_free 3 . | ||
104 | .Pp | ||
105 | .Fn BIO_set_ssl | ||
106 | sets the internal | ||
107 | .Vt SSL | ||
108 | pointer of | ||
109 | .Vt BIO | ||
110 | .Fa b | ||
111 | to | ||
112 | .Fa ssl | ||
113 | using | ||
114 | the close flag | ||
115 | .Fa c . | ||
116 | .Pp | ||
117 | .Fn BIO_get_ssl | ||
118 | retrieves the | ||
119 | .Vt SSL | ||
120 | pointer of | ||
121 | .Vt BIO | ||
122 | .Fa b ; | ||
123 | it can then be manipulated using the standard SSL library functions. | ||
124 | .Pp | ||
125 | .Fn BIO_set_ssl_mode | ||
126 | sets the | ||
127 | .Vt SSL | ||
128 | .Vt BIO | ||
129 | mode to | ||
130 | .Fa client . | ||
131 | If | ||
132 | .Fa client | ||
133 | is 1, client mode is set. | ||
134 | If | ||
135 | .Fa client | ||
136 | is 0, server mode is set. | ||
137 | .Pp | ||
138 | .Fn BIO_set_ssl_renegotiate_bytes | ||
139 | sets the renegotiate byte count to | ||
140 | .Fa num . | ||
141 | When set after every | ||
142 | .Fa num | ||
143 | bytes of I/O (read and write) the SSL session is automatically renegotiated. | ||
144 | .Fa num | ||
145 | must be at least 512 bytes. | ||
146 | .Pp | ||
147 | .Fn BIO_set_ssl_renegotiate_timeout | ||
148 | sets the renegotiate timeout to | ||
149 | .Fa seconds . | ||
150 | When the renegotiate timeout elapses the session is automatically renegotiated. | ||
151 | .Pp | ||
152 | .Fn BIO_get_num_renegotiates | ||
153 | returns the total number of session renegotiations due to I/O or timeout. | ||
154 | .Pp | ||
155 | .Fn BIO_new_ssl | ||
156 | allocates an | ||
157 | .Vt SSL | ||
158 | .Vt BIO | ||
159 | using | ||
160 | .Vt SSL_CTX | ||
161 | .Va ctx | ||
162 | and using client mode if | ||
163 | .Fa client | ||
164 | is nonzero. | ||
165 | .Pp | ||
166 | .Fn BIO_new_ssl_connect | ||
167 | creates a new | ||
168 | .Vt BIO | ||
169 | chain consisting of an | ||
170 | .Vt SSL | ||
171 | .Vt BIO | ||
172 | (using | ||
173 | .Fa ctx ) | ||
174 | followed by a connect BIO. | ||
175 | .Pp | ||
176 | .Fn BIO_new_buffer_ssl_connect | ||
177 | creates a new | ||
178 | .Vt BIO | ||
179 | chain consisting of a buffering | ||
180 | .Vt BIO , | ||
181 | an | ||
182 | .Vt SSL | ||
183 | .Vt BIO | ||
184 | (using | ||
185 | .Fa ctx ) | ||
186 | and a connect | ||
187 | .Vt BIO . | ||
188 | .Pp | ||
189 | .Fn BIO_ssl_copy_session_id | ||
190 | copies an SSL session id between | ||
191 | .Vt BIO | ||
192 | chains | ||
193 | .Fa from | ||
194 | and | ||
195 | .Fa to . | ||
196 | It does this by locating the | ||
197 | .Vt SSL | ||
198 | .Vt BIO Ns s | ||
199 | in each chain and calling | ||
200 | .Xr SSL_copy_session_id 3 | ||
201 | on the internal | ||
202 | .Vt SSL | ||
203 | pointer. | ||
204 | .Pp | ||
205 | .Fn BIO_ssl_shutdown | ||
206 | closes down an SSL connection on | ||
207 | .Vt BIO | ||
208 | chain | ||
209 | .Fa bio . | ||
210 | It does this by locating the | ||
211 | .Vt SSL | ||
212 | .Vt BIO | ||
213 | in the | ||
214 | chain and calling | ||
215 | .Xr SSL_shutdown 3 | ||
216 | on its internal | ||
217 | .Vt SSL | ||
218 | pointer. | ||
219 | .Pp | ||
220 | .Fn BIO_do_handshake | ||
221 | attempts to complete an SSL handshake on the supplied | ||
222 | .Vt BIO | ||
223 | and establish the SSL connection. | ||
224 | It returns 1 if the connection was established successfully. | ||
225 | A zero or negative value is returned if the connection could not be | ||
226 | established; the call | ||
227 | .Xr BIO_should_retry 3 | ||
228 | should be used for non blocking connect | ||
229 | .Vt BIO Ns s | ||
230 | to determine if the call should be retried. | ||
231 | If an SSL connection has already been established this call has no effect. | ||
232 | .Sh NOTES | ||
233 | .Vt SSL | ||
234 | .Vt BIO Ns s | ||
235 | are exceptional in that if the underlying transport is non-blocking they can | ||
236 | still request a retry in exceptional circumstances. | ||
237 | Specifically this will happen if a session renegotiation takes place during a | ||
238 | .Xr BIO_read 3 | ||
239 | operation. | ||
240 | One case where this happens is when SGC or step up occurs. | ||
241 | .Pp | ||
242 | In OpenSSL 0.9.6 and later the SSL flag | ||
243 | .Dv SSL_AUTO_RETRY | ||
244 | can be set to disable this behaviour. | ||
245 | In other words, when this flag is set an | ||
246 | .Vt SSL | ||
247 | .Vt BIO | ||
248 | using a blocking transport will never request a retry. | ||
249 | .Pp | ||
250 | Since unknown | ||
251 | .Xr BIO_ctrl 3 | ||
252 | operations are sent through filter | ||
253 | .Vt BIO Ns s | ||
254 | the server name and port can be set using | ||
255 | .Xr BIO_set_host 3 | ||
256 | on the | ||
257 | .Vt BIO | ||
258 | returned by | ||
259 | .Fn BIO_new_ssl_connect | ||
260 | without having to locate the connect | ||
261 | .Vt BIO | ||
262 | first. | ||
263 | .Pp | ||
264 | Applications do not have to call | ||
265 | .Fn BIO_do_handshake | ||
266 | but may wish to do so to separate the handshake process from other I/O | ||
267 | processing. | ||
268 | .Sh RETURN VALUES | ||
269 | .\" XXX | ||
270 | This section is incomplete. | ||
271 | .Sh EXAMPLE | ||
272 | This SSL/TLS client example attempts to retrieve a page from an SSL/TLS web | ||
273 | server. | ||
274 | The I/O routines are identical to those of the unencrypted example in | ||
275 | .Xr BIO_s_connect 3 . | ||
276 | .Bd -literal | ||
277 | BIO *sbio, *out; | ||
278 | int len; | ||
279 | char tmpbuf[1024]; | ||
280 | SSL_CTX *ctx; | ||
281 | SSL *ssl; | ||
282 | |||
283 | ERR_load_crypto_strings(); | ||
284 | ERR_load_SSL_strings(); | ||
285 | OpenSSL_add_all_algorithms(); | ||
286 | |||
287 | /* | ||
288 | * We would seed the PRNG here if the platform didn't do it automatically | ||
289 | */ | ||
290 | |||
291 | ctx = SSL_CTX_new(SSLv23_client_method()); | ||
292 | |||
293 | /* | ||
294 | * We'd normally set some stuff like the verify paths and mode here because | ||
295 | * as things stand this will connect to any server whose certificate is | ||
296 | * signed by any CA. | ||
297 | */ | ||
298 | |||
299 | sbio = BIO_new_ssl_connect(ctx); | ||
300 | |||
301 | BIO_get_ssl(sbio, &ssl); | ||
302 | |||
303 | if (!ssl) { | ||
304 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
305 | /* whatever ... */ | ||
306 | } | ||
307 | |||
308 | /* Don't want any retries */ | ||
309 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
310 | |||
311 | /* We might want to do other things with ssl here */ | ||
312 | |||
313 | BIO_set_conn_hostname(sbio, "localhost:https"); | ||
314 | |||
315 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
316 | if (BIO_do_connect(sbio) <= 0) { | ||
317 | fprintf(stderr, "Error connecting to server\en"); | ||
318 | ERR_print_errors_fp(stderr); | ||
319 | /* whatever ... */ | ||
320 | } | ||
321 | |||
322 | if (BIO_do_handshake(sbio) <= 0) { | ||
323 | fprintf(stderr, "Error establishing SSL connection\en"); | ||
324 | ERR_print_errors_fp(stderr); | ||
325 | /* whatever ... */ | ||
326 | } | ||
327 | |||
328 | /* Could examine ssl here to get connection info */ | ||
329 | |||
330 | BIO_puts(sbio, "GET / HTTP/1.0\en\en"); | ||
331 | for (;;) { | ||
332 | len = BIO_read(sbio, tmpbuf, 1024); | ||
333 | if(len <= 0) break; | ||
334 | BIO_write(out, tmpbuf, len); | ||
335 | } | ||
336 | BIO_free_all(sbio); | ||
337 | BIO_free(out); | ||
338 | .Ed | ||
339 | .Pp | ||
340 | Here is a simple server example. | ||
341 | It makes use of a buffering | ||
342 | .Vt BIO | ||
343 | to allow lines to be read from the | ||
344 | .Vt SSL | ||
345 | .Vt BIO | ||
346 | using | ||
347 | .Xr BIO_gets 3 . | ||
348 | It creates a pseudo web page containing the actual request from a client and | ||
349 | also echoes the request to standard output. | ||
350 | .Bd -literal | ||
351 | BIO *sbio, *bbio, *acpt, *out; | ||
352 | int len; | ||
353 | char tmpbuf[1024]; | ||
354 | SSL_CTX *ctx; | ||
355 | SSL *ssl; | ||
356 | |||
357 | ERR_load_crypto_strings(); | ||
358 | ERR_load_SSL_strings(); | ||
359 | OpenSSL_add_all_algorithms(); | ||
360 | |||
361 | /* Might seed PRNG here */ | ||
362 | |||
363 | ctx = SSL_CTX_new(SSLv23_server_method()); | ||
364 | |||
365 | if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
366 | || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
367 | || !SSL_CTX_check_private_key(ctx)) { | ||
368 | fprintf(stderr, "Error setting up SSL_CTX\en"); | ||
369 | ERR_print_errors_fp(stderr); | ||
370 | return 0; | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * Might do other things here like setting verify locations and DH and/or | ||
375 | * RSA temporary key callbacks | ||
376 | */ | ||
377 | |||
378 | /* New SSL BIO setup as server */ | ||
379 | sbio = BIO_new_ssl(ctx,0); | ||
380 | |||
381 | BIO_get_ssl(sbio, &ssl); | ||
382 | |||
383 | if (!ssl) { | ||
384 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
385 | /* whatever ... */ | ||
386 | } | ||
387 | |||
388 | /* Don't want any retries */ | ||
389 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
390 | |||
391 | /* Create the buffering BIO */ | ||
392 | |||
393 | bbio = BIO_new(BIO_f_buffer()); | ||
394 | |||
395 | /* Add to chain */ | ||
396 | sbio = BIO_push(bbio, sbio); | ||
397 | |||
398 | acpt = BIO_new_accept("4433"); | ||
399 | |||
400 | /* | ||
401 | * By doing this when a new connection is established we automatically | ||
402 | * have sbio inserted into it. The BIO chain is now 'swallowed' by the | ||
403 | * accept BIO and will be freed when the accept BIO is freed. | ||
404 | */ | ||
405 | |||
406 | BIO_set_accept_bios(acpt,sbio); | ||
407 | |||
408 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
409 | |||
410 | /* Setup accept BIO */ | ||
411 | if (BIO_do_accept(acpt) <= 0) { | ||
412 | fprintf(stderr, "Error setting up accept BIO\en"); | ||
413 | ERR_print_errors_fp(stderr); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | /* Now wait for incoming connection */ | ||
418 | if (BIO_do_accept(acpt) <= 0) { | ||
419 | fprintf(stderr, "Error in connection\en"); | ||
420 | ERR_print_errors_fp(stderr); | ||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | /* We only want one connection so remove and free accept BIO */ | ||
425 | |||
426 | sbio = BIO_pop(acpt); | ||
427 | |||
428 | BIO_free_all(acpt); | ||
429 | |||
430 | if (BIO_do_handshake(sbio) <= 0) { | ||
431 | fprintf(stderr, "Error in SSL handshake\en"); | ||
432 | ERR_print_errors_fp(stderr); | ||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | BIO_puts(sbio, "HTTP/1.0 200 OK\er\enContent-type: text/plain\er\en\er\en"); | ||
437 | BIO_puts(sbio, "\er\enConnection Established\er\enRequest headers:\er\en"); | ||
438 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
439 | |||
440 | for (;;) { | ||
441 | len = BIO_gets(sbio, tmpbuf, 1024); | ||
442 | if (len <= 0) | ||
443 | break; | ||
444 | BIO_write(sbio, tmpbuf, len); | ||
445 | BIO_write(out, tmpbuf, len); | ||
446 | /* Look for blank line signifying end of headers */ | ||
447 | if ((tmpbuf[0] == '\er') || (tmpbuf[0] == '\en')) | ||
448 | break; | ||
449 | } | ||
450 | |||
451 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
452 | BIO_puts(sbio, "\er\en"); | ||
453 | |||
454 | /* Since there is a buffering BIO present we had better flush it */ | ||
455 | BIO_flush(sbio); | ||
456 | |||
457 | BIO_free_all(sbio); | ||
458 | .Ed | ||
459 | .Sh BUGS | ||
460 | In OpenSSL versions before 1.0.0 the | ||
461 | .Xr BIO_pop 3 | ||
462 | call was handled incorrectly: | ||
463 | the I/O BIO reference count was incorrectly incremented (instead of | ||
464 | decremented) and dissociated with the | ||
465 | .Vt SSL | ||
466 | .Vt BIO | ||
467 | even if the | ||
468 | .Vt SSL | ||
469 | .Vt BIO | ||
470 | was not | ||
471 | explicitly being popped (e.g., a pop higher up the chain). | ||
472 | Applications which included workarounds for this bug (e.g., freeing BIOs more | ||
473 | than once) should be modified to handle this fix or they may free up an already | ||
474 | freed | ||
475 | .Vt BIO . | ||
diff --git a/src/lib/libssl/doc/SSL_CIPHER_get_name.3 b/src/lib/libssl/doc/SSL_CIPHER_get_name.3 new file mode 100644 index 0000000000..0c6cccd1cc --- /dev/null +++ b/src/lib/libssl/doc/SSL_CIPHER_get_name.3 | |||
@@ -0,0 +1,193 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CIPHER_GET_NAME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CIPHER_get_name , | ||
6 | .Nm SSL_CIPHER_get_bits , | ||
7 | .Nm SSL_CIPHER_get_version , | ||
8 | .Nm SSL_CIPHER_description | ||
9 | .Nd get SSL_CIPHER properties | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft const char * | ||
13 | .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" | ||
14 | .Ft int | ||
15 | .Fn SSL_CIPHER_get_bits "const SSL_CIPHER *cipher" "int *alg_bits" | ||
16 | .Ft char * | ||
17 | .Fn SSL_CIPHER_get_version "const SSL_CIPHER *cipher" | ||
18 | .Ft char * | ||
19 | .Fn SSL_CIPHER_description "const SSL_CIPHER *cipher" "char *buf" "int size" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CIPHER_get_name | ||
22 | returns a pointer to the name of | ||
23 | .Fa cipher . | ||
24 | If the | ||
25 | argument is the | ||
26 | .Dv NULL | ||
27 | pointer, a pointer to the constant value | ||
28 | .Qq NONE | ||
29 | is returned. | ||
30 | .Pp | ||
31 | .Fn SSL_CIPHER_get_bits | ||
32 | returns the number of secret bits used for | ||
33 | .Fa cipher . | ||
34 | If | ||
35 | .Fa alg_bits | ||
36 | is not | ||
37 | .Dv NULL , | ||
38 | it contains the number of bits processed by the | ||
39 | chosen algorithm. | ||
40 | If | ||
41 | .Fa cipher | ||
42 | is | ||
43 | .Dv NULL , | ||
44 | 0 is returned. | ||
45 | .Pp | ||
46 | .Fn SSL_CIPHER_get_version | ||
47 | returns a string which indicates the SSL/TLS protocol version that first | ||
48 | defined the cipher. | ||
49 | This is currently | ||
50 | .Qq SSLv2 | ||
51 | or | ||
52 | .Qq TLSv1/SSLv3 . | ||
53 | In some cases it should possibly return | ||
54 | .Qq TLSv1.2 | ||
55 | but the function does not; use | ||
56 | .Xr SSL_CIPHER_description 3 | ||
57 | instead. | ||
58 | If | ||
59 | .Fa cipher | ||
60 | is | ||
61 | .Dv NULL , | ||
62 | .Qq (NONE) | ||
63 | is returned. | ||
64 | .Pp | ||
65 | .Fn SSL_CIPHER_description | ||
66 | returns a textual description of the cipher used into the buffer | ||
67 | .Fa buf | ||
68 | of length | ||
69 | .Fa len | ||
70 | provided. | ||
71 | If | ||
72 | .Fa buf | ||
73 | is | ||
74 | .Dv NULL , | ||
75 | a buffer is allocated using | ||
76 | .Xr asprintf 3 ; | ||
77 | that buffer should be freed using the | ||
78 | .Xr free 3 | ||
79 | function. | ||
80 | If | ||
81 | .Fa len | ||
82 | is too small, or if | ||
83 | .Fa buf | ||
84 | is | ||
85 | .Dv NULL | ||
86 | and the allocation fails, a pointer to the string | ||
87 | .Qq Buffer too small | ||
88 | is returned. | ||
89 | .Sh NOTES | ||
90 | The number of bits processed can be different from the secret bits. | ||
91 | For example, an export cipher like EXP-RC4-MD5 has only 40 secret bits. | ||
92 | The algorithm does use the full 128 bits (which would be returned for | ||
93 | .Fa alg_bits ) , | ||
94 | but 88 bits are fixed. | ||
95 | The search space is hence only 40 bits. | ||
96 | .Pp | ||
97 | The string returned by | ||
98 | .Fn SSL_CIPHER_description | ||
99 | in case of success consists | ||
100 | of cleartext information separated by one or more blanks in the following | ||
101 | sequence: | ||
102 | .Bl -tag -width Ds | ||
103 | .It Aq Ar ciphername | ||
104 | Textual representation of the cipher name. | ||
105 | .It Aq Ar protocol version | ||
106 | Protocol version: | ||
107 | .Em SSLv2 , | ||
108 | .Em SSLv3 , | ||
109 | .Em TLSv1.2 . | ||
110 | The TLSv1.0 ciphers are flagged with SSLv3. | ||
111 | No new ciphers were added by TLSv1.1. | ||
112 | .It Kx= Ns Aq Ar key exchange | ||
113 | Key exchange method: | ||
114 | .Em RSA | ||
115 | (for export ciphers as | ||
116 | .Em RSA(512) | ||
117 | or | ||
118 | .Em RSA(1024) ) , | ||
119 | .Em DH | ||
120 | (for export ciphers as | ||
121 | .Em DH(512) | ||
122 | or | ||
123 | .Em DH(1024) ) , | ||
124 | .Em DH/RSA , | ||
125 | .Em DH/DSS , | ||
126 | .Em Fortezza . | ||
127 | .It Au= Ns Aq Ar authentication | ||
128 | Authentication method: | ||
129 | .Em RSA , | ||
130 | .Em DSS , | ||
131 | .Em DH , | ||
132 | .Em None . | ||
133 | .Em None | ||
134 | is the representation of anonymous ciphers. | ||
135 | .It Enc= Ns Aq Ar symmetric encryption method | ||
136 | Encryption method with number of secret bits: | ||
137 | .Em DES(40) , | ||
138 | .Em DES(56) , | ||
139 | .Em 3DES(168) , | ||
140 | .Em RC4(40) , | ||
141 | .Em RC4(56) , | ||
142 | .Em RC4(64) , | ||
143 | .Em RC4(128) , | ||
144 | .Em RC2(40) , | ||
145 | .Em RC2(56) , | ||
146 | .Em RC2(128) , | ||
147 | .Em IDEA(128) , | ||
148 | .Em Fortezza , | ||
149 | .Em None . | ||
150 | .It Mac= Ns Aq Ar message authentication code | ||
151 | Message digest: | ||
152 | .Em MD5 , | ||
153 | .Em SHA1 . | ||
154 | .It Aq Ar export flag | ||
155 | If the cipher is flagged exportable with respect to old US crypto | ||
156 | regulations, the word | ||
157 | .Dq export | ||
158 | is printed. | ||
159 | .El | ||
160 | .Sh RETURN VALUES | ||
161 | See | ||
162 | .Sx DESCRIPTION | ||
163 | .Sh EXAMPLES | ||
164 | Some examples for the output of | ||
165 | .Fn SSL_CIPHER_description : | ||
166 | .D1 "EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1" | ||
167 | .D1 "EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1" | ||
168 | .D1 "RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5" | ||
169 | .D1 "EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export" | ||
170 | .Pp | ||
171 | A complete list can be retrieved by invoking the following command: | ||
172 | .Pp | ||
173 | .Dl $ openssl ciphers -v ALL | ||
174 | .Sh SEE ALSO | ||
175 | .Xr ciphers 1 , | ||
176 | .Xr ssl 3 , | ||
177 | .Xr SSL_get_ciphers 3 , | ||
178 | .Xr SSL_get_current_cipher 3 | ||
179 | .Sh BUGS | ||
180 | If | ||
181 | .Fn SSL_CIPHER_description | ||
182 | is called with | ||
183 | .Fa cipher | ||
184 | being | ||
185 | .Dv NULL , | ||
186 | the library crashes. | ||
187 | .Pp | ||
188 | If | ||
189 | .Fn SSL_CIPHER_description | ||
190 | cannot handle a built-in cipher, | ||
191 | the according description of the cipher property is | ||
192 | .Qq unknown . | ||
193 | This case should not occur. | ||
diff --git a/src/lib/libssl/doc/SSL_COMP_add_compression_method.3 b/src/lib/libssl/doc/SSL_COMP_add_compression_method.3 new file mode 100644 index 0000000000..c23d676930 --- /dev/null +++ b/src/lib/libssl/doc/SSL_COMP_add_compression_method.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_COMP_add_compression_method | ||
6 | .Nd handle SSL/TLS integrated compression methods | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_COMP_add_compression_method "int id" "COMP_METHOD *cm" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_COMP_add_compression_method | ||
13 | adds the compression method | ||
14 | .Fa cm | ||
15 | with the identifier | ||
16 | .Fa id | ||
17 | to the list of available compression methods. | ||
18 | This list is globally maintained for all SSL operations within this application. | ||
19 | It cannot be set for specific SSL_CTX or SSL objects. | ||
20 | .Sh NOTES | ||
21 | The TLS standard (or SSLv3) allows the integration of compression methods | ||
22 | into the communication. | ||
23 | The TLS RFC does however not specify compression methods or their corresponding | ||
24 | identifiers, so there is currently no compatible way to integrate compression | ||
25 | with unknown peers. | ||
26 | It is therefore currently not recommended to integrate compression into | ||
27 | applications. | ||
28 | Applications for non-public use may agree on certain compression methods. | ||
29 | Using different compression methods with the same identifier will lead to | ||
30 | connection failure. | ||
31 | .Pp | ||
32 | An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) | ||
33 | will unconditionally send the list of all compression methods enabled with | ||
34 | .Fn SSL_COMP_add_compression_method | ||
35 | to the server during the handshake. | ||
36 | Unlike the mechanisms to set a cipher list, there is no method available to | ||
37 | restrict the list of compression method on a per connection basis. | ||
38 | .Pp | ||
39 | An OpenSSL server will match the identifiers listed by a client against | ||
40 | its own compression methods and will unconditionally activate compression | ||
41 | when a matching identifier is found. | ||
42 | There is no way to restrict the list of compression methods supported on a per | ||
43 | connection basis. | ||
44 | .Pp | ||
45 | The OpenSSL library has the compression methods | ||
46 | .Fn COMP_rle | ||
47 | and (when especially enabled during compilation) | ||
48 | .Fn COMP_zlib | ||
49 | available. | ||
50 | .Sh WARNINGS | ||
51 | Once the identities of the compression methods for the TLS protocol have | ||
52 | been standardized, the compression API will most likely be changed. | ||
53 | Using it in the current state is not recommended. | ||
54 | .Sh RETURN VALUES | ||
55 | .Fn SSL_COMP_add_compression_method | ||
56 | may return the following values: | ||
57 | .Bl -tag -width Ds | ||
58 | .It 0 | ||
59 | The operation succeeded. | ||
60 | .It 1 | ||
61 | The operation failed. | ||
62 | Check the error queue to find out the reason. | ||
63 | .El | ||
64 | .Sh SEE ALSO | ||
65 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_add_extra_chain_cert.3 b/src/lib/libssl/doc/SSL_CTX_add_extra_chain_cert.3 new file mode 100644 index 0000000000..2664c67a5a --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_add_extra_chain_cert.3 | |||
@@ -0,0 +1,42 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_add_extra_chain_cert | ||
6 | .Nd add certificate to chain | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX ctx" "X509 *x509" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_add_extra_chain_cert | ||
13 | adds the certificate | ||
14 | .Fa x509 | ||
15 | to the certificate chain presented together with the certificate. | ||
16 | Several certificates can be added one after the other. | ||
17 | .Sh NOTES | ||
18 | When constructing the certificate chain, the chain will be formed from | ||
19 | these certificates explicitly specified. | ||
20 | If no chain is specified, the library will try to complete the chain from the | ||
21 | available CA certificates in the trusted CA storage, see | ||
22 | .Xr SSL_CTX_load_verify_locations 3 . | ||
23 | .Pp | ||
24 | The x509 certificate provided to | ||
25 | .Fn SSL_CTX_add_extra_chain_cert | ||
26 | will be freed by the library when the | ||
27 | .Vt SSL_CTX | ||
28 | is destroyed. | ||
29 | An application | ||
30 | .Em should not | ||
31 | free the | ||
32 | .Fa x509 | ||
33 | object. | ||
34 | .Sh RETURN VALUES | ||
35 | .Fn SSL_CTX_add_extra_chain_cert | ||
36 | returns 1 on success. | ||
37 | Check out the error stack to find out the reason for failure otherwise. | ||
38 | .Sh SEE ALSO | ||
39 | .Xr ssl 3 , | ||
40 | .Xr SSL_CTX_load_verify_locations 3 , | ||
41 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
42 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_add_session.3 b/src/lib/libssl/doc/SSL_CTX_add_session.3 new file mode 100644 index 0000000000..74b4481496 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_add_session.3 | |||
@@ -0,0 +1,87 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_ADD_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_add_session , | ||
6 | .Nm SSL_add_session , | ||
7 | .Nm SSL_CTX_remove_session , | ||
8 | .Nm SSL_remove_session | ||
9 | .Nd manipulate session cache | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft int | ||
13 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
14 | .Ft int | ||
15 | .Fn SSL_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
16 | .Ft int | ||
17 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
18 | .Ft int | ||
19 | .Fn SSL_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_add_session | ||
22 | adds the session | ||
23 | .Fa c | ||
24 | to the context | ||
25 | .Fa ctx . | ||
26 | The reference count for session | ||
27 | .Fa c | ||
28 | is incremented by 1. | ||
29 | If a session with the same session id already exists, | ||
30 | the old session is removed by calling | ||
31 | .Xr SSL_SESSION_free 3 . | ||
32 | .Pp | ||
33 | .Fn SSL_CTX_remove_session | ||
34 | removes the session | ||
35 | .Fa c | ||
36 | from the context | ||
37 | .Fa ctx . | ||
38 | .Xr SSL_SESSION_free 3 | ||
39 | is called once for | ||
40 | .Fa c . | ||
41 | .Pp | ||
42 | .Fn SSL_add_session | ||
43 | and | ||
44 | .Fn SSL_remove_session | ||
45 | are synonyms for their | ||
46 | .Fn SSL_CTX_* | ||
47 | counterparts. | ||
48 | .Sh NOTES | ||
49 | When adding a new session to the internal session cache, it is examined | ||
50 | whether a session with the same session id already exists. | ||
51 | In this case it is assumed that both sessions are identical. | ||
52 | If the same session is stored in a different | ||
53 | .Vt SSL_SESSION | ||
54 | object, the old session is removed and replaced by the new session. | ||
55 | If the session is actually identical (the | ||
56 | .Vt SSL_SESSION | ||
57 | object is identical), | ||
58 | .Fn SSL_CTX_add_session | ||
59 | is a no-op, and the return value is 0. | ||
60 | .Pp | ||
61 | If a server | ||
62 | .Vt SSL_CTX | ||
63 | is configured with the | ||
64 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
65 | flag then the internal cache will not be populated automatically by new | ||
66 | sessions negotiated by the SSL/TLS implementation, even though the internal | ||
67 | cache will be searched automatically for session-resume requests (the | ||
68 | latter can be suppressed by | ||
69 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP ) . | ||
70 | So the application can use | ||
71 | .Fn SSL_CTX_add_session | ||
72 | directly to have full control over the sessions that can be resumed if desired. | ||
73 | .Sh RETURN VALUES | ||
74 | The following values are returned by all functions: | ||
75 | .Bl -tag -width Ds | ||
76 | .It 0 | ||
77 | The operation failed. | ||
78 | In case of the add operation, it was tried to add the same (identical) session | ||
79 | twice. | ||
80 | In case of the remove operation, the session was not found in the cache. | ||
81 | .It 1 | ||
82 | The operation succeeded. | ||
83 | .El | ||
84 | .Sh SEE ALSO | ||
85 | .Xr ssl 3 , | ||
86 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
87 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_ctrl.3 b/src/lib/libssl/doc/SSL_CTX_ctrl.3 new file mode 100644 index 0000000000..d0a4ffd554 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_ctrl.3 | |||
@@ -0,0 +1,46 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_CTRL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_ctrl , | ||
6 | .Nm SSL_CTX_callback_ctrl , | ||
7 | .Nm SSL_ctrl , | ||
8 | .Nm SSL_callback_ctrl | ||
9 | .Nd internal handling functions for SSL_CTX and SSL objects | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" | ||
14 | .Ft long | ||
15 | .Fn SSL_CTX_callback_ctrl "SSL_CTX *" "int cmd" "void (*fp)()" | ||
16 | .Ft long | ||
17 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "void *parg" | ||
18 | .Ft long | ||
19 | .Fn SSL_callback_ctrl "SSL *" "int cmd" "void (*fp)()" | ||
20 | .Sh DESCRIPTION | ||
21 | The | ||
22 | .Fn SSL_*_ctrl | ||
23 | family of functions is used to manipulate settings of | ||
24 | the | ||
25 | .Vt SSL_CTX | ||
26 | and | ||
27 | .Vt SSL | ||
28 | objects. | ||
29 | Depending on the command | ||
30 | .Fa cmd | ||
31 | the arguments | ||
32 | .Fa larg , | ||
33 | .Fa parg , | ||
34 | or | ||
35 | .Fa fp | ||
36 | are evaluated. | ||
37 | These functions should never be called directly. | ||
38 | All functionalities needed are made available via other functions or macros. | ||
39 | .Sh RETURN VALUES | ||
40 | The return values of the | ||
41 | .Fn SSL*_ctrl | ||
42 | functions depend on the command supplied via the | ||
43 | .Fn cmd | ||
44 | parameter. | ||
45 | .Sh SEE ALSO | ||
46 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_flush_sessions.3 b/src/lib/libssl/doc/SSL_CTX_flush_sessions.3 new file mode 100644 index 0000000000..6431008c4f --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_flush_sessions.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_FLUSH_SESSIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_flush_sessions , | ||
6 | .Nm SSL_flush_sessions | ||
7 | .Nd remove expired sessions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" | ||
12 | .Ft void | ||
13 | .Fn SSL_flush_sessions "SSL_CTX *ctx" "long tm" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_flush_sessions | ||
16 | causes a run through the session cache of | ||
17 | .Fa ctx | ||
18 | to remove sessions expired at time | ||
19 | .Fa tm . | ||
20 | .Pp | ||
21 | .Fn SSL_flush_sessions | ||
22 | is a synonym for | ||
23 | .Fn SSL_CTX_flush_sessions . | ||
24 | .Sh NOTES | ||
25 | If enabled, the internal session cache will collect all sessions established | ||
26 | up to the specified maximum number (see | ||
27 | .Fn SSL_CTX_sess_set_cache_size ) . | ||
28 | As sessions will not be reused ones they are expired, they should be | ||
29 | removed from the cache to save resources. | ||
30 | This can either be done automatically whenever 255 new sessions were | ||
31 | established (see | ||
32 | .Xr SSL_CTX_set_session_cache_mode 3 ) | ||
33 | or manually by calling | ||
34 | .Fn SSL_CTX_flush_sessions . | ||
35 | .Pp | ||
36 | The parameter | ||
37 | .Fa tm | ||
38 | specifies the time which should be used for the | ||
39 | expiration test, in most cases the actual time given by | ||
40 | .Fn time 0 | ||
41 | will be used. | ||
42 | .Pp | ||
43 | .Fn SSL_CTX_flush_sessions | ||
44 | will only check sessions stored in the internal cache. | ||
45 | When a session is found and removed, the | ||
46 | .Va remove_session_cb | ||
47 | is however called to synchronize with the external cache (see | ||
48 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
49 | .Sh RETURN VALUES | ||
50 | .Sh SEE ALSO | ||
51 | .Xr ssl 3 , | ||
52 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
53 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
54 | .Xr SSL_CTX_set_timeout 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_free.3 b/src/lib/libssl/doc/SSL_CTX_free.3 new file mode 100644 index 0000000000..9cf5934303 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_free.3 | |||
@@ -0,0 +1,44 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_free | ||
6 | .Nd free an allocated SSL_CTX object | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_CTX_free "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_free | ||
13 | decrements the reference count of | ||
14 | .Fa ctx , | ||
15 | and removes the | ||
16 | .Vt SSL_CTX | ||
17 | object pointed to by | ||
18 | .Fa ctx | ||
19 | and frees up the allocated memory if the reference count has reached 0. | ||
20 | .Pp | ||
21 | It also calls the | ||
22 | .Xr free 3 Ns ing procedures for indirectly affected items, if applicable: | ||
23 | the session cache, the list of ciphers, the list of Client CAs, | ||
24 | the certificates and keys. | ||
25 | .Sh WARNINGS | ||
26 | If a session-remove callback is set | ||
27 | .Pq Xr SSL_CTX_sess_set_remove_cb 3 , | ||
28 | this callback will be called for each session being freed from | ||
29 | .Fa ctx Ns 's | ||
30 | session cache. | ||
31 | This implies that all corresponding sessions from an external session cache are | ||
32 | removed as well. | ||
33 | If this is not desired, the user should explicitly unset the callback by | ||
34 | calling | ||
35 | .Fn SSL_CTX_sess_set_remove_cb ctx NULL | ||
36 | prior to calling | ||
37 | .Fn SSL_CTX_free . | ||
38 | .Sh RETURN VALUES | ||
39 | .Fn SSL_CTX_free | ||
40 | does not provide diagnostic information. | ||
41 | .Sh SEE ALSO | ||
42 | .Xr ssl 3 , | ||
43 | .Xr SSL_CTX_new 3 , | ||
44 | .Xr SSL_CTX_sess_set_get_cb 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_get_ex_new_index.3 b/src/lib/libssl/doc/SSL_CTX_get_ex_new_index.3 new file mode 100644 index 0000000000..593f39c24c --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_get_ex_new_index.3 | |||
@@ -0,0 +1,67 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_get_ex_new_index , | ||
6 | .Nm SSL_CTX_set_ex_data , | ||
7 | .Nm SSL_CTX_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_CTX_get_ex_new_index | ||
13 | .Fa long argl | ||
14 | .Fa void *argp | ||
15 | .Fa CRYPTO_EX_new *new_func | ||
16 | .Fa CRYPTO_EX_dup *dup_func | ||
17 | .Fa CRYPTO_EX_free *free_func | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_CTX_set_ex_data "SSL_CTX *ctx" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *ctx" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate application | ||
34 | specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_CTX_get_ex_new_index | ||
37 | is used to register a new index for application specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa ctx | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa ctx . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality can be found in | ||
57 | .Xr RSA_get_ex_new_index 3 . | ||
58 | The | ||
59 | .Fn *_get_ex_data | ||
60 | and | ||
61 | .Fn *_set_ex_data | ||
62 | functionality is described in | ||
63 | .Xr CRYPTO_set_ex_data 3 . | ||
64 | .Sh SEE ALSO | ||
65 | .Xr CRYPTO_set_ex_data 3 , | ||
66 | .Xr RSA_get_ex_new_index 3 , | ||
67 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_get_verify_mode.3 b/src/lib/libssl/doc/SSL_CTX_get_verify_mode.3 new file mode 100644 index 0000000000..4139229d7b --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_get_verify_mode.3 | |||
@@ -0,0 +1,70 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_GET_VERIFY_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_get_verify_mode , | ||
6 | .Nm SSL_get_verify_mode , | ||
7 | .Nm SSL_CTX_get_verify_depth , | ||
8 | .Nm SSL_get_verify_depth , | ||
9 | .Nm SSL_get_verify_callback , | ||
10 | .Nm SSL_CTX_get_verify_callback | ||
11 | .Nd get currently set verification parameters | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft int | ||
15 | .Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" | ||
16 | .Ft int | ||
17 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
18 | .Ft int | ||
19 | .Fn SSL_CTX_get_verify_depth "const SSL_CTX *ctx" | ||
20 | .Ft int | ||
21 | .Fn SSL_get_verify_depth "const SSL *ssl" | ||
22 | .Ft int | ||
23 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
24 | .Fa int "X509_STORE_CTX *" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo "(*SSL_get_verify_callback(const SSL *ssl))" | ||
28 | .Fa int "X509_STORE_CTX *" | ||
29 | .Fc | ||
30 | .Sh DESCRIPTION | ||
31 | .Fn SSL_CTX_get_verify_mode | ||
32 | returns the verification mode currently set in | ||
33 | .Fa ctx . | ||
34 | .Pp | ||
35 | .Fn SSL_get_verify_mode | ||
36 | returns the verification mode currently set in | ||
37 | .Fa ssl . | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_get_verify_depth | ||
40 | returns the verification depth limit currently set | ||
41 | in | ||
42 | .Fa ctx . | ||
43 | If no limit has been explicitly set, | ||
44 | \(mi1 is returned and the default value will be used. | ||
45 | .Pp | ||
46 | .Fn SSL_get_verify_depth | ||
47 | returns the verification depth limit currently set in | ||
48 | .Fa ssl . | ||
49 | If no limit has been explicitly set, | ||
50 | \(mi1 is returned and the default value will be used. | ||
51 | .Pp | ||
52 | .Fn SSL_CTX_get_verify_callback | ||
53 | returns a function pointer to the verification callback currently set in | ||
54 | .Fa ctx . | ||
55 | If no callback was explicitly set, the | ||
56 | .Dv NULL | ||
57 | pointer is returned and the default callback will be used. | ||
58 | .Pp | ||
59 | .Fn SSL_get_verify_callback | ||
60 | returns a function pointer to the verification callback currently set in | ||
61 | .Fa ssl . | ||
62 | If no callback was explicitly set, the | ||
63 | .Dv NULL | ||
64 | pointer is returned and the default callback will be used. | ||
65 | .Sh RETURN VALUES | ||
66 | See | ||
67 | .Sx DESCRIPTION | ||
68 | .Sh SEE ALSO | ||
69 | .Xr ssl 3 , | ||
70 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3 new file mode 100644 index 0000000000..1e494032f4 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_load_verify_locations.3 | |||
@@ -0,0 +1,158 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_load_verify_locations | ||
6 | .Nd set default locations for trusted CA certificates | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fo SSL_CTX_load_verify_locations | ||
11 | .Fa "SSL_CTX *ctx" "const char *CAfile" "const char *CApath" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | .Fn SSL_CTX_load_verify_locations | ||
15 | specifies the locations for | ||
16 | .Fa ctx , | ||
17 | at which CA certificates for verification purposes are located. | ||
18 | The certificates available via | ||
19 | .Fa CAfile | ||
20 | and | ||
21 | .Fa CApath | ||
22 | are trusted. | ||
23 | .Sh NOTES | ||
24 | If | ||
25 | .Fa CAfile | ||
26 | is not | ||
27 | .Dv NULL , | ||
28 | it points to a file of CA certificates in PEM format. | ||
29 | The file can contain several CA certificates identified by sequences of: | ||
30 | .Bd -literal | ||
31 | -----BEGIN CERTIFICATE----- | ||
32 | ... (CA certificate in base64 encoding) ... | ||
33 | -----END CERTIFICATE----- | ||
34 | .Ed | ||
35 | Before, between, and after the certificates arbitrary text is allowed which can | ||
36 | be used, e.g., for descriptions of the certificates. | ||
37 | .Pp | ||
38 | The | ||
39 | .Fa CAfile | ||
40 | is processed on execution of the | ||
41 | .Fn SSL_CTX_load_verify_locations | ||
42 | function. | ||
43 | .Pp | ||
44 | If | ||
45 | .Fa CApath | ||
46 | is not NULL, it points to a directory containing CA certificates in PEM format. | ||
47 | The files each contain one CA certificate. | ||
48 | The files are looked up by the CA subject name hash value, | ||
49 | which must hence be available. | ||
50 | If more than one CA certificate with the same name hash value exist, | ||
51 | the extension must be different (e.g., | ||
52 | .Pa 9d66eef0.0 , | ||
53 | .Pa 9d66eef0.1 , | ||
54 | etc.). | ||
55 | The search is performed in the ordering of the extension number, | ||
56 | regardless of other properties of the certificates. | ||
57 | .Pp | ||
58 | The certificates in | ||
59 | .Fa CApath | ||
60 | are only looked up when required, e.g., when building the certificate chain or | ||
61 | when actually performing the verification of a peer certificate. | ||
62 | .Pp | ||
63 | When looking up CA certificates, the OpenSSL library will first search the | ||
64 | certificates in | ||
65 | .Fa CAfile , | ||
66 | then those in | ||
67 | .Fa CApath . | ||
68 | Certificate matching is done based on the subject name, the key identifier (if | ||
69 | present), and the serial number as taken from the certificate to be verified. | ||
70 | If these data do not match, the next certificate will be tried. | ||
71 | If a first certificate matching the parameters is found, | ||
72 | the verification process will be performed; | ||
73 | no other certificates for the same parameters will be searched in case of | ||
74 | failure. | ||
75 | .Pp | ||
76 | In server mode, when requesting a client certificate, the server must send | ||
77 | the list of CAs of which it will accept client certificates. | ||
78 | This list is not influenced by the contents of | ||
79 | .Fa CAfile | ||
80 | or | ||
81 | .Fa CApath | ||
82 | and must explicitly be set using the | ||
83 | .Xr SSL_CTX_set_client_CA_list 3 | ||
84 | family of functions. | ||
85 | .Pp | ||
86 | When building its own certificate chain, an OpenSSL client/server will try to | ||
87 | fill in missing certificates from | ||
88 | .Fa CAfile Ns / Fa CApath , | ||
89 | if the | ||
90 | certificate chain was not explicitly specified (see | ||
91 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
92 | and | ||
93 | .Xr SSL_CTX_use_certificate 3 ) . | ||
94 | .Sh WARNINGS | ||
95 | If several CA certificates matching the name, key identifier, and serial | ||
96 | number condition are available, only the first one will be examined. | ||
97 | This may lead to unexpected results if the same CA certificate is available | ||
98 | with different expiration dates. | ||
99 | If a | ||
100 | .Dq certificate expired | ||
101 | verification error occurs, no other certificate will be searched. | ||
102 | Make sure to not have expired certificates mixed with valid ones. | ||
103 | .Sh RETURN VALUES | ||
104 | The following return values can occur: | ||
105 | .Bl -tag -width Ds | ||
106 | .It 0 | ||
107 | The operation failed because | ||
108 | .Fa CAfile | ||
109 | and | ||
110 | .Fa CApath | ||
111 | are | ||
112 | .Dv NULL | ||
113 | or the processing at one of the locations specified failed. | ||
114 | Check the error stack to find out the reason. | ||
115 | .It 1 | ||
116 | The operation succeeded. | ||
117 | .El | ||
118 | .Sh EXAMPLES | ||
119 | Generate a CA certificate file with descriptive text from the CA certificates | ||
120 | .Pa ca1.pem | ||
121 | .Pa ca2.pem | ||
122 | .Pa ca3.pem : | ||
123 | .Bd -literal | ||
124 | #!/bin/sh | ||
125 | rm CAfile.pem | ||
126 | for i in ca1.pem ca2.pem ca3.pem; do | ||
127 | openssl x509 -in $i -text >> CAfile.pem | ||
128 | done | ||
129 | .Ed | ||
130 | .Pp | ||
131 | Prepare the directory /some/where/certs containing several CA certificates | ||
132 | for use as | ||
133 | .Fa CApath : | ||
134 | .Bd -literal | ||
135 | $ cd /some/where/certs | ||
136 | $ rm -f *.[0-9]* *.r[0-9]* | ||
137 | $ for c in *.pem; do | ||
138 | > [ "$c" = "*.pem" ] && continue | ||
139 | > hash=$(openssl x509 -noout -hash -in "$c") | ||
140 | > if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then | ||
141 | > suf=0 | ||
142 | > while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done | ||
143 | > ln -s "$c" $hash.$suf | ||
144 | > fi | ||
145 | > if egrep -q -- '-BEGIN X509 CRL-' "$c"; then | ||
146 | > suf=0 | ||
147 | > while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done | ||
148 | > ln -s "$c" $hash.r$suf | ||
149 | > fi | ||
150 | > done | ||
151 | .Ed | ||
152 | .Sh SEE ALSO | ||
153 | .Xr ssl 3 , | ||
154 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
155 | .Xr SSL_CTX_set_cert_store 3 , | ||
156 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
157 | .Xr SSL_CTX_use_certificate 3 , | ||
158 | .Xr SSL_get_client_CA_list 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_new.3 b/src/lib/libssl/doc/SSL_CTX_new.3 new file mode 100644 index 0000000000..b798d10a9e --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_new.3 | |||
@@ -0,0 +1,108 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_new , | ||
6 | .Nm SSLv3_method , | ||
7 | .Nm SSLv3_server_method , | ||
8 | .Nm SSLv3_client_method , | ||
9 | .Nm TLSv1_method , | ||
10 | .Nm TLSv1_server_method , | ||
11 | .Nm TLSv1_client_method , | ||
12 | .Nm TLSv1_1_method , | ||
13 | .Nm TLSv1_1_server_method , | ||
14 | .Nm TLSv1_1_client_method , | ||
15 | .Nm SSLv23_method , | ||
16 | .Nm SSLv23_server_method , | ||
17 | .Nm SSLv23_client_method | ||
18 | .Nd create a new SSL_CTX object as framework for TLS/SSL enabled functions | ||
19 | .Sh SYNOPSIS | ||
20 | .In openssl/ssl.h | ||
21 | .Ft SSL_CTX * | ||
22 | .Fn SSL_CTX_new "const SSL_METHOD *method" | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_CTX_new | ||
25 | creates a new | ||
26 | .Vt SSL_CTX | ||
27 | object as framework to establish TLS/SSL enabled connections. | ||
28 | .Sh NOTES | ||
29 | The | ||
30 | .Vt SSL_CTX | ||
31 | object uses | ||
32 | .Fa method | ||
33 | as its connection method. | ||
34 | The methods exist in a generic type (for client and server use), | ||
35 | a server only type, and a client only type. | ||
36 | .Fa method | ||
37 | can be of the following types: | ||
38 | .Bl -tag -width Ds | ||
39 | .It Fn SSLv3_method void , Fn SSLv3_server_method void , \ | ||
40 | Fn SSLv3_client_method void | ||
41 | A TLS/SSL connection established with these methods will only understand the | ||
42 | SSLv3 protocol. | ||
43 | A client will send out SSLv3 client hello messages and will indicate that it | ||
44 | only understands SSLv3. | ||
45 | A server will only understand SSLv3 client hello messages. | ||
46 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
47 | which are widely used for compatibility reasons; see | ||
48 | .Fn SSLv23_*_method . | ||
49 | .It Fn TLSv1_method void , Fn TLSv1_server_method void , \ | ||
50 | Fn TLSv1_client_method void | ||
51 | A TLS/SSL connection established with these methods will only understand the | ||
52 | TLSv1 protocol. | ||
53 | A client will send out TLSv1 client hello messages and will indicate that it | ||
54 | only understands TLSv1. | ||
55 | A server will only understand TLSv1 client hello messages. | ||
56 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
57 | which are widely used for compatibility reasons; see | ||
58 | .Fn SSLv23_*_method . | ||
59 | It will also not understand SSLv3 client hello messages. | ||
60 | .It Fn SSLv23_method void , Fn SSLv23_server_method void , \ | ||
61 | Fn SSLv23_client_method void | ||
62 | A TLS/SSL connection established with these methods may understand the SSLv3, | ||
63 | TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
64 | .Pp | ||
65 | A client will send out TLSv1 client hello messages including extensions and | ||
66 | will indicate that it also understands TLSv1.1, TLSv1.2 and permits a fallback | ||
67 | to SSLv3. | ||
68 | A server will support SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
69 | This is the best choice when compatibility is a concern. | ||
70 | .El | ||
71 | .Pp | ||
72 | The list of protocols available can later be limited using the | ||
73 | .Dv SSL_OP_NO_SSLv3 , | ||
74 | .Dv SSL_OP_NO_TLSv1 , | ||
75 | .Dv SSL_OP_NO_TLSv1_1 , | ||
76 | and | ||
77 | .Dv SSL_OP_NO_TLSv1_2 | ||
78 | options of the | ||
79 | .Fn SSL_CTX_set_options | ||
80 | or | ||
81 | .Fn SSL_set_options | ||
82 | functions. | ||
83 | Using these options it is possible to choose, for example, | ||
84 | .Fn SSLv23_server_method | ||
85 | and be able to negotiate with all possible clients, | ||
86 | but to only allow newer protocols like TLSv1, TLSv1.1 or TLS v1.2. | ||
87 | .Pp | ||
88 | .Fn SSL_CTX_new | ||
89 | initializes the list of ciphers, the session cache setting, the callbacks, | ||
90 | the keys and certificates, and the options to its default values. | ||
91 | .Sh RETURN VALUES | ||
92 | The following return values can occur: | ||
93 | .Bl -tag -width Ds | ||
94 | .It Dv NULL | ||
95 | The creation of a new | ||
96 | .Vt SSL_CTX | ||
97 | object failed. | ||
98 | Check the error stack to find out the reason. | ||
99 | .It Pointer to an SSL_CTX object | ||
100 | The return value points to an allocated | ||
101 | .Vt SSL_CTX | ||
102 | object. | ||
103 | .El | ||
104 | .Sh SEE ALSO | ||
105 | .Xr ssl 3 , | ||
106 | .Xr SSL_accept 3 , | ||
107 | .Xr SSL_CTX_free 3 , | ||
108 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_sess_number.3 b/src/lib/libssl/doc/SSL_CTX_sess_number.3 new file mode 100644 index 0000000000..862576ca50 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_sess_number.3 | |||
@@ -0,0 +1,101 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_NUMBER 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_number , | ||
6 | .Nm SSL_CTX_sess_connect , | ||
7 | .Nm SSL_CTX_sess_connect_good , | ||
8 | .Nm SSL_CTX_sess_connect_renegotiate , | ||
9 | .Nm SSL_CTX_sess_accept , | ||
10 | .Nm SSL_CTX_sess_accept_good , | ||
11 | .Nm SSL_CTX_sess_accept_renegotiate , | ||
12 | .Nm SSL_CTX_sess_hits , | ||
13 | .Nm SSL_CTX_sess_cb_hits , | ||
14 | .Nm SSL_CTX_sess_misses , | ||
15 | .Nm SSL_CTX_sess_timeouts , | ||
16 | .Nm SSL_CTX_sess_cache_full | ||
17 | .Nd obtain session cache statistics | ||
18 | .Sh SYNOPSIS | ||
19 | .In openssl/ssl.h | ||
20 | .Ft long | ||
21 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
22 | .Ft long | ||
23 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
24 | .Ft long | ||
25 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
26 | .Ft long | ||
27 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
28 | .Ft long | ||
29 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
30 | .Ft long | ||
31 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
32 | .Ft long | ||
33 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
34 | .Ft long | ||
35 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
36 | .Ft long | ||
37 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
38 | .Ft long | ||
39 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
40 | .Ft long | ||
41 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
42 | .Ft long | ||
43 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
44 | .Sh DESCRIPTION | ||
45 | .Fn SSL_CTX_sess_number | ||
46 | returns the current number of sessions in the internal session cache. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_sess_connect | ||
49 | returns the number of started SSL/TLS handshakes in client mode. | ||
50 | .Pp | ||
51 | .Fn SSL_CTX_sess_connect_good | ||
52 | returns the number of successfully established SSL/TLS sessions in client mode. | ||
53 | .Pp | ||
54 | .Fn SSL_CTX_sess_connect_renegotiate | ||
55 | returns the number of start renegotiations in client mode. | ||
56 | .Pp | ||
57 | .Fn SSL_CTX_sess_accept | ||
58 | returns the number of started SSL/TLS handshakes in server mode. | ||
59 | .Pp | ||
60 | .Fn SSL_CTX_sess_accept_good | ||
61 | returns the number of successfully established SSL/TLS sessions in server mode. | ||
62 | .Pp | ||
63 | .Fn SSL_CTX_sess_accept_renegotiate | ||
64 | returns the number of start renegotiations in server mode. | ||
65 | .Pp | ||
66 | .Fn SSL_CTX_sess_hits | ||
67 | returns the number of successfully reused sessions. | ||
68 | In client mode a session set with | ||
69 | .Xr SSL_set_session 3 | ||
70 | successfully reused is counted as a hit. | ||
71 | In server mode a session successfully retrieved from internal or external cache | ||
72 | is counted as a hit. | ||
73 | .Pp | ||
74 | .Fn SSL_CTX_sess_cb_hits | ||
75 | returns the number of successfully retrieved sessions from the external session | ||
76 | cache in server mode. | ||
77 | .Pp | ||
78 | .Fn SSL_CTX_sess_misses | ||
79 | returns the number of sessions proposed by clients that were not found in the | ||
80 | internal session cache in server mode. | ||
81 | .Pp | ||
82 | .Fn SSL_CTX_sess_timeouts | ||
83 | returns the number of sessions proposed by clients and either found in the | ||
84 | internal or external session cache in server mode, | ||
85 | but that were invalid due to timeout. | ||
86 | These sessions are not included in the | ||
87 | .Fn SSL_CTX_sess_hits | ||
88 | count. | ||
89 | .Pp | ||
90 | .Fn SSL_CTX_sess_cache_full | ||
91 | returns the number of sessions that were removed because the maximum session | ||
92 | cache size was exceeded. | ||
93 | .Sh RETURN VALUES | ||
94 | The functions return the values indicated in the | ||
95 | .Sx DESCRIPTION | ||
96 | section. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr ssl 3 , | ||
99 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
100 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
101 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_sess_set_cache_size.3 b/src/lib/libssl/doc/SSL_CTX_sess_set_cache_size.3 new file mode 100644 index 0000000000..ad434e8496 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_sess_set_cache_size.3 | |||
@@ -0,0 +1,52 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_set_cache_size , | ||
6 | .Nm SSL_CTX_sess_get_cache_size | ||
7 | .Nd manipulate session cache size | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_sess_set_cache_size | ||
16 | sets the size of the internal session cache of context | ||
17 | .Fa ctx | ||
18 | to | ||
19 | .Fa t . | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_sess_get_cache_size | ||
22 | returns the currently valid session cache size. | ||
23 | .Sh NOTES | ||
24 | The internal session cache size is | ||
25 | .Dv SSL_SESSION_CACHE_MAX_SIZE_DEFAULT , | ||
26 | currently 1024\(mu20, so that up to 20000 sessions can be held. | ||
27 | This size can be modified using the | ||
28 | .Fn SSL_CTX_sess_set_cache_size | ||
29 | call. | ||
30 | A special case is the size 0, which is used for unlimited size. | ||
31 | .Pp | ||
32 | When the maximum number of sessions is reached, | ||
33 | no more new sessions are added to the cache. | ||
34 | New space may be added by calling | ||
35 | .Xr SSL_CTX_flush_sessions 3 | ||
36 | to remove expired sessions. | ||
37 | .Pp | ||
38 | If the size of the session cache is reduced and more sessions are already in | ||
39 | the session cache, | ||
40 | old session will be removed the next time a session shall be added. | ||
41 | This removal is not synchronized with the expiration of sessions. | ||
42 | .Sh RETURN VALUES | ||
43 | .Fn SSL_CTX_sess_set_cache_size | ||
44 | returns the previously valid size. | ||
45 | .Pp | ||
46 | .Fn SSL_CTX_sess_get_cache_size | ||
47 | returns the currently valid size. | ||
48 | .Sh SEE ALSO | ||
49 | .Xr ssl 3 , | ||
50 | .Xr SSL_CTX_flush_sessions 3 , | ||
51 | .Xr SSL_CTX_sess_number 3 , | ||
52 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3 new file mode 100644 index 0000000000..d5c506cec8 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_sess_set_get_cb.3 | |||
@@ -0,0 +1,156 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_SET_GET_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_set_new_cb , | ||
6 | .Nm SSL_CTX_sess_set_remove_cb , | ||
7 | .Nm SSL_CTX_sess_set_get_cb , | ||
8 | .Nm SSL_CTX_sess_get_new_cb , | ||
9 | .Nm SSL_CTX_sess_get_remove_cb , | ||
10 | .Nm SSL_CTX_sess_get_get_cb | ||
11 | .Nd provide callback functions for server side external session caching | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft void | ||
15 | .Fo SSL_CTX_sess_set_new_cb | ||
16 | .Fa "SSL_CTX *ctx" | ||
17 | .Fa "int (*new_session_cb)(SSL *, SSL_SESSION *)" | ||
18 | .Fc | ||
19 | .Ft void | ||
20 | .Fo SSL_CTX_sess_set_remove_cb | ||
21 | .Fa "SSL_CTX *ctx" | ||
22 | .Fa "void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fo SSL_CTX_sess_set_get_cb | ||
26 | .Fa "SSL_CTX *ctx" | ||
27 | .Fa "SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)" | ||
28 | .Fc | ||
29 | .Ft int | ||
30 | .Fo "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" | ||
31 | .Fa "struct ssl_st *ssl" | ||
32 | .Fa "SSL_SESSION *sess" | ||
33 | .Fc | ||
34 | .Ft void | ||
35 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
36 | .Fa "struct ssl_ctx_st *ctx" | ||
37 | .Fa "SSL_SESSION *sess" | ||
38 | .Fc | ||
39 | .Ft SSL_SESSION * | ||
40 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
41 | .Fa "struct ssl_st *ssl" | ||
42 | .Fa "unsigned char *data" | ||
43 | .Fa "int len" | ||
44 | .Fa "int *copy" | ||
45 | .Fc | ||
46 | .Ft int | ||
47 | .Fo "(*new_session_cb)" | ||
48 | .Fa "struct ssl_st *ssl" | ||
49 | .Fa "SSL_SESSION *sess" | ||
50 | .Fc | ||
51 | .Ft void | ||
52 | .Fo "(*remove_session_cb)" | ||
53 | .Fa "struct ssl_ctx_st *ctx" | ||
54 | .Fa "SSL_SESSION *sess" | ||
55 | .Fc | ||
56 | .Ft SSL_SESSION * | ||
57 | .Fo "(*get_session_cb)" | ||
58 | .Fa "struct ssl_st *ssl" | ||
59 | .Fa "unsigned char *data" | ||
60 | .Fa "int len" | ||
61 | .Fa "int *copy" | ||
62 | .Fc | ||
63 | .Sh DESCRIPTION | ||
64 | .Fn SSL_CTX_sess_set_new_cb | ||
65 | sets the callback function which is automatically called whenever a new session | ||
66 | was negotiated. | ||
67 | .Pp | ||
68 | .Fn SSL_CTX_sess_set_remove_cb | ||
69 | sets the callback function which is automatically called whenever a session is | ||
70 | removed by the SSL engine (because it is considered faulty or the session has | ||
71 | become obsolete because of exceeding the timeout value). | ||
72 | .Pp | ||
73 | .Fn SSL_CTX_sess_set_get_cb | ||
74 | sets the callback function which is called whenever a SSL/TLS client proposes | ||
75 | to resume a session but the session cannot be found in the internal session | ||
76 | cache (see | ||
77 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
78 | (SSL/TLS server only.) | ||
79 | .Pp | ||
80 | .Fn SSL_CTX_sess_get_new_cb , | ||
81 | .Fn SSL_CTX_sess_get_remove_cb , | ||
82 | and | ||
83 | .Fn SSL_CTX_sess_get_get_cb | ||
84 | retrieve the function pointers of the provided callback functions. | ||
85 | If a callback function has not been set, the | ||
86 | .Dv NULL | ||
87 | pointer is returned. | ||
88 | .Sh NOTES | ||
89 | In order to allow external session caching, synchronization with the internal | ||
90 | session cache is realized via callback functions. | ||
91 | Inside these callback functions, session can be saved to disk or put into a | ||
92 | database using the | ||
93 | .Xr d2i_SSL_SESSION 3 | ||
94 | interface. | ||
95 | .Pp | ||
96 | The | ||
97 | .Fn new_session_cb | ||
98 | function is called whenever a new session has been negotiated and session | ||
99 | caching is enabled (see | ||
100 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
101 | The | ||
102 | .Fn new_session_cb | ||
103 | is passed the | ||
104 | .Fa ssl | ||
105 | connection and the ssl session | ||
106 | .Fa sess . | ||
107 | If the callback returns 0, the session will be immediately removed again. | ||
108 | .Pp | ||
109 | The | ||
110 | .Fn remove_session_cb | ||
111 | is called whenever the SSL engine removes a session from the internal cache. | ||
112 | This happens when the session is removed because it is expired or when a | ||
113 | connection was not shut down cleanly. | ||
114 | It also happens for all sessions in the internal session cache when | ||
115 | .Xr SSL_CTX_free 3 | ||
116 | is called. | ||
117 | The | ||
118 | .Fn remove_session_cb | ||
119 | function is passed the | ||
120 | .Fa ctx | ||
121 | and the | ||
122 | .Vt ssl | ||
123 | session | ||
124 | .Fa sess . | ||
125 | It does not provide any feedback. | ||
126 | .Pp | ||
127 | The | ||
128 | .Fn get_session_cb | ||
129 | function is only called on SSL/TLS servers with the session id proposed by the | ||
130 | client. | ||
131 | The | ||
132 | .Fn get_session_cb | ||
133 | function is always called, also when session caching was disabled. | ||
134 | The | ||
135 | .Fn get_session_cb | ||
136 | is passed the | ||
137 | .Fa ssl | ||
138 | connection, the session id of length | ||
139 | .Fa length | ||
140 | at the memory location | ||
141 | .Fa data . | ||
142 | With the parameter | ||
143 | .Fa copy | ||
144 | the callback can require the SSL engine to increment the reference count of the | ||
145 | .Vt SSL_SESSION | ||
146 | object, | ||
147 | Normally the reference count is not incremented and therefore the session must | ||
148 | not be explicitly freed with | ||
149 | .Xr SSL_SESSION_free 3 . | ||
150 | .Sh SEE ALSO | ||
151 | .Xr d2i_SSL_SESSION 3 , | ||
152 | .Xr ssl 3 , | ||
153 | .Xr SSL_CTX_flush_sessions 3 , | ||
154 | .Xr SSL_CTX_free 3 , | ||
155 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
156 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_sessions.3 b/src/lib/libssl/doc/SSL_CTX_sessions.3 new file mode 100644 index 0000000000..96aa018289 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_sessions.3 | |||
@@ -0,0 +1,31 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESSIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sessions | ||
6 | .Nd access internal session cache | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft struct lhash_st * | ||
10 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_sessions | ||
13 | returns a pointer to the lhash databases containing the internal session cache | ||
14 | for | ||
15 | .Fa ctx . | ||
16 | .Sh NOTES | ||
17 | The sessions in the internal session cache are kept in an | ||
18 | .Xr lhash 3 | ||
19 | type database. | ||
20 | It is possible to directly access this database, e.g., for searching. | ||
21 | In parallel, | ||
22 | the sessions form a linked list which is maintained separately from the | ||
23 | .Xr lhash 3 | ||
24 | operations, so that the database must not be modified directly but by using the | ||
25 | .Xr SSL_CTX_add_session 3 | ||
26 | family of functions. | ||
27 | .Sh SEE ALSO | ||
28 | .Xr lhash 3 , | ||
29 | .Xr ssl 3 , | ||
30 | .Xr SSL_CTX_add_session 3 , | ||
31 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_cert_store.3 b/src/lib/libssl/doc/SSL_CTX_set_cert_store.3 new file mode 100644 index 0000000000..f80670ce78 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_cert_store.3 | |||
@@ -0,0 +1,77 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CERT_STORE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cert_store , | ||
6 | .Nm SSL_CTX_get_cert_store | ||
7 | .Nd manipulate X509 certificate verification storage | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" | ||
12 | .Ft X509_STORE * | ||
13 | .Fn SSL_CTX_get_cert_store "const SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_cert_store | ||
16 | setsthe verification storage of | ||
17 | .Fa ctx | ||
18 | to or replaces it with | ||
19 | .Fa store . | ||
20 | If another | ||
21 | .Vt X509_STORE | ||
22 | object is currently set in | ||
23 | .Fa ctx , | ||
24 | it will be | ||
25 | .Xr X509_STORE_free 3 Ns ed. | ||
26 | .Pp | ||
27 | .Fn SSL_CTX_get_cert_store | ||
28 | returns a pointer to the current certificate verification storage. | ||
29 | .Sh NOTES | ||
30 | In order to verify the certificates presented by the peer, trusted CA | ||
31 | certificates must be accessed. | ||
32 | These CA certificates are made available via lookup methods, handled inside the | ||
33 | .Vt X509_STORE . | ||
34 | From the | ||
35 | .Vt X509_STORE | ||
36 | the | ||
37 | .Vt X509_STORE_CTX | ||
38 | used when verifying certificates is created. | ||
39 | .Pp | ||
40 | Typically the trusted certificate store is handled indirectly via using | ||
41 | .Xr SSL_CTX_load_verify_locations 3 . | ||
42 | Using the | ||
43 | .Fn SSL_CTX_set_cert_store | ||
44 | and | ||
45 | .Fn SSL_CTX_get_cert_store | ||
46 | functions it is possible to manipulate the | ||
47 | .Vt X509_STORE | ||
48 | object beyond the | ||
49 | .Xr SSL_CTX_load_verify_locations 3 | ||
50 | call. | ||
51 | .Pp | ||
52 | Currently no detailed documentation on how to use the | ||
53 | .Vt X509_STORE | ||
54 | object is available. | ||
55 | Not all members of the | ||
56 | .Vt X509_STORE | ||
57 | are used when the verification takes place. | ||
58 | So will, for example, the | ||
59 | .Fn verify_callback | ||
60 | be overridden with the | ||
61 | .Fn verify_callback | ||
62 | set via the | ||
63 | .Xr SSL_CTX_set_verify 3 | ||
64 | family of functions. | ||
65 | This document must therefore be updated when documentation about the | ||
66 | .Vt X509_STORE | ||
67 | object and its handling becomes available. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_CTX_set_cert_store | ||
70 | does not return diagnostic output. | ||
71 | .Pp | ||
72 | .Fn SSL_CTX_get_cert_store | ||
73 | returns the current setting. | ||
74 | .Sh SEE ALSO | ||
75 | .Xr ssl 3 , | ||
76 | .Xr SSL_CTX_load_verify_locations 3 , | ||
77 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_cert_verify_callback.3 new file mode 100644 index 0000000000..b34d3a6003 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_cert_verify_callback.3 | |||
@@ -0,0 +1,109 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cert_verify_callback | ||
6 | .Nd set peer certificate verification procedure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fo SSL_CTX_set_cert_verify_callback | ||
11 | .Fa "SSL_CTX *ctx" | ||
12 | .Fa "int (*callback)(X509_STORE_CTX *, void *)" | ||
13 | .Fa "void *arg" | ||
14 | .Fc | ||
15 | .Sh DESCRIPTION | ||
16 | .Fn SSL_CTX_set_cert_verify_callback | ||
17 | sets the verification callback function for | ||
18 | .Fa ctx . | ||
19 | .Vt SSL | ||
20 | objects that are created from | ||
21 | .Fa ctx | ||
22 | inherit the setting valid at the time when | ||
23 | .Xr SSL_new 3 | ||
24 | is called. | ||
25 | .Sh NOTES | ||
26 | Whenever a certificate is verified during a SSL/TLS handshake, | ||
27 | a verification function is called. | ||
28 | If the application does not explicitly specify a verification callback | ||
29 | function, the built-in verification function is used. | ||
30 | If a verification callback | ||
31 | .Fa callback | ||
32 | is specified via | ||
33 | .Fn SSL_CTX_set_cert_verify_callback , | ||
34 | the supplied callback function is called instead. | ||
35 | By setting | ||
36 | .Fa callback | ||
37 | to | ||
38 | .Dv NULL , | ||
39 | the default behaviour is restored. | ||
40 | .Pp | ||
41 | When the verification must be performed, | ||
42 | .Fa callback | ||
43 | will be called with the arguments | ||
44 | .Fn callback "X509_STORE_CTX *x509_store_ctx" "void *arg" . | ||
45 | The argument | ||
46 | .Fa arg | ||
47 | is specified by the application when setting | ||
48 | .Fa callback . | ||
49 | .Pp | ||
50 | .Fa callback | ||
51 | should return 1 to indicate verification success and 0 to indicate verification | ||
52 | failure. | ||
53 | If | ||
54 | .Dv SSL_VERIFY_PEER | ||
55 | is set and | ||
56 | .Fa callback | ||
57 | returns 0, the handshake will fail. | ||
58 | As the verification procedure may allow the connection to continue in case of | ||
59 | failure (by always returning 1) the verification result must be set in any case | ||
60 | using the | ||
61 | .Fa error | ||
62 | member of | ||
63 | .Fa x509_store_ctx | ||
64 | so that the calling application will be informed about the detailed result of | ||
65 | the verification procedure! | ||
66 | .Pp | ||
67 | Within | ||
68 | .Fa x509_store_ctx , | ||
69 | .Fa callback | ||
70 | has access to the | ||
71 | .Fa verify_callback | ||
72 | function set using | ||
73 | .Xr SSL_CTX_set_verify 3 . | ||
74 | .Sh WARNINGS | ||
75 | Do not mix the verification callback described in this function with the | ||
76 | .Fa verify_callback | ||
77 | function called during the verification process. | ||
78 | The latter is set using the | ||
79 | .Xr SSL_CTX_set_verify 3 | ||
80 | family of functions. | ||
81 | .Pp | ||
82 | Providing a complete verification procedure including certificate purpose | ||
83 | settings, etc., is a complex task. | ||
84 | The built-in procedure is quite powerful and in most cases it should be | ||
85 | sufficient to modify its behaviour using the | ||
86 | .Fa verify_callback | ||
87 | function. | ||
88 | .Sh RETURN VALUES | ||
89 | .Fn SSL_CTX_set_cert_verify_callback | ||
90 | does not provide diagnostic information. | ||
91 | .Sh SEE ALSO | ||
92 | .Xr ssl 3 , | ||
93 | .Xr SSL_CTX_load_verify_locations 3 , | ||
94 | .Xr SSL_CTX_set_verify 3 , | ||
95 | .Xr SSL_get_verify_result 3 | ||
96 | .Sh HISTORY | ||
97 | Previous to OpenSSL 0.9.7, the | ||
98 | .Fa arg | ||
99 | argument to | ||
100 | .Fn SSL_CTX_set_cert_verify_callback | ||
101 | was ignored, and | ||
102 | .Fa callback | ||
103 | was called | ||
104 | simply as | ||
105 | .Ft int | ||
106 | .Fn (*callback) "X509_STORE_CTX *" . | ||
107 | To compile software written for previous versions of OpenSSL, | ||
108 | a dummy argument will have to be added to | ||
109 | .Fa callback . | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_cipher_list.3 b/src/lib/libssl/doc/SSL_CTX_set_cipher_list.3 new file mode 100644 index 0000000000..c3ee5304e3 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_cipher_list.3 | |||
@@ -0,0 +1,79 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CIPHER_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cipher_list , | ||
6 | .Nm SSL_set_cipher_list | ||
7 | .Nd choose list of available SSL_CIPHERs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft int | ||
11 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *str" | ||
12 | .Ft int | ||
13 | .Fn SSL_set_cipher_list "SSL *ssl" "const char *str" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_cipher_list | ||
16 | sets the list of available ciphers for | ||
17 | .Fa ctx | ||
18 | using the control string | ||
19 | .Fa str . | ||
20 | The format of the string is described | ||
21 | in | ||
22 | .Xr ciphers 1 . | ||
23 | The list of ciphers is inherited by all | ||
24 | .Fa ssl | ||
25 | objects created from | ||
26 | .Fa ctx . | ||
27 | .Pp | ||
28 | .Fn SSL_set_cipher_list | ||
29 | sets the list of ciphers only for | ||
30 | .Fa ssl . | ||
31 | .Sh NOTES | ||
32 | The control string | ||
33 | .Fa str | ||
34 | should be universally usable and not depend on details of the library | ||
35 | configuration (ciphers compiled in). | ||
36 | Thus no syntax checking takes place. | ||
37 | Items that are not recognized, because the corresponding ciphers are not | ||
38 | compiled in or because they are mistyped, are simply ignored. | ||
39 | Failure is only flagged if no ciphers could be collected at all. | ||
40 | .Pp | ||
41 | It should be noted that inclusion of a cipher to be used into the list is a | ||
42 | necessary condition. | ||
43 | On the client side, the inclusion into the list is also sufficient. | ||
44 | On the server side, additional restrictions apply. | ||
45 | All ciphers have additional requirements. | ||
46 | ADH ciphers don't need a certificate, but DH-parameters must have been set. | ||
47 | All other ciphers need a corresponding certificate and key. | ||
48 | .Pp | ||
49 | A RSA cipher can only be chosen when a RSA certificate is available. | ||
50 | RSA export ciphers with a keylength of 512 bits for the RSA key require a | ||
51 | temporary 512 bit RSA key, as typically the supplied key has a length of 1024 | ||
52 | bits (see | ||
53 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
54 | RSA ciphers using EDH need a certificate and key and additional DH-parameters | ||
55 | (see | ||
56 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
57 | .Pp | ||
58 | A DSA cipher can only be chosen when a DSA certificate is available. | ||
59 | DSA ciphers always use DH key exchange and therefore need DH-parameters (see | ||
60 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
61 | .Pp | ||
62 | When these conditions are not met for any cipher in the list (for example, a | ||
63 | client only supports export RSA ciphers with an asymmetric key length of 512 | ||
64 | bits and the server is not configured to use temporary RSA keys), the | ||
65 | .Dq no shared cipher | ||
66 | .Pq Dv SSL_R_NO_SHARED_CIPHER | ||
67 | error is generated and the handshake will fail. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_CTX_set_cipher_list | ||
70 | and | ||
71 | .Fn SSL_set_cipher_list | ||
72 | return 1 if any cipher could be selected and 0 on complete failure. | ||
73 | .Sh SEE ALSO | ||
74 | .Xr ciphers 1 , | ||
75 | .Xr ssl 3 , | ||
76 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
77 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
78 | .Xr SSL_CTX_use_certificate 3 , | ||
79 | .Xr SSL_get_ciphers 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_client_CA_list.3 b/src/lib/libssl/doc/SSL_CTX_set_client_CA_list.3 new file mode 100644 index 0000000000..5d6fa9bea1 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_client_CA_list.3 | |||
@@ -0,0 +1,129 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CLIENT_CA_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_client_CA_list , | ||
6 | .Nm SSL_set_client_CA_list , | ||
7 | .Nm SSL_CTX_add_client_CA , | ||
8 | .Nm SSL_add_client_CA | ||
9 | .Nd set list of CAs sent to the client when requesting a client certificate | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" | ||
14 | .Ft void | ||
15 | .Fn SSL_set_client_CA_list "SSL *s" "STACK_OF(X509_NAME) *list" | ||
16 | .Ft int | ||
17 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *cacert" | ||
18 | .Ft int | ||
19 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *cacert" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_client_CA_list | ||
22 | sets the | ||
23 | .Fa list | ||
24 | of CAs sent to the client when requesting a client certificate for | ||
25 | .Fa ctx . | ||
26 | .Pp | ||
27 | .Fn SSL_set_client_CA_list | ||
28 | sets the | ||
29 | .Fa list | ||
30 | of CAs sent to the client when requesting a client certificate for the chosen | ||
31 | .Fa ssl , | ||
32 | overriding the setting valid for | ||
33 | .Fa ssl Ns 's | ||
34 | .Vt SSL_CTX | ||
35 | object. | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_add_client_CA | ||
38 | adds the CA name extracted from | ||
39 | .Fa cacert | ||
40 | to the list of CAs sent to the client when requesting a client certificate for | ||
41 | .Fa ctx . | ||
42 | .Pp | ||
43 | .Fn SSL_add_client_CA | ||
44 | adds the CA name extracted from | ||
45 | .Fa cacert | ||
46 | to the list of CAs sent to the client when requesting a client certificate for | ||
47 | the chosen | ||
48 | .Fa ssl , | ||
49 | overriding the setting valid for | ||
50 | .Fa ssl Ns 's | ||
51 | .Va SSL_CTX | ||
52 | object. | ||
53 | .Sh NOTES | ||
54 | When a TLS/SSL server requests a client certificate (see | ||
55 | .Fn SSL_CTX_set_verify ) , | ||
56 | it sends a list of CAs for which it will accept certificates to the client. | ||
57 | .Pp | ||
58 | This list must explicitly be set using | ||
59 | .Fn SSL_CTX_set_client_CA_list | ||
60 | for | ||
61 | .Fa ctx | ||
62 | and | ||
63 | .Fn SSL_set_client_CA_list | ||
64 | for the specific | ||
65 | .Fa ssl . | ||
66 | The list specified overrides the previous setting. | ||
67 | The CAs listed do not become trusted | ||
68 | .Po | ||
69 | .Fa list | ||
70 | only contains the names, not the complete certificates | ||
71 | .Pc ; | ||
72 | use | ||
73 | .Xr SSL_CTX_load_verify_locations 3 | ||
74 | to additionally load them for verification. | ||
75 | .Pp | ||
76 | If the list of acceptable CAs is compiled in a file, the | ||
77 | .Xr SSL_load_client_CA_file 3 | ||
78 | function can be used to help importing the necessary data. | ||
79 | .Pp | ||
80 | .Fn SSL_CTX_add_client_CA | ||
81 | and | ||
82 | .Fn SSL_add_client_CA | ||
83 | can be used to add additional items the list of client CAs. | ||
84 | If no list was specified before using | ||
85 | .Fn SSL_CTX_set_client_CA_list | ||
86 | or | ||
87 | .Fn SSL_set_client_CA_list , | ||
88 | a new client CA list for | ||
89 | .Fa ctx | ||
90 | or | ||
91 | .Fa ssl | ||
92 | (as appropriate) is opened. | ||
93 | .Pp | ||
94 | These functions are only useful for TLS/SSL servers. | ||
95 | .Sh RETURN VALUES | ||
96 | .Fn SSL_CTX_set_client_CA_list | ||
97 | and | ||
98 | .Fn SSL_set_client_CA_list | ||
99 | do not return diagnostic information. | ||
100 | .Pp | ||
101 | .Fn SSL_CTX_add_client_CA | ||
102 | and | ||
103 | .Fn SSL_add_client_CA | ||
104 | have the following return values: | ||
105 | .Bl -tag -width Ds | ||
106 | .It 0 | ||
107 | A failure while manipulating the | ||
108 | .Dv STACK_OF Ns | ||
109 | .Pq Vt X509_NAME | ||
110 | object occurred or the | ||
111 | .Vt X509_NAME | ||
112 | could not be extracted from | ||
113 | .Fa cacert . | ||
114 | Check the error stack to find out the reason. | ||
115 | .It 1 | ||
116 | The operation succeeded. | ||
117 | .El | ||
118 | .Sh EXAMPLES | ||
119 | Scan all certificates in | ||
120 | .Fa CAfile | ||
121 | and list them as acceptable CAs: | ||
122 | .Bd -literal | ||
123 | SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile)); | ||
124 | .Ed | ||
125 | .Sh SEE ALSO | ||
126 | .Xr ssl 3 , | ||
127 | .Xr SSL_CTX_load_verify_locations 3 , | ||
128 | .Xr SSL_get_client_CA_list 3 , | ||
129 | .Xr SSL_load_client_CA_file 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3 new file mode 100644 index 0000000000..6aaa5f1016 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_client_cert_cb.3 | |||
@@ -0,0 +1,140 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CLIENT_CERT_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_client_cert_cb , | ||
6 | .Nm SSL_CTX_get_client_cert_cb | ||
7 | .Nd handle client certificate callback function | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fo SSL_CTX_set_client_cert_cb | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa "int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
14 | .Fc | ||
15 | .Ft int | ||
16 | .Fo "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
17 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn "(*client_cert_cb)" "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
21 | .Sh DESCRIPTION | ||
22 | .Fn SSL_CTX_set_client_cert_cb | ||
23 | sets the | ||
24 | .Fa client_cert_cb() | ||
25 | callback that is called when a client certificate is requested by a server and | ||
26 | no certificate was yet set for the SSL object. | ||
27 | .Pp | ||
28 | When | ||
29 | .Fa client_cert_cb | ||
30 | is | ||
31 | .Dv NULL , | ||
32 | no callback function is used. | ||
33 | .Pp | ||
34 | .Fn SSL_CTX_get_client_cert_cb | ||
35 | returns a pointer to the currently set callback function. | ||
36 | .Pp | ||
37 | .Fn client_cert_cb | ||
38 | is the application-defined callback. | ||
39 | If it wants to set a certificate, | ||
40 | a certificate/private key combination must be set using the | ||
41 | .Fa x509 | ||
42 | and | ||
43 | .Fa pkey | ||
44 | arguments and 1 must be returned. | ||
45 | The certificate will be installed into | ||
46 | .Fa ssl ; | ||
47 | see the | ||
48 | .Sx NOTES | ||
49 | and | ||
50 | .Sx BUGS | ||
51 | sections. | ||
52 | If no certificate should be set, | ||
53 | 0 has to be returned and no certificate will be sent. | ||
54 | A negative return value will suspend the handshake and the handshake function | ||
55 | will return immediately. | ||
56 | .Xr SSL_get_error 3 | ||
57 | will return | ||
58 | .Dv SSL_ERROR_WANT_X509_LOOKUP | ||
59 | to indicate that the handshake was suspended. | ||
60 | The next call to the handshake function will again lead to the call of | ||
61 | .Fa client_cert_cb() . | ||
62 | It is the job of the | ||
63 | .Fa client_cert_cb() | ||
64 | to store information | ||
65 | about the state of the last call, if required to continue. | ||
66 | .Sh NOTES | ||
67 | During a handshake (or renegotiation) | ||
68 | a server may request a certificate from the client. | ||
69 | A client certificate must only be sent when the server did send the request. | ||
70 | .Pp | ||
71 | When a certificate has been set using the | ||
72 | .Xr SSL_CTX_use_certificate 3 | ||
73 | family of functions, | ||
74 | it will be sent to the server. | ||
75 | The TLS standard requires that only a certificate is sent if it matches the | ||
76 | list of acceptable CAs sent by the server. | ||
77 | This constraint is violated by the default behavior of the OpenSSL library. | ||
78 | Using the callback function it is possible to implement a proper selection | ||
79 | routine or to allow a user interaction to choose the certificate to be sent. | ||
80 | .Pp | ||
81 | If a callback function is defined and no certificate was yet defined for the | ||
82 | .Vt SSL | ||
83 | object, the callback function will be called. | ||
84 | If the callback function returns a certificate, the OpenSSL library | ||
85 | will try to load the private key and certificate data into the | ||
86 | .Vt SSL | ||
87 | object using the | ||
88 | .Fn SSL_use_certificate | ||
89 | and | ||
90 | .Fn SSL_use_private_key | ||
91 | functions. | ||
92 | Thus it will permanently install the certificate and key for this SSL object. | ||
93 | It will not be reset by calling | ||
94 | .Xr SSL_clear 3 . | ||
95 | If the callback returns no certificate, the OpenSSL library will not send a | ||
96 | certificate. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr ssl 3 , | ||
99 | .Xr SSL_clear 3 , | ||
100 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
101 | .Xr SSL_CTX_use_certificate 3 , | ||
102 | .Xr SSL_free 3 , | ||
103 | .Xr SSL_get_client_CA_list 3 | ||
104 | .Sh BUGS | ||
105 | The | ||
106 | .Fa client_cert_cb() | ||
107 | cannot return a complete certificate chain; | ||
108 | it can only return one client certificate. | ||
109 | If the chain only has a length of 2, | ||
110 | the root CA certificate may be omitted according to the TLS standard and | ||
111 | thus a standard conforming answer can be sent to the server. | ||
112 | For a longer chain, the client must send the complete chain | ||
113 | (with the option to leave out the root CA certificate). | ||
114 | This can be accomplished only by either adding the intermediate CA certificates | ||
115 | into the trusted certificate store for the | ||
116 | .Vt SSL_CTX | ||
117 | object (resulting in having to add CA certificates that otherwise maybe would | ||
118 | not be trusted), or by adding the chain certificates using the | ||
119 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
120 | function, which is only available for the | ||
121 | .Vt SSL_CTX | ||
122 | object as a whole and that therefore probably can only apply for one client | ||
123 | certificate, making the concept of the callback function | ||
124 | (to allow the choice from several certificates) questionable. | ||
125 | .Pp | ||
126 | Once the | ||
127 | .Vt SSL | ||
128 | object has been used in conjunction with the callback function, | ||
129 | the certificate will be set for the | ||
130 | .Vt SSL | ||
131 | object and will not be cleared even when | ||
132 | .Xr SSL_clear 3 | ||
133 | is called. | ||
134 | It is therefore | ||
135 | .Em mandatory | ||
136 | to destroy the | ||
137 | .Vt SSL | ||
138 | object using | ||
139 | .Xr SSL_free 3 | ||
140 | and create a new one to return to the previous state. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 new file mode 100644 index 0000000000..2c35ed501c --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_default_passwd_cb.3 | |||
@@ -0,0 +1,92 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_default_passwd_cb , | ||
6 | .Nm SSL_CTX_set_default_passwd_cb_userdata | ||
7 | .Nd set passwd callback for encrypted PEM file handling | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_default_passwd_cb_userdata "SSL_CTX *ctx" "void *u" | ||
14 | .Ft int | ||
15 | .Fn pem_passwd_cb "char *buf" "int size" "int rwflag" "void *userdata" | ||
16 | .Sh DESCRIPTION | ||
17 | .Fn SSL_CTX_set_default_passwd_cb | ||
18 | sets the default password callback called when loading/storing a PEM | ||
19 | certificate with encryption. | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
22 | sets a pointer to userdata | ||
23 | .Fa u | ||
24 | which will be provided to the password callback on invocation. | ||
25 | .Pp | ||
26 | The | ||
27 | .Fn pem_passwd_cb , | ||
28 | which must be provided by the application, | ||
29 | hands back the password to be used during decryption. | ||
30 | On invocation a pointer to | ||
31 | .Fa userdata | ||
32 | is provided. | ||
33 | The pem_passwd_cb must write the password into the provided buffer | ||
34 | .Fa buf | ||
35 | which is of size | ||
36 | .Fa size . | ||
37 | The actual length of the password must be returned to the calling function. | ||
38 | .Fa rwflag | ||
39 | indicates whether the callback is used for reading/decryption | ||
40 | .Pq Fa rwflag No = 0 | ||
41 | or writing/encryption | ||
42 | .Pq Fa rwflag No = 1 . | ||
43 | .Sh NOTES | ||
44 | When loading or storing private keys, a password might be supplied to protect | ||
45 | the private key. | ||
46 | The way this password can be supplied may depend on the application. | ||
47 | If only one private key is handled, it can be practical to have | ||
48 | .Fn pem_passwd_cb | ||
49 | handle the password dialog interactively. | ||
50 | If several keys have to be handled, it can be practical to ask for the password | ||
51 | once, then keep it in memory and use it several times. | ||
52 | In the last case, the password could be stored into the | ||
53 | .Fa userdata | ||
54 | storage and the | ||
55 | .Fn pem_passwd_cb | ||
56 | only returns the password already stored. | ||
57 | .Pp | ||
58 | When asking for the password interactively, | ||
59 | .Fn pem_passwd_cb | ||
60 | can use | ||
61 | .Fa rwflag | ||
62 | to check whether an item shall be encrypted | ||
63 | .Pq Fa rwflag No = 1 . | ||
64 | In this case the password dialog may ask for the same password twice for | ||
65 | comparison in order to catch typos which would make decryption impossible. | ||
66 | .Pp | ||
67 | Other items in PEM formatting (certificates) can also be encrypted; it is | ||
68 | however atypical, as certificate information is considered public. | ||
69 | .Sh RETURN VALUES | ||
70 | .Fn SSL_CTX_set_default_passwd_cb | ||
71 | and | ||
72 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
73 | do not provide diagnostic information. | ||
74 | .Sh EXAMPLES | ||
75 | The following example returns the password provided as | ||
76 | .Fa userdata | ||
77 | to the calling function. | ||
78 | The password is considered to be a | ||
79 | .Sq \e0 | ||
80 | terminated string. | ||
81 | If the password does not fit into the buffer, the password is truncated. | ||
82 | .Bd -literal | ||
83 | int pem_passwd_cb(char *buf, int size, int rwflag, void *password) | ||
84 | { | ||
85 | strncpy(buf, (char *)password, size); | ||
86 | buf[size - 1] = '\e0'; | ||
87 | return strlen(buf); | ||
88 | } | ||
89 | .Ed | ||
90 | .Sh SEE ALSO | ||
91 | .Xr ssl 3 , | ||
92 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/doc/SSL_CTX_set_generate_session_id.3 new file mode 100644 index 0000000000..e2e2a70362 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_generate_session_id.3 | |||
@@ -0,0 +1,193 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_generate_session_id , | ||
6 | .Nm SSL_set_generate_session_id , | ||
7 | .Nm SSL_has_matching_session_id | ||
8 | .Nd manipulate generation of SSL session IDs (server only) | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Bd -literal | ||
12 | typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, | ||
13 | unsigned int *id_len); | ||
14 | .Ed | ||
15 | .Ft int | ||
16 | .Fn SSL_CTX_set_generate_session_id "SSL_CTX *ctx" "GEN_SESSION_CB cb" | ||
17 | .Ft int | ||
18 | .Fn SSL_set_generate_session_id "SSL *ssl" "GEN_SESSION_CB" "cb);" | ||
19 | .Ft int | ||
20 | .Fo SSL_has_matching_session_id | ||
21 | .Fa "const SSL *ssl" "const unsigned char *id" "unsigned int id_len" | ||
22 | .Fc | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_CTX_set_generate_session_id | ||
25 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
26 | for | ||
27 | .Fa ctx | ||
28 | to be | ||
29 | .Fa cb . | ||
30 | .Pp | ||
31 | .Fn SSL_set_generate_session_id | ||
32 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
33 | for | ||
34 | .Fa ssl | ||
35 | to be | ||
36 | .Fa cb . | ||
37 | .Pp | ||
38 | .Fn SSL_has_matching_session_id | ||
39 | checks, whether a session with id | ||
40 | .Fa id | ||
41 | (of length | ||
42 | .Fa id_len ) | ||
43 | is already contained in the internal session cache | ||
44 | of the parent context of | ||
45 | .Fa ssl . | ||
46 | .Sh NOTES | ||
47 | When a new session is established between client and server, | ||
48 | the server generates a session id. | ||
49 | The session id is an arbitrary sequence of bytes. | ||
50 | The length of the session id is 16 bytes for SSLv2 sessions and between 1 and | ||
51 | 32 bytes for SSLv3/TLSv1. | ||
52 | The session id is not security critical but must be unique for the server. | ||
53 | Additionally, the session id is transmitted in the clear when reusing the | ||
54 | session so it must not contain sensitive information. | ||
55 | .Pp | ||
56 | Without a callback being set, an OpenSSL server will generate a unique session | ||
57 | id from pseudo random numbers of the maximum possible length. | ||
58 | Using the callback function, the session id can be changed to contain | ||
59 | additional information like, e.g., a host id in order to improve load balancing | ||
60 | or external caching techniques. | ||
61 | .Pp | ||
62 | The callback function receives a pointer to the memory location to put | ||
63 | .Fa id | ||
64 | into and a pointer to the maximum allowed length | ||
65 | .Fa id_len . | ||
66 | The buffer at location | ||
67 | .Fa id | ||
68 | is only guaranteed to have the size | ||
69 | .Fa id_len . | ||
70 | The callback is only allowed to generate a shorter id and reduce | ||
71 | .Fa id_len ; | ||
72 | the callback | ||
73 | .Em must never | ||
74 | increase | ||
75 | .Fa id_len | ||
76 | or write to the location | ||
77 | .Fa id | ||
78 | exceeding the given limit. | ||
79 | .Pp | ||
80 | If a SSLv2 session id is generated and | ||
81 | .Fa id_len | ||
82 | is reduced, it will be restored after the callback has finished and the session | ||
83 | id will be padded with 0x00. | ||
84 | It is not recommended to change the | ||
85 | .Fa id_len | ||
86 | for SSLv2 sessions. | ||
87 | The callback can use the | ||
88 | .Xr SSL_get_version 3 | ||
89 | function to check whether the session is of type SSLv2. | ||
90 | .Pp | ||
91 | The location | ||
92 | .Fa id | ||
93 | is filled with 0x00 before the callback is called, | ||
94 | so the callback may only fill part of the possible length and leave | ||
95 | .Fa id_len | ||
96 | untouched while maintaining reproducibility. | ||
97 | .Pp | ||
98 | Since the sessions must be distinguished, session ids must be unique. | ||
99 | Without the callback a random number is used, | ||
100 | so that the probability of generating the same session id is extremely small | ||
101 | (2^128 possible ids for an SSLv2 session, 2^256 for SSLv3/TLSv1). | ||
102 | In order to ensure the uniqueness of the generated session id, | ||
103 | the callback must call | ||
104 | .Fn SSL_has_matching_session_id | ||
105 | and generate another id if a conflict occurs. | ||
106 | If an id conflict is not resolved, the handshake will fail. | ||
107 | If the application codes, e.g., a unique host id, a unique process number, and | ||
108 | a unique sequence number into the session id, uniqueness could easily be | ||
109 | achieved without randomness added (it should however be taken care that | ||
110 | no confidential information is leaked this way). | ||
111 | If the application cannot guarantee uniqueness, | ||
112 | it is recommended to use the maximum | ||
113 | .Fa id_len | ||
114 | and fill in the bytes not used to code special information with random data to | ||
115 | avoid collisions. | ||
116 | .Pp | ||
117 | .Fn SSL_has_matching_session_id | ||
118 | will only query the internal session cache, not the external one. | ||
119 | Since the session id is generated before the handshake is completed, | ||
120 | it is not immediately added to the cache. | ||
121 | If another thread is using the same internal session cache, | ||
122 | a race condition can occur in that another thread generates the same session id. | ||
123 | Collisions can also occur when using an external session cache, | ||
124 | since the external cache is not tested with | ||
125 | .Fn SSL_has_matching_session_id | ||
126 | and the same race condition applies. | ||
127 | .Pp | ||
128 | When calling | ||
129 | .Fn SSL_has_matching_session_id | ||
130 | for an SSLv2 session with reduced | ||
131 | .Fa id_len Ns , | ||
132 | the match operation will be performed using the fixed length required and with | ||
133 | a 0x00 padded id. | ||
134 | .Pp | ||
135 | The callback must return 0 if it cannot generate a session id for whatever | ||
136 | reason and return 1 on success. | ||
137 | .Sh RETURN VALUES | ||
138 | .Fn SSL_CTX_set_generate_session_id | ||
139 | and | ||
140 | .Fn SSL_set_generate_session_id | ||
141 | always return 1. | ||
142 | .Pp | ||
143 | .Fn SSL_has_matching_session_id | ||
144 | returns 1 if another session with the same id is already in the cache. | ||
145 | .Sh EXAMPLES | ||
146 | The callback function listed will generate a session id with the server id | ||
147 | given, and will fill the rest with pseudo random bytes: | ||
148 | .Bd -literal | ||
149 | const char session_id_prefix = "www-18"; | ||
150 | |||
151 | #define MAX_SESSION_ID_ATTEMPTS 10 | ||
152 | static int | ||
153 | generate_session_id(const SSL *ssl, unsigned char *id, | ||
154 | unsigned int *id_len) | ||
155 | { | ||
156 | unsigned int count = 0; | ||
157 | const char *version; | ||
158 | |||
159 | version = SSL_get_version(ssl); | ||
160 | if (!strcmp(version, "SSLv2")) { | ||
161 | /* we must not change id_len */ | ||
162 | ; | ||
163 | } | ||
164 | |||
165 | do { | ||
166 | RAND_pseudo_bytes(id, *id_len); | ||
167 | /* | ||
168 | * Prefix the session_id with the required prefix. NB: If | ||
169 | * our prefix is too long, clip it \(en but there will be | ||
170 | * worse effects anyway, e.g., the server could only | ||
171 | * possibly create one session ID (the prefix!) so all | ||
172 | * future session negotiations will fail due to conflicts. | ||
173 | */ | ||
174 | memcpy(id, session_id_prefix, | ||
175 | (strlen(session_id_prefix) < *id_len) ? | ||
176 | strlen(session_id_prefix) : *id_len); | ||
177 | } while (SSL_has_matching_session_id(ssl, id, *id_len) && | ||
178 | (++count < MAX_SESSION_ID_ATTEMPTS)); | ||
179 | |||
180 | if (count >= MAX_SESSION_ID_ATTEMPTS) | ||
181 | return 0; | ||
182 | return 1; | ||
183 | } | ||
184 | .Ed | ||
185 | .Sh SEE ALSO | ||
186 | .Xr ssl 3 , | ||
187 | .Xr SSL_get_version 3 | ||
188 | .Sh HISTORY | ||
189 | .Fn SSL_CTX_set_generate_session_id , | ||
190 | .Fn SSL_set_generate_session_id | ||
191 | and | ||
192 | .Fn SSL_has_matching_session_id | ||
193 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_info_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_info_callback.3 new file mode 100644 index 0000000000..dcf298addf --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_info_callback.3 | |||
@@ -0,0 +1,164 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_INFO_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_info_callback , | ||
6 | .Nm SSL_CTX_get_info_callback , | ||
7 | .Nm SSL_set_info_callback , | ||
8 | .Nm SSL_get_info_callback | ||
9 | .Nd handle information callback for SSL connections | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_info_callback "SSL_CTX *ctx" "void (*callback)()" | ||
14 | .Ft void | ||
15 | .Fn "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
16 | .Ft void | ||
17 | .Fn SSL_set_info_callback "SSL *ssl" "void (*callback)()" | ||
18 | .Ft void | ||
19 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_info_callback | ||
22 | sets the | ||
23 | .Fa callback | ||
24 | function that can be used to obtain state information for SSL objects created | ||
25 | from | ||
26 | .Fa ctx | ||
27 | during connection setup and use. | ||
28 | The setting for | ||
29 | .Fa ctx | ||
30 | is overridden from the setting for a specific SSL object, if specified. | ||
31 | When | ||
32 | .Fa callback | ||
33 | is | ||
34 | .Dv NULL , | ||
35 | no callback function is used. | ||
36 | .Pp | ||
37 | .Fn SSL_set_info_callback | ||
38 | sets the | ||
39 | .Fa callback | ||
40 | function that can be used to | ||
41 | obtain state information for | ||
42 | .Fa ssl | ||
43 | during connection setup and use. | ||
44 | When | ||
45 | .Fa callback | ||
46 | is | ||
47 | .Dv NULL , | ||
48 | the callback setting currently valid for | ||
49 | .Fa ctx | ||
50 | is used. | ||
51 | .Pp | ||
52 | .Fn SSL_CTX_get_info_callback | ||
53 | returns a pointer to the currently set information callback function for | ||
54 | .Fa ctx . | ||
55 | .Pp | ||
56 | .Fn SSL_get_info_callback | ||
57 | returns a pointer to the currently set information callback function for | ||
58 | .Fa ssl . | ||
59 | .Sh NOTES | ||
60 | When setting up a connection and during use, | ||
61 | it is possible to obtain state information from the SSL/TLS engine. | ||
62 | When set, an information callback function is called whenever the state changes, | ||
63 | an alert appears, or an error occurs. | ||
64 | .Pp | ||
65 | The callback function is called as | ||
66 | .Fn callback "SSL *ssl" "int where" "int ret" . | ||
67 | The | ||
68 | .Fa where | ||
69 | argument specifies information about where (in which context) | ||
70 | the callback function was called. | ||
71 | If | ||
72 | .Fa ret | ||
73 | is 0, an error condition occurred. | ||
74 | If an alert is handled, | ||
75 | .Dv SSL_CB_ALERT | ||
76 | is set and | ||
77 | .Fa ret | ||
78 | specifies the alert information. | ||
79 | .Pp | ||
80 | .Fa where | ||
81 | is a bitmask made up of the following bits: | ||
82 | .Bl -tag -width Ds | ||
83 | .It Dv SSL_CB_LOOP | ||
84 | Callback has been called to indicate state change inside a loop. | ||
85 | .It Dv SSL_CB_EXIT | ||
86 | Callback has been called to indicate error exit of a handshake function. | ||
87 | (May be soft error with retry option for non-blocking setups.) | ||
88 | .It Dv SSL_CB_READ | ||
89 | Callback has been called during read operation. | ||
90 | .It Dv SSL_CB_WRITE | ||
91 | Callback has been called during write operation. | ||
92 | .It Dv SSL_CB_ALERT | ||
93 | Callback has been called due to an alert being sent or received. | ||
94 | .It Dv SSL_CB_READ_ALERT | ||
95 | .It Dv SSL_CB_WRITE_ALERT | ||
96 | .It Dv SSL_CB_ACCEPT_LOOP | ||
97 | .It Dv SSL_CB_ACCEPT_EXIT | ||
98 | .It Dv SSL_CB_CONNECT_LOOP | ||
99 | .It Dv SSL_CB_CONNECT_EXIT | ||
100 | .It Dv SSL_CB_HANDSHAKE_START | ||
101 | Callback has been called because a new handshake is started. | ||
102 | .It Dv SSL_CB_HANDSHAKE_DONE | ||
103 | Callback has been called because a handshake is finished. | ||
104 | .El | ||
105 | .Pp | ||
106 | The current state information can be obtained using the | ||
107 | .Xr SSL_state_string 3 | ||
108 | family of functions. | ||
109 | .Pp | ||
110 | The | ||
111 | .Fa ret | ||
112 | information can be evaluated using the | ||
113 | .Xr SSL_alert_type_string 3 | ||
114 | family of functions. | ||
115 | .Sh RETURN VALUES | ||
116 | .Fn SSL_set_info_callback | ||
117 | does not provide diagnostic information. | ||
118 | .Pp | ||
119 | .Fn SSL_get_info_callback | ||
120 | returns the current setting. | ||
121 | .Sh EXAMPLES | ||
122 | The following example callback function prints state strings, | ||
123 | information about alerts being handled and error messages to the | ||
124 | .Va bio_err | ||
125 | .Vt BIO . | ||
126 | .Bd -literal | ||
127 | void | ||
128 | apps_ssl_info_callback(SSL *s, int where, int ret) | ||
129 | { | ||
130 | const char *str; | ||
131 | int w; | ||
132 | |||
133 | w = where & ~SSL_ST_MASK; | ||
134 | |||
135 | if (w & SSL_ST_CONNECT) | ||
136 | str = "SSL_connect"; | ||
137 | else if (w & SSL_ST_ACCEPT) | ||
138 | str = "SSL_accept"; | ||
139 | else | ||
140 | str = "undefined"; | ||
141 | |||
142 | if (where & SSL_CB_LOOP) { | ||
143 | BIO_printf(bio_err, "%s:%s\en", str, | ||
144 | SSL_state_string_long(s)); | ||
145 | } else if (where & SSL_CB_ALERT) { | ||
146 | str = (where & SSL_CB_READ) ? "read" : "write"; | ||
147 | BIO_printf(bio_err, "SSL3 alert %s:%s:%s\en", str, | ||
148 | SSL_alert_type_string_long(ret), | ||
149 | SSL_alert_desc_string_long(ret)); | ||
150 | } else if (where & SSL_CB_EXIT) { | ||
151 | if (ret == 0) | ||
152 | BIO_printf(bio_err, "%s:failed in %s\en", | ||
153 | str, SSL_state_string_long(s)); | ||
154 | else if (ret < 0) { | ||
155 | BIO_printf(bio_err, "%s:error in %s\en", | ||
156 | str, SSL_state_string_long(s)); | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | .Ed | ||
161 | .Sh SEE ALSO | ||
162 | .Xr ssl 3 , | ||
163 | .Xr SSL_alert_type_string 3 , | ||
164 | .Xr SSL_state_string 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_max_cert_list.3 b/src/lib/libssl/doc/SSL_CTX_set_max_cert_list.3 new file mode 100644 index 0000000000..7380884867 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_max_cert_list.3 | |||
@@ -0,0 +1,102 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MAX_CERT_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_max_cert_list , | ||
6 | .Nm SSL_CTX_get_max_cert_list , | ||
7 | .Nm SSL_set_max_cert_list , | ||
8 | .Nm SSL_get_max_cert_list | ||
9 | .Nd manipulate allowed size for the peer's certificate chain | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" | ||
14 | .Ft long | ||
15 | .Fn SSL_CTX_get_max_cert_list "SSL_CTX *ctx" | ||
16 | .Ft long | ||
17 | .Fn SSL_set_max_cert_list "SSL *ssl" "long size" | ||
18 | .Ft long | ||
19 | .Fn SSL_get_max_cert_list "SSL *ctx" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_max_cert_list | ||
22 | sets the maximum size allowed for the peer's certificate chain for all | ||
23 | .Vt SSL | ||
24 | objects created from | ||
25 | .Fa ctx | ||
26 | to be | ||
27 | .Fa size | ||
28 | bytes. | ||
29 | The | ||
30 | .Vt SSL | ||
31 | objects inherit the setting valid for | ||
32 | .Fa ctx | ||
33 | at the time | ||
34 | .Xr SSL_new 3 | ||
35 | is being called. | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_get_max_cert_list | ||
38 | returns the currently set maximum size for | ||
39 | .Fa ctx . | ||
40 | .Pp | ||
41 | .Fn SSL_set_max_cert_list | ||
42 | sets the maximum size allowed for the peer's certificate chain for | ||
43 | .Fa ssl | ||
44 | to be | ||
45 | .Fa size | ||
46 | bytes. | ||
47 | This setting stays valid until a new value is set. | ||
48 | .Pp | ||
49 | .Fn SSL_get_max_cert_list | ||
50 | returns the currently set maximum size for | ||
51 | .Fa ssl . | ||
52 | .Sh NOTES | ||
53 | During the handshake process, the peer may send a certificate chain. | ||
54 | The TLS/SSL standard does not give any maximum size of the certificate chain. | ||
55 | The OpenSSL library handles incoming data by a dynamically allocated buffer. | ||
56 | In order to prevent this buffer from growing without bound due to data | ||
57 | received from a faulty or malicious peer, a maximum size for the certificate | ||
58 | chain is set. | ||
59 | .Pp | ||
60 | The default value for the maximum certificate chain size is 100kB (30kB | ||
61 | on the 16bit DOS platform). | ||
62 | This should be sufficient for usual certificate chains | ||
63 | (OpenSSL's default maximum chain length is 10, see | ||
64 | .Xr SSL_CTX_set_verify 3 , | ||
65 | and certificates without special extensions have a typical size of 1-2kB). | ||
66 | .Pp | ||
67 | For special applications it can be necessary to extend the maximum certificate | ||
68 | chain size allowed to be sent by the peer. | ||
69 | See for example the work on | ||
70 | .%T "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" | ||
71 | and | ||
72 | .%T "TLS Delegation Protocol" | ||
73 | at | ||
74 | .Lk http://www.ietf.org/ | ||
75 | and | ||
76 | .Lk http://www.globus.org/ . | ||
77 | .Pp | ||
78 | Under normal conditions it should never be necessary to set a value smaller | ||
79 | than the default, as the buffer is handled dynamically and only uses the | ||
80 | memory actually required by the data sent by the peer. | ||
81 | .Pp | ||
82 | If the maximum certificate chain size allowed is exceeded, the handshake will | ||
83 | fail with a | ||
84 | .Dv SSL_R_EXCESSIVE_MESSAGE_SIZE | ||
85 | error. | ||
86 | .Sh RETURN VALUES | ||
87 | .Fn SSL_CTX_set_max_cert_list | ||
88 | and | ||
89 | .Fn SSL_set_max_cert_list | ||
90 | return the previously set value. | ||
91 | .Pp | ||
92 | .Fn SSL_CTX_get_max_cert_list | ||
93 | and | ||
94 | .Fn SSL_get_max_cert_list | ||
95 | return the currently set value. | ||
96 | .Sh SEE ALSO | ||
97 | .Xr ssl 3 , | ||
98 | .Xr SSL_CTX_set_verify 3 , | ||
99 | .Xr SSL_new 3 | ||
100 | .Sh HISTORY | ||
101 | .Fn SSL*_set/get_max_cert_list | ||
102 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_mode.3 b/src/lib/libssl/doc/SSL_CTX_set_mode.3 new file mode 100644 index 0000000000..b980d43dbe --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_mode.3 | |||
@@ -0,0 +1,123 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_mode , | ||
6 | .Nm SSL_set_mode , | ||
7 | .Nm SSL_CTX_get_mode , | ||
8 | .Nm SSL_get_mode | ||
9 | .Nd manipulate SSL engine mode | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" | ||
14 | .Ft long | ||
15 | .Fn SSL_set_mode "SSL *ssl" "long mode" | ||
16 | .Ft long | ||
17 | .Fn SSL_CTX_get_mode "SSL_CTX *ctx" | ||
18 | .Ft long | ||
19 | .Fn SSL_get_mode "SSL *ssl" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_mode | ||
22 | adds the mode set via bitmask in | ||
23 | .Fa mode | ||
24 | to | ||
25 | .Fa ctx . | ||
26 | Options already set before are not cleared. | ||
27 | .Pp | ||
28 | .Fn SSL_set_mode | ||
29 | adds the mode set via bitmask in | ||
30 | .Fa mode | ||
31 | to | ||
32 | .Fa ssl . | ||
33 | Options already set before are not cleared. | ||
34 | .Pp | ||
35 | .Fn SSL_CTX_get_mode | ||
36 | returns the mode set for | ||
37 | .Fa ctx . | ||
38 | .Pp | ||
39 | .Fn SSL_get_mode | ||
40 | returns the mode set for | ||
41 | .Fa ssl . | ||
42 | .Sh NOTES | ||
43 | The following mode changes are available: | ||
44 | .Bl -tag -width Ds | ||
45 | .It Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
46 | Allow | ||
47 | .Fn SSL_write ... n | ||
48 | to return | ||
49 | .Ms r | ||
50 | with | ||
51 | .EQ | ||
52 | 0 < r < n | ||
53 | .EN | ||
54 | (i.e., report success when just a single record has been written). | ||
55 | When not set (the default), | ||
56 | .Xr SSL_write 3 | ||
57 | will only report success once the complete chunk was written. | ||
58 | Once | ||
59 | .Xr SSL_write 3 | ||
60 | returns with | ||
61 | .Ms r , | ||
62 | .Ms r | ||
63 | bytes have been successfully written and the next call to | ||
64 | .Xr SSL_write 3 | ||
65 | must only send the | ||
66 | .Ms n \(mi r | ||
67 | bytes left, imitating the behaviour of | ||
68 | .Xr write 2 . | ||
69 | .It Dv SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | ||
70 | Make it possible to retry | ||
71 | .Xr SSL_write 3 | ||
72 | with changed buffer location (the buffer contents must stay the same). | ||
73 | This is not the default to avoid the misconception that non-blocking | ||
74 | .Xr SSL_write 3 | ||
75 | behaves like non-blocking | ||
76 | .Xr write 2 . | ||
77 | .It Dv SSL_MODE_AUTO_RETRY | ||
78 | Never bother the application with retries if the transport is blocking. | ||
79 | If a renegotiation take place during normal operation, a | ||
80 | .Xr SSL_read 3 | ||
81 | or | ||
82 | .Xr SSL_write 3 | ||
83 | would return | ||
84 | with \(mi1 and indicate the need to retry with | ||
85 | .Dv SSL_ERROR_WANT_READ . | ||
86 | In a non-blocking environment applications must be prepared to handle | ||
87 | incomplete read/write operations. | ||
88 | In a blocking environment, applications are not always prepared to deal with | ||
89 | read/write operations returning without success report. | ||
90 | The flag | ||
91 | .Dv SSL_MODE_AUTO_RETRY | ||
92 | will cause read/write operations to only return after the handshake and | ||
93 | successful completion. | ||
94 | .It Dv SSL_MODE_RELEASE_BUFFERS | ||
95 | When we no longer need a read buffer or a write buffer for a given | ||
96 | .Vt SSL , | ||
97 | then release the memory we were using to hold it. | ||
98 | Released memory is either appended to a list of unused RAM chunks on the | ||
99 | .Vt SSL_CTX , | ||
100 | or simply freed if the list of unused chunks would become longer than | ||
101 | .Va "SSL_CTX->freelist_max_len" , | ||
102 | which defaults to 32. | ||
103 | Using this flag can save around 34k per idle SSL connection. | ||
104 | This flag has no effect on SSL v2 connections, or on DTLS connections. | ||
105 | .El | ||
106 | .Sh RETURN VALUES | ||
107 | .Fn SSL_CTX_set_mode | ||
108 | and | ||
109 | .Fn SSL_set_mode | ||
110 | return the new mode bitmask after adding | ||
111 | .Fa mode . | ||
112 | .Pp | ||
113 | .Fn SSL_CTX_get_mode | ||
114 | and | ||
115 | .Fn SSL_get_mode | ||
116 | return the current bitmask. | ||
117 | .Sh SEE ALSO | ||
118 | .Xr ssl 3 , | ||
119 | .Xr SSL_read 3 , | ||
120 | .Xr SSL_write 3 | ||
121 | .Sh HISTORY | ||
122 | .Dv SSL_MODE_AUTO_RETRY | ||
123 | was added in OpenSSL 0.9.6. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_msg_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_msg_callback.3 new file mode 100644 index 0000000000..82c1479af0 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_msg_callback.3 | |||
@@ -0,0 +1,132 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MSG_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_msg_callback , | ||
6 | .Nm SSL_CTX_set_msg_callback_arg , | ||
7 | .Nm SSL_set_msg_callback , | ||
8 | .Nm SSL_get_msg_callback_arg | ||
9 | .Nd install callback for observing protocol messages | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_msg_callback | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
16 | .Fc | ||
17 | .Ft void | ||
18 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
19 | .Ft void | ||
20 | .Fo SSL_set_msg_callback | ||
21 | .Fa "SSL *ssl" | ||
22 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fn SSL_set_msg_callback_arg "SSL *ssl" "void *arg" | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_set_msg_callback | ||
28 | or | ||
29 | .Fn SSL_set_msg_callback | ||
30 | can be used to define a message callback function | ||
31 | .Fa cb | ||
32 | for observing all SSL/TLS protocol messages (such as handshake messages) | ||
33 | that are received or sent. | ||
34 | .Fn SSL_CTX_set_msg_callback_arg | ||
35 | and | ||
36 | .Fn SSL_set_msg_callback_arg | ||
37 | can be used to set argument | ||
38 | .Fa arg | ||
39 | to the callback function, which is available for arbitrary application use. | ||
40 | .Pp | ||
41 | .Fn SSL_CTX_set_msg_callback | ||
42 | and | ||
43 | .Fn SSL_CTX_set_msg_callback_arg | ||
44 | specify default settings that will be copied to new | ||
45 | .Vt SSL | ||
46 | objects by | ||
47 | .Xr SSL_new 3 . | ||
48 | .Fn SSL_set_msg_callback | ||
49 | and | ||
50 | .Fn SSL_set_msg_callback_arg | ||
51 | modify the actual settings of an | ||
52 | .Vt SSL | ||
53 | object. | ||
54 | Using a | ||
55 | .Dv NULL | ||
56 | pointer for | ||
57 | .Fa cb | ||
58 | disables the message callback. | ||
59 | .Pp | ||
60 | When | ||
61 | .Fa cb | ||
62 | is called by the SSL/TLS library for a protocol message, | ||
63 | the function arguments have the following meaning: | ||
64 | .Bl -tag -width Ds | ||
65 | .It Fa write_p | ||
66 | This flag is 0 when a protocol message has been received and 1 when a protocol | ||
67 | message has been sent. | ||
68 | .It Fa version | ||
69 | The protocol version according to which the protocol message is | ||
70 | interpreted by the library. | ||
71 | Currently, this is one of | ||
72 | .Dv SSL2_VERSION , | ||
73 | .Dv SSL3_VERSION | ||
74 | and | ||
75 | .Dv TLS1_VERSION | ||
76 | (for SSL 2.0, SSL 3.0 and TLS 1.0, respectively). | ||
77 | .It Fa content_type | ||
78 | In the case of SSL 2.0, this is always 0. | ||
79 | In the case of SSL 3.0 or TLS 1.0, this is one of the | ||
80 | .Em ContentType | ||
81 | values defined in the protocol specification | ||
82 | .Po | ||
83 | .Dq change_cipher_spec(20) , | ||
84 | .Dq alert(21) , | ||
85 | .Dq handshake(22) ; | ||
86 | but never | ||
87 | .Dq application_data(23) | ||
88 | because the callback will only be called for protocol messages. | ||
89 | .Pc | ||
90 | .It Fa buf , Fa len | ||
91 | .Fa buf | ||
92 | points to a buffer containing the protocol message, which consists of | ||
93 | .Fa len | ||
94 | bytes. | ||
95 | The buffer is no longer valid after the callback function has returned. | ||
96 | .It Fa ssl | ||
97 | The | ||
98 | .Vt SSL | ||
99 | object that received or sent the message. | ||
100 | .It Fa arg | ||
101 | The user-defined argument optionally defined by | ||
102 | .Fn SSL_CTX_set_msg_callback_arg | ||
103 | or | ||
104 | .Fn SSL_set_msg_callback_arg . | ||
105 | .El | ||
106 | .Sh NOTES | ||
107 | Protocol messages are passed to the callback function after decryption | ||
108 | and fragment collection where applicable. | ||
109 | (Thus record boundaries are not visible.) | ||
110 | .Pp | ||
111 | If processing a received protocol message results in an error, | ||
112 | the callback function may not be called. | ||
113 | For example, the callback function will never see messages that are considered | ||
114 | too large to be processed. | ||
115 | .Pp | ||
116 | Due to automatic protocol version negotiation, | ||
117 | .Fa version | ||
118 | is not necessarily the protocol version used by the sender of the message: | ||
119 | If a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, | ||
120 | .Fa version | ||
121 | will be | ||
122 | .Dv SSL3_VERSION . | ||
123 | .Sh SEE ALSO | ||
124 | .Xr ssl 3 , | ||
125 | .Xr SSL_new 3 | ||
126 | .Sh HISTORY | ||
127 | .Fn SSL_CTX_set_msg_callback , | ||
128 | .Fn SSL_CTX_set_msg_callback_arg , | ||
129 | .Fn SSL_set_msg_callback | ||
130 | and | ||
131 | .Fn SSL_get_msg_callback_arg | ||
132 | were added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_options.3 b/src/lib/libssl/doc/SSL_CTX_set_options.3 new file mode 100644 index 0000000000..8b2f75cc59 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_options.3 | |||
@@ -0,0 +1,384 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_OPTIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_options , | ||
6 | .Nm SSL_set_options , | ||
7 | .Nm SSL_CTX_clear_options , | ||
8 | .Nm SSL_clear_options , | ||
9 | .Nm SSL_CTX_get_options , | ||
10 | .Nm SSL_get_options , | ||
11 | .Nm SSL_get_secure_renegotiation_support | ||
12 | .Nd manipulate SSL options | ||
13 | .Sh SYNOPSIS | ||
14 | .In openssl/ssl.h | ||
15 | .Ft long | ||
16 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" | ||
17 | .Ft long | ||
18 | .Fn SSL_set_options "SSL *ssl" "long options" | ||
19 | .Ft long | ||
20 | .Fn SSL_CTX_clear_options "SSL_CTX *ctx" "long options" | ||
21 | .Ft long | ||
22 | .Fn SSL_clear_options "SSL *ssl" "long options" | ||
23 | .Ft long | ||
24 | .Fn SSL_CTX_get_options "SSL_CTX *ctx" | ||
25 | .Ft long | ||
26 | .Fn SSL_get_options "SSL *ssl" | ||
27 | .Ft long | ||
28 | .Fn SSL_get_secure_renegotiation_support "SSL *ssl" | ||
29 | .Sh DESCRIPTION | ||
30 | Note: all these functions are implemented using macros. | ||
31 | .Pp | ||
32 | .Fn SSL_CTX_set_options | ||
33 | adds the options set via bitmask in | ||
34 | .Fa options | ||
35 | to | ||
36 | .Fa ctx . | ||
37 | Options already set before are not cleared! | ||
38 | .Pp | ||
39 | .Fn SSL_set_options | ||
40 | adds the options set via bitmask in | ||
41 | .Fa options | ||
42 | to | ||
43 | .Fa ssl . | ||
44 | Options already set before are not cleared! | ||
45 | .Pp | ||
46 | .Fn SSL_CTX_clear_options | ||
47 | clears the options set via bitmask in | ||
48 | .Fa options | ||
49 | to | ||
50 | .Fa ctx . | ||
51 | .Pp | ||
52 | .Fn SSL_clear_options | ||
53 | clears the options set via bitmask in | ||
54 | .Fa options | ||
55 | to | ||
56 | .Fa ssl . | ||
57 | .Pp | ||
58 | .Fn SSL_CTX_get_options | ||
59 | returns the options set for | ||
60 | .Fa ctx . | ||
61 | .Pp | ||
62 | .Fn SSL_get_options | ||
63 | returns the options set for | ||
64 | .Fa ssl . | ||
65 | .Pp | ||
66 | .Fn SSL_get_secure_renegotiation_support | ||
67 | indicates whether the peer supports secure renegotiation. | ||
68 | .Sh NOTES | ||
69 | The behaviour of the SSL library can be changed by setting several options. | ||
70 | The options are coded as bitmasks and can be combined by a bitwise OR | ||
71 | operation (|). | ||
72 | .Pp | ||
73 | .Fn SSL_CTX_set_options | ||
74 | and | ||
75 | .Fn SSL_set_options | ||
76 | affect the (external) protocol behaviour of the SSL library. | ||
77 | The (internal) behaviour of the API can be changed by using the similar | ||
78 | .Xr SSL_CTX_set_mode 3 | ||
79 | and | ||
80 | .Xr SSL_set_mode 3 | ||
81 | functions. | ||
82 | .Pp | ||
83 | During a handshake, the option settings of the SSL object are used. | ||
84 | When a new SSL object is created from a context using | ||
85 | .Xr SSL_new 3 , | ||
86 | the current option setting is copied. | ||
87 | Changes to | ||
88 | .Fa ctx | ||
89 | do not affect already created | ||
90 | .Vt SSL | ||
91 | objects. | ||
92 | .Fn SSL_clear | ||
93 | does not affect the settings. | ||
94 | .Pp | ||
95 | The following | ||
96 | .Em bug workaround | ||
97 | options are available: | ||
98 | .Bl -tag -width Ds | ||
99 | .It Dv SSL_OP_MICROSOFT_SESS_ID_BUG | ||
100 | .Lk www.microsoft.com | ||
101 | \(en when talking SSLv2, if session-id reuse is performed, | ||
102 | the session-id passed back in the server-finished message is different from the | ||
103 | one decided upon. | ||
104 | .It Dv SSL_OP_NETSCAPE_CHALLENGE_BUG | ||
105 | Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte challenge but | ||
106 | then appears to only use 16 bytes when generating the encryption keys. | ||
107 | Using 16 bytes is ok but it should be ok to use 32. | ||
108 | According to the SSLv3 spec, one should use 32 bytes for the challenge when | ||
109 | operating in SSLv2/v3 compatibility mode, but as mentioned above, this breaks | ||
110 | this server so 16 bytes is the way to go. | ||
111 | .It Dv SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG | ||
112 | As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. | ||
113 | .It Dv SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG | ||
114 | \&... | ||
115 | .It Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER | ||
116 | \&... | ||
117 | .It Dv SSL_OP_SAFARI_ECDHE_ECDSA_BUG | ||
118 | Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. | ||
119 | OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers. | ||
120 | .It Dv SSL_OP_SSLEAY_080_CLIENT_DH_BUG | ||
121 | \&... | ||
122 | .It Dv SSL_OP_TLS_D5_BUG | ||
123 | \&... | ||
124 | .It Dv SSL_OP_TLS_BLOCK_PADDING_BUG | ||
125 | \&... | ||
126 | .It Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
127 | Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability | ||
128 | affecting CBC ciphers, which cannot be handled by some broken SSL | ||
129 | implementations. | ||
130 | This option has no effect for connections using other ciphers. | ||
131 | .It Dv SSL_OP_TLSEXT_PADDING | ||
132 | Adds a padding extension to ensure the ClientHello size is never between 256 | ||
133 | and 511 bytes in length. | ||
134 | This is needed as a workaround for some implementations. | ||
135 | .It Dv SSL_OP_ALL | ||
136 | All of the above bug workarounds. | ||
137 | .El | ||
138 | .Pp | ||
139 | It is usually safe to use | ||
140 | .Dv SSL_OP_ALL | ||
141 | to enable the bug workaround options if compatibility with somewhat broken | ||
142 | implementations is desired. | ||
143 | .Pp | ||
144 | The following | ||
145 | .Em modifying | ||
146 | options are available: | ||
147 | .Bl -tag -width Ds | ||
148 | .It Dv SSL_OP_TLS_ROLLBACK_BUG | ||
149 | Disable version rollback attack detection. | ||
150 | .Pp | ||
151 | During the client key exchange, the client must send the same information | ||
152 | about acceptable SSL/TLS protocol levels as during the first hello. | ||
153 | Some clients violate this rule by adapting to the server's answer. | ||
154 | (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, | ||
155 | the server only understands up to SSLv3. | ||
156 | In this case the client must still use the same SSLv3.1=TLSv1 announcement. | ||
157 | Some clients step down to SSLv3 with respect to the server's answer and violate | ||
158 | the version rollback protection.) | ||
159 | .It Dv SSL_OP_SINGLE_DH_USE | ||
160 | Always create a new key when using temporary/ephemeral DH parameters | ||
161 | (see | ||
162 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
163 | This option must be used to prevent small subgroup attacks, when the DH | ||
164 | parameters were not generated using | ||
165 | .Dq strong | ||
166 | primes (e.g., when using DSA-parameters, see | ||
167 | .Xr dhparam 1 ) . | ||
168 | If | ||
169 | .Dq strong | ||
170 | primes were used, it is not strictly necessary to generate a new DH key during | ||
171 | each handshake but it is also recommended. | ||
172 | .Dv SSL_OP_SINGLE_DH_USE | ||
173 | should therefore be enabled whenever temporary/ephemeral DH parameters are used. | ||
174 | .It SSL_OP_EPHEMERAL_RSA | ||
175 | Always use ephemeral (temporary) RSA key when doing RSA operations (see | ||
176 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
177 | According to the specifications, this is only done when a RSA key can only be | ||
178 | used for signature operations (namely under export ciphers with restricted RSA | ||
179 | keylength). | ||
180 | By setting this option, ephemeral RSA keys are always used. | ||
181 | This option breaks compatibility with the SSL/TLS specifications and may lead | ||
182 | to interoperability problems with clients and should therefore never be used. | ||
183 | Ciphers with EDH (ephemeral Diffie-Hellman) key exchange should be used instead. | ||
184 | .It Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
185 | When choosing a cipher, use the server's preferences instead of the client | ||
186 | preferences. | ||
187 | When not set, the SSL server will always follow the client's preferences. | ||
188 | When set, the SSLv3/TLSv1 server will choose following its own preferences. | ||
189 | Because of the different protocol, for SSLv2 the server will send its list of | ||
190 | preferences to the client and the client chooses. | ||
191 | .It Dv SSL_OP_NETSCAPE_CA_DN_BUG | ||
192 | If we accept a netscape connection, demand a client cert, have a | ||
193 | non-self-signed CA which does not have its CA in netscape, and the browser has | ||
194 | a cert, it will crash/hang. | ||
195 | Works for 3.x and 4.xbeta | ||
196 | .It Dv SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG | ||
197 | \&... | ||
198 | .It Dv SSL_OP_NO_SSLv2 | ||
199 | As of | ||
200 | .Ox 5.6 , | ||
201 | this option has no effect as SSLv2 support has been removed. | ||
202 | In previous versions it disabled use of the SSLv2 protocol. | ||
203 | .It Dv SSL_OP_NO_SSLv3 | ||
204 | Do not use the SSLv3 protocol. | ||
205 | .It Dv SSL_OP_NO_TLSv1 | ||
206 | Do not use the TLSv1.0 protocol. | ||
207 | .It Dv SSL_OP_NO_TLSv1_1 | ||
208 | Do not use the TLSv1.1 protocol. | ||
209 | .It Dv SSL_OP_NO_TLSv1_2 | ||
210 | Do not use the TLSv1.2 protocol. | ||
211 | .It Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
212 | When performing renegotiation as a server, always start a new session (i.e., | ||
213 | session resumption requests are only accepted in the initial handshake). | ||
214 | This option is not needed for clients. | ||
215 | .It Dv SSL_OP_NO_TICKET | ||
216 | Normally clients and servers will, where possible, transparently make use of | ||
217 | RFC4507bis tickets for stateless session resumption. | ||
218 | .Pp | ||
219 | If this option is set this functionality is disabled and tickets will not be | ||
220 | used by clients or servers. | ||
221 | .It Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
222 | As of | ||
223 | .Ox 5.6 , | ||
224 | this option has no effect. | ||
225 | In previous versions it allowed legacy insecure renegotiation between OpenSSL | ||
226 | and unpatched clients or servers. | ||
227 | See the | ||
228 | .Sx SECURE RENEGOTIATION | ||
229 | section for more details. | ||
230 | .It Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
231 | Allow legacy insecure renegotiation between OpenSSL and unpatched servers | ||
232 | .Em only : | ||
233 | this option is currently set by default. | ||
234 | See the | ||
235 | .Sx SECURE RENEGOTIATION | ||
236 | section for more details. | ||
237 | .El | ||
238 | .Sh SECURE RENEGOTIATION | ||
239 | OpenSSL 0.9.8m and later always attempts to use secure renegotiation as | ||
240 | described in RFC5746. | ||
241 | This counters the prefix attack described in CVE-2009-3555 and elsewhere. | ||
242 | .Pp | ||
243 | The deprecated and highly broken SSLv2 protocol does not support renegotiation | ||
244 | at all; its use is | ||
245 | .Em strongly | ||
246 | discouraged. | ||
247 | .Pp | ||
248 | This attack has far-reaching consequences which application writers should be | ||
249 | aware of. | ||
250 | In the description below an implementation supporting secure renegotiation is | ||
251 | referred to as | ||
252 | .Dq patched . | ||
253 | A server not supporting secure | ||
254 | renegotiation is referred to as | ||
255 | .Dq unpatched . | ||
256 | .Pp | ||
257 | The following sections describe the operations permitted by OpenSSL's secure | ||
258 | renegotiation implementation. | ||
259 | .Ss Patched client and server | ||
260 | Connections and renegotiation are always permitted by OpenSSL implementations. | ||
261 | .Ss Unpatched client and patched OpenSSL server | ||
262 | The initial connection succeeds but client renegotiation is denied by the | ||
263 | server with a | ||
264 | .Em no_renegotiation | ||
265 | warning alert if TLS v1.0 is used or a fatal | ||
266 | .Em handshake_failure | ||
267 | alert in SSL v3.0. | ||
268 | .Pp | ||
269 | If the patched OpenSSL server attempts to renegotiate a fatal | ||
270 | .Em handshake_failure | ||
271 | alert is sent. | ||
272 | This is because the server code may be unaware of the unpatched nature of the | ||
273 | client. | ||
274 | .Pp | ||
275 | .Em N.B.: | ||
276 | a bug in OpenSSL clients earlier than 0.9.8m (all of which are unpatched) will | ||
277 | result in the connection hanging if it receives a | ||
278 | .Em no_renegotiation | ||
279 | alert. | ||
280 | OpenSSL versions 0.9.8m and later will regard a | ||
281 | .Em no_renegotiation | ||
282 | alert as fatal and respond with a fatal | ||
283 | .Em handshake_failure | ||
284 | alert. | ||
285 | This is because the OpenSSL API currently has no provision to indicate to an | ||
286 | application that a renegotiation attempt was refused. | ||
287 | .Ss Patched OpenSSL client and unpatched server | ||
288 | If the option | ||
289 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
290 | is set then initial connections and renegotiation between patched OpenSSL | ||
291 | clients and unpatched servers succeeds. | ||
292 | If neither option is set then initial connections to unpatched servers will | ||
293 | fail. | ||
294 | .Pp | ||
295 | The option | ||
296 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
297 | is currently set by default even though it has security implications: | ||
298 | otherwise it would be impossible to connect to unpatched servers (i.e., all of | ||
299 | them initially) and this is clearly not acceptable. | ||
300 | Renegotiation is permitted because this does not add any additional security | ||
301 | issues: during an attack clients do not see any renegotiations anyway. | ||
302 | .Pp | ||
303 | As more servers become patched the option | ||
304 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
305 | will | ||
306 | .Em not | ||
307 | be set by default in a future version of OpenSSL. | ||
308 | .Pp | ||
309 | OpenSSL client applications wishing to ensure they can connect to unpatched | ||
310 | servers should always | ||
311 | .Em set | ||
312 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
313 | .Pp | ||
314 | OpenSSL client applications that want to ensure they can | ||
315 | .Em not | ||
316 | connect to unpatched servers (and thus avoid any security issues) should always | ||
317 | .Em clear | ||
318 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
319 | using | ||
320 | .Fn SSL_CTX_clear_options | ||
321 | or | ||
322 | .Fn SSL_clear_options . | ||
323 | .Sh RETURN VALUES | ||
324 | .Fn SSL_CTX_set_options | ||
325 | and | ||
326 | .Fn SSL_set_options | ||
327 | return the new options bitmask after adding | ||
328 | .Fa options . | ||
329 | .Pp | ||
330 | .Fn SSL_CTX_clear_options | ||
331 | and | ||
332 | .Fn SSL_clear_options | ||
333 | return the new options bitmask after clearing | ||
334 | .Fa options . | ||
335 | .Pp | ||
336 | .Fn SSL_CTX_get_options | ||
337 | and | ||
338 | .Fn SSL_get_options | ||
339 | return the current bitmask. | ||
340 | .Pp | ||
341 | .Fn SSL_get_secure_renegotiation_support | ||
342 | returns 1 is the peer supports secure renegotiation and 0 if it does not. | ||
343 | .Sh SEE ALSO | ||
344 | .Xr dhparam 1 , | ||
345 | .Xr ssl 3 , | ||
346 | .Xr SSL_clear 3 , | ||
347 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
348 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
349 | .Xr SSL_new 3 | ||
350 | .Sh HISTORY | ||
351 | .Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
352 | and | ||
353 | .Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
354 | have been added in | ||
355 | OpenSSL 0.9.7. | ||
356 | .Pp | ||
357 | .Dv SSL_OP_TLS_ROLLBACK_BUG | ||
358 | has been added in OpenSSL 0.9.6 and was automatically enabled with | ||
359 | .Dv SSL_OP_ALL . | ||
360 | As of 0.9.7, it is no longer included in | ||
361 | .Dv SSL_OP_ALL | ||
362 | and must be explicitly set. | ||
363 | .Pp | ||
364 | .Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
365 | has been added in OpenSSL 0.9.6e. | ||
366 | Versions up to OpenSSL 0.9.6c do not include the countermeasure that can be | ||
367 | disabled with this option (in OpenSSL 0.9.6d, it was always enabled). | ||
368 | .Pp | ||
369 | .Fn SSL_CTX_clear_options | ||
370 | and | ||
371 | .Fn SSL_clear_options | ||
372 | were first added in OpenSSL 0.9.8m. | ||
373 | .Pp | ||
374 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION , | ||
375 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
376 | and the function | ||
377 | .Fn SSL_get_secure_renegotiation_support | ||
378 | were first added in OpenSSL 0.9.8m. | ||
379 | .Pp | ||
380 | .Dv SSL_OP_NO_SSLv2 | ||
381 | and | ||
382 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
383 | were changed to have no effect in | ||
384 | .Ox 5.6 . | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_psk_client_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_psk_client_callback.3 new file mode 100644 index 0000000000..9bd5c9c545 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_psk_client_callback.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_PSK_CLIENT_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_psk_client_callback , | ||
6 | .Nm SSL_set_psk_client_callback | ||
7 | .Nd set PSK client callback | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fo SSL_CTX_set_psk_client_callback | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
14 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
15 | .Fc | ||
16 | .Ft void | ||
17 | .Fo SSL_set_psk_client_callback | ||
18 | .Fa "SSL *ssl" | ||
19 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
20 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
21 | .Fc | ||
22 | .Sh DESCRIPTION | ||
23 | A client application must provide a callback function which is called | ||
24 | when the client is sending the ClientKeyExchange message to the server. | ||
25 | .Pp | ||
26 | The purpose of the callback function is to select the PSK identity and | ||
27 | the pre-shared key to use during the connection setup phase. | ||
28 | .Pp | ||
29 | The callback is set using functions | ||
30 | .Fn SSL_CTX_set_psk_client_callback | ||
31 | or | ||
32 | .Fn SSL_set_psk_client_callback . | ||
33 | The callback function is given the connection in parameter | ||
34 | .Fa ssl , | ||
35 | a | ||
36 | .Dv NULL Ns | ||
37 | -terminated PSK identity hint sent by the server in parameter | ||
38 | .Fa hint , | ||
39 | a buffer | ||
40 | .Fa identity | ||
41 | of length | ||
42 | .Fa max_identity_len | ||
43 | bytes where the resulting | ||
44 | .Dv NULL Ns | ||
45 | -terminated identity is to be stored, and a buffer | ||
46 | .Fa psk | ||
47 | of | ||
48 | length | ||
49 | .Fa max_psk_len | ||
50 | bytes where the resulting pre-shared key is to be stored. | ||
51 | .Sh NOTES | ||
52 | Note that parameter | ||
53 | .Fa hint | ||
54 | given to the callback may be | ||
55 | .Dv NULL . | ||
56 | .Sh RETURN VALUES | ||
57 | Return values from the client callback are interpreted as follows: | ||
58 | .Pp | ||
59 | On success (callback found a PSK identity and a pre-shared key to use) | ||
60 | the length (> 0) of | ||
61 | .Fa psk | ||
62 | in bytes is returned. | ||
63 | .Pp | ||
64 | Otherwise or on errors callback should return 0. | ||
65 | In this case the connection setup fails. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/doc/SSL_CTX_set_quiet_shutdown.3 new file mode 100644 index 0000000000..91e17350f9 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_quiet_shutdown.3 | |||
@@ -0,0 +1,116 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_quiet_shutdown , | ||
6 | .Nm SSL_CTX_get_quiet_shutdown , | ||
7 | .Nm SSL_set_quiet_shutdown , | ||
8 | .Nm SSL_get_quiet_shutdown | ||
9 | .Nd manipulate shutdown behaviour | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
14 | .Ft int | ||
15 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
16 | .Ft void | ||
17 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
18 | .Ft int | ||
19 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_quiet_shutdown | ||
22 | sets the | ||
23 | .Dq quiet shutdown | ||
24 | flag for | ||
25 | .Fa ctx | ||
26 | to be | ||
27 | .Fa mode . | ||
28 | .Vt SSL | ||
29 | objects created from | ||
30 | .Fa ctx | ||
31 | inherit the | ||
32 | .Fa mode | ||
33 | valid at the time | ||
34 | .Xr SSL_new 3 | ||
35 | is called. | ||
36 | .Fa mode | ||
37 | may be 0 or 1. | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_get_quiet_shutdown | ||
40 | returns the | ||
41 | .Dq quiet shutdown | ||
42 | setting of | ||
43 | .Fa ctx . | ||
44 | .Pp | ||
45 | .Fn SSL_set_quiet_shutdown | ||
46 | sets the | ||
47 | .Dq quiet shutdown | ||
48 | flag for | ||
49 | .Fa ssl | ||
50 | to be | ||
51 | .Fa mode . | ||
52 | The setting stays valid until | ||
53 | .Fa ssl | ||
54 | is removed with | ||
55 | .Xr SSL_free 3 | ||
56 | or | ||
57 | .Fn SSL_set_quiet_shutdown | ||
58 | is called again. | ||
59 | It is not changed when | ||
60 | .Xr SSL_clear 3 | ||
61 | is called. | ||
62 | .Fa mode | ||
63 | may be 0 or 1. | ||
64 | .Pp | ||
65 | .Fn SSL_get_quiet_shutdown | ||
66 | returns the | ||
67 | .Dq quiet shutdown | ||
68 | setting of | ||
69 | .Fa ssl . | ||
70 | .Sh NOTES | ||
71 | Normally when a SSL connection is finished, the parties must send out | ||
72 | .Dq close notify | ||
73 | alert messages using | ||
74 | .Xr SSL_shutdown 3 | ||
75 | for a clean shutdown. | ||
76 | .Pp | ||
77 | When setting the | ||
78 | .Dq quiet shutdown | ||
79 | flag to 1, | ||
80 | .Xr SSL_shutdown 3 | ||
81 | will set the internal flags to | ||
82 | .Dv SSL_SENT_SHUTDOWN Ns | ||
83 | .Pf | | ||
84 | .Dv SSL_RECEIVED_SHUTDOWN . | ||
85 | .Po | ||
86 | .Xr SSL_shutdown 3 | ||
87 | then behaves like | ||
88 | .Xr SSL_set_shutdown 3 | ||
89 | called with | ||
90 | .Dv SSL_SENT_SHUTDOWN Ns | ||
91 | .Pf | | ||
92 | .Dv SSL_RECEIVED_SHUTDOWN . | ||
93 | .Pc | ||
94 | The session is thus considered to be shut down, but no | ||
95 | .Dq close notify | ||
96 | alert is sent to the peer. | ||
97 | This behaviour violates the TLS standard. | ||
98 | .Pp | ||
99 | The default is normal shutdown behaviour as described by the TLS standard. | ||
100 | .Sh RETURN VALUES | ||
101 | .Fn SSL_CTX_set_quiet_shutdown | ||
102 | and | ||
103 | .Fn SSL_set_quiet_shutdown | ||
104 | do not return diagnostic information. | ||
105 | .Pp | ||
106 | .Fn SSL_CTX_get_quiet_shutdown | ||
107 | and | ||
108 | .Fn SSL_get_quiet_shutdown | ||
109 | return the current setting. | ||
110 | .Sh SEE ALSO | ||
111 | .Xr ssl 3 , | ||
112 | .Xr SSL_clear 3 , | ||
113 | .Xr SSL_free 3 , | ||
114 | .Xr SSL_new 3 , | ||
115 | .Xr SSL_set_shutdown 3 , | ||
116 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3 new file mode 100644 index 0000000000..e7ebe2190e --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_session_cache_mode.3 | |||
@@ -0,0 +1,140 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_session_cache_mode , | ||
6 | .Nm SSL_CTX_get_session_cache_mode | ||
7 | .Nd enable/disable session caching | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_session_cache_mode | ||
16 | enables/disables session caching by setting the operational mode for | ||
17 | .Ar ctx | ||
18 | to | ||
19 | .Ar mode . | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_get_session_cache_mode | ||
22 | returns the currently used cache mode. | ||
23 | .Sh NOTES | ||
24 | The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. | ||
25 | The sessions can be held in memory for each | ||
26 | .Fa ctx , | ||
27 | if more than one | ||
28 | .Vt SSL_CTX | ||
29 | object is being maintained, the sessions are unique for each | ||
30 | .Vt SSL_CTX | ||
31 | object. | ||
32 | .Pp | ||
33 | In order to reuse a session, a client must send the session's id to the server. | ||
34 | It can only send exactly one id. | ||
35 | The server then either agrees to reuse the session or it starts a full | ||
36 | handshake (to create a new session). | ||
37 | .Pp | ||
38 | A server will lookup up the session in its internal session storage. | ||
39 | If the session is not found in internal storage or lookups for the internal | ||
40 | storage have been deactivated | ||
41 | .Pq Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP , | ||
42 | the server will try the external storage if available. | ||
43 | .Pp | ||
44 | Since a client may try to reuse a session intended for use in a different | ||
45 | context, the session id context must be set by the server (see | ||
46 | .Xr SSL_CTX_set_session_id_context 3 ) . | ||
47 | .Pp | ||
48 | The following session cache modes and modifiers are available: | ||
49 | .Bl -tag -width Ds | ||
50 | .It Dv SSL_SESS_CACHE_OFF | ||
51 | No session caching for client or server takes place. | ||
52 | .It Dv SSL_SESS_CACHE_CLIENT | ||
53 | Client sessions are added to the session cache. | ||
54 | As there is no reliable way for the OpenSSL library to know whether a session | ||
55 | should be reused or which session to choose (due to the abstract BIO layer the | ||
56 | SSL engine does not have details about the connection), | ||
57 | the application must select the session to be reused by using the | ||
58 | .Xr SSL_set_session 3 | ||
59 | function. | ||
60 | This option is not activated by default. | ||
61 | .It Dv SSL_SESS_CACHE_SERVER | ||
62 | Server sessions are added to the session cache. | ||
63 | When a client proposes a session to be reused, the server looks for the | ||
64 | corresponding session in (first) the internal session cache (unless | ||
65 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
66 | is set), then (second) in the external cache if available. | ||
67 | If the session is found, the server will try to reuse the session. | ||
68 | This is the default. | ||
69 | .It Dv SSL_SESS_CACHE_BOTH | ||
70 | Enable both | ||
71 | .Dv SSL_SESS_CACHE_CLIENT | ||
72 | and | ||
73 | .Dv SSL_SESS_CACHE_SERVER | ||
74 | at the same time. | ||
75 | .It Dv SSL_SESS_CACHE_NO_AUTO_CLEAR | ||
76 | Normally the session cache is checked for expired sessions every 255 | ||
77 | connections using the | ||
78 | .Xr SSL_CTX_flush_sessions 3 | ||
79 | function. | ||
80 | Since this may lead to a delay which cannot be controlled, | ||
81 | the automatic flushing may be disabled and | ||
82 | .Xr SSL_CTX_flush_sessions 3 | ||
83 | can be called explicitly by the application. | ||
84 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
85 | By setting this flag, session-resume operations in an SSL/TLS server will not | ||
86 | automatically look up sessions in the internal cache, | ||
87 | even if sessions are automatically stored there. | ||
88 | If external session caching callbacks are in use, | ||
89 | this flag guarantees that all lookups are directed to the external cache. | ||
90 | As automatic lookup only applies for SSL/TLS servers, | ||
91 | the flag has no effect on clients. | ||
92 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
93 | Depending on the presence of | ||
94 | .Dv SSL_SESS_CACHE_CLIENT | ||
95 | and/or | ||
96 | .Dv SSL_SESS_CACHE_SERVER, | ||
97 | sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. | ||
98 | Normally a new session is added to the internal cache as well as any external | ||
99 | session caching (callback) that is configured for the | ||
100 | .Vt SSL_CTX . | ||
101 | This flag will prevent sessions being stored in the internal cache | ||
102 | (though the application can add them manually using | ||
103 | .Xr SSL_CTX_add_session 3 ) . | ||
104 | Note: | ||
105 | in any SSL/TLS servers where external caching is configured, any successful | ||
106 | session lookups in the external cache (e.g., for session-resume requests) would | ||
107 | normally be copied into the local cache before processing continues \(en this | ||
108 | flag prevents these additions to the internal cache as well. | ||
109 | .It Dv SSL_SESS_CACHE_NO_INTERNAL | ||
110 | Enable both | ||
111 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
112 | and | ||
113 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
114 | at the same time. | ||
115 | .El | ||
116 | .Pp | ||
117 | The default mode is | ||
118 | .Dv SSL_SESS_CACHE_SERVER . | ||
119 | .Sh RETURN VALUES | ||
120 | .Fn SSL_CTX_set_session_cache_mode | ||
121 | returns the previously set cache mode. | ||
122 | .Pp | ||
123 | .Fn SSL_CTX_get_session_cache_mode | ||
124 | returns the currently set cache mode. | ||
125 | .Sh SEE ALSO | ||
126 | .Xr ssl 3 , | ||
127 | .Xr SSL_CTX_add_session 3 , | ||
128 | .Xr SSL_CTX_flush_sessions 3 , | ||
129 | .Xr SSL_CTX_sess_number 3 , | ||
130 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
131 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
132 | .Xr SSL_CTX_set_session_id_context 3 , | ||
133 | .Xr SSL_CTX_set_timeout 3 , | ||
134 | .Xr SSL_session_reused 3 , | ||
135 | .Xr SSL_set_session 3 | ||
136 | .Sh HISTORY | ||
137 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
138 | and | ||
139 | .Dv SSL_SESS_CACHE_NO_INTERNAL | ||
140 | were introduced in OpenSSL 0.9.6h. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_session_id_context.3 b/src/lib/libssl/doc/SSL_CTX_set_session_id_context.3 new file mode 100644 index 0000000000..0411c687a4 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_session_id_context.3 | |||
@@ -0,0 +1,102 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_session_id_context , | ||
6 | .Nm SSL_set_session_id_context | ||
7 | .Nd set context within which session can be reused (server side only) | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft int | ||
11 | .Fo SSL_CTX_set_session_id_context | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa const unsigned char *sid_ctx" | ||
14 | .Fa "unsigned int sid_ctx_len" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo SSL_set_session_id_context | ||
18 | .Fa "SSL *ssl" | ||
19 | .Fa const unsigned char *sid_ctx" | ||
20 | .Fa "unsigned int sid_ctx_len" | ||
21 | .Fc | ||
22 | .Sh DESCRIPTION | ||
23 | .Fn SSL_CTX_set_session_id_context | ||
24 | sets the context | ||
25 | .Fa sid_ctx | ||
26 | of length | ||
27 | .Fa sid_ctx_len | ||
28 | within which a session can be reused for the | ||
29 | .Fa ctx | ||
30 | object. | ||
31 | .Pp | ||
32 | .Fn SSL_set_session_id_context | ||
33 | sets the context | ||
34 | .Fa sid_ctx | ||
35 | of length | ||
36 | .Fa sid_ctx_len | ||
37 | within which a session can be reused for the | ||
38 | .Fa ssl | ||
39 | object. | ||
40 | .Sh NOTES | ||
41 | Sessions are generated within a certain context. | ||
42 | When exporting/importing sessions with | ||
43 | .Xr i2d_SSL_SESSION 3 | ||
44 | and | ||
45 | .Xr d2i_SSL_SESSION 3 , | ||
46 | it would be possible to re-import a session generated from another context | ||
47 | (e.g., another application), which might lead to malfunctions. | ||
48 | Therefore each application must set its own session id context | ||
49 | .Fa sid_ctx | ||
50 | which is used to distinguish the contexts and is stored in exported sessions. | ||
51 | The | ||
52 | .Fa sid_ctx | ||
53 | can be any kind of binary data with a given length; it is therefore possible | ||
54 | to use, for instance, the name of the application, the hostname, the service | ||
55 | name... | ||
56 | .Pp | ||
57 | The session id context becomes part of the session. | ||
58 | The session id context is set by the SSL/TLS server. | ||
59 | The | ||
60 | .Fn SSL_CTX_set_session_id_context | ||
61 | and | ||
62 | .Fn SSL_set_session_id_context | ||
63 | functions are therefore only useful on the server side. | ||
64 | .Pp | ||
65 | OpenSSL clients will check the session id context returned by the server when | ||
66 | reusing a session. | ||
67 | .Pp | ||
68 | The maximum length of the | ||
69 | .Fa sid_ctx | ||
70 | is limited to | ||
71 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
72 | .Sh WARNINGS | ||
73 | If the session id context is not set on an SSL/TLS server and client | ||
74 | certificates are used, stored sessions will not be reused but a fatal error | ||
75 | will be flagged and the handshake will fail. | ||
76 | .Pp | ||
77 | If a server returns a different session id context to an OpenSSL client | ||
78 | when reusing a session, an error will be flagged and the handshake will | ||
79 | fail. | ||
80 | OpenSSL servers will always return the correct session id context, | ||
81 | as an OpenSSL server checks the session id context itself before reusing | ||
82 | a session as described above. | ||
83 | .Sh RETURN VALUES | ||
84 | .Fn SSL_CTX_set_session_id_context | ||
85 | and | ||
86 | .Fn SSL_set_session_id_context | ||
87 | return the following values: | ||
88 | .Bl -tag -width Ds | ||
89 | .It 0 | ||
90 | The length | ||
91 | .Fa sid_ctx_len | ||
92 | of the session id context | ||
93 | .Fa sid_ctx | ||
94 | exceeded | ||
95 | the maximum allowed length of | ||
96 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
97 | The error is logged to the error stack. | ||
98 | .It 1 | ||
99 | The operation succeeded. | ||
100 | .El | ||
101 | .Sh SEE ALSO | ||
102 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_ssl_version.3 b/src/lib/libssl/doc/SSL_CTX_set_ssl_version.3 new file mode 100644 index 0000000000..f3753dac20 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_ssl_version.3 | |||
@@ -0,0 +1,78 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SSL_VERSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_ssl_version , | ||
6 | .Nm SSL_set_ssl_method , | ||
7 | .Nm SSL_get_ssl_method | ||
8 | .Nd choose a new TLS/SSL method | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" | ||
13 | .Ft int | ||
14 | .Fn SSL_set_ssl_method "SSL *s" "const SSL_METHOD *method" | ||
15 | .Ft const SSL_METHOD * | ||
16 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_CTX_set_ssl_version | ||
19 | sets a new default TLS/SSL | ||
20 | .Fa method | ||
21 | for | ||
22 | .Vt SSL | ||
23 | objects newly created from this | ||
24 | .Fa ctx . | ||
25 | .Vt SSL | ||
26 | objects already created with | ||
27 | .Xr SSL_new 3 | ||
28 | are not affected, except when | ||
29 | .Xr SSL_clear 3 | ||
30 | is called. | ||
31 | .Pp | ||
32 | .Fn SSL_set_ssl_method | ||
33 | sets a new TLS/SSL | ||
34 | .Fa method | ||
35 | for a particular | ||
36 | .Vt SSL | ||
37 | object | ||
38 | .Fa s . | ||
39 | It may be reset when | ||
40 | .Xr SSL_clear 3 | ||
41 | is called. | ||
42 | .Pp | ||
43 | .Fn SSL_get_ssl_method | ||
44 | returns a function pointer to the TLS/SSL method set in | ||
45 | .Fa ssl . | ||
46 | .Sh NOTES | ||
47 | The available | ||
48 | .Fa method | ||
49 | choices are described in | ||
50 | .Xr SSL_CTX_new 3 . | ||
51 | .Pp | ||
52 | When | ||
53 | .Xr SSL_clear 3 | ||
54 | is called and no session is connected to an | ||
55 | .Vt SSL | ||
56 | object, the method of the | ||
57 | .Vt SSL | ||
58 | object is reset to the method currently set in the corresponding | ||
59 | .Vt SSL_CTX | ||
60 | object. | ||
61 | .Sh RETURN VALUES | ||
62 | The following return values can occur for | ||
63 | .Fn SSL_CTX_set_ssl_version | ||
64 | and | ||
65 | .Fn SSL_set_ssl_method : | ||
66 | .Bl -tag -width Ds | ||
67 | .It 0 | ||
68 | The new choice failed. | ||
69 | Check the error stack to find out the reason. | ||
70 | .It 1 | ||
71 | The operation succeeded. | ||
72 | .El | ||
73 | .Sh SEE ALSO | ||
74 | .Xr ssl 3 , | ||
75 | .Xr SSL_clear 3 , | ||
76 | .Xr SSL_CTX_new 3 , | ||
77 | .Xr SSL_new 3 , | ||
78 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_timeout.3 b/src/lib/libssl/doc/SSL_CTX_set_timeout.3 new file mode 100644 index 0000000000..c8aaee24e2 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_timeout.3 | |||
@@ -0,0 +1,62 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TIMEOUT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_timeout , | ||
6 | .Nm SSL_CTX_get_timeout | ||
7 | .Nd manipulate timeout values for session caching | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_get_timeout "SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_timeout | ||
16 | sets the timeout for newly created sessions for | ||
17 | .Fa ctx | ||
18 | to | ||
19 | .Fa t . | ||
20 | The timeout value | ||
21 | .Fa t | ||
22 | must be given in seconds. | ||
23 | .Pp | ||
24 | .Fn SSL_CTX_get_timeout | ||
25 | returns the currently set timeout value for | ||
26 | .Fa ctx . | ||
27 | .Sh NOTES | ||
28 | Whenever a new session is created, it is assigned a maximum lifetime. | ||
29 | This lifetime is specified by storing the creation time of the session and the | ||
30 | timeout value valid at this time. | ||
31 | If the actual time is later than creation time plus timeout, | ||
32 | the session is not reused. | ||
33 | .Pp | ||
34 | Due to this realization, all sessions behave according to the timeout value | ||
35 | valid at the time of the session negotiation. | ||
36 | Changes of the timeout value do not affect already established sessions. | ||
37 | .Pp | ||
38 | The expiration time of a single session can be modified using the | ||
39 | .Xr SSL_SESSION_get_time 3 | ||
40 | family of functions. | ||
41 | .Pp | ||
42 | Expired sessions are removed from the internal session cache, whenever | ||
43 | .Xr SSL_CTX_flush_sessions 3 | ||
44 | is called, either directly by the application or automatically (see | ||
45 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
46 | .Pp | ||
47 | The default value for session timeout is decided on a per-protocol basis; see | ||
48 | .Xr SSL_get_default_timeout 3 . | ||
49 | All currently supported protocols have the same default timeout value of 300 | ||
50 | seconds. | ||
51 | .Sh RETURN VALUES | ||
52 | .Fn SSL_CTX_set_timeout | ||
53 | returns the previously set timeout value. | ||
54 | .Pp | ||
55 | .Fn SSL_CTX_get_timeout | ||
56 | returns the currently set timeout value. | ||
57 | .Sh SEE ALSO | ||
58 | .Xr ssl 3 , | ||
59 | .Xr SSL_CTX_flush_sessions 3 , | ||
60 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
61 | .Xr SSL_get_default_timeout 3 , | ||
62 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_tmp_dh_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_tmp_dh_callback.3 new file mode 100644 index 0000000000..f28d083f45 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_tmp_dh_callback.3 | |||
@@ -0,0 +1,233 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_tmp_dh_callback , | ||
6 | .Nm SSL_CTX_set_tmp_dh , | ||
7 | .Nm SSL_set_tmp_dh_callback , | ||
8 | .Nm SSL_set_tmp_dh | ||
9 | .Nd handle DH keys for ephemeral key exchange | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_tmp_dh_callback | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)" | ||
16 | .Fc | ||
17 | .Ft long | ||
18 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX *ctx" "DH *dh" | ||
19 | .Ft void | ||
20 | .Fo SSL_set_tmp_dh_callback | ||
21 | .Fa "SSL *ssl" | ||
22 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength" | ||
23 | .Fc | ||
24 | .Ft long | ||
25 | .Fn SSL_set_tmp_dh "SSL *ssl" "DH *dh" | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_set_tmp_dh_callback | ||
28 | sets the callback function for | ||
29 | .Fa ctx | ||
30 | to be used when a DH parameters are required to | ||
31 | .Fa tmp_dh_callback . | ||
32 | The callback is inherited by all | ||
33 | .Vt ssl | ||
34 | objects created from | ||
35 | .Fa ctx . | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_set_tmp_dh | ||
38 | sets DH parameters to be used to be | ||
39 | .Sy dh Ns . | ||
40 | The key is inherited by all | ||
41 | .Fa ssl | ||
42 | objects created from | ||
43 | .Fa ctx . | ||
44 | .Pp | ||
45 | .Fn SSL_set_tmp_dh_callback | ||
46 | sets the callback only for | ||
47 | .Fa ssl . | ||
48 | .Pp | ||
49 | .Fn SSL_set_tmp_dh | ||
50 | sets the parameters only for | ||
51 | .Fa ssl . | ||
52 | .Pp | ||
53 | These functions apply to SSL/TLS servers only. | ||
54 | .Sh NOTES | ||
55 | When using a cipher with RSA authentication, | ||
56 | an ephemeral DH key exchange can take place. | ||
57 | Ciphers with DSA keys always use ephemeral DH keys as well. | ||
58 | In these cases, the session data are negotiated using the ephemeral/temporary | ||
59 | DH key and the key supplied and certified by the certificate chain is only used | ||
60 | for signing. | ||
61 | Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. | ||
62 | .Pp | ||
63 | Using ephemeral DH key exchange yields forward secrecy, | ||
64 | as the connection can only be decrypted when the DH key is known. | ||
65 | By generating a temporary DH key inside the server application that is lost | ||
66 | when the application is left, it becomes impossible for an attacker to decrypt | ||
67 | past sessions, even if he gets hold of the normal (certified) key, | ||
68 | as this key was only used for signing. | ||
69 | .Pp | ||
70 | In order to perform a DH key exchange the server must use a DH group | ||
71 | (DH parameters) and generate a DH key. | ||
72 | The server will always generate a new DH key during the negotiation, | ||
73 | when the DH parameters are supplied via callback and/or when the | ||
74 | .Dv SSL_OP_SINGLE_DH_USE | ||
75 | option of | ||
76 | .Xr SSL_CTX_set_options 3 | ||
77 | is set. | ||
78 | It will immediately create a DH key, when DH parameters are supplied via | ||
79 | .Fn SSL_CTX_set_tmp_dh | ||
80 | and | ||
81 | .Dv SSL_OP_SINGLE_DH_USE | ||
82 | is not set. | ||
83 | In this case, it may happen that a key is generated on initialization without | ||
84 | later being needed, while on the other hand the computer time during the | ||
85 | negotiation is being saved. | ||
86 | .Pp | ||
87 | If | ||
88 | .Dq strong | ||
89 | primes were used to generate the DH parameters, it is not strictly necessary to | ||
90 | generate a new key for each handshake but it does improve forward secrecy. | ||
91 | If it is not assured that | ||
92 | .Dq strong | ||
93 | primes were used (see especially the section about DSA parameters below), | ||
94 | .Dv SSL_OP_SINGLE_DH_USE | ||
95 | must be used in order to prevent small subgroup attacks. | ||
96 | Always using | ||
97 | .Dv SSL_OP_SINGLE_DH_USE | ||
98 | has an impact on the computer time needed during negotiation, | ||
99 | but it is not very large, | ||
100 | so application authors/users should consider always enabling this option. | ||
101 | .Pp | ||
102 | As generating DH parameters is extremely time consuming, an application should | ||
103 | not generate the parameters on the fly but supply the parameters. | ||
104 | DH parameters can be reused, | ||
105 | as the actual key is newly generated during the negotiation. | ||
106 | The risk in reusing DH parameters is that an attacker may specialize on a very | ||
107 | often used DH group. | ||
108 | Applications should therefore generate their own DH parameters during the | ||
109 | installation process using the openssl | ||
110 | .Xr dhparam 1 | ||
111 | application. | ||
112 | In order to reduce the computer time needed for this generation, | ||
113 | it is possible to use DSA parameters instead (see | ||
114 | .Xr dhparam 1 ) , | ||
115 | but in this case | ||
116 | .Dv SSL_OP_SINGLE_DH_USE | ||
117 | is mandatory. | ||
118 | .Pp | ||
119 | Application authors may compile in DH parameters. | ||
120 | Files | ||
121 | .Pa dh512.pem , | ||
122 | .Pa dh1024.pem , | ||
123 | .Pa dh2048.pem , | ||
124 | and | ||
125 | .Pa dh4096.pem | ||
126 | in the | ||
127 | .Pa apps | ||
128 | directory of the current version of the OpenSSL distribution contain the | ||
129 | .Sq SKIP | ||
130 | DH parameters, | ||
131 | which use safe primes and were generated verifiably pseudo-randomly. | ||
132 | These files can be converted into C code using the | ||
133 | .Fl C | ||
134 | option of the | ||
135 | .Xr dhparam 1 | ||
136 | application. | ||
137 | Authors may also generate their own set of parameters using | ||
138 | .Xr dhparam 1 , | ||
139 | but a user may not be sure how the parameters were generated. | ||
140 | The generation of DH parameters during installation is therefore recommended. | ||
141 | .Pp | ||
142 | An application may either directly specify the DH parameters or can supply the | ||
143 | DH parameters via a callback function. | ||
144 | The callback approach has the advantage that the callback may supply DH | ||
145 | parameters for different key lengths. | ||
146 | .Pp | ||
147 | The | ||
148 | .Fa tmp_dh_callback | ||
149 | is called with the | ||
150 | .Fa keylength | ||
151 | needed and the | ||
152 | .Fa is_export | ||
153 | information. | ||
154 | The | ||
155 | .Fa is_export | ||
156 | flag is set when the ephemeral DH key exchange is performed with an export | ||
157 | cipher. | ||
158 | .Sh RETURN VALUES | ||
159 | .Fn SSL_CTX_set_tmp_dh_callback | ||
160 | and | ||
161 | .Fn SSL_set_tmp_dh_callback | ||
162 | do not return diagnostic output. | ||
163 | .Pp | ||
164 | .Fn SSL_CTX_set_tmp_dh | ||
165 | and | ||
166 | .Fn SSL_set_tmp_dh | ||
167 | do return 1 on success and 0 on failure. | ||
168 | Check the error queue to find out the reason of failure. | ||
169 | .Sh EXAMPLES | ||
170 | Handle DH parameters for key lengths of 512 and 1024 bits. | ||
171 | (Error handling partly left out.) | ||
172 | .Bd -literal | ||
173 | \&... | ||
174 | /* Set up ephemeral DH stuff */ | ||
175 | DH *dh_512 = NULL; | ||
176 | DH *dh_1024 = NULL; | ||
177 | FILE *paramfile; | ||
178 | |||
179 | \&... | ||
180 | |||
181 | /* "openssl dhparam -out dh_param_512.pem -2 512" */ | ||
182 | paramfile = fopen("dh_param_512.pem", "r"); | ||
183 | if (paramfile) { | ||
184 | dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
185 | fclose(paramfile); | ||
186 | } | ||
187 | /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ | ||
188 | paramfile = fopen("dh_param_1024.pem", "r"); | ||
189 | if (paramfile) { | ||
190 | dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
191 | fclose(paramfile); | ||
192 | } | ||
193 | |||
194 | \&... | ||
195 | |||
196 | /* "openssl dhparam -C -2 512" etc... */ | ||
197 | DH *get_dh512() { ... } | ||
198 | DH *get_dh1024() { ... } | ||
199 | |||
200 | DH * | ||
201 | tmp_dh_callback(SSL *s, int is_export, int keylength) | ||
202 | { | ||
203 | DH *dh_tmp=NULL; | ||
204 | |||
205 | switch (keylength) { | ||
206 | case 512: | ||
207 | if (!dh_512) | ||
208 | dh_512 = get_dh512(); | ||
209 | dh_tmp = dh_512; | ||
210 | break; | ||
211 | case 1024: | ||
212 | if (!dh_1024) | ||
213 | dh_1024 = get_dh1024(); | ||
214 | dh_tmp = dh_1024; | ||
215 | break; | ||
216 | default: | ||
217 | /* | ||
218 | * Generating a key on the fly is very costly, | ||
219 | * so use what is there | ||
220 | */ | ||
221 | setup_dh_parameters_like_above(); | ||
222 | } | ||
223 | |||
224 | return(dh_tmp); | ||
225 | } | ||
226 | .Ed | ||
227 | .Sh SEE ALSO | ||
228 | .Xr ciphers 1 , | ||
229 | .Xr dhparam 1 , | ||
230 | .Xr ssl 3 , | ||
231 | .Xr SSL_CTX_set_cipher_list 3 , | ||
232 | .Xr SSL_CTX_set_options 3 , | ||
233 | .Xr SSL_CTX_set_tmp_rsa_callback 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 new file mode 100644 index 0000000000..55b3aaafed --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_tmp_rsa_callback.3 | |||
@@ -0,0 +1,228 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK.POD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_tmp_rsa_callback , | ||
6 | .Nm SSL_CTX_set_tmp_rsa , | ||
7 | .Nm SSL_CTX_need_tmp_rsa , | ||
8 | .Nm SSL_set_tmp_rsa_callback , | ||
9 | .Nm SSL_set_tmp_rsa , | ||
10 | .Nm SSL_need_tmp_rsa | ||
11 | .Nd handle RSA keys for ephemeral key exchange | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft void | ||
15 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
16 | .Fa "SSL_CTX *ctx" | ||
17 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
18 | .Fc | ||
19 | .Ft long | ||
20 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
21 | .Ft long | ||
22 | .Fn SSL_CTX_need_tmp_rsa "SSL_CTX *ctx" | ||
23 | .Ft void | ||
24 | .Fo SSL_set_tmp_rsa_callback | ||
25 | .Fa "SSL_CTX *ctx" | ||
26 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
27 | .Fc | ||
28 | .Ft long | ||
29 | .Fn SSL_set_tmp_rsa "SSL *ssl" "RSA *rsa" | ||
30 | .Ft long | ||
31 | .Fn SSL_need_tmp_rsa "SSL *ssl" | ||
32 | .Ft RSA * | ||
33 | .Fn "(*tmp_rsa_callback)" "SSL *ssl" "int is_export" "int keylength" | ||
34 | .Sh DESCRIPTION | ||
35 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
36 | sets the callback function for | ||
37 | .Fa ctx | ||
38 | to be used when a temporary/ephemeral RSA key is required to | ||
39 | .Fa tmp_rsa_callback . | ||
40 | The callback is inherited by all | ||
41 | .Vt SSL | ||
42 | objects newly created from | ||
43 | .Fa ctx | ||
44 | with | ||
45 | .Xr SSL_new 3 . | ||
46 | Already created SSL objects are not affected. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_set_tmp_rsa | ||
49 | sets the temporary/ephemeral RSA key to be used to be | ||
50 | .Fa rsa . | ||
51 | The key is inherited by all | ||
52 | .Vt SSL | ||
53 | objects newly created from | ||
54 | .Fa ctx | ||
55 | with | ||
56 | .Xr SSL_new 3 . | ||
57 | Already created SSL objects are not affected. | ||
58 | .Pp | ||
59 | .Fn SSL_CTX_need_tmp_rsa | ||
60 | returns 1, | ||
61 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
62 | .Sq exportable | ||
63 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
64 | .Pp | ||
65 | .Fn SSL_set_tmp_rsa_callback | ||
66 | sets the callback only for | ||
67 | .Fa ssl . | ||
68 | .Pp | ||
69 | .Fn SSL_set_tmp_rsa | ||
70 | sets the key only for | ||
71 | .Fa ssl . | ||
72 | .Pp | ||
73 | .Fn SSL_need_tmp_rsa | ||
74 | returns 1, | ||
75 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
76 | .Sq exportable | ||
77 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
78 | .Pp | ||
79 | These functions apply to SSL/TLS servers only. | ||
80 | .Sh NOTES | ||
81 | When using a cipher with RSA authentication, | ||
82 | an ephemeral RSA key exchange can take place. | ||
83 | In this case the session data are negotiated using the ephemeral/temporary RSA | ||
84 | key and the RSA key supplied and certified by the certificate chain is only | ||
85 | used for signing. | ||
86 | .Pp | ||
87 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
88 | than the usual key length of 1024 bits were created. | ||
89 | To use these ciphers with RSA keys of usual length, an ephemeral key exchange | ||
90 | must be performed, as the normal (certified) key cannot be directly used. | ||
91 | .Pp | ||
92 | Using ephemeral RSA key exchange yields forward secrecy, | ||
93 | as the connection can only be decrypted when the RSA key is known. | ||
94 | By generating a temporary RSA key inside the server application that is lost | ||
95 | when the application is left, it becomes impossible for an attacker to decrypt | ||
96 | past sessions, even if he gets hold of the normal (certified) RSA key, | ||
97 | as this key was used for signing only. | ||
98 | The downside is that creating a RSA key is computationally expensive. | ||
99 | .Pp | ||
100 | Additionally, the use of ephemeral RSA key exchange is only allowed in the TLS | ||
101 | standard when the RSA key can be used for signing only, that is, | ||
102 | for export ciphers. | ||
103 | Using ephemeral RSA key exchange for other purposes violates the standard and | ||
104 | can break interoperability with clients. | ||
105 | It is therefore strongly recommended to not use ephemeral RSA key exchange and | ||
106 | use EDH (Ephemeral Diffie-Hellman) key exchange instead in order to achieve | ||
107 | forward secrecy (see | ||
108 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
109 | .Pp | ||
110 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
111 | and must be explicitly enabled using the | ||
112 | .Dv SSL_OP_EPHEMERAL_RSA | ||
113 | option of | ||
114 | .Xr SSL_CTX_set_options 3 , | ||
115 | violating the TLS/SSL | ||
116 | standard. | ||
117 | When ephemeral RSA key exchange is required for export ciphers, | ||
118 | it will automatically be used without this option! | ||
119 | .Pp | ||
120 | An application may either directly specify the key or can supply the key via | ||
121 | a callback function. | ||
122 | The callback approach has the advantage that the callback may generate the key | ||
123 | only in case it is actually needed. | ||
124 | However, as the generation of a RSA key is costly, | ||
125 | it will lead to a significant delay in the handshake procedure. | ||
126 | Another advantage of the callback function is that it can supply keys of | ||
127 | different size (e.g., for | ||
128 | .Dv SSL_OP_EPHEMERAL_RSA | ||
129 | usage) while the explicit setting of the key is only useful for key size of | ||
130 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
131 | if a longer key would be allowed. | ||
132 | .Pp | ||
133 | The | ||
134 | .Fa tmp_rsa_callback | ||
135 | is called with the | ||
136 | .Fa keylength | ||
137 | needed and the | ||
138 | .Fa is_export | ||
139 | information. | ||
140 | The | ||
141 | .Fa is_export | ||
142 | flag is set when the ephemeral RSA key exchange is performed with an export | ||
143 | cipher. | ||
144 | .Sh RETURN VALUES | ||
145 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
146 | and | ||
147 | .Fn SSL_set_tmp_rsa_callback | ||
148 | do not return diagnostic output. | ||
149 | .Pp | ||
150 | .Fn SSL_CTX_set_tmp_rsa | ||
151 | and | ||
152 | .Fn SSL_set_tmp_rsa | ||
153 | return 1 on success and 0 on failure. | ||
154 | Check the error queue to find out the reason of failure. | ||
155 | .Pp | ||
156 | .Fn SSL_CTX_need_tmp_rsa | ||
157 | and | ||
158 | .Fn SSL_need_tmp_rsa | ||
159 | return 1 if a temporary RSA key is needed and 0 otherwise. | ||
160 | .Sh EXAMPLES | ||
161 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. | ||
162 | As the generation of a RSA key costs a lot of computer time, | ||
163 | they are saved for later reuse. | ||
164 | For demonstration purposes, two keys for 512 bits and 1024 bits | ||
165 | respectively are generated. | ||
166 | .Bd -literal | ||
167 | \&... | ||
168 | |||
169 | /* Set up ephemeral RSA stuff */ | ||
170 | RSA *rsa_512 = NULL; | ||
171 | RSA *rsa_1024 = NULL; | ||
172 | |||
173 | rsa_512 = RSA_generate_key(512, RSA_F4, NULL, NULL); | ||
174 | if (rsa_512 == NULL) | ||
175 | evaluate_error_queue(); | ||
176 | |||
177 | rsa_1024 = RSA_generate_key(1024, RSA_F4, NULL, NULL); | ||
178 | if (rsa_1024 == NULL) | ||
179 | evaluate_error_queue(); | ||
180 | |||
181 | \&... | ||
182 | |||
183 | RSA * | ||
184 | tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
185 | { | ||
186 | RSA *rsa_tmp = NULL; | ||
187 | |||
188 | switch (keylength) { | ||
189 | case 512: | ||
190 | if (rsa_512) | ||
191 | rsa_tmp = rsa_512; | ||
192 | else { | ||
193 | /* | ||
194 | * generate on the fly, | ||
195 | * should not happen in this example | ||
196 | */ | ||
197 | rsa_tmp = RSA_generate_key(keylength, RSA_F4, NULL, | ||
198 | NULL); | ||
199 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
200 | } | ||
201 | break; | ||
202 | case 1024: | ||
203 | if (rsa_1024) | ||
204 | rsa_tmp = rsa_1024; | ||
205 | else | ||
206 | should_not_happen_in_this_example(); | ||
207 | break; | ||
208 | default: | ||
209 | /* | ||
210 | * Generating a key on the fly is very costly, | ||
211 | * so use what is there | ||
212 | */ | ||
213 | if (rsa_1024) | ||
214 | rsa_tmp = rsa_1024; | ||
215 | else | ||
216 | /* Use at least a shorter key */ | ||
217 | rsa_tmp = rsa_512; | ||
218 | } | ||
219 | return rsa_tmp; | ||
220 | } | ||
221 | .Ed | ||
222 | .Sh SEE ALSO | ||
223 | .Xr ciphers 1 , | ||
224 | .Xr ssl 3 , | ||
225 | .Xr SSL_CTX_set_cipher_list 3 , | ||
226 | .Xr SSL_CTX_set_options 3 , | ||
227 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
228 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_set_verify.3 b/src/lib/libssl/doc/SSL_CTX_set_verify.3 new file mode 100644 index 0000000000..6ce2e60089 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_set_verify.3 | |||
@@ -0,0 +1,412 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_VERIFY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_verify , | ||
6 | .Nm SSL_set_verify , | ||
7 | .Nm SSL_CTX_set_verify_depth , | ||
8 | .Nm SSL_set_verify_depth | ||
9 | .Nd set peer certificate verification parameters | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_verify | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "int mode" | ||
16 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
17 | .Fc | ||
18 | .Ft void | ||
19 | .Fo SSL_set_verify | ||
20 | .Fa "SSL *s" | ||
21 | .Fa "int mode" | ||
22 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fn SSL_CTX_set_verify_depth "SSL_CTX *ctx" "int depth" | ||
26 | .Ft void | ||
27 | .Fn SSL_set_verify_depth "SSL *s" "int depth" | ||
28 | .Ft int | ||
29 | .Fn verify_callback "int preverify_ok" "X509_STORE_CTX *x509_ctx" | ||
30 | .Sh DESCRIPTION | ||
31 | .Fn SSL_CTX_set_verify | ||
32 | sets the verification flags for | ||
33 | .Fa ctx | ||
34 | to be | ||
35 | .Fa mode | ||
36 | and | ||
37 | specifies the | ||
38 | .Fa verify_callback | ||
39 | function to be used. | ||
40 | If no callback function shall be specified, the | ||
41 | .Dv NULL | ||
42 | pointer can be used for | ||
43 | .Fa verify_callback . | ||
44 | .Pp | ||
45 | .Fn SSL_set_verify | ||
46 | sets the verification flags for | ||
47 | .Fa ssl | ||
48 | to be | ||
49 | .Fa mode | ||
50 | and specifies the | ||
51 | .Fa verify_callback | ||
52 | function to be used. | ||
53 | If no callback function shall be specified, the | ||
54 | .Dv NULL | ||
55 | pointer can be used for | ||
56 | .Fa verify_callback . | ||
57 | In this case last | ||
58 | .Fa verify_callback | ||
59 | set specifically for this | ||
60 | .Fa ssl | ||
61 | remains. | ||
62 | If no special callback was set before, the default callback for the underlying | ||
63 | .Fa ctx | ||
64 | is used, that was valid at the time | ||
65 | .Fa ssl | ||
66 | was created with | ||
67 | .Xr SSL_new 3 . | ||
68 | .Pp | ||
69 | .Fn SSL_CTX_set_verify_depth | ||
70 | sets the maximum | ||
71 | .Fa depth | ||
72 | for the certificate chain verification that shall be allowed for | ||
73 | .Fa ctx . | ||
74 | (See the | ||
75 | .Sx BUGS | ||
76 | section.) | ||
77 | .Pp | ||
78 | .Fn SSL_set_verify_depth | ||
79 | sets the maximum | ||
80 | .Fa depth | ||
81 | for the certificate chain verification that shall be allowed for | ||
82 | .Fa ssl . | ||
83 | (See the | ||
84 | .Sx BUGS | ||
85 | section.) | ||
86 | .Sh NOTES | ||
87 | The verification of certificates can be controlled by a set of bitwise ORed | ||
88 | .Fa mode | ||
89 | flags: | ||
90 | .Bl -tag -width Ds | ||
91 | .It Dv SSL_VERIFY_NONE | ||
92 | .Em Server mode: | ||
93 | the server will not send a client certificate request to the client, | ||
94 | so the client will not send a certificate. | ||
95 | .Pp | ||
96 | .Em Client mode: | ||
97 | if not using an anonymous cipher (by default disabled), | ||
98 | the server will send a certificate which will be checked. | ||
99 | The result of the certificate verification process can be checked after the | ||
100 | TLS/SSL handshake using the | ||
101 | .Xr SSL_get_verify_result 3 | ||
102 | function. | ||
103 | The handshake will be continued regardless of the verification result. | ||
104 | .It Dv SSL_VERIFY_PEER | ||
105 | .Em Server mode: | ||
106 | the server sends a client certificate request to the client. | ||
107 | The certificate returned (if any) is checked. | ||
108 | If the verification process fails, | ||
109 | the TLS/SSL handshake is immediately terminated with an alert message | ||
110 | containing the reason for the verification failure. | ||
111 | The behaviour can be controlled by the additional | ||
112 | .Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
113 | and | ||
114 | .Dv SSL_VERIFY_CLIENT_ONCE | ||
115 | flags. | ||
116 | .Pp | ||
117 | .Em Client mode: | ||
118 | the server certificate is verified. | ||
119 | If the verification process fails, | ||
120 | the TLS/SSL handshake is immediately terminated with an alert message | ||
121 | containing the reason for the verification failure. | ||
122 | If no server certificate is sent, because an anonymous cipher is used, | ||
123 | .Dv SSL_VERIFY_PEER | ||
124 | is ignored. | ||
125 | .It Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
126 | .Em Server mode: | ||
127 | if the client did not return a certificate, the TLS/SSL | ||
128 | handshake is immediately terminated with a | ||
129 | .Dq handshake failure | ||
130 | alert. | ||
131 | This flag must be used together with | ||
132 | .Dv SSL_VERIFY_PEER. | ||
133 | .Pp | ||
134 | .Em Client mode: | ||
135 | ignored | ||
136 | .It Dv SSL_VERIFY_CLIENT_ONCE | ||
137 | .Em Server mode: | ||
138 | only request a client certificate on the initial TLS/SSL handshake. | ||
139 | Do not ask for a client certificate again in case of a renegotiation. | ||
140 | This flag must be used together with | ||
141 | .Dv SSL_VERIFY_PEER . | ||
142 | .Pp | ||
143 | .Em Client mode: | ||
144 | ignored | ||
145 | .El | ||
146 | .Pp | ||
147 | Exactly one of the | ||
148 | .Fa mode | ||
149 | flags | ||
150 | .Dv SSL_VERIFY_NONE | ||
151 | and | ||
152 | .Dv SSL_VERIFY_PEER | ||
153 | must be set at any time. | ||
154 | .Pp | ||
155 | The actual verification procedure is performed either using the built-in | ||
156 | verification procedure or using another application provided verification | ||
157 | function set with | ||
158 | .Xr SSL_CTX_set_cert_verify_callback 3 . | ||
159 | The following descriptions apply in the case of the built-in procedure. | ||
160 | An application provided procedure also has access to the verify depth | ||
161 | information and the | ||
162 | .Fa verify_callback Ns () | ||
163 | function, but the way this information is used may be different. | ||
164 | .Pp | ||
165 | .Fn SSL_CTX_set_verify_depth | ||
166 | and | ||
167 | .Fn SSL_set_verify_depth | ||
168 | set the limit up to which depth certificates in a chain are used during the | ||
169 | verification procedure. | ||
170 | If the certificate chain is longer than allowed, | ||
171 | the certificates above the limit are ignored. | ||
172 | Error messages are generated as if these certificates would not be present, | ||
173 | most likely a | ||
174 | .Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY | ||
175 | will be issued. | ||
176 | The depth count is | ||
177 | .Dq level 0: peer certificate , | ||
178 | .Dq level 1: CA certificate , | ||
179 | .Dq level 2: higher level CA certificate , | ||
180 | and so on. | ||
181 | Setting the maximum depth to 2 allows the levels 0, 1, and 2. | ||
182 | The default depth limit is 100, | ||
183 | allowing for the peer certificate and an additional 100 CA certificates. | ||
184 | .Pp | ||
185 | The | ||
186 | .Fa verify_callback | ||
187 | function is used to control the behaviour when the | ||
188 | .Dv SSL_VERIFY_PEER | ||
189 | flag is set. | ||
190 | It must be supplied by the application and receives two arguments: | ||
191 | .Fa preverify_ok | ||
192 | indicates whether the verification of the certificate in question was passed | ||
193 | (preverify_ok=1) or not (preverify_ok=0). | ||
194 | .Fa x509_ctx | ||
195 | is a pointer to the complete context used | ||
196 | for the certificate chain verification. | ||
197 | .Pp | ||
198 | The certificate chain is checked starting with the deepest nesting level | ||
199 | (the root CA certificate) and worked upward to the peer's certificate. | ||
200 | At each level signatures and issuer attributes are checked. | ||
201 | Whenever a verification error is found, the error number is stored in | ||
202 | .Fa x509_ctx | ||
203 | and | ||
204 | .Fa verify_callback | ||
205 | is called with | ||
206 | .Fa preverify_ok | ||
207 | equal to 0. | ||
208 | By applying | ||
209 | .Fn X509_CTX_store_* | ||
210 | functions | ||
211 | .Fa verify_callback | ||
212 | can locate the certificate in question and perform additional steps (see | ||
213 | .Sx EXAMPLES ) . | ||
214 | If no error is found for a certificate, | ||
215 | .Fa verify_callback | ||
216 | is called with | ||
217 | .Fa preverify_ok | ||
218 | equal to 1 before advancing to the next level. | ||
219 | .Pp | ||
220 | The return value of | ||
221 | .Fa verify_callback | ||
222 | controls the strategy of the further verification process. | ||
223 | If | ||
224 | .Fa verify_callback | ||
225 | returns 0, the verification process is immediately stopped with | ||
226 | .Dq verification failed | ||
227 | state. | ||
228 | If | ||
229 | .Dv SSL_VERIFY_PEER | ||
230 | is set, a verification failure alert is sent to the peer and the TLS/SSL | ||
231 | handshake is terminated. | ||
232 | If | ||
233 | .Fa verify_callback | ||
234 | returns 1, the verification process is continued. | ||
235 | If | ||
236 | .Fa verify_callback | ||
237 | always returns 1, | ||
238 | the TLS/SSL handshake will not be terminated with respect to verification | ||
239 | failures and the connection will be established. | ||
240 | The calling process can however retrieve the error code of the last | ||
241 | verification error using | ||
242 | .Xr SSL_get_verify_result 3 | ||
243 | or by maintaining its own error storage managed by | ||
244 | .Fa verify_callback . | ||
245 | .Pp | ||
246 | If no | ||
247 | .Fa verify_callback | ||
248 | is specified, the default callback will be used. | ||
249 | Its return value is identical to | ||
250 | .Fa preverify_ok , | ||
251 | so that any verification | ||
252 | failure will lead to a termination of the TLS/SSL handshake with an | ||
253 | alert message, if | ||
254 | .Dv SSL_VERIFY_PEER | ||
255 | is set. | ||
256 | .Sh RETURN VALUES | ||
257 | The | ||
258 | .Fn SSL*_set_verify* | ||
259 | functions do not provide diagnostic information. | ||
260 | .Sh EXAMPLES | ||
261 | The following code sequence realizes an example | ||
262 | .Fa verify_callback | ||
263 | function that will always continue the TLS/SSL handshake regardless of | ||
264 | verification failure, if wished. | ||
265 | The callback realizes a verification depth limit with more informational output. | ||
266 | .Pp | ||
267 | All verification errors are printed; | ||
268 | information about the certificate chain is printed on request. | ||
269 | The example is realized for a server that does allow but not require client | ||
270 | certificates. | ||
271 | .Pp | ||
272 | The example makes use of the ex_data technique to store application data | ||
273 | into/retrieve application data from the | ||
274 | .Vt SSL | ||
275 | structure (see | ||
276 | .Xr SSL_get_ex_new_index 3 , | ||
277 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 ) . | ||
278 | .Bd -literal | ||
279 | \&... | ||
280 | |||
281 | typedef struct { | ||
282 | int verbose_mode; | ||
283 | int verify_depth; | ||
284 | int always_continue; | ||
285 | } mydata_t; | ||
286 | int mydata_index; | ||
287 | \&... | ||
288 | static int | ||
289 | verify_callback(int preverify_ok, X509_STORE_CTX *ctx) | ||
290 | { | ||
291 | char buf[256]; | ||
292 | X509 *err_cert; | ||
293 | int err, depth; | ||
294 | SSL *ssl; | ||
295 | mydata_t *mydata; | ||
296 | |||
297 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
298 | err = X509_STORE_CTX_get_error(ctx); | ||
299 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
300 | |||
301 | /* | ||
302 | * Retrieve the pointer to the SSL of the connection currently | ||
303 | * treated * and the application specific data stored into the | ||
304 | * SSL object. | ||
305 | */ | ||
306 | ssl = X509_STORE_CTX_get_ex_data(ctx, | ||
307 | SSL_get_ex_data_X509_STORE_CTX_idx()); | ||
308 | mydata = SSL_get_ex_data(ssl, mydata_index); | ||
309 | |||
310 | X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256); | ||
311 | |||
312 | /* | ||
313 | * Catch a too long certificate chain. The depth limit set using | ||
314 | * SSL_CTX_set_verify_depth() is by purpose set to "limit+1" so | ||
315 | * that whenever the "depth>verify_depth" condition is met, we | ||
316 | * have violated the limit and want to log this error condition. | ||
317 | * We must do it here, because the CHAIN_TOO_LONG error would not | ||
318 | * be found explicitly; only errors introduced by cutting off the | ||
319 | * additional certificates would be logged. | ||
320 | */ | ||
321 | if (depth > mydata->verify_depth) { | ||
322 | preverify_ok = 0; | ||
323 | err = X509_V_ERR_CERT_CHAIN_TOO_LONG; | ||
324 | X509_STORE_CTX_set_error(ctx, err); | ||
325 | } | ||
326 | if (!preverify_ok) { | ||
327 | printf("verify error:num=%d:%s:depth=%d:%s\en", err, | ||
328 | X509_verify_cert_error_string(err), depth, buf); | ||
329 | } else if (mydata->verbose_mode) { | ||
330 | printf("depth=%d:%s\en", depth, buf); | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | * At this point, err contains the last verification error. | ||
335 | * We can use it for something special | ||
336 | */ | ||
337 | if (!preverify_ok && (err == | ||
338 | X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) { | ||
339 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), | ||
340 | buf, 256); | ||
341 | printf("issuer= %s\en", buf); | ||
342 | } | ||
343 | |||
344 | if (mydata->always_continue) | ||
345 | return 1; | ||
346 | else | ||
347 | return preverify_ok; | ||
348 | } | ||
349 | \&... | ||
350 | |||
351 | mydata_t mydata; | ||
352 | |||
353 | \&... | ||
354 | |||
355 | mydata_index = SSL_get_ex_new_index(0, "mydata index", NULL, NULL, NULL); | ||
356 | |||
357 | \&... | ||
358 | |||
359 | SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, | ||
360 | verify_callback); | ||
361 | |||
362 | /* | ||
363 | * Let the verify_callback catch the verify_depth error so that we get | ||
364 | * an appropriate error in the logfile. | ||
365 | */ | ||
366 | SSL_CTX_set_verify_depth(verify_depth + 1); | ||
367 | |||
368 | /* | ||
369 | * Set up the SSL specific data into "mydata" and store it into the SSL | ||
370 | * structure. | ||
371 | */ | ||
372 | mydata.verify_depth = verify_depth; ... | ||
373 | SSL_set_ex_data(ssl, mydata_index, &mydata); | ||
374 | |||
375 | \&... | ||
376 | |||
377 | SSL_accept(ssl); /* check of success left out for clarity */ | ||
378 | if (peer = SSL_get_peer_certificate(ssl)) { | ||
379 | if (SSL_get_verify_result(ssl) == X509_V_OK) { | ||
380 | /* The client sent a certificate which verified OK */ | ||
381 | } | ||
382 | } | ||
383 | .Ed | ||
384 | .Sh SEE ALSO | ||
385 | .Xr ssl 3 , | ||
386 | .Xr SSL_CTX_get_verify_mode 3 , | ||
387 | .Xr SSL_CTX_load_verify_locations 3 , | ||
388 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
389 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
390 | .Xr SSL_get_ex_new_index 3 , | ||
391 | .Xr SSL_get_peer_certificate 3 , | ||
392 | .Xr SSL_get_verify_result 3 , | ||
393 | .Xr SSL_new 3 | ||
394 | .Sh BUGS | ||
395 | In client mode, it is not checked whether the | ||
396 | .Dv SSL_VERIFY_PEER | ||
397 | flag is set, but whether | ||
398 | .Dv SSL_VERIFY_NONE | ||
399 | is not set. | ||
400 | This can lead to unexpected behaviour, if the | ||
401 | .Dv SSL_VERIFY_PEER | ||
402 | and | ||
403 | .Dv SSL_VERIFY_NONE | ||
404 | are not used as required (exactly one must be set at any time). | ||
405 | .Pp | ||
406 | The certificate verification depth set with | ||
407 | .Fn SSL[_CTX]_verify_depth | ||
408 | stops the verification at a certain depth. | ||
409 | The error message produced will be that of an incomplete certificate chain and | ||
410 | not | ||
411 | .Dv X509_V_ERR_CERT_CHAIN_TOO_LONG | ||
412 | as may be expected. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_use_certificate.3 b/src/lib/libssl/doc/SSL_CTX_use_certificate.3 new file mode 100644 index 0000000000..eac4d8e42c --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_use_certificate.3 | |||
@@ -0,0 +1,333 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_USE_CERTIFICATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_use_certificate , | ||
6 | .Nm SSL_CTX_use_certificate_ASN1 , | ||
7 | .Nm SSL_CTX_use_certificate_file , | ||
8 | .Nm SSL_use_certificate , | ||
9 | .Nm SSL_use_certificate_ASN1 , | ||
10 | .Nm SSL_use_certificate_file , | ||
11 | .Nm SSL_CTX_use_certificate_chain , | ||
12 | .Nm SSL_CTX_use_certificate_chain_file , | ||
13 | .Nm SSL_CTX_use_PrivateKey , | ||
14 | .Nm SSL_CTX_use_PrivateKey_ASN1 , | ||
15 | .Nm SSL_CTX_use_PrivateKey_file , | ||
16 | .Nm SSL_CTX_use_RSAPrivateKey , | ||
17 | .Nm SSL_CTX_use_RSAPrivateKey_ASN1 , | ||
18 | .Nm SSL_CTX_use_RSAPrivateKey_file , | ||
19 | .Nm SSL_use_PrivateKey_file , | ||
20 | .Nm SSL_use_PrivateKey_ASN1 , | ||
21 | .Nm SSL_use_PrivateKey , | ||
22 | .Nm SSL_use_RSAPrivateKey , | ||
23 | .Nm SSL_use_RSAPrivateKey_ASN1 , | ||
24 | .Nm SSL_use_RSAPrivateKey_file , | ||
25 | .Nm SSL_CTX_check_private_key , | ||
26 | .Nm SSL_check_private_key | ||
27 | .Nd load certificate and key data | ||
28 | .Sh SYNOPSIS | ||
29 | .In openssl/ssl.h | ||
30 | .Ft int | ||
31 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
32 | .Ft int | ||
33 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
34 | .Ft int | ||
35 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "const char *file" "int type" | ||
36 | .Ft int | ||
37 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
38 | .Ft int | ||
39 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "unsigned char *d" "int len" | ||
40 | .Ft int | ||
41 | .Fn SSL_use_certificate_file "SSL *ssl" "const char *file" "int type" | ||
42 | .Ft int | ||
43 | .Fn SSL_CTX_use_certificate_chain "SSL_CTX *ctx" "void *buf" "int len" | ||
44 | .Ft int | ||
45 | .Fn SSL_CTX_use_certificate_chain_file "SSL_CTX *ctx" "const char *file" | ||
46 | .Ft int | ||
47 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
48 | .Ft int | ||
49 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
50 | .Fa "int pk" "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
54 | .Ft int | ||
55 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
56 | .Ft int | ||
57 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
58 | .Ft int | ||
59 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
60 | .Ft int | ||
61 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
62 | .Ft int | ||
63 | .Fn SSL_use_PrivateKey_ASN1 "int pk" "SSL *ssl" "unsigned char *d" "long len" | ||
64 | .Ft int | ||
65 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
66 | .Ft int | ||
67 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
68 | .Ft int | ||
69 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
70 | .Ft int | ||
71 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
72 | .Ft int | ||
73 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
74 | .Ft int | ||
75 | .Fn SSL_check_private_key "const SSL *ssl" | ||
76 | .Sh DESCRIPTION | ||
77 | These functions load the certificates and private keys into the | ||
78 | .Vt SSL_CTX | ||
79 | or | ||
80 | .Vt SSL | ||
81 | object, respectively. | ||
82 | .Pp | ||
83 | The | ||
84 | .Fn SSL_CTX_* | ||
85 | class of functions loads the certificates and keys into the | ||
86 | .Vt SSL_CTX | ||
87 | object | ||
88 | .Fa ctx . | ||
89 | The information is passed to | ||
90 | .Vt SSL | ||
91 | objects | ||
92 | .Fa ssl | ||
93 | created from | ||
94 | .Fa ctx | ||
95 | with | ||
96 | .Xr SSL_new 3 | ||
97 | by copying, so that changes applied to | ||
98 | .Fa ctx | ||
99 | do not propagate to already existing | ||
100 | .Vt SSL | ||
101 | objects. | ||
102 | .Pp | ||
103 | The | ||
104 | .Fn SSL_* | ||
105 | class of functions only loads certificates and keys into a specific | ||
106 | .Vt SSL | ||
107 | object. | ||
108 | The specific information is kept when | ||
109 | .Xr SSL_clear 3 | ||
110 | is called for this | ||
111 | .Vt SSL | ||
112 | object. | ||
113 | .Pp | ||
114 | .Fn SSL_CTX_use_certificate | ||
115 | loads the certificate | ||
116 | .Fa x | ||
117 | into | ||
118 | .Fa ctx ; | ||
119 | .Fn SSL_use_certificate | ||
120 | loads | ||
121 | .Fa x | ||
122 | into | ||
123 | .Fa ssl . | ||
124 | The rest of the certificates needed to form the complete certificate chain can | ||
125 | be specified using the | ||
126 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
127 | function. | ||
128 | .Pp | ||
129 | .Fn SSL_CTX_use_certificate_ASN1 | ||
130 | loads the ASN1 encoded certificate from the memory location | ||
131 | .Fa d | ||
132 | (with length | ||
133 | .Fa len ) | ||
134 | into | ||
135 | .Fa ctx ; | ||
136 | .Fn SSL_use_certificate_ASN1 | ||
137 | loads the ASN1 encoded certificate into | ||
138 | .Fa ssl . | ||
139 | .Pp | ||
140 | .Fn SSL_CTX_use_certificate_file | ||
141 | loads the first certificate stored in | ||
142 | .Fa file | ||
143 | into | ||
144 | .Fa ctx . | ||
145 | The formatting | ||
146 | .Fa type | ||
147 | of the certificate must be specified from the known types | ||
148 | .Dv SSL_FILETYPE_PEM | ||
149 | and | ||
150 | .Dv SSL_FILETYPE_ASN1 . | ||
151 | .Fn SSL_use_certificate_file | ||
152 | loads the certificate from | ||
153 | .Fa file | ||
154 | into | ||
155 | .Fa ssl . | ||
156 | See the | ||
157 | .Sx NOTES | ||
158 | section on why | ||
159 | .Fn SSL_CTX_use_certificate_chain_file | ||
160 | should be preferred. | ||
161 | .Pp | ||
162 | The | ||
163 | .Fn SSL_CTX_use_certificate_chain* | ||
164 | functions load a certificate chain into | ||
165 | .Fa ctx . | ||
166 | The certificates must be in PEM format and must be sorted starting with the | ||
167 | subject's certificate (actual client or server certificate), | ||
168 | followed by intermediate CA certificates if applicable, | ||
169 | and ending at the highest level (root) CA. | ||
170 | There is no corresponding function working on a single | ||
171 | .Vt SSL | ||
172 | object. | ||
173 | .Pp | ||
174 | .Fn SSL_CTX_use_PrivateKey | ||
175 | adds | ||
176 | .Fa pkey | ||
177 | as private key to | ||
178 | .Fa ctx . | ||
179 | .Fn SSL_CTX_use_RSAPrivateKey | ||
180 | adds the private key | ||
181 | .Fa rsa | ||
182 | of type RSA to | ||
183 | .Fa ctx . | ||
184 | .Fn SSL_use_PrivateKey | ||
185 | adds | ||
186 | .Fa pkey | ||
187 | as private key to | ||
188 | .Fa ssl ; | ||
189 | .Fn SSL_use_RSAPrivateKey | ||
190 | adds | ||
191 | .Fa rsa | ||
192 | as private key of type RSA to | ||
193 | .Fa ssl . | ||
194 | If a certificate has already been set and the private does not belong to the | ||
195 | certificate, an error is returned. | ||
196 | To change a certificate private key pair, | ||
197 | the new certificate needs to be set with | ||
198 | .Fn SSL_use_certificate | ||
199 | or | ||
200 | .Fn SSL_CTX_use_certificate | ||
201 | before setting the private key with | ||
202 | .Fn SSL_CTX_use_PrivateKey | ||
203 | or | ||
204 | .Fn SSL_use_PrivateKey . | ||
205 | .Pp | ||
206 | .Fn SSL_CTX_use_PrivateKey_ASN1 | ||
207 | adds the private key of type | ||
208 | .Fa pk | ||
209 | stored at memory location | ||
210 | .Fa d | ||
211 | (length | ||
212 | .Fa len ) | ||
213 | to | ||
214 | .Fa ctx . | ||
215 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 | ||
216 | adds the private key of type RSA stored at memory location | ||
217 | .Fa d | ||
218 | (length | ||
219 | .Fa len ) | ||
220 | to | ||
221 | .Fa ctx . | ||
222 | .Fn SSL_use_PrivateKey_ASN1 | ||
223 | and | ||
224 | .Fn SSL_use_RSAPrivateKey_ASN1 | ||
225 | add the private key to | ||
226 | .Fa ssl . | ||
227 | .Pp | ||
228 | .Fn SSL_CTX_use_PrivateKey_file | ||
229 | adds the first private key found in | ||
230 | .Fa file | ||
231 | to | ||
232 | .Fa ctx . | ||
233 | The formatting | ||
234 | .Fa type | ||
235 | of the certificate must be specified from the known types | ||
236 | .Dv SSL_FILETYPE_PEM | ||
237 | and | ||
238 | .Dv SSL_FILETYPE_ASN1 . | ||
239 | .Fn SSL_CTX_use_RSAPrivateKey_file | ||
240 | adds the first private RSA key found in | ||
241 | .Fa file | ||
242 | to | ||
243 | .Fa ctx . | ||
244 | .Fn SSL_use_PrivateKey_file | ||
245 | adds the first private key found in | ||
246 | .Fa file | ||
247 | to | ||
248 | .Fa ssl ; | ||
249 | .Fn SSL_use_RSAPrivateKey_file | ||
250 | adds the first private RSA key found to | ||
251 | .Fa ssl . | ||
252 | .Pp | ||
253 | .Fn SSL_CTX_check_private_key | ||
254 | checks the consistency of a private key with the corresponding certificate | ||
255 | loaded into | ||
256 | .Fa ctx . | ||
257 | If more than one key/certificate pair (RSA/DSA) is installed, | ||
258 | the last item installed will be checked. | ||
259 | If, e.g., the last item was a RSA certificate or key, | ||
260 | the RSA key/certificate pair will be checked. | ||
261 | .Fn SSL_check_private_key | ||
262 | performs the same check for | ||
263 | .Fa ssl . | ||
264 | If no key/certificate was explicitly added for this | ||
265 | .Fa ssl , | ||
266 | the last item added into | ||
267 | .Fa ctx | ||
268 | will be checked. | ||
269 | .Sh NOTES | ||
270 | The internal certificate store of OpenSSL can hold two private key/certificate | ||
271 | pairs at a time: | ||
272 | one key/certificate of type RSA and one key/certificate of type DSA. | ||
273 | The certificate used depends on the cipher select, see also | ||
274 | .Xr SSL_CTX_set_cipher_list 3 . | ||
275 | .Pp | ||
276 | When reading certificates and private keys from file, files of type | ||
277 | .Dv SSL_FILETYPE_ASN1 | ||
278 | (also known as | ||
279 | .Em DER , | ||
280 | binary encoding) can only contain one certificate or private key; consequently, | ||
281 | .Fn SSL_CTX_use_certificate_chain_file | ||
282 | is only applicable to PEM formatting. | ||
283 | Files of type | ||
284 | .Dv SSL_FILETYPE_PEM | ||
285 | can contain more than one item. | ||
286 | .Pp | ||
287 | .Fn SSL_CTX_use_certificate_chain_file | ||
288 | adds the first certificate found in the file to the certificate store. | ||
289 | The other certificates are added to the store of chain certificates using | ||
290 | .Xr SSL_CTX_add_extra_chain_cert 3 . | ||
291 | There exists only one extra chain store, so that the same chain is appended | ||
292 | to both types of certificates, RSA and DSA! | ||
293 | If it is not intended to use both type of certificate at the same time, | ||
294 | it is recommended to use the | ||
295 | .Fn SSL_CTX_use_certificate_chain_file | ||
296 | instead of the | ||
297 | .Fn SSL_CTX_use_certificate_file | ||
298 | function in order to allow the use of complete certificate chains even when no | ||
299 | trusted CA storage is used or when the CA issuing the certificate shall not be | ||
300 | added to the trusted CA storage. | ||
301 | .Pp | ||
302 | If additional certificates are needed to complete the chain during the TLS | ||
303 | negotiation, CA certificates are additionally looked up in the locations of | ||
304 | trusted CA certificates (see | ||
305 | .Xr SSL_CTX_load_verify_locations 3 ) . | ||
306 | .Pp | ||
307 | The private keys loaded from file can be encrypted. | ||
308 | In order to successfully load encrypted keys, | ||
309 | a function returning the passphrase must have been supplied (see | ||
310 | .Xr SSL_CTX_set_default_passwd_cb 3 ) . | ||
311 | (Certificate files might be encrypted as well from the technical point of view, | ||
312 | it however does not make sense as the data in the certificate is considered | ||
313 | public anyway.) | ||
314 | .Sh RETURN VALUES | ||
315 | On success, the functions return 1. | ||
316 | Otherwise check out the error stack to find out the reason. | ||
317 | .Sh SEE ALSO | ||
318 | .Xr ssl 3 , | ||
319 | .Xr SSL_clear 3 , | ||
320 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
321 | .Xr SSL_CTX_load_verify_locations 3 , | ||
322 | .Xr SSL_CTX_set_cipher_list 3 , | ||
323 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
324 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
325 | .Xr SSL_new 3 | ||
326 | .Sh HISTORY | ||
327 | Support for DER encoded private keys | ||
328 | .Pq Dv SSL_FILETYPE_ASN1 | ||
329 | in | ||
330 | .Fn SSL_CTX_use_PrivateKey_file | ||
331 | and | ||
332 | .Fn SSL_use_PrivateKey_file | ||
333 | was added in 0.9.8. | ||
diff --git a/src/lib/libssl/doc/SSL_CTX_use_psk_identity_hint.3 b/src/lib/libssl/doc/SSL_CTX_use_psk_identity_hint.3 new file mode 100644 index 0000000000..4d4e8a6173 --- /dev/null +++ b/src/lib/libssl/doc/SSL_CTX_use_psk_identity_hint.3 | |||
@@ -0,0 +1,107 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_USE_PSK_IDENTITY_HINT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_use_psk_identity_hint , | ||
6 | .Nm SSL_use_psk_identity_hint , | ||
7 | .Nm SSL_CTX_set_psk_server_callback , | ||
8 | .Nm SSL_set_psk_server_callback | ||
9 | .Nd set PSK identity hint to use | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft int | ||
13 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
14 | .Ft int | ||
15 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
16 | .Ft void | ||
17 | .Fo SSL_CTX_set_psk_server_callback | ||
18 | .Fa "SSL_CTX *ctx" | ||
19 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
20 | .Fc | ||
21 | .Ft void | ||
22 | .Fo SSL_set_psk_server_callback | ||
23 | .Fa "SSL *ssl" | ||
24 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
25 | .Fc | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_use_psk_identity_hint | ||
28 | sets the given | ||
29 | .Dv NULL Ns | ||
30 | -terminated PSK identity hint | ||
31 | .Fa hint | ||
32 | to SSL context object | ||
33 | .Fa ctx . | ||
34 | .Fn SSL_use_psk_identity_hint | ||
35 | sets the given | ||
36 | .Dv NULL Ns | ||
37 | -terminated | ||
38 | PSK identity hint | ||
39 | .Fa hint | ||
40 | to SSL connection object | ||
41 | .Fa ssl . | ||
42 | If | ||
43 | .Fa hint | ||
44 | is | ||
45 | .Dv NULL | ||
46 | the current hint from | ||
47 | .Fa ctx | ||
48 | or | ||
49 | .Fa ssl | ||
50 | is deleted. | ||
51 | .Pp | ||
52 | In the case where PSK identity hint is | ||
53 | .Dv NULL , | ||
54 | the server does not send the | ||
55 | .Em ServerKeyExchange | ||
56 | message to the client. | ||
57 | .Pp | ||
58 | A server application must provide a callback function which is called when the | ||
59 | server receives the | ||
60 | .Em ClientKeyExchange | ||
61 | message from the client. | ||
62 | The purpose of the callback function is to validate the received PSK identity | ||
63 | and to fetch the pre-shared key used during the connection setup phase. | ||
64 | The callback is set using functions | ||
65 | .Fn SSL_CTX_set_psk_server_callback | ||
66 | or | ||
67 | .Fn SSL_set_psk_server_callback . | ||
68 | The callback function is given the connection in parameter | ||
69 | .Fa ssl , | ||
70 | .Dv NULL Ns | ||
71 | -terminated PSK identity sent by the client in parameter | ||
72 | .Fa identity , | ||
73 | and a buffer | ||
74 | .Fa psk | ||
75 | of length | ||
76 | .Fa max_psk_len | ||
77 | bytes where the pre-shared key is to be stored. | ||
78 | .Sh RETURN VALUES | ||
79 | .Fn SSL_CTX_use_psk_identity_hint | ||
80 | and | ||
81 | .Fn SSL_use_psk_identity_hint | ||
82 | return 1 on success, 0 otherwise. | ||
83 | .Pp | ||
84 | Return values from the server callback are interpreted as follows: | ||
85 | .Bl -tag -width Ds | ||
86 | .It >0 | ||
87 | PSK identity was found and the server callback has provided the PSK | ||
88 | successfully in parameter | ||
89 | .Fa psk . | ||
90 | Return value is the length of | ||
91 | .Fa psk | ||
92 | in bytes. | ||
93 | It is an error to return a value greater than | ||
94 | .Fa max_psk_len . | ||
95 | .Pp | ||
96 | If the PSK identity was not found but the callback instructs the protocol to | ||
97 | continue anyway, the callback must provide some random data to | ||
98 | .Fa psk | ||
99 | and return the length of the random data, so the connection will fail with | ||
100 | .Dq decryption_error | ||
101 | before it will be finished completely. | ||
102 | .It 0 | ||
103 | PSK identity was not found. | ||
104 | An | ||
105 | .Dq unknown_psk_identity | ||
106 | alert message will be sent and the connection setup fails. | ||
107 | .El | ||
diff --git a/src/lib/libssl/doc/SSL_SESSION_free.3 b/src/lib/libssl/doc/SSL_SESSION_free.3 new file mode 100644 index 0000000000..f7d2350b55 --- /dev/null +++ b/src/lib/libssl/doc/SSL_SESSION_free.3 | |||
@@ -0,0 +1,76 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_free | ||
6 | .Nd free an allocated SSL_SESSION structure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_SESSION_free "SSL_SESSION *session" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_SESSION_free | ||
13 | decrements the reference count of | ||
14 | .Fa session | ||
15 | and removes the | ||
16 | .Vt SSL_SESSION | ||
17 | structure pointed to by | ||
18 | .Fa session | ||
19 | and frees up the allocated memory, if the reference count has reached 0. | ||
20 | .Sh NOTES | ||
21 | .Vt SSL_SESSION | ||
22 | objects are allocated when a TLS/SSL handshake operation is successfully | ||
23 | completed. | ||
24 | Depending on the settings, see | ||
25 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
26 | the | ||
27 | .Vt SSL_SESSION | ||
28 | objects are internally referenced by the | ||
29 | .Vt SSL_CTX | ||
30 | and linked into its session cache. | ||
31 | .Vt SSL | ||
32 | objects may be using the | ||
33 | .Vt SSL_SESSION | ||
34 | object; as a session may be reused, several | ||
35 | .Vt SSL | ||
36 | objects may be using one | ||
37 | .Vt SSL_SESSION | ||
38 | object at the same time. | ||
39 | It is therefore crucial to keep the reference count (usage information) correct | ||
40 | and not delete a | ||
41 | .Vt SSL_SESSION | ||
42 | object that is still used, as this may lead to program failures due to dangling | ||
43 | pointers. | ||
44 | These failures may also appear delayed, e.g., when an | ||
45 | .Vt SSL_SESSION | ||
46 | object is completely freed as the reference count incorrectly becomes 0, but it | ||
47 | is still referenced in the internal session cache and the cache list is | ||
48 | processed during a | ||
49 | .Xr SSL_CTX_flush_sessions 3 | ||
50 | operation. | ||
51 | .Pp | ||
52 | .Fn SSL_SESSION_free | ||
53 | must only be called for | ||
54 | .Vt SSL_SESSION | ||
55 | objects, for which the reference count was explicitly incremented (e.g., by | ||
56 | calling | ||
57 | .Xr SSL_get1_session 3 ; | ||
58 | see | ||
59 | .Xr SSL_get_session 3 ) | ||
60 | or when the | ||
61 | .Vt SSL_SESSION | ||
62 | object was generated outside a TLS handshake operation, e.g., by using | ||
63 | .Xr d2i_SSL_SESSION 3 . | ||
64 | It must not be called on other | ||
65 | .Vt SSL_SESSION | ||
66 | objects, as this would cause incorrect reference counts and therefore program | ||
67 | failures. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_SESSION_free | ||
70 | does not provide diagnostic information. | ||
71 | .Sh SEE ALSO | ||
72 | .Xr d2i_SSL_SESSION 3 , | ||
73 | .Xr ssl 3 , | ||
74 | .Xr SSL_CTX_flush_sessions 3 , | ||
75 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
76 | .Xr SSL_get_session 3 | ||
diff --git a/src/lib/libssl/doc/SSL_SESSION_get_ex_new_index.3 b/src/lib/libssl/doc/SSL_SESSION_get_ex_new_index.3 new file mode 100644 index 0000000000..d6a94cb0b7 --- /dev/null +++ b/src/lib/libssl/doc/SSL_SESSION_get_ex_new_index.3 | |||
@@ -0,0 +1,77 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_get_ex_new_index , | ||
6 | .Nm SSL_SESSION_set_ex_data , | ||
7 | .Nm SSL_SESSION_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_SESSION_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *session" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *session" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate | ||
34 | application-specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_SESSION_get_ex_new_index | ||
37 | is used to register a new index for application-specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_SESSION_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa session | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_SESSION_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa session . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality | ||
57 | can be found in | ||
58 | .Xr RSA_get_ex_new_index 3 . | ||
59 | The | ||
60 | .Fn *_get_ex_data | ||
61 | and | ||
62 | .Fn *_set_ex_data | ||
63 | functionality is described in | ||
64 | .Xr CRYPTO_set_ex_data 3 . | ||
65 | .Sh WARNINGS | ||
66 | The application data is only maintained for sessions held in memory. | ||
67 | The application data is not included when dumping the session with | ||
68 | .Xr i2d_SSL_SESSION 3 | ||
69 | (and all functions indirectly calling the dump functions like | ||
70 | .Xr PEM_write_SSL_SESSION 3 | ||
71 | and | ||
72 | .Xr PEM_write_bio_SSL_SESSION 3 ) | ||
73 | and can therefore not be restored. | ||
74 | .Sh SEE ALSO | ||
75 | .Xr CRYPTO_set_ex_data 3 , | ||
76 | .Xr RSA_get_ex_new_index 3 , | ||
77 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_SESSION_get_time.3 b/src/lib/libssl/doc/SSL_SESSION_get_time.3 new file mode 100644 index 0000000000..d094adb50a --- /dev/null +++ b/src/lib/libssl/doc/SSL_SESSION_get_time.3 | |||
@@ -0,0 +1,91 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_GET_TIME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_get_time , | ||
6 | .Nm SSL_SESSION_set_time , | ||
7 | .Nm SSL_SESSION_get_timeout , | ||
8 | .Nm SSL_SESSION_set_timeout | ||
9 | .Nd retrieve and manipulate session time and timeout settings | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
14 | .Ft long | ||
15 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long tm" | ||
16 | .Ft long | ||
17 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
18 | .Ft long | ||
19 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long tm" | ||
20 | .Ft long | ||
21 | .Fn SSL_get_time "const SSL_SESSION *s" | ||
22 | .Ft long | ||
23 | .Fn SSL_set_time "SSL_SESSION *s" "long tm" | ||
24 | .Ft long | ||
25 | .Fn SSL_get_timeout "const SSL_SESSION *s" | ||
26 | .Ft long | ||
27 | .Fn SSL_set_timeout "SSL_SESSION *s" "long tm" | ||
28 | .Sh DESCRIPTION | ||
29 | .Fn SSL_SESSION_get_time | ||
30 | returns the time at which the session | ||
31 | .Fa s | ||
32 | was established. | ||
33 | The time is given in seconds since the Epoch and therefore compatible to the | ||
34 | time delivered by the | ||
35 | .Xr time 3 | ||
36 | call. | ||
37 | .Pp | ||
38 | .Fn SSL_SESSION_set_time | ||
39 | replaces the creation time of the session | ||
40 | .Fa s | ||
41 | with | ||
42 | the chosen value | ||
43 | .Fa tm . | ||
44 | .Pp | ||
45 | .Fn SSL_SESSION_get_timeout | ||
46 | returns the timeout value set for session | ||
47 | .Fa s | ||
48 | in seconds. | ||
49 | .Pp | ||
50 | .Fn SSL_SESSION_set_timeout | ||
51 | sets the timeout value for session | ||
52 | .Fa s | ||
53 | in seconds to | ||
54 | .Fa tm . | ||
55 | .Pp | ||
56 | The | ||
57 | .Fn SSL_get_time , | ||
58 | .Fn SSL_set_time , | ||
59 | .Fn SSL_get_timeout , | ||
60 | and | ||
61 | .Fn SSL_set_timeout | ||
62 | functions are synonyms for the | ||
63 | .Fn SSL_SESSION_* | ||
64 | counterparts. | ||
65 | .Sh NOTES | ||
66 | Sessions are expired by examining the creation time and the timeout value. | ||
67 | Both are set at creation time of the session to the actual time and the default | ||
68 | timeout value at creation, respectively, as set by | ||
69 | .Xr SSL_CTX_set_timeout 3 . | ||
70 | Using these functions it is possible to extend or shorten the lifetime of the | ||
71 | session. | ||
72 | .Sh RETURN VALUES | ||
73 | .Fn SSL_SESSION_get_time | ||
74 | and | ||
75 | .Fn SSL_SESSION_get_timeout | ||
76 | return the currently valid values. | ||
77 | .Pp | ||
78 | .Fn SSL_SESSION_set_time | ||
79 | and | ||
80 | .Fn SSL_SESSION_set_timeout | ||
81 | return 1 on success. | ||
82 | .Pp | ||
83 | If any of the function is passed the | ||
84 | .Dv NULL | ||
85 | pointer for the session | ||
86 | .Fa s , | ||
87 | 0 is returned. | ||
88 | .Sh SEE ALSO | ||
89 | .Xr ssl 3 , | ||
90 | .Xr SSL_CTX_set_timeout 3 , | ||
91 | .Xr SSL_get_default_timeout 3 | ||
diff --git a/src/lib/libssl/doc/SSL_accept.3 b/src/lib/libssl/doc/SSL_accept.3 new file mode 100644 index 0000000000..88bea1fde7 --- /dev/null +++ b/src/lib/libssl/doc/SSL_accept.3 | |||
@@ -0,0 +1,110 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_ACCEPT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_accept | ||
6 | .Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_accept "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_accept | ||
13 | waits for a TLS/SSL client to initiate the TLS/SSL handshake. | ||
14 | The communication channel must already have been set and assigned to the | ||
15 | .Fa ssl | ||
16 | object by setting an underlying | ||
17 | .Vt BIO . | ||
18 | .Sh NOTES | ||
19 | The behaviour of | ||
20 | .Fn SSL_accept | ||
21 | depends on the underlying | ||
22 | .Vt BIO . | ||
23 | .Pp | ||
24 | If the underlying | ||
25 | .Vt BIO | ||
26 | is | ||
27 | .Em blocking , | ||
28 | .Fn SSL_accept | ||
29 | will only return once the handshake has been finished or an error occurred, | ||
30 | except for SGC (Server Gated Cryptography). | ||
31 | For SGC, | ||
32 | .Fn SSL_accept | ||
33 | may return with \(mi1, but | ||
34 | .Fn SSL_get_error | ||
35 | will yield | ||
36 | .Dv SSL_ERROR_WANT_READ/WRITE | ||
37 | and | ||
38 | .Fn SSL_accept | ||
39 | should be called again. | ||
40 | .Pp | ||
41 | If the underlying | ||
42 | .Vt BIO | ||
43 | is | ||
44 | .Em non-blocking , | ||
45 | .Fn SSL_accept | ||
46 | will also return when the underlying | ||
47 | .Vt BIO | ||
48 | could not satisfy the needs of | ||
49 | .Fn SSL_accept | ||
50 | to continue the handshake, indicating the problem by the return value \(mi1. | ||
51 | In this case a call to | ||
52 | .Xr SSL_get_error 3 | ||
53 | with the | ||
54 | return value of | ||
55 | .Fn SSL_accept | ||
56 | will yield | ||
57 | .Dv SSL_ERROR_WANT_READ | ||
58 | or | ||
59 | .Dv SSL_ERROR_WANT_WRITE . | ||
60 | The calling process then must repeat the call after taking appropriate action | ||
61 | to satisfy the needs of | ||
62 | .Fn SSL_accept . | ||
63 | The action depends on the underlying | ||
64 | .Dv BIO . | ||
65 | When using a non-blocking socket, nothing is to be done, but | ||
66 | .Xr select 2 | ||
67 | can be used to check for the required condition. | ||
68 | When using a buffering | ||
69 | .Vt BIO , | ||
70 | like a | ||
71 | .Vt BIO | ||
72 | pair, data must be written into or retrieved out of the | ||
73 | .Vt BIO | ||
74 | before being able to continue. | ||
75 | .Sh RETURN VALUES | ||
76 | The following return values can occur: | ||
77 | .Bl -tag -width Ds | ||
78 | .It 0 | ||
79 | The TLS/SSL handshake was not successful but was shut down controlled and by | ||
80 | the specifications of the TLS/SSL protocol. | ||
81 | Call | ||
82 | .Xr SSL_get_error 3 | ||
83 | with the return value | ||
84 | .Fa ret | ||
85 | to find out the reason. | ||
86 | .It 1 | ||
87 | The TLS/SSL handshake was successfully completed, | ||
88 | and a TLS/SSL connection has been established. | ||
89 | .It <0 | ||
90 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
91 | at the protocol level or a connection failure occurred. | ||
92 | The shutdown was not clean. | ||
93 | It can also occur of action is need to continue the operation for non-blocking | ||
94 | .Vt BIO Ns | ||
95 | s. | ||
96 | Call | ||
97 | .Xr SSL_get_error 3 | ||
98 | with the return value | ||
99 | .Fa ret | ||
100 | to find out the reason. | ||
101 | .El | ||
102 | .Sh SEE ALSO | ||
103 | .Xr bio 3 , | ||
104 | .Xr ssl 3 , | ||
105 | .Xr SSL_connect 3 , | ||
106 | .Xr SSL_CTX_new 3 , | ||
107 | .Xr SSL_do_handshake 3 , | ||
108 | .Xr SSL_get_error 3 , | ||
109 | .Xr SSL_set_connect_state 3 , | ||
110 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_alert_type_string.3 b/src/lib/libssl/doc/SSL_alert_type_string.3 new file mode 100644 index 0000000000..f4b652bc1a --- /dev/null +++ b/src/lib/libssl/doc/SSL_alert_type_string.3 | |||
@@ -0,0 +1,190 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_ALERT_TYPE_STRING.POD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_alert_type_string , | ||
6 | .Nm SSL_alert_type_string_long , | ||
7 | .Nm SSL_alert_desc_string , | ||
8 | .Nm SSL_alert_desc_string_long | ||
9 | .Nd get textual description of alert information | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft const char * Ns | ||
13 | .Fn SSL_alert_type_string "int value" | ||
14 | .Ft const char * Ns | ||
15 | .Fn SSL_alert_type_string_long "int value" | ||
16 | .Ft const char * Ns | ||
17 | .Fn SSL_alert_desc_string "int value" | ||
18 | .Ft const char * Ns | ||
19 | .Fn SSL_alert_desc_string_long "int value" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_alert_type_string | ||
22 | returns a one letter string indicating the type of the alert specified by | ||
23 | .Fa value . | ||
24 | .Pp | ||
25 | .Fn SSL_alert_type_string_long | ||
26 | returns a string indicating the type of the alert specified by | ||
27 | .Fa value . | ||
28 | .Pp | ||
29 | .Fn SSL_alert_desc_string | ||
30 | returns a two letter string as a short form describing the reason of the alert | ||
31 | specified by | ||
32 | .Fa value . | ||
33 | .Pp | ||
34 | .Fn SSL_alert_desc_string_long | ||
35 | returns a string describing the reason of the alert specified by | ||
36 | .Fa value . | ||
37 | .Sh NOTES | ||
38 | When one side of an SSL/TLS communication wants to inform the peer about | ||
39 | a special situation, it sends an alert. | ||
40 | The alert is sent as a special message and does not influence the normal data | ||
41 | stream (unless its contents results in the communication being canceled). | ||
42 | .Pp | ||
43 | A warning alert is sent, when a non-fatal error condition occurs. | ||
44 | The | ||
45 | .Dq close notify | ||
46 | alert is sent as a warning alert. | ||
47 | Other examples for non-fatal errors are certificate errors | ||
48 | .Po | ||
49 | .Dq certificate expired , | ||
50 | .Dq unsupported certificate | ||
51 | .Pc , | ||
52 | for which a warning alert may be sent. | ||
53 | (The sending party may, however, decide to send a fatal error.) | ||
54 | The receiving side may cancel the connection on reception of a warning alert at | ||
55 | its discretion. | ||
56 | .Pp | ||
57 | Several alert messages must be sent as fatal alert messages as specified | ||
58 | by the TLS RFC. | ||
59 | A fatal alert always leads to a connection abort. | ||
60 | .Sh RETURN VALUES | ||
61 | The following strings can occur for | ||
62 | .Fn SSL_alert_type_string | ||
63 | or | ||
64 | .Fn SSL_alert_type_string_long : | ||
65 | .Bl -tag -width Ds | ||
66 | .It \(dqW\(dq/\(dqwarning\(dq | ||
67 | .It \(dqF\(dq/\(dqfatal\(dq | ||
68 | .It \(dqU\(dq/\(dqunknown\(dq | ||
69 | This indicates that no support is available for this alert type. | ||
70 | Probably | ||
71 | .Fa value | ||
72 | does not contain a correct alert message. | ||
73 | .El | ||
74 | .Pp | ||
75 | The following strings can occur for | ||
76 | .Fn SSL_alert_desc_string | ||
77 | or | ||
78 | .Fn SSL_alert_desc_string_long : | ||
79 | .Bl -tag -width Ds | ||
80 | .It \(dqCN\(dq/\(dqclose notify\(dq | ||
81 | The connection shall be closed. | ||
82 | This is a warning alert. | ||
83 | .It \(dqUM\(dq/\(dqunexpected message\(dq | ||
84 | An inappropriate message was received. | ||
85 | This alert is always fatal and should never be observed in communication | ||
86 | between proper implementations. | ||
87 | .It \(dqBM\(dq/\(dqbad record mac\(dq | ||
88 | This alert is returned if a record is received with an incorrect MAC. | ||
89 | This message is always fatal. | ||
90 | .It \(dqDF\(dq/\(dqdecompression failure\(dq | ||
91 | The decompression function received improper input | ||
92 | (e.g., data that would expand to excessive length). | ||
93 | This message is always fatal. | ||
94 | .It \(dqHF\(dq/\(dqhandshake failure\(dq | ||
95 | Reception of a handshake_failure alert message indicates that the sender was | ||
96 | unable to negotiate an acceptable set of security parameters given the options | ||
97 | available. | ||
98 | This is a fatal error. | ||
99 | .It \(dqNC\(dq/\(dqno certificate\(dq | ||
100 | A client, that was asked to send a certificate, does not send a certificate | ||
101 | (SSLv3 only). | ||
102 | .It \(dqBC\(dq/\(dqbad certificate\(dq | ||
103 | A certificate was corrupt, contained signatures that did not verify correctly, | ||
104 | etc. | ||
105 | .It \(dqUC\(dq/\(dqunsupported certificate\(dq | ||
106 | A certificate was of an unsupported type. | ||
107 | .It \(dqCR\(dq/\(dqcertificate revoked\(dq | ||
108 | A certificate was revoked by its signer. | ||
109 | .It \(dqCE\(dq/\(dqcertificate expired\(dq | ||
110 | A certificate has expired or is not currently valid. | ||
111 | .It \(dqCU\(dq/\(dqcertificate unknown\(dq | ||
112 | Some other (unspecified) issue arose in processing the certificate, | ||
113 | rendering it unacceptable. | ||
114 | .It \(dqIP\(dq/\(dqillegal parameter\(dq | ||
115 | A field in the handshake was out of range or inconsistent with other fields. | ||
116 | This is always fatal. | ||
117 | .It \(dqDC\(dq/\(dqdecryption failed\(dq | ||
118 | A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple | ||
119 | of the block length or its padding values, when checked, weren't correct. | ||
120 | This message is always fatal. | ||
121 | .It \(dqRO\(dq/\(dqrecord overflow\(dq | ||
122 | A TLSCiphertext record was received which had a length more than | ||
123 | 2^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than | ||
124 | 2^14+1024 bytes. | ||
125 | This message is always fatal. | ||
126 | .It \(dqCA\(dq/\(dqunknown CA\(dq | ||
127 | A valid certificate chain or partial chain was received, | ||
128 | but the certificate was not accepted because the CA certificate could not be | ||
129 | located or couldn't be matched with a known, trusted CA. | ||
130 | This message is always fatal. | ||
131 | .It \(dqAD\(dq/\(dqaccess denied\(dq | ||
132 | A valid certificate was received, but when access control was applied, | ||
133 | the sender decided not to proceed with negotiation. | ||
134 | This message is always fatal. | ||
135 | .It \(dqDE\(dq/\(dqdecode error\(dq | ||
136 | A message could not be decoded because some field was out of the specified | ||
137 | range or the length of the message was incorrect. | ||
138 | This message is always fatal. | ||
139 | .It \(dqCY\(dq/\(dqdecrypt error\(dq | ||
140 | A handshake cryptographic operation failed, including being unable to correctly | ||
141 | verify a signature, decrypt a key exchange, or validate a finished message. | ||
142 | .It \(dqER\(dq/\(dqexport restriction\(dq | ||
143 | A negotiation not in compliance with export restrictions was detected; | ||
144 | for example, attempting to transfer a 1024 bit ephemeral RSA key for the | ||
145 | RSA_EXPORT handshake method. | ||
146 | This message is always fatal. | ||
147 | .It \(dqPV\(dq/\(dqprotocol version\(dq | ||
148 | The protocol version the client has attempted to negotiate is recognized, | ||
149 | but not supported. | ||
150 | (For example, old protocol versions might be avoided for security reasons.) | ||
151 | This message is always fatal. | ||
152 | .It \(dqIS\(dq/\(dqinsufficient security\(dq | ||
153 | Returned instead of handshake_failure when a negotiation has failed | ||
154 | specifically because the server requires ciphers more secure than those | ||
155 | supported by the client. | ||
156 | This message is always fatal. | ||
157 | .It \(dqIE\(dq/\(dqinternal error\(dq | ||
158 | An internal error unrelated to the peer or the correctness of the protocol | ||
159 | makes it impossible to continue (such as a memory allocation failure). | ||
160 | This message is always fatal. | ||
161 | .It \(dqUS\(dq/\(dquser canceled\(dq | ||
162 | This handshake is being canceled for some reason unrelated to a protocol | ||
163 | failure. | ||
164 | If the user cancels an operation after the handshake is complete, | ||
165 | just closing the connection by sending a close_notify is more appropriate. | ||
166 | This alert should be followed by a close_notify. | ||
167 | This message is generally a warning. | ||
168 | .It \(dqNR\(dq/\(dqno renegotiation\(dq | ||
169 | Sent by the client in response to a hello request or by the server in response | ||
170 | to a client hello after initial handshaking. | ||
171 | Either of these would normally lead to renegotiation; when that is not | ||
172 | appropriate, the recipient should respond with this alert; at that point, | ||
173 | the original requester can decide whether to proceed with the connection. | ||
174 | One case where this would be appropriate would be where a server has spawned a | ||
175 | process to satisfy a request; the process might receive security parameters | ||
176 | (key length, authentication, etc.) at startup and it might be difficult to | ||
177 | communicate changes to these parameters after that point. | ||
178 | This message is always a warning. | ||
179 | .It \(dqUP\(dq/\(dqunknown PSK identity\(dq | ||
180 | Sent by the server to indicate that it does not recognize a PSK identity or an | ||
181 | SRP identity. | ||
182 | .It \(dqUK\(dq/\(dqunknown\(dq | ||
183 | This indicates that no description is available for this alert type. | ||
184 | Probably | ||
185 | .Fa value | ||
186 | does not contain a correct alert message. | ||
187 | .El | ||
188 | .Sh SEE ALSO | ||
189 | .Xr ssl 3 , | ||
190 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/doc/SSL_clear.3 b/src/lib/libssl/doc/SSL_clear.3 new file mode 100644 index 0000000000..dc596ce12a --- /dev/null +++ b/src/lib/libssl/doc/SSL_clear.3 | |||
@@ -0,0 +1,89 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CLEAR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_clear | ||
6 | .Nd reset SSL object to allow another connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_clear "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | Reset | ||
13 | .Fa ssl | ||
14 | to allow another connection. | ||
15 | All settings (method, ciphers, BIOs) are kept. | ||
16 | .Sh NOTES | ||
17 | .Fn SSL_clear | ||
18 | is used to prepare an | ||
19 | .Vt SSL | ||
20 | object for a new connection. | ||
21 | While all settings are kept, | ||
22 | a side effect is the handling of the current SSL session. | ||
23 | If a session is still | ||
24 | .Em open , | ||
25 | it is considered bad and will be removed from the session cache, | ||
26 | as required by RFC2246. | ||
27 | A session is considered open if | ||
28 | .Xr SSL_shutdown 3 | ||
29 | was not called for the connection or at least | ||
30 | .Xr SSL_set_shutdown 3 | ||
31 | was used to | ||
32 | set the | ||
33 | .Dv SSL_SENT_SHUTDOWN | ||
34 | state. | ||
35 | .Pp | ||
36 | If a session was closed cleanly, | ||
37 | the session object will be kept and all settings corresponding. | ||
38 | This explicitly means that for example the special method used during the | ||
39 | session will be kept for the next handshake. | ||
40 | So if the session was a TLSv1 session, a | ||
41 | .Vt SSL | ||
42 | client object will use a TLSv1 client method for the next handshake and a | ||
43 | .Vt SSL | ||
44 | server object will use a TLSv1 server method, even if | ||
45 | .Fn SSLv23_*_method Ns s | ||
46 | were chosen on startup. | ||
47 | This might lead to connection failures (see | ||
48 | .Xr SSL_new 3 ) | ||
49 | for a description of the method's properties. | ||
50 | .Sh WARNINGS | ||
51 | .Fn SSL_clear | ||
52 | resets the | ||
53 | .Vt SSL | ||
54 | object to allow for another connection. | ||
55 | The reset operation however keeps several settings of the last sessions | ||
56 | (some of these settings were made automatically during the last handshake). | ||
57 | It only makes sense for a new connection with the exact same peer that shares | ||
58 | these settings, | ||
59 | and may fail if that peer changes its settings between connections. | ||
60 | Use the sequence | ||
61 | .Xr SSL_get_session 3 ; | ||
62 | .Xr SSL_new 3 ; | ||
63 | .Xr SSL_set_session 3 ; | ||
64 | .Xr SSL_free 3 | ||
65 | instead to avoid such failures (or simply | ||
66 | .Xr SSL_free 3 ; | ||
67 | .Xr SSL_new 3 | ||
68 | if session reuse is not desired). | ||
69 | .Sh RETURN VALUES | ||
70 | The following return values can occur: | ||
71 | .Bl -tag -width Ds | ||
72 | .It 0 | ||
73 | The | ||
74 | .Fn SSL_clear | ||
75 | operation could not be performed. | ||
76 | Check the error stack to find out the reason. | ||
77 | .It 1 | ||
78 | The | ||
79 | .Fn SSL_clear | ||
80 | operation was successful. | ||
81 | .El | ||
82 | .Sh SEE ALSO | ||
83 | .Xr ssl 3 , | ||
84 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
85 | .Xr SSL_CTX_set_options 3 , | ||
86 | .Xr SSL_free 3 , | ||
87 | .Xr SSL_new 3 , | ||
88 | .Xr SSL_set_shutdown 3 , | ||
89 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_connect.3 b/src/lib/libssl/doc/SSL_connect.3 new file mode 100644 index 0000000000..4f8428c3c9 --- /dev/null +++ b/src/lib/libssl/doc/SSL_connect.3 | |||
@@ -0,0 +1,99 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CONNECT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_connect | ||
6 | .Nd initiate the TLS/SSL handshake with an TLS/SSL server | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_connect "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_connect | ||
13 | initiates the TLS/SSL handshake with a server. | ||
14 | The communication channel must already have been set and assigned to the | ||
15 | .Fa ssl | ||
16 | by setting an underlying | ||
17 | .Vt BIO . | ||
18 | .Sh NOTES | ||
19 | The behaviour of | ||
20 | .Fn SSL_connect | ||
21 | depends on the underlying | ||
22 | .Vt BIO. | ||
23 | .Pp | ||
24 | If the underlying | ||
25 | .Vt BIO | ||
26 | is | ||
27 | .Em blocking , | ||
28 | .Fn SSL_connect | ||
29 | will only return once the handshake has been finished or an error occurred. | ||
30 | .Pp | ||
31 | If the underlying | ||
32 | .Vt BIO | ||
33 | is | ||
34 | .Em non-blocking , | ||
35 | .Fn SSL_connect | ||
36 | will also return when the underlying | ||
37 | .Vt BIO | ||
38 | could not satisfy the needs of | ||
39 | .Fn SSL_connect | ||
40 | to continue the handshake, indicating the problem with the return value \(mi1. | ||
41 | In this case a call to | ||
42 | .Xr SSL_get_error 3 | ||
43 | with the return value of | ||
44 | .Fn SSL_connect | ||
45 | will yield | ||
46 | .Dv SSL_ERROR_WANT_READ | ||
47 | or | ||
48 | .Dv SSL_ERROR_WANT_WRITE . | ||
49 | The calling process then must repeat the call after taking appropriate action | ||
50 | to satisfy the needs of | ||
51 | .Fn SSL_connect . | ||
52 | The action depends on the underlying | ||
53 | .Vt BIO . | ||
54 | When using a non-blocking socket, nothing is to be done, but | ||
55 | .Xr select 2 | ||
56 | can be used to check for the required condition. | ||
57 | When using a buffering | ||
58 | .Vt BIO , | ||
59 | like a | ||
60 | .Vt BIO | ||
61 | pair, data must be written into or retrieved out of the | ||
62 | .Vt BIO | ||
63 | before being able to continue. | ||
64 | .Sh RETURN VALUES | ||
65 | The following return values can occur: | ||
66 | .Bl -tag -width Ds | ||
67 | .It 0 | ||
68 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
69 | by the specifications of the TLS/SSL protocol. | ||
70 | Call | ||
71 | .Xr SSL_get_error 3 | ||
72 | with the return value | ||
73 | .Fa ret | ||
74 | to find out the reason. | ||
75 | .It 1 | ||
76 | The TLS/SSL handshake was successfully completed, | ||
77 | and a TLS/SSL connection has been established. | ||
78 | .It <0 | ||
79 | The TLS/SSL handshake was not successful, because either a fatal error occurred | ||
80 | at the protocol level or a connection failure occurred. | ||
81 | The shutdown was not clean. | ||
82 | It can also occur if action is needed to continue the operation for | ||
83 | non-blocking | ||
84 | .Vt BIO Ns s. | ||
85 | Call | ||
86 | .Xr SSL_get_error 3 | ||
87 | with the return value | ||
88 | .Fa ret | ||
89 | to find out the reason. | ||
90 | .El | ||
91 | .Sh SEE ALSO | ||
92 | .Xr bio 3 , | ||
93 | .Xr ssl 3 , | ||
94 | .Xr SSL_accept 3 , | ||
95 | .Xr SSL_CTX_new 3 , | ||
96 | .Xr SSL_do_handshake 3 , | ||
97 | .Xr SSL_get_error 3 , | ||
98 | .Xr SSL_set_connect_state 3 , | ||
99 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_do_handshake.3 b/src/lib/libssl/doc/SSL_do_handshake.3 new file mode 100644 index 0000000000..8e6e0a820b --- /dev/null +++ b/src/lib/libssl/doc/SSL_do_handshake.3 | |||
@@ -0,0 +1,110 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_DO_HANDSHAKE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_do_handshake | ||
6 | .Nd perform a TLS/SSL handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_do_handshake "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_do_handshake | ||
13 | will wait for a SSL/TLS handshake to take place. | ||
14 | If the connection is in client mode, the handshake will be started. | ||
15 | The handshake routines may have to be explicitly set in advance using either | ||
16 | .Xr SSL_set_connect_state 3 | ||
17 | or | ||
18 | .Xr SSL_set_accept_state 3 . | ||
19 | .Sh NOTES | ||
20 | The behaviour of | ||
21 | .Fn SSL_do_handshake | ||
22 | depends on the underlying | ||
23 | .Vt BIO . | ||
24 | .Pp | ||
25 | If the underlying | ||
26 | .Vt BIO | ||
27 | is | ||
28 | .Em blocking , | ||
29 | .Fn SSL_do_handshake | ||
30 | will only return once the handshake has been finished or an error occurred, | ||
31 | except for SGC (Server Gated Cryptography). | ||
32 | For SGC, | ||
33 | .Fn SSL_do_handshake | ||
34 | may return with \(mi1, but | ||
35 | .Xr SSL_get_error 3 | ||
36 | will yield | ||
37 | .Dv SSL_ERROR_WANT_READ | ||
38 | or | ||
39 | .Dv SSL_ERROR_WANT_WRITE | ||
40 | and | ||
41 | .Fn SSL_do_handshake | ||
42 | should be called again. | ||
43 | .Pp | ||
44 | If the underlying | ||
45 | .Vt BIO | ||
46 | is | ||
47 | .Em non-blocking , | ||
48 | .Fn SSL_do_handshake | ||
49 | will also return when the underlying | ||
50 | .Vt BIO | ||
51 | could not satisfy the needs of | ||
52 | .Fn SSL_do_handshake | ||
53 | to continue the handshake. | ||
54 | In this case a call to | ||
55 | .Xr SSL_get_error 3 | ||
56 | with the return value of | ||
57 | .Fn SSL_do_handshake | ||
58 | will yield | ||
59 | .Dv SSL_ERROR_WANT_READ | ||
60 | or | ||
61 | .Dv SSL_ERROR_WANT_WRITE . | ||
62 | The calling process then must repeat the call after taking appropriate action | ||
63 | to satisfy the needs of | ||
64 | .Fn SSL_do_handshake . | ||
65 | The action depends on the underlying | ||
66 | .Vt BIO . | ||
67 | When using a non-blocking socket, nothing is to be done, but | ||
68 | .Xr select 2 | ||
69 | can be used to check for the required condition. | ||
70 | When using a buffering | ||
71 | .Vt BIO , | ||
72 | like a | ||
73 | .Vt BIO | ||
74 | pair, data must be written into or retrieved out of the | ||
75 | .Vt BIO | ||
76 | before being able to continue. | ||
77 | .Sh RETURN VALUES | ||
78 | The following return values can occur: | ||
79 | .Bl -tag -width Ds | ||
80 | .It 0 | ||
81 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
82 | by the specifications of the TLS/SSL protocol. | ||
83 | Call | ||
84 | .Xr SSL_get_error 3 | ||
85 | with the return value | ||
86 | .Fa ret | ||
87 | to find out the reason. | ||
88 | .It 1 | ||
89 | The TLS/SSL handshake was successfully completed, | ||
90 | and a TLS/SSL connection has been established. | ||
91 | .It <0 | ||
92 | The TLS/SSL handshake was not successful because either a fatal error occurred | ||
93 | at the protocol level or a connection failure occurred. | ||
94 | The shutdown was not clean. | ||
95 | It can also occur if action is needed to continue the operation for | ||
96 | non-blocking | ||
97 | .Vt BIO Ns s. | ||
98 | Call | ||
99 | .Xr SSL_get_error 3 | ||
100 | with the return value | ||
101 | .Fa ret | ||
102 | to find out the reason. | ||
103 | .El | ||
104 | .Sh SEE ALSO | ||
105 | .Xr bio 3 , | ||
106 | .Xr ssl 3 , | ||
107 | .Xr SSL_accept 3 , | ||
108 | .Xr SSL_connect 3 , | ||
109 | .Xr SSL_get_error 3 , | ||
110 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/doc/SSL_free.3 b/src/lib/libssl/doc/SSL_free.3 new file mode 100644 index 0000000000..453cd7d424 --- /dev/null +++ b/src/lib/libssl/doc/SSL_free.3 | |||
@@ -0,0 +1,59 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_free | ||
6 | .Nd free an allocated SSL structure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_free "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_free | ||
13 | decrements the reference count of | ||
14 | .Fa ssl , | ||
15 | and removes the | ||
16 | .Vt SSL | ||
17 | structure pointed to by | ||
18 | .Fa ssl | ||
19 | and frees up the allocated memory if the reference count has reached 0. | ||
20 | .Sh NOTES | ||
21 | .Fn SSL_free | ||
22 | also calls the | ||
23 | .Xr free 3 Ns | ||
24 | ing procedures for indirectly affected items, if applicable: the buffering | ||
25 | .Vt BIO , | ||
26 | the read and write | ||
27 | .Vt BIOs , | ||
28 | cipher lists specially created for this | ||
29 | .Fa ssl , | ||
30 | the | ||
31 | .Sy SSL_SESSION . | ||
32 | Do not explicitly free these indirectly freed up items before or after calling | ||
33 | .Fn SSL_free , | ||
34 | as trying to free things twice may lead to program failure. | ||
35 | .Pp | ||
36 | The | ||
37 | .Fa ssl | ||
38 | session has reference counts from two users: the | ||
39 | .Vt SSL | ||
40 | object, for which the reference count is removed by | ||
41 | .Fn SSL_free | ||
42 | and the internal session cache. | ||
43 | If the session is considered bad, because | ||
44 | .Xr SSL_shutdown 3 | ||
45 | was not called for the connection and | ||
46 | .Xr SSL_set_shutdown 3 | ||
47 | was not used to set the | ||
48 | .Vt SSL_SENT_SHUTDOWN | ||
49 | state, the session will also be removed from the session cache as required by | ||
50 | RFC2246. | ||
51 | .Sh RETURN VALUES | ||
52 | .Fn SSL_free | ||
53 | does not provide diagnostic information. | ||
54 | .Sh SEE ALSO | ||
55 | .Xr ssl 3 , | ||
56 | .Xr SSL_clear 3 , | ||
57 | .Xr SSL_new 3 , | ||
58 | .Xr SSL_set_shutdown 3 , | ||
59 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_SSL_CTX.3 b/src/lib/libssl/doc/SSL_get_SSL_CTX.3 new file mode 100644 index 0000000000..40effb512f --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_SSL_CTX.3 | |||
@@ -0,0 +1,25 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_SSL_CTX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_SSL_CTX | ||
6 | .Nd get the SSL_CTX from which an SSL is created | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft SSL_CTX * | ||
10 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_SSL_CTX | ||
13 | returns a pointer to the | ||
14 | .Vt SSL_CTX | ||
15 | object from which | ||
16 | .Fa ssl | ||
17 | was created with | ||
18 | .Xr SSL_new 3 . | ||
19 | .Sh RETURN VALUES | ||
20 | The pointer to the | ||
21 | .Vt SSL_CTX | ||
22 | object is returned. | ||
23 | .Sh SEE ALSO | ||
24 | .Xr ssl 3 , | ||
25 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_ciphers.3 b/src/lib/libssl/doc/SSL_get_ciphers.3 new file mode 100644 index 0000000000..f836988f39 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_ciphers.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CIPHERS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ciphers , | ||
6 | .Nm SSL_get_cipher_list | ||
7 | .Nd get list of available SSL_CIPHERs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft STACK_OF(SSL_CIPHER) * | ||
11 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_get_cipher_list "const SSL *ssl" "int priority" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_ciphers | ||
16 | returns the stack of available | ||
17 | .Vt SSL_CIPHER Ns s | ||
18 | for | ||
19 | .Fa ssl , | ||
20 | sorted by preference. | ||
21 | If | ||
22 | .Fa ssl | ||
23 | is | ||
24 | .Dv NULL | ||
25 | or no ciphers are available, | ||
26 | .Dv NULL | ||
27 | is returned. | ||
28 | .Pp | ||
29 | .Fn SSL_get_cipher_list | ||
30 | returns a pointer to the name of the | ||
31 | .Vt SSL_CIPHER | ||
32 | listed for | ||
33 | .Fa ssl | ||
34 | with | ||
35 | .Fa priority . | ||
36 | If | ||
37 | .Fa ssl | ||
38 | is | ||
39 | .Dv NULL , | ||
40 | no ciphers are available, or there are fewer ciphers than | ||
41 | .Fa priority | ||
42 | available, | ||
43 | .Dv NULL | ||
44 | is returned. | ||
45 | .Sh NOTES | ||
46 | The details of the ciphers obtained by | ||
47 | .Fn SSL_get_ciphers | ||
48 | can be obtained using the | ||
49 | .Xr SSL_CIPHER_get_name 3 | ||
50 | family of functions. | ||
51 | .Pp | ||
52 | Call | ||
53 | .Fn SSL_get_cipher_list | ||
54 | with | ||
55 | .Fa priority | ||
56 | starting from 0 to obtain the sorted list of available ciphers, until | ||
57 | .Dv NULL | ||
58 | is returned. | ||
59 | .Sh RETURN VALUES | ||
60 | See | ||
61 | .Sx DESCRIPTION . | ||
62 | .Sh SEE ALSO | ||
63 | .Xr ssl 3 , | ||
64 | .Xr SSL_CIPHER_get_name 3 , | ||
65 | .Xr SSL_CTX_set_cipher_list 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_client_CA_list.3 b/src/lib/libssl/doc/SSL_get_client_CA_list.3 new file mode 100644 index 0000000000..9c08a8e17d --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_client_CA_list.3 | |||
@@ -0,0 +1,58 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CLIENT_CA_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_client_CA_list , | ||
6 | .Nm SSL_CTX_get_client_CA_list | ||
7 | .Nd get list of client CAs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft STACK_OF(X509_NAME) * | ||
11 | .Fn SSL_get_client_CA_list "const SSL *s" | ||
12 | .Ft STACK_OF(X509_NAME) * | ||
13 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_get_client_CA_list | ||
16 | returns the list of client CAs explicitly set for | ||
17 | .Fa ctx | ||
18 | using | ||
19 | .Xr SSL_CTX_set_client_CA_list 3 . | ||
20 | .Pp | ||
21 | .Fn SSL_get_client_CA_list | ||
22 | returns the list of client CAs explicitly set for | ||
23 | .Fa ssl | ||
24 | using | ||
25 | .Fn SSL_set_client_CA_list | ||
26 | or | ||
27 | .Fa ssl Ns 's | ||
28 | .Vt SSL_CTX | ||
29 | object with | ||
30 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
31 | when in server mode. | ||
32 | In client mode, | ||
33 | .Fn SSL_get_client_CA_list | ||
34 | returns the list of client CAs sent from the server, if any. | ||
35 | .Sh RETURN VALUES | ||
36 | .Fn SSL_CTX_set_client_CA_list | ||
37 | and | ||
38 | .Fn SSL_set_client_CA_list | ||
39 | do not return diagnostic information. | ||
40 | .Pp | ||
41 | .Fn SSL_CTX_add_client_CA | ||
42 | and | ||
43 | .Fn SSL_add_client_CA | ||
44 | have the following return values: | ||
45 | .Bl -tag -width Ds | ||
46 | .It Dv STACK_OF Ns Po Vt X509_NAMES Pc | ||
47 | List of CA names explicitly set (for | ||
48 | .Fa ctx | ||
49 | or in server mode) or sent by the server (client mode). | ||
50 | .It Dv NULL | ||
51 | No client CA list was explicitly set (for | ||
52 | .Fa ctx | ||
53 | or in server mode) or the server did not send a list of CAs (client mode). | ||
54 | .El | ||
55 | .Sh SEE ALSO | ||
56 | .Xr ssl 3 , | ||
57 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
58 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_current_cipher.3 b/src/lib/libssl/doc/SSL_get_current_cipher.3 new file mode 100644 index 0000000000..ec1f2bb7df --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_current_cipher.3 | |||
@@ -0,0 +1,49 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CURRENT_CIPHER 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_current_cipher , | ||
6 | .Nm SSL_get_cipher , | ||
7 | .Nm SSL_get_cipher_name , | ||
8 | .Nm SSL_get_cipher_bits , | ||
9 | .Nm SSL_get_cipher_version | ||
10 | .Nd get SSL_CIPHER of a connection | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/ssl.h | ||
13 | .Ft SSL_CIPHER * | ||
14 | .Fn SSL_get_current_cipher "const SSL *ssl" | ||
15 | .Fd #define SSL_get_cipher(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
16 | .Fd #define SSL_get_cipher_name(s) \ | ||
17 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
18 | .Fd #define SSL_get_cipher_bits(s,np) \ | ||
19 | SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) | ||
20 | .Fd #define SSL_get_cipher_version(s) \ | ||
21 | SSL_CIPHER_get_version(SSL_get_current_cipher(s)) | ||
22 | .Sh DESCRIPTION | ||
23 | .Fn SSL_get_current_cipher | ||
24 | returns a pointer to an | ||
25 | .Vt SSL_CIPHER | ||
26 | object containing the description of the actually used cipher of a connection | ||
27 | established with the | ||
28 | .Fa ssl | ||
29 | object. | ||
30 | .Pp | ||
31 | .Fn SSL_get_cipher | ||
32 | and | ||
33 | .Fn SSL_get_cipher_name | ||
34 | are identical macros to obtain the name of the currently used cipher. | ||
35 | .Fn SSL_get_cipher_bits | ||
36 | is a macro to obtain the number of secret/algorithm bits used and | ||
37 | .Fn SSL_get_cipher_version | ||
38 | returns the protocol name. | ||
39 | See | ||
40 | .Xr SSL_CIPHER_get_name 3 | ||
41 | for more details. | ||
42 | .Sh RETURN VALUES | ||
43 | .Fn SSL_get_current_cipher | ||
44 | returns the cipher actually used or | ||
45 | .Dv NULL , | ||
46 | when no session has been established. | ||
47 | .Sh SEE ALSO | ||
48 | .Xr ssl 3 , | ||
49 | .Xr SSL_CIPHER_get_name 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_default_timeout.3 b/src/lib/libssl/doc/SSL_get_default_timeout.3 new file mode 100644 index 0000000000..28ab34d5e8 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_default_timeout.3 | |||
@@ -0,0 +1,33 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_DEFAULT_TIMEOUT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_default_timeout | ||
6 | .Nd get default session timeout value | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_default_timeout | ||
13 | returns the default timeout value assigned to | ||
14 | .Vt SSL_SESSION | ||
15 | objects negotiated for the protocol valid for | ||
16 | .Fa ssl . | ||
17 | .Sh NOTES | ||
18 | Whenever a new session is negotiated, it is assigned a timeout value, | ||
19 | after which it will not be accepted for session reuse. | ||
20 | If the timeout value was not explicitly set using | ||
21 | .Xr SSL_CTX_set_timeout 3 , | ||
22 | the hardcoded default timeout for the protocol will be used. | ||
23 | .Pp | ||
24 | .Fn SSL_get_default_timeout | ||
25 | return this hardcoded value, which is 300 seconds for all currently supported | ||
26 | protocols (SSLv2, SSLv3, and TLSv1). | ||
27 | .Sh RETURN VALUES | ||
28 | See description. | ||
29 | .Sh SEE ALSO | ||
30 | .Xr ssl 3 , | ||
31 | .Xr SSL_CTX_flush_sessions 3 , | ||
32 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
33 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_error.3 b/src/lib/libssl/doc/SSL_get_error.3 new file mode 100644 index 0000000000..ad533f68c5 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_error.3 | |||
@@ -0,0 +1,166 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_ERROR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_error | ||
6 | .Nd obtain result code for TLS/SSL I/O operation | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_get_error "const SSL *ssl" "int ret" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_error | ||
13 | returns a result code (suitable for the C | ||
14 | .Dq switch | ||
15 | statement) for a preceding call to | ||
16 | .Xr SSL_connect 3 , | ||
17 | .Xr SSL_accept 3 , | ||
18 | .Xr SSL_do_handshake 3 , | ||
19 | .Xr SSL_read 3 , | ||
20 | .Xr SSL_peek 3 , | ||
21 | or | ||
22 | .Xr SSL_write 3 | ||
23 | on | ||
24 | .Fa ssl . | ||
25 | The value returned by that TLS/SSL I/O function must be passed to | ||
26 | .Fn SSL_get_error | ||
27 | in parameter | ||
28 | .Fa ret . | ||
29 | .Pp | ||
30 | In addition to | ||
31 | .Fa ssl | ||
32 | and | ||
33 | .Fa ret , | ||
34 | .Fn SSL_get_error | ||
35 | inspects the current thread's OpenSSL error queue. | ||
36 | Thus, | ||
37 | .Fn SSL_get_error | ||
38 | must be used in the same thread that performed the TLS/SSL I/O operation, | ||
39 | and no other OpenSSL function calls should appear in between. | ||
40 | The current thread's error queue must be empty before the TLS/SSL I/O operation | ||
41 | is attempted, or | ||
42 | .Fn SSL_get_error | ||
43 | will not work reliably. | ||
44 | .Sh RETURN VALUES | ||
45 | The following return values can currently occur: | ||
46 | .Bl -tag -width Ds | ||
47 | .It Dv SSL_ERROR_NONE | ||
48 | The TLS/SSL I/O operation completed. | ||
49 | This result code is returned if and only if | ||
50 | .Fa ret | ||
51 | < 0. | ||
52 | .It Dv SSL_ERROR_ZERO_RETURN | ||
53 | The TLS/SSL connection has been closed. | ||
54 | If the protocol version is SSL 3.0 or TLS 1.0, this result code is returned | ||
55 | only if a closure alert has occurred in the protocol, i.e., if the connection | ||
56 | has been closed cleanly. | ||
57 | Note that in this case | ||
58 | .Dv SSL_ERROR_ZERO_RETURN | ||
59 | does not necessarily indicate that the underlying transport has been closed. | ||
60 | .It Dv SSL_ERROR_WANT_READ , Dv SSL_ERROR_WANT_WRITE | ||
61 | The operation did not complete; | ||
62 | the same TLS/SSL I/O function should be called again later. | ||
63 | If, by then, the underlying | ||
64 | .Vt BIO | ||
65 | has data available for reading (if the result code is | ||
66 | .Dv SSL_ERROR_WANT_READ ) | ||
67 | or allows writing data | ||
68 | .Pq Dv SSL_ERROR_WANT_WRITE , | ||
69 | then some TLS/SSL protocol progress will take place, | ||
70 | i.e., at least part of an TLS/SSL record will be read or written. | ||
71 | Note that the retry may again lead to a | ||
72 | .Dv SSL_ERROR_WANT_READ | ||
73 | or | ||
74 | .Dv SSL_ERROR_WANT_WRITE | ||
75 | condition. | ||
76 | There is no fixed upper limit for the number of iterations that may be | ||
77 | necessary until progress becomes visible at application protocol level. | ||
78 | .Pp | ||
79 | For socket | ||
80 | .Fa BIO Ns | ||
81 | s (e.g., when | ||
82 | .Fn SSL_set_fd | ||
83 | was used), | ||
84 | .Xr select 2 | ||
85 | or | ||
86 | .Xr poll 2 | ||
87 | on the underlying socket can be used to find out when the TLS/SSL I/O function | ||
88 | should be retried. | ||
89 | .Pp | ||
90 | Caveat: Any TLS/SSL I/O function can lead to either of | ||
91 | .Dv SSL_ERROR_WANT_READ | ||
92 | and | ||
93 | .Dv SSL_ERROR_WANT_WRITE . | ||
94 | In particular, | ||
95 | .Xr SSL_read 3 | ||
96 | or | ||
97 | .Xr SSL_peek 3 | ||
98 | may want to write data and | ||
99 | .Xr SSL_write 3 | ||
100 | may want | ||
101 | to read data. | ||
102 | This is mainly because TLS/SSL handshakes may occur at any time during the | ||
103 | protocol (initiated by either the client or the server); | ||
104 | .Xr SSL_read 3 , | ||
105 | .Xr SSL_peek 3 , | ||
106 | and | ||
107 | .Xr SSL_write 3 | ||
108 | will handle any pending handshakes. | ||
109 | .It Dv SSL_ERROR_WANT_CONNECT , Dv SSL_ERROR_WANT_ACCEPT | ||
110 | The operation did not complete; the same TLS/SSL I/O function should be | ||
111 | called again later. | ||
112 | The underlying BIO was not connected yet to the peer and the call would block | ||
113 | in | ||
114 | .Xr connect 2 Ns / Ns | ||
115 | .Xr accept 2 . | ||
116 | The SSL function should be | ||
117 | called again when the connection is established. | ||
118 | These messages can only appear with a | ||
119 | .Xr BIO_s_connect 3 | ||
120 | or | ||
121 | .Xr BIO_s_accept 3 | ||
122 | .Vt BIO , | ||
123 | respectively. | ||
124 | In order to find out when the connection has been successfully established, | ||
125 | on many platforms | ||
126 | .Xr select 2 | ||
127 | or | ||
128 | .Xr poll 2 | ||
129 | for writing on the socket file descriptor can be used. | ||
130 | .It Dv SSL_ERROR_WANT_X509_LOOKUP | ||
131 | The operation did not complete because an application callback set by | ||
132 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
133 | has asked to be called again. | ||
134 | The TLS/SSL I/O function should be called again later. | ||
135 | Details depend on the application. | ||
136 | .It Dv SSL_ERROR_SYSCALL | ||
137 | Some I/O error occurred. | ||
138 | The OpenSSL error queue may contain more information on the error. | ||
139 | If the error queue is empty (i.e., | ||
140 | .Fn ERR_get_error | ||
141 | returns 0), | ||
142 | .Fa ret | ||
143 | can be used to find out more about the error: | ||
144 | If | ||
145 | .Fa ret | ||
146 | == 0, an | ||
147 | .Dv EOF | ||
148 | was observed that violates the protocol. | ||
149 | If | ||
150 | .Fa ret | ||
151 | == \(mi1, the underlying | ||
152 | .Vt BIO | ||
153 | reported an | ||
154 | I/O error (for socket I/O on Unix systems, consult | ||
155 | .Dv errno | ||
156 | for details). | ||
157 | .It Dv SSL_ERROR_SSL | ||
158 | A failure in the SSL library occurred, usually a protocol error. | ||
159 | The OpenSSL error queue contains more information on the error. | ||
160 | .El | ||
161 | .Sh SEE ALSO | ||
162 | .Xr err 3 , | ||
163 | .Xr ssl 3 | ||
164 | .Sh HISTORY | ||
165 | .Fn SSL_get_error | ||
166 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libssl/doc/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/doc/SSL_get_ex_data_X509_STORE_CTX_idx.3 new file mode 100644 index 0000000000..9151f1d989 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_ex_data_X509_STORE_CTX_idx.3 | |||
@@ -0,0 +1,62 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ex_data_X509_STORE_CTX_idx | ||
6 | .Nd get ex_data index to access SSL structure from X509_STORE_CTX | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
13 | returns the index number under which the pointer to the | ||
14 | .Vt SSL | ||
15 | object is stored into the | ||
16 | .Vt X509_STORE_CTX | ||
17 | object. | ||
18 | .Sh NOTES | ||
19 | Whenever a | ||
20 | .Vt X509_STORE_CTX | ||
21 | object is created for the verification of the peer's certificate during a | ||
22 | handshake, a pointer to the | ||
23 | .Vt SSL | ||
24 | object is stored into the | ||
25 | .Vt X509_STORE_CTX | ||
26 | object to identify the connection affected. | ||
27 | To retrieve this pointer the | ||
28 | .Xr X509_STORE_CTX_get_ex_data 3 | ||
29 | function can be used with the correct index. | ||
30 | This index is globally the same for all | ||
31 | .Vt X509_STORE_CTX | ||
32 | objects and can be retrieved using | ||
33 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx . | ||
34 | The index value is set when | ||
35 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
36 | is first called either by the application program directly or indirectly during | ||
37 | other SSL setup functions or during the handshake. | ||
38 | .Pp | ||
39 | The value depends on other index values defined for | ||
40 | .Vt X509_STORE_CTX | ||
41 | objects before the SSL index is created. | ||
42 | .Sh RETURN VALUES | ||
43 | .Bl -tag -width Ds | ||
44 | .It \(>=0 | ||
45 | The index value to access the pointer. | ||
46 | .It \(la0 | ||
47 | An error occurred, check the error stack for a detailed error message. | ||
48 | .El | ||
49 | .Sh EXAMPLES | ||
50 | The index returned from | ||
51 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
52 | provides access to | ||
53 | .Vt SSL | ||
54 | object for the connection during the | ||
55 | .Fn verify_callback | ||
56 | when checking the peer's certificate. | ||
57 | Please check the example in | ||
58 | .Xr SSL_CTX_set_verify 3 . | ||
59 | .Sh SEE ALSO | ||
60 | .Xr CRYPTO_set_ex_data 3 , | ||
61 | .Xr ssl 3 , | ||
62 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_ex_new_index.3 b/src/lib/libssl/doc/SSL_get_ex_new_index.3 new file mode 100644 index 0000000000..5b1ff19c54 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_ex_new_index.3 | |||
@@ -0,0 +1,73 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ex_new_index , | ||
6 | .Nm SSL_set_ex_data , | ||
7 | .Nm SSL_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate application | ||
34 | specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_get_ex_new_index | ||
37 | is used to register a new index for application specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa ssl | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa ssl . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality can be found in | ||
57 | .Xr RSA_get_ex_new_index 3 . | ||
58 | The | ||
59 | .Fn *_get_ex_data | ||
60 | and | ||
61 | .Fn *_set_ex_data | ||
62 | functionality is described in | ||
63 | .Xr CRYPTO_set_ex_data 3 . | ||
64 | .Sh EXAMPLES | ||
65 | An example of how to use the functionality is included in the example | ||
66 | .Fn verify_callback | ||
67 | in | ||
68 | .Xr SSL_CTX_set_verify 3 . | ||
69 | .Sh SEE ALSO | ||
70 | .Xr CRYPTO_set_ex_data 3 , | ||
71 | .Xr RSA_get_ex_new_index 3 , | ||
72 | .Xr ssl 3 , | ||
73 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_fd.3 b/src/lib/libssl/doc/SSL_get_fd.3 new file mode 100644 index 0000000000..458e73dacc --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_fd.3 | |||
@@ -0,0 +1,43 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_FD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_fd , | ||
6 | .Nm SSL_get_rfd , | ||
7 | .Nm SSL_get_wfd | ||
8 | .Nd get file descriptor linked to an SSL object | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_get_fd "const SSL *ssl" | ||
13 | .Ft int | ||
14 | .Fn SSL_get_rfd "const SSL *ssl" | ||
15 | .Ft int | ||
16 | .Fn SSL_get_wfd "const SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_get_fd | ||
19 | returns the file descriptor which is linked to | ||
20 | .Fa ssl . | ||
21 | .Fn SSL_get_rfd | ||
22 | and | ||
23 | .Fn SSL_get_wfd | ||
24 | return the file descriptors for the read or the write channel, | ||
25 | which can be different. | ||
26 | If the read and the write channel are different, | ||
27 | .Fn SSL_get_fd | ||
28 | will return the file descriptor of the read channel. | ||
29 | .Sh RETURN VALUES | ||
30 | The following return values can occur: | ||
31 | .Bl -tag -width Ds | ||
32 | .It \(mi1 | ||
33 | The operation failed, because the underlying | ||
34 | .Vt BIO | ||
35 | is not of the correct type (suitable for file descriptors). | ||
36 | .It \(>=0 | ||
37 | The file descriptor linked to | ||
38 | .Fa ssl . | ||
39 | .El | ||
40 | .Sh SEE ALSO | ||
41 | .Xr bio 3 , | ||
42 | .Xr ssl 3 , | ||
43 | .Xr SSL_set_fd 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_peer_cert_chain.3 b/src/lib/libssl/doc/SSL_get_peer_cert_chain.3 new file mode 100644 index 0000000000..850e8cf913 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_peer_cert_chain.3 | |||
@@ -0,0 +1,44 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PEER_CERT_CHAIN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_peer_cert_chain | ||
6 | .Nd get the X509 certificate chain of the peer | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft STACK_OF(X509) * | ||
10 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_peer_cert_chain | ||
13 | returns a pointer to | ||
14 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
15 | certificates forming the certificate chain of the peer. | ||
16 | If called on the client side, the stack also contains the peer's certificate; | ||
17 | if called on the server side, the peer's certificate must be obtained | ||
18 | separately using | ||
19 | .Xr SSL_get_peer_certificate 3 . | ||
20 | If the peer did not present a certificate, | ||
21 | .Dv NULL | ||
22 | is returned. | ||
23 | .Sh NOTES | ||
24 | The peer certificate chain is not necessarily available after reusing a | ||
25 | session, in which case a | ||
26 | .Dv NULL | ||
27 | pointer is returned. | ||
28 | .Pp | ||
29 | The reference count of the | ||
30 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
31 | object is not incremented. | ||
32 | If the corresponding session is freed, the pointer must not be used any longer. | ||
33 | .Sh RETURN VALUES | ||
34 | The following return values can occur: | ||
35 | .Bl -tag -width Ds | ||
36 | .It Dv NULL | ||
37 | No certificate was presented by the peer or no connection was established or | ||
38 | the certificate chain is no longer available when a session is reused. | ||
39 | .It Pointer to a Dv STACK_OF Ns Po X509 Pc | ||
40 | The return value points to the certificate chain presented by the peer. | ||
41 | .El | ||
42 | .Sh SEE ALSO | ||
43 | .Xr ssl 3 , | ||
44 | .Xr SSL_get_peer_certificate 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_peer_certificate.3 b/src/lib/libssl/doc/SSL_get_peer_certificate.3 new file mode 100644 index 0000000000..7e4ab3fccf --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_peer_certificate.3 | |||
@@ -0,0 +1,50 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PEER_CERTIFICATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_peer_certificate | ||
6 | .Nd get the X509 certificate of the peer | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft X509 * | ||
10 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_peer_certificate | ||
13 | returns a pointer to the X509 certificate the peer presented. | ||
14 | If the peer did not present a certificate, | ||
15 | .Dv NULL | ||
16 | is returned. | ||
17 | .Sh NOTES | ||
18 | Due to the protocol definition, a TLS/SSL server will always send a | ||
19 | certificate, if present. | ||
20 | A client will only send a certificate when explicitly requested to do so by the | ||
21 | server (see | ||
22 | .Xr SSL_CTX_set_verify 3 ) . | ||
23 | If an anonymous cipher is used, no certificates are sent. | ||
24 | .Pp | ||
25 | That a certificate is returned does not indicate information about the | ||
26 | verification state. | ||
27 | Use | ||
28 | .Xr SSL_get_verify_result 3 | ||
29 | to check the verification state. | ||
30 | .Pp | ||
31 | The reference count of the | ||
32 | .Vt X509 | ||
33 | object is incremented by one, so that it will not be destroyed when the session | ||
34 | containing the peer certificate is freed. | ||
35 | The | ||
36 | .Vt X509 | ||
37 | object must be explicitly freed using | ||
38 | .Xr X509_free 3 . | ||
39 | .Sh RETURN VALUES | ||
40 | The following return values can occur: | ||
41 | .Bl -tag -width Ds | ||
42 | .It Dv NULL | ||
43 | No certificate was presented by the peer or no connection was established. | ||
44 | .It Pointer to an X509 certificate | ||
45 | The return value points to the certificate presented by the peer. | ||
46 | .El | ||
47 | .Sh SEE ALSO | ||
48 | .Xr ssl 3 , | ||
49 | .Xr SSL_CTX_set_verify 3 , | ||
50 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_psk_identity.3 b/src/lib/libssl/doc/SSL_get_psk_identity.3 new file mode 100644 index 0000000000..b3a72cca29 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_psk_identity.3 | |||
@@ -0,0 +1,41 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PSK_IDENTITY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_psk_identity , | ||
6 | .Nm SSL_get_psk_identity_hint | ||
7 | .Nd get PSK client identity and hint | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_get_psk_identity_hint "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_get_psk_identity "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_psk_identity_hint | ||
16 | is used to retrieve the PSK identity hint used during the connection setup | ||
17 | related to | ||
18 | .Vt SSL | ||
19 | object | ||
20 | .Fa ssl . | ||
21 | Similarly, | ||
22 | .Fn SSL_get_psk_identity | ||
23 | is used to retrieve the PSK identity used during the connection setup. | ||
24 | .Sh RETURN VALUES | ||
25 | If | ||
26 | .Pf non- Dv NULL , | ||
27 | .Fn SSL_get_psk_identity_hint | ||
28 | returns the PSK identity hint and | ||
29 | .Fn SSL_get_psk_identity | ||
30 | returns the PSK identity. | ||
31 | Both are | ||
32 | .Dv NULL Ns -terminated. | ||
33 | .Fn SSL_get_psk_identity_hint | ||
34 | may return | ||
35 | .Dv NULL | ||
36 | if no PSK identity hint was used during the connection setup. | ||
37 | .Pp | ||
38 | Note that the return value is valid only during the lifetime of the | ||
39 | .Vt SSL | ||
40 | object | ||
41 | .Fa ssl . | ||
diff --git a/src/lib/libssl/doc/SSL_get_rbio.3 b/src/lib/libssl/doc/SSL_get_rbio.3 new file mode 100644 index 0000000000..a8370d5ef2 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_rbio.3 | |||
@@ -0,0 +1,42 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_RBIO 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_rbio , | ||
6 | .Nm SSL_get_wbio | ||
7 | .Nd get BIO linked to an SSL object | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft BIO * | ||
11 | .Fn SSL_get_rbio "SSL *ssl" | ||
12 | .Ft BIO * | ||
13 | .Fn SSL_get_wbio "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_rbio | ||
16 | and | ||
17 | .Fn SSL_get_wbio | ||
18 | return pointers to the | ||
19 | .Vt BIO Ns s | ||
20 | for the read or the write channel, which can be different. | ||
21 | The reference count of the | ||
22 | .Vt BIO | ||
23 | is not incremented. | ||
24 | .Sh RETURN VALUES | ||
25 | The following return values can occur: | ||
26 | .Bl -tag -width Ds | ||
27 | .It Dv NULL | ||
28 | No | ||
29 | .Vt BIO | ||
30 | was connected to the | ||
31 | .Vt SSL | ||
32 | object. | ||
33 | .It Any other pointer | ||
34 | The | ||
35 | .Vt BIO | ||
36 | linked to | ||
37 | .Fa ssl . | ||
38 | .El | ||
39 | .Sh SEE ALSO | ||
40 | .Xr bio 3 , | ||
41 | .Xr ssl 3 , | ||
42 | .Xr SSL_set_bio 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_session.3 b/src/lib/libssl/doc/SSL_get_session.3 new file mode 100644 index 0000000000..fe9a6d48ef --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_session.3 | |||
@@ -0,0 +1,94 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_session , | ||
6 | .Nm SSL_get0_session , | ||
7 | .Nm SSL_get1_session | ||
8 | .Nd retrieve TLS/SSL session data | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft SSL_SESSION * | ||
12 | SSL_get_session "const SSL *ssl" | ||
13 | .Ft SSL_SESSION * | ||
14 | SSL_get0_session "const SSL *ssl" | ||
15 | .Ft SSL_SESSION * | ||
16 | SSL_get1_session "SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_get_session | ||
19 | returns a pointer to the | ||
20 | .Vt SSL_SESSION | ||
21 | actually used in | ||
22 | .Fa ssl . | ||
23 | The reference count of the | ||
24 | .Vt SSL_SESSION | ||
25 | is not incremented, so that the pointer can become invalid by other operations. | ||
26 | .Pp | ||
27 | .Fn SSL_get0_session | ||
28 | is the same as | ||
29 | .Fn SSL_get_session . | ||
30 | .Pp | ||
31 | .Fn SSL_get1_session | ||
32 | is the same as | ||
33 | .Fn SSL_get_session , | ||
34 | but the reference count of the | ||
35 | .Vt SSL_SESSION | ||
36 | is incremented by one. | ||
37 | .Sh NOTES | ||
38 | The | ||
39 | Fa ssl | ||
40 | session contains all information required to re-establish the connection | ||
41 | without a new handshake. | ||
42 | .Pp | ||
43 | .Fn SSL_get0_session | ||
44 | returns a pointer to the actual session. | ||
45 | As the reference counter is not incremented, | ||
46 | the pointer is only valid while the connection is in use. | ||
47 | If | ||
48 | .Xr SSL_clear 3 | ||
49 | or | ||
50 | .Xr SSL_free 3 | ||
51 | is called, the session may be removed completely (if considered bad), | ||
52 | and the pointer obtained will become invalid. | ||
53 | Even if the session is valid, | ||
54 | it can be removed at any time due to timeout during | ||
55 | .Xr SSL_CTX_flush_sessions 3 . | ||
56 | .Pp | ||
57 | If the data is to be kept, | ||
58 | .Fn SSL_get1_session | ||
59 | will increment the reference count, so that the session will not be implicitly | ||
60 | removed by other operations but stays in memory. | ||
61 | In order to remove the session | ||
62 | .Xr SSL_SESSION_free 3 | ||
63 | must be explicitly called once to decrement the reference count again. | ||
64 | .Pp | ||
65 | .Vt SSL_SESSION | ||
66 | objects keep internal link information about the session cache list when being | ||
67 | inserted into one | ||
68 | .Vt SSL_CTX | ||
69 | object's session cache. | ||
70 | One | ||
71 | .Vt SSL_SESSION | ||
72 | object, regardless of its reference count, must therefore only be used with one | ||
73 | .Vt SSL_CTX | ||
74 | object (and the | ||
75 | .Vt SSL | ||
76 | objects created from this | ||
77 | .Vt SSL_CTX | ||
78 | object). | ||
79 | .Sh RETURN VALUES | ||
80 | The following return values can occur: | ||
81 | .Bl -tag -width Ds | ||
82 | .It Dv NULL | ||
83 | There is no session available in | ||
84 | .Fa ssl . | ||
85 | .It Pointer to an Vt SSL | ||
86 | The return value points to the data of an | ||
87 | .Vt SSL | ||
88 | session. | ||
89 | .El | ||
90 | .Sh SEE ALSO | ||
91 | .Xr ssl 3 , | ||
92 | .Xr SSL_clear 3 , | ||
93 | .Xr SSL_free 3 , | ||
94 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/doc/SSL_get_verify_result.3 b/src/lib/libssl/doc/SSL_get_verify_result.3 new file mode 100644 index 0000000000..3409dc0698 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_verify_result.3 | |||
@@ -0,0 +1,46 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_VERIFY_RESULT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_verify_result | ||
6 | .Nd get result of peer certificate verification | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_verify_result | ||
13 | returns the result of the verification of the X509 certificate presented by the | ||
14 | peer, if any. | ||
15 | .Sh NOTES | ||
16 | .Fn SSL_get_verify_result | ||
17 | can only return one error code while the verification of a certificate can fail | ||
18 | because of many reasons at the same time. | ||
19 | Only the last verification error that occurred during the processing is | ||
20 | available from | ||
21 | .Fn SSL_get_verify_result . | ||
22 | .Pp | ||
23 | The verification result is part of the established session and is restored when | ||
24 | a session is reused. | ||
25 | .Sh RETURN VALUES | ||
26 | The following return values can currently occur: | ||
27 | .Bl -tag -width Ds | ||
28 | .It Dv X509_V_OK | ||
29 | The verification succeeded or no peer certificate was presented. | ||
30 | .It Any other value | ||
31 | Documented in | ||
32 | .Xr verify 1 . | ||
33 | .El | ||
34 | .Sh SEE ALSO | ||
35 | .Xr verify 1 , | ||
36 | .Xr ssl 3 , | ||
37 | .Xr SSL_get_peer_certificate 3 , | ||
38 | .Xr SSL_set_verify_result 3 | ||
39 | .Sh BUGS | ||
40 | If no peer certificate was presented, the returned result code is | ||
41 | .Dv X509_V_OK . | ||
42 | This is because no verification error occurred; | ||
43 | however, it does not indicate success. | ||
44 | .Fn SSL_get_verify_result | ||
45 | is only useful in connection with | ||
46 | .Xr SSL_get_peer_certificate 3 . | ||
diff --git a/src/lib/libssl/doc/SSL_get_version.3 b/src/lib/libssl/doc/SSL_get_version.3 new file mode 100644 index 0000000000..f8fe406d44 --- /dev/null +++ b/src/lib/libssl/doc/SSL_get_version.3 | |||
@@ -0,0 +1,32 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_VERSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_version | ||
6 | .Nd get the protocol version of a connection. | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft const char * | ||
10 | .Fn SSL_get_version "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_version | ||
13 | returns the name of the protocol used for the connection | ||
14 | .Fa ssl . | ||
15 | .Sh RETURN VALUES | ||
16 | The following strings can be returned: | ||
17 | .Bl -tag -width Ds | ||
18 | .It Qq SSLv2 | ||
19 | The connection uses the SSLv2 protocol. | ||
20 | .It Qq SSLv3 | ||
21 | The connection uses the SSLv3 protocol. | ||
22 | .It Qq TLSv1 | ||
23 | The connection uses the TLSv1.0 protocol. | ||
24 | .It Qq TLSv1.1 | ||
25 | The connection uses the TLSv1.1 protocol. | ||
26 | .It Qq TLSv1.2 | ||
27 | The connection uses the TLSv1.2 protocol. | ||
28 | .It Qq unknown | ||
29 | This indicates that no version has been set (no connection established). | ||
30 | .El | ||
31 | .Sh SEE ALSO | ||
32 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_library_init.3 b/src/lib/libssl/doc/SSL_library_init.3 new file mode 100644 index 0000000000..0644ebd987 --- /dev/null +++ b/src/lib/libssl/doc/SSL_library_init.3 | |||
@@ -0,0 +1,51 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_LIBRARY_INIT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_library_init , | ||
6 | .Nm OpenSSL_add_ssl_algorithms , | ||
7 | .Nm SSLeay_add_ssl_algorithms | ||
8 | .Nd initialize SSL library by registering algorithms | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_library_init void | ||
13 | .Fd #define OpenSSL_add_ssl_algorithms() SSL_library_init() | ||
14 | .Fd #define SSLeay_add_ssl_algorithms() SSL_library_init() | ||
15 | .Sh DESCRIPTION | ||
16 | .Fn SSL_library_init | ||
17 | registers the available SSL/TLS ciphers and digests. | ||
18 | .Pp | ||
19 | .Fn OpenSSL_add_ssl_algorithms | ||
20 | and | ||
21 | .Fn SSLeay_add_ssl_algorithms | ||
22 | are synonyms for | ||
23 | .Fn SSL_library_init . | ||
24 | .Sh NOTES | ||
25 | .Fn SSL_library_init | ||
26 | must be called before any other action takes place. | ||
27 | .Fn SSL_library_init | ||
28 | is not reentrant. | ||
29 | .Sh WARNING | ||
30 | .Fn SSL_library_init | ||
31 | adds ciphers and digests used directly and indirectly by SSL/TLS. | ||
32 | .Sh RETURN VALUES | ||
33 | .Fn SSL_library_init | ||
34 | always returns 1, so it is safe to discard the return value. | ||
35 | .Sh EXAMPLES | ||
36 | A typical TLS/SSL application will start with the library initialization, and | ||
37 | provide readable error messages. | ||
38 | .Bd -literal | ||
39 | SSL_load_error_strings(); /* readable error messages */ | ||
40 | SSL_library_init(); /* initialize library */ | ||
41 | .Ed | ||
42 | .Sh NOTES | ||
43 | OpenSSL 0.9.8o and 1.0.0a and later added SHA2 algorithms to | ||
44 | .Fn SSL_library_init . | ||
45 | Applications which need to use SHA2 in earlier versions of OpenSSL should call | ||
46 | .Fn OpenSSL_add_all_algorithms | ||
47 | as well. | ||
48 | .Sh SEE ALSO | ||
49 | .Xr RAND_add 3 , | ||
50 | .Xr ssl 3 , | ||
51 | .Xr SSL_load_error_strings 3 | ||
diff --git a/src/lib/libssl/doc/SSL_load_client_CA_file.3 b/src/lib/libssl/doc/SSL_load_client_CA_file.3 new file mode 100644 index 0000000000..52d21e8e31 --- /dev/null +++ b/src/lib/libssl/doc/SSL_load_client_CA_file.3 | |||
@@ -0,0 +1,50 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_LOAD_CLIENT_CA_FILE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_load_client_CA_file | ||
6 | .Nd load certificate names from file | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft STACK_OF(X509_NAME) * | ||
10 | .Fn SSL_load_client_CA_file "const char *file" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_load_client_CA_file | ||
13 | reads certificates from | ||
14 | .Fa file | ||
15 | and returns a | ||
16 | .Dv STACK_OF Ns | ||
17 | .Pq Vt X509_NAME | ||
18 | with the subject names found. | ||
19 | .Sh NOTES | ||
20 | .Fn SSL_load_client_CA_file | ||
21 | reads a file of PEM formatted certificates and extracts the | ||
22 | .Vt X509_NAME Ns s | ||
23 | of the certificates found. | ||
24 | While the name suggests the specific usage as support function for | ||
25 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
26 | it is not limited to CA certificates. | ||
27 | .Sh RETURN VALUES | ||
28 | The following return values can occur: | ||
29 | .Bl -tag -width Ds | ||
30 | .It Dv NULL | ||
31 | The operation failed, check out the error stack for the reason. | ||
32 | .It Pointer to Dv STACK_OF Ns Po Vt X509_NAME Pc | ||
33 | Pointer to the subject names of the successfully read certificates. | ||
34 | .El | ||
35 | .Sh EXAMPLES | ||
36 | Load names of CAs from file and use it as a client CA list: | ||
37 | .Bd -literal | ||
38 | SSL_CTX *ctx; | ||
39 | STACK_OF(X509_NAME) *cert_names; | ||
40 | \&... | ||
41 | cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem"); | ||
42 | if (cert_names != NULL) | ||
43 | SSL_CTX_set_client_CA_list(ctx, cert_names); | ||
44 | else | ||
45 | error_handling(); | ||
46 | \&... | ||
47 | .Ed | ||
48 | .Sh SEE ALSO | ||
49 | .Xr ssl 3 , | ||
50 | .Xr SSL_CTX_set_client_CA_list 3 | ||
diff --git a/src/lib/libssl/doc/SSL_new.3 b/src/lib/libssl/doc/SSL_new.3 new file mode 100644 index 0000000000..3c5b303bbb --- /dev/null +++ b/src/lib/libssl/doc/SSL_new.3 | |||
@@ -0,0 +1,38 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_new | ||
6 | .Nd create a new SSL structure for a connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft SSL * | ||
10 | .Fn SSL_new "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_new | ||
13 | creates a new | ||
14 | .Vt SSL | ||
15 | structure which is needed to hold the data for a TLS/SSL connection. | ||
16 | The new structure inherits the settings of the underlying context | ||
17 | .Fa ctx : | ||
18 | connection method (SSLv2/v3/TLSv1), options, verification settings, | ||
19 | timeout settings. | ||
20 | .Sh RETURN VALUES | ||
21 | The following return values can occur: | ||
22 | .Bl -tag -width Ds | ||
23 | .It Dv NULL | ||
24 | The creation of a new | ||
25 | .Vt SSL | ||
26 | structure failed. | ||
27 | Check the error stack to find out the reason. | ||
28 | .It Pointer to an Vt SSL No structure | ||
29 | The return value points to an allocated | ||
30 | .Vt SSL | ||
31 | structure. | ||
32 | .El | ||
33 | .Sh SEE ALSO | ||
34 | .Xr ssl 3 , | ||
35 | .Xr SSL_clear 3 , | ||
36 | .Xr SSL_CTX_set_options 3 , | ||
37 | .Xr SSL_free 3 , | ||
38 | .Xr SSL_get_SSL_CTX 3 | ||
diff --git a/src/lib/libssl/doc/SSL_pending.3 b/src/lib/libssl/doc/SSL_pending.3 new file mode 100644 index 0000000000..e07ba48283 --- /dev/null +++ b/src/lib/libssl/doc/SSL_pending.3 | |||
@@ -0,0 +1,41 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_PENDING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_pending | ||
6 | .Nd obtain number of readable bytes buffered in an SSL object | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_pending "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_pending | ||
13 | returns the number of bytes which are available inside | ||
14 | .Fa ssl | ||
15 | for immediate read. | ||
16 | .Sh NOTES | ||
17 | Data are received in blocks from the peer. | ||
18 | Therefore data can be buffered inside | ||
19 | .Fa ssl | ||
20 | and are ready for immediate retrieval with | ||
21 | .Xr SSL_read 3 . | ||
22 | .Sh RETURN VALUES | ||
23 | The number of bytes pending is returned. | ||
24 | .Sh SEE ALSO | ||
25 | .Xr ssl 3 , | ||
26 | .Xr SSL_read 3 | ||
27 | .Sh BUGS | ||
28 | .Fn SSL_pending | ||
29 | takes into account only bytes from the TLS/SSL record that is currently being | ||
30 | processed (if any). | ||
31 | If the | ||
32 | .Vt SSL | ||
33 | object's | ||
34 | .Em read_ahead | ||
35 | flag is set, additional protocol bytes may have been read containing more | ||
36 | TLS/SSL records; these are ignored by | ||
37 | .Fn SSL_pending . | ||
38 | .Pp | ||
39 | Up to OpenSSL 0.9.6, | ||
40 | .Fn SSL_pending | ||
41 | does not check if the record type of pending data is application data. | ||
diff --git a/src/lib/libssl/doc/SSL_read.3 b/src/lib/libssl/doc/SSL_read.3 new file mode 100644 index 0000000000..aed39c300f --- /dev/null +++ b/src/lib/libssl/doc/SSL_read.3 | |||
@@ -0,0 +1,190 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_READ 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_read | ||
6 | .Nd read bytes from a TLS/SSL connection. | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_read | ||
13 | tries to read | ||
14 | .Fa num | ||
15 | bytes from the specified | ||
16 | .Fa ssl | ||
17 | into the buffer | ||
18 | .Fa buf . | ||
19 | .Sh NOTES | ||
20 | If necessary, | ||
21 | .Fn SSL_read | ||
22 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
23 | .Xr SSL_connect 3 | ||
24 | or | ||
25 | .Xr SSL_accept 3 . | ||
26 | If the peer requests a re-negotiation, | ||
27 | it will be performed transparently during the | ||
28 | .Fn SSL_read | ||
29 | operation. | ||
30 | The behaviour of | ||
31 | .Fn SSL_read | ||
32 | depends on the underlying | ||
33 | .Vt BIO . | ||
34 | .Pp | ||
35 | For the transparent negotiation to succeed, the | ||
36 | .Fa ssl | ||
37 | must have been initialized to client or server mode. | ||
38 | This is being done by calling | ||
39 | .Xr SSL_set_connect_state 3 | ||
40 | or | ||
41 | .Xr SSL_set_accept_state 3 | ||
42 | before the first call to | ||
43 | .Fn SSL_read | ||
44 | or | ||
45 | .Xr SSL_write 3 . | ||
46 | .Pp | ||
47 | .Fn SSL_read | ||
48 | works based on the SSL/TLS records. | ||
49 | The data are received in records (with a maximum record size of 16kB for | ||
50 | SSLv3/TLSv1). | ||
51 | Only after a record has been completely received can it be processed | ||
52 | (decrypted and checked for integrity). | ||
53 | Therefore data not retrieved at the last call of | ||
54 | .Fn SSL_read | ||
55 | can still be buffered inside the SSL layer and will be retrieved on the next | ||
56 | call to | ||
57 | .Fn SSL_read . | ||
58 | If | ||
59 | .Fa num | ||
60 | is higher than the number of bytes buffered, | ||
61 | .Fn SSL_read | ||
62 | will return with the bytes buffered. | ||
63 | If no more bytes are in the buffer, | ||
64 | .Fn SSL_read | ||
65 | will trigger the processing of the next record. | ||
66 | Only when the record has been received and processed completely will | ||
67 | .Fn SSL_read | ||
68 | return reporting success. | ||
69 | At most the contents of the record will be returned. | ||
70 | As the size of an SSL/TLS record may exceed the maximum packet size of the | ||
71 | underlying transport (e.g., TCP), it may be necessary to read several packets | ||
72 | from the transport layer before the record is complete and | ||
73 | .Fn SSL_read | ||
74 | can succeed. | ||
75 | .Pp | ||
76 | If the underlying | ||
77 | .Vt BIO | ||
78 | is | ||
79 | .Em blocking , | ||
80 | .Fn SSL_read | ||
81 | will only return once the read operation has been finished or an error | ||
82 | has occurred, except when a renegotiation take place, in which case a | ||
83 | .Dv SSL_ERROR_WANT_READ | ||
84 | may occur. | ||
85 | This behavior can be controlled with the | ||
86 | .Dv SSL_MODE_AUTO_RETRY | ||
87 | flag of the | ||
88 | .Xr SSL_CTX_set_mode 3 | ||
89 | call. | ||
90 | .Pp | ||
91 | If the underlying | ||
92 | .Vt BIO | ||
93 | is | ||
94 | .Em non-blocking , | ||
95 | .Fn SSL_read | ||
96 | will also return when the underlying | ||
97 | .Vt BIO | ||
98 | could not satisfy the needs of | ||
99 | .Fn SSL_read | ||
100 | to continue the operation. | ||
101 | In this case a call to | ||
102 | .Xr SSL_get_error 3 | ||
103 | with the return value of | ||
104 | .Fn SSL_read | ||
105 | will yield | ||
106 | .Dv SSL_ERROR_WANT_READ | ||
107 | or | ||
108 | .Dv SSL_ERROR_WANT_WRITE . | ||
109 | As at any time a re-negotiation is possible, a call to | ||
110 | .Fn SSL_read | ||
111 | can also cause write operations! | ||
112 | The calling process then must repeat the call after taking appropriate action | ||
113 | to satisfy the needs of | ||
114 | .Fn SSL_read . | ||
115 | The action depends on the underlying | ||
116 | .Vt BIO . | ||
117 | When using a non-blocking socket, nothing is to be done, but | ||
118 | .Xr select 2 | ||
119 | can be used to check for the required condition. | ||
120 | When using a buffering | ||
121 | .Vt BIO , | ||
122 | like a | ||
123 | .Vt BIO | ||
124 | pair, data must be written into or retrieved out of the | ||
125 | .Vt BIO | ||
126 | before being able to continue. | ||
127 | .Pp | ||
128 | .Xr SSL_pending 3 | ||
129 | can be used to find out whether there are buffered bytes available for | ||
130 | immediate retrieval. | ||
131 | In this case | ||
132 | .Fn SSL_read | ||
133 | can be called without blocking or actually receiving new data from the | ||
134 | underlying socket. | ||
135 | .Sh WARNING | ||
136 | When an | ||
137 | .Fn SSL_read | ||
138 | operation has to be repeated because of | ||
139 | .Dv SSL_ERROR_WANT_READ | ||
140 | or | ||
141 | .Dv SSL_ERROR_WANT_WRITE , | ||
142 | it must be repeated with the same arguments. | ||
143 | .Sh RETURN VALUES | ||
144 | The following return values can occur: | ||
145 | .Bl -tag -width Ds | ||
146 | .It >0 | ||
147 | The read operation was successful; the return value is the number of bytes | ||
148 | actually read from the TLS/SSL connection. | ||
149 | .It 0 | ||
150 | The read operation was not successful. | ||
151 | The reason may either be a clean shutdown due to a | ||
152 | .Dq close notify | ||
153 | alert sent by the peer (in which case the | ||
154 | .Dv SSL_RECEIVED_SHUTDOWN | ||
155 | flag in the ssl shutdown state is set (see | ||
156 | .Xr SSL_shutdown 3 | ||
157 | and | ||
158 | .Xr SSL_set_shutdown 3 ) . | ||
159 | It is also possible that the peer simply shut down the underlying transport and | ||
160 | the shutdown is incomplete. | ||
161 | Call | ||
162 | .Fn SSL_get_error | ||
163 | with the return value to find out whether an error occurred or the connection | ||
164 | was shut down cleanly | ||
165 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
166 | .Pp | ||
167 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
168 | be detected whether the underlying connection was closed. | ||
169 | It cannot be checked whether the closure was initiated by the peer or by | ||
170 | something else. | ||
171 | .It <0 | ||
172 | The read operation was not successful, because either an error occurred or | ||
173 | action must be taken by the calling process. | ||
174 | Call | ||
175 | .Fn SSL_get_error | ||
176 | with the return value to find out the reason. | ||
177 | .El | ||
178 | .Sh SEE ALSO | ||
179 | .Xr bio 3 , | ||
180 | .Xr ssl 3 , | ||
181 | .Xr SSL_accept 3 , | ||
182 | .Xr SSL_connect 3 , | ||
183 | .Xr SSL_CTX_new 3 , | ||
184 | .Xr SSL_CTX_set_mode 3 , | ||
185 | .Xr SSL_get_error 3 , | ||
186 | .Xr SSL_pending 3 , | ||
187 | .Xr SSL_set_connect_state 3 , | ||
188 | .Xr SSL_set_shutdown 3 , | ||
189 | .Xr SSL_shutdown 3 , | ||
190 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/doc/SSL_rstate_string.3 b/src/lib/libssl/doc/SSL_rstate_string.3 new file mode 100644 index 0000000000..77fcd06eac --- /dev/null +++ b/src/lib/libssl/doc/SSL_rstate_string.3 | |||
@@ -0,0 +1,52 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_RSTATE_STRING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_rstate_string , | ||
6 | .Nm SSL_rstate_string_long | ||
7 | .Nd get textual description of state of an SSL object during read operation | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_rstate_string "SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_rstate_string | ||
16 | returns a 2-letter string indicating the current read state of the | ||
17 | .Vt SSL | ||
18 | object | ||
19 | .Fa ssl . | ||
20 | .Pp | ||
21 | .Fn SSL_rstate_string_long | ||
22 | returns a string indicating the current read state of the | ||
23 | .Vt SSL | ||
24 | object | ||
25 | .Fa ssl . | ||
26 | .Sh NOTES | ||
27 | When performing a read operation, the SSL/TLS engine must parse the record, | ||
28 | consisting of header and body. | ||
29 | When working in a blocking environment, | ||
30 | .Fn SSL_rstate_string[_long] | ||
31 | should always return | ||
32 | .Qo RD Qc Ns / Ns Qo read done Qc . | ||
33 | .Pp | ||
34 | This function should only seldom be needed in applications. | ||
35 | .Sh RETURN VALUES | ||
36 | .Fn SSL_rstate_string | ||
37 | and | ||
38 | .Fn SSL_rstate_string_long | ||
39 | can return the following values: | ||
40 | .Bl -tag -width Ds | ||
41 | .It Qo RH Qc Ns / Ns Qo read header Qc | ||
42 | The header of the record is being evaluated. | ||
43 | .It Qo RB Qc Ns / Ns Qo read body Qc | ||
44 | The body of the record is being evaluated. | ||
45 | .It Qo RD Qc Ns / Ns Qo read done Qc | ||
46 | The record has been completely processed. | ||
47 | .It Qo unknown Qc Ns / Ns Qo unknown Qc | ||
48 | The read state is unknown. | ||
49 | This should never happen. | ||
50 | .El | ||
51 | .Sh SEE ALSO | ||
52 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/doc/SSL_session_reused.3 b/src/lib/libssl/doc/SSL_session_reused.3 new file mode 100644 index 0000000000..40a88cd881 --- /dev/null +++ b/src/lib/libssl/doc/SSL_session_reused.3 | |||
@@ -0,0 +1,29 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_REUSED 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_session_reused | ||
6 | .Nd query whether a reused session was negotiated during handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_session_reused "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | Query whether a reused session was negotiated during the handshake. | ||
13 | .Sh NOTES | ||
14 | During the negotiation, a client can propose to reuse a session. | ||
15 | The server then looks up the session in its cache. | ||
16 | If both client and server agree on the session, | ||
17 | it will be reused and a flag is set that can be queried by the application. | ||
18 | .Sh RETURN VALUES | ||
19 | The following return values can occur: | ||
20 | .Bl -tag -width Ds | ||
21 | .It 0 | ||
22 | A new session was negotiated. | ||
23 | .It 1 | ||
24 | A session was reused. | ||
25 | .El | ||
26 | .Sh SEE ALSO | ||
27 | .Xr ssl 3 , | ||
28 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
29 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_bio.3 b/src/lib/libssl/doc/SSL_set_bio.3 new file mode 100644 index 0000000000..62bc22370d --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_bio.3 | |||
@@ -0,0 +1,48 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_BIO 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_bio | ||
6 | .Nd connect the SSL object with a BIO | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_bio | ||
13 | connects the | ||
14 | .Vt BIO Ns | ||
15 | s | ||
16 | .Fa rbio | ||
17 | and | ||
18 | .Fa wbio | ||
19 | for the read and write operations of the TLS/SSL (encrypted) side of | ||
20 | .Fa ssl . | ||
21 | .Pp | ||
22 | The SSL engine inherits the behaviour of | ||
23 | .Fa rbio | ||
24 | and | ||
25 | .Fa wbio , | ||
26 | respectively. | ||
27 | If a | ||
28 | .Vt BIO | ||
29 | is non-blocking, the | ||
30 | .Fa ssl | ||
31 | will also have non-blocking behaviour. | ||
32 | .Pp | ||
33 | If there was already a | ||
34 | .Vt BIO | ||
35 | connected to | ||
36 | .Fa ssl , | ||
37 | .Xr BIO_free 3 | ||
38 | will be called (for both the reading and writing side, if different). | ||
39 | .Sh RETURN VALUES | ||
40 | .Fn SSL_set_bio | ||
41 | cannot fail. | ||
42 | .Sh SEE ALSO | ||
43 | .Xr bio 3 , | ||
44 | .Xr ssl 3 , | ||
45 | .Xr SSL_accept 3 , | ||
46 | .Xr SSL_connect 3 , | ||
47 | .Xr SSL_get_rbio 3 , | ||
48 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_connect_state.3 b/src/lib/libssl/doc/SSL_set_connect_state.3 new file mode 100644 index 0000000000..37e52788a4 --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_connect_state.3 | |||
@@ -0,0 +1,68 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_CONNECT_STATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_connect_state , | ||
6 | .Nm SSL_get_accept_state | ||
7 | .Nd prepare SSL object to work in client or server mode | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_set_connect_state "SSL *ssl" | ||
12 | .Ft void | ||
13 | .Fn SSL_set_accept_state "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_set_connect_state | ||
16 | sets | ||
17 | .Fa ssl | ||
18 | to work in client mode. | ||
19 | .Pp | ||
20 | .Fn SSL_set_accept_state | ||
21 | sets | ||
22 | .Fa ssl | ||
23 | to work in server mode. | ||
24 | .Sh NOTES | ||
25 | When the | ||
26 | .Vt SSL_CTX | ||
27 | object was created with | ||
28 | .Xr SSL_CTX_new 3 , | ||
29 | it was either assigned a dedicated client method, a dedicated server method, or | ||
30 | a generic method, that can be used for both client and server connections. | ||
31 | (The method might have been changed with | ||
32 | .Xr SSL_CTX_set_ssl_version 3 | ||
33 | or | ||
34 | .Xr SSL_set_ssl_method 3 . ) | ||
35 | .Pp | ||
36 | When beginning a new handshake, the SSL engine must know whether it must call | ||
37 | the connect (client) or accept (server) routines. | ||
38 | Even though it may be clear from the method chosen whether client or server | ||
39 | mode was requested, the handshake routines must be explicitly set. | ||
40 | .Pp | ||
41 | When using the | ||
42 | .Xr SSL_connect 3 | ||
43 | or | ||
44 | .Xr SSL_accept 3 | ||
45 | routines, the correct handshake routines are automatically set. | ||
46 | When performing a transparent negotiation using | ||
47 | .Xr SSL_write 3 | ||
48 | or | ||
49 | .Xr SSL_read 3 , | ||
50 | the handshake routines must be explicitly set in advance using either | ||
51 | .Fn SSL_set_connect_state | ||
52 | or | ||
53 | .Fn SSL_set_accept_state . | ||
54 | .Sh RETURN VALUES | ||
55 | .Fn SSL_set_connect_state | ||
56 | and | ||
57 | .Fn SSL_set_accept_state | ||
58 | do not return diagnostic information. | ||
59 | .Sh SEE ALSO | ||
60 | .Xr ssl 3 , | ||
61 | .Xr SSL_accept 3 , | ||
62 | .Xr SSL_connect 3 , | ||
63 | .Xr SSL_CTX_new 3 , | ||
64 | .Xr SSL_CTX_set_ssl_version 3 , | ||
65 | .Xr SSL_do_handshake 3 , | ||
66 | .Xr SSL_new 3 , | ||
67 | .Xr SSL_read 3 , | ||
68 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_fd.3 b/src/lib/libssl/doc/SSL_set_fd.3 new file mode 100644 index 0000000000..94345ae236 --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_fd.3 | |||
@@ -0,0 +1,70 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_FD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_fd , | ||
6 | .Nm SSL_set_rfd , | ||
7 | .Nm SSL_set_wfd | ||
8 | .Nd connect the SSL object with a file descriptor | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
13 | .Ft int | ||
14 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
15 | .Ft int | ||
16 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_set_fd | ||
19 | sets the file descriptor | ||
20 | .Fa fd | ||
21 | as the input/output facility for the TLS/SSL (encrypted) side of | ||
22 | .Fa ssl . | ||
23 | .Fa fd | ||
24 | will typically be the socket file descriptor of a network connection. | ||
25 | .Pp | ||
26 | When performing the operation, a socket | ||
27 | .Vt BIO | ||
28 | is automatically created to interface between the | ||
29 | .Fa ssl | ||
30 | and | ||
31 | .Fa fd . | ||
32 | The | ||
33 | .Vt BIO | ||
34 | and hence the SSL engine inherit the behaviour of | ||
35 | .Fa fd . | ||
36 | If | ||
37 | .Fa fd | ||
38 | is non-blocking, the | ||
39 | .Fa ssl | ||
40 | will also have non-blocking behaviour. | ||
41 | .Pp | ||
42 | If there was already a | ||
43 | .Vt BIO | ||
44 | connected to | ||
45 | .Fa ssl , | ||
46 | .Xr BIO_free 3 | ||
47 | will be called (for both the reading and writing side, if different). | ||
48 | .Pp | ||
49 | .Fn SSL_set_rfd | ||
50 | and | ||
51 | .Fn SSL_set_wfd | ||
52 | perform the respective action, but only for the read channel or the write | ||
53 | channel, which can be set independently. | ||
54 | .Sh RETURN VALUES | ||
55 | The following return values can occur: | ||
56 | .Bl -tag -width Ds | ||
57 | .It 0 | ||
58 | The operation failed. | ||
59 | Check the error stack to find out why. | ||
60 | .It 1 | ||
61 | The operation succeeded. | ||
62 | .El | ||
63 | .Sh SEE ALSO | ||
64 | .Xr bio 3 , | ||
65 | .Xr ssl 3 , | ||
66 | .Xr SSL_accept 3 , | ||
67 | .Xr SSL_connect 3 , | ||
68 | .Xr SSL_get_fd 3 , | ||
69 | .Xr SSL_set_bio 3 , | ||
70 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_session.3 b/src/lib/libssl/doc/SSL_set_session.3 new file mode 100644 index 0000000000..3721b0e0e6 --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_session.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_session | ||
6 | .Nd set a TLS/SSL session to be used during TLS/SSL connect | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_session | ||
13 | sets | ||
14 | .Fa session | ||
15 | to be used when the TLS/SSL connection is to be established. | ||
16 | .Fn SSL_set_session | ||
17 | is only useful for TLS/SSL clients. | ||
18 | When the session is set, the reference count of | ||
19 | .Fa session | ||
20 | is incremented | ||
21 | by 1. | ||
22 | If the session is not reused, the reference count is decremented again during | ||
23 | .Fn SSL_connect . | ||
24 | Whether the session was reused can be queried with the | ||
25 | .Xr SSL_session_reused 3 | ||
26 | call. | ||
27 | .Pp | ||
28 | If there is already a session set inside | ||
29 | .Fa ssl | ||
30 | (because it was set with | ||
31 | .Fn SSL_set_session | ||
32 | before or because the same | ||
33 | .Fa ssl | ||
34 | was already used for a connection), | ||
35 | .Xr SSL_SESSION_free 3 | ||
36 | will be called for that session. | ||
37 | .Sh NOTES | ||
38 | .Vt SSL_SESSION | ||
39 | objects keep internal link information about the session cache list when being | ||
40 | inserted into one | ||
41 | .Vt SSL_CTX | ||
42 | object's session cache. | ||
43 | One | ||
44 | .Vt SSL_SESSION | ||
45 | object, regardless of its reference count, must therefore only be used with one | ||
46 | .Vt SSL_CTX | ||
47 | object (and the | ||
48 | .Vt SSL | ||
49 | objects created from this | ||
50 | .Vt SSL_CTX | ||
51 | object). | ||
52 | .Sh RETURN VALUES | ||
53 | The following return values can occur: | ||
54 | .Bl -tag -width Ds | ||
55 | .It 0 | ||
56 | The operation failed; check the error stack to find out the reason. | ||
57 | .It 1 | ||
58 | The operation succeeded. | ||
59 | .El | ||
60 | .Sh SEE ALSO | ||
61 | .Xr ssl 3 , | ||
62 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
63 | .Xr SSL_get_session 3 , | ||
64 | .Xr SSL_SESSION_free 3 , | ||
65 | .Xr SSL_session_reused 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_shutdown.3 b/src/lib/libssl/doc/SSL_set_shutdown.3 new file mode 100644 index 0000000000..239bbd6801 --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_shutdown.3 | |||
@@ -0,0 +1,85 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_shutdown , | ||
6 | .Nm SSL_get_shutdown | ||
7 | .Nd manipulate shutdown state of an SSL connection | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
12 | .Ft int | ||
13 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_set_shutdown | ||
16 | sets the shutdown state of | ||
17 | .Fa ssl | ||
18 | to | ||
19 | .Fa mode . | ||
20 | .Pp | ||
21 | .Fn SSL_get_shutdown | ||
22 | returns the shutdown mode of | ||
23 | .Fa ssl . | ||
24 | .Sh NOTES | ||
25 | The shutdown state of an ssl connection is a bitmask of: | ||
26 | .Bl -tag -width Ds | ||
27 | .It 0 | ||
28 | No shutdown setting, yet. | ||
29 | .It Dv SSL_SENT_SHUTDOWN | ||
30 | A | ||
31 | .Dq close notify | ||
32 | shutdown alert was sent to the peer; the connection is being considered closed | ||
33 | and the session is closed and correct. | ||
34 | .It Dv SSL_RECEIVED_SHUTDOWN | ||
35 | A shutdown alert was received form the peer, either a normal | ||
36 | .Dq close notify | ||
37 | or a fatal error. | ||
38 | .El | ||
39 | .Pp | ||
40 | .Dv SSL_SENT_SHUTDOWN | ||
41 | and | ||
42 | .Dv SSL_RECEIVED_SHUTDOWN | ||
43 | can be set at the same time. | ||
44 | .Pp | ||
45 | The shutdown state of the connection is used to determine the state of the | ||
46 | .Fa ssl | ||
47 | session. | ||
48 | If the session is still open when | ||
49 | .Xr SSL_clear 3 | ||
50 | or | ||
51 | .Xr SSL_free 3 | ||
52 | is called, it is considered bad and removed according to RFC2246. | ||
53 | The actual condition for a correctly closed session is | ||
54 | .Dv SSL_SENT_SHUTDOWN | ||
55 | (according to the TLS RFC, it is acceptable to only send the | ||
56 | .Dq close notify | ||
57 | alert but to not wait for the peer's answer when the underlying connection is | ||
58 | closed). | ||
59 | .Fn SSL_set_shutdown | ||
60 | can be used to set this state without sending a close alert to the peer (see | ||
61 | .Xr SSL_shutdown 3 ) . | ||
62 | .Pp | ||
63 | If a | ||
64 | .Dq close notify | ||
65 | was received, | ||
66 | .Dv SSL_RECEIVED_SHUTDOWN | ||
67 | will be set, but to set | ||
68 | .Dv SSL_SENT_SHUTDOWN | ||
69 | the application must still call | ||
70 | .Xr SSL_shutdown 3 | ||
71 | or | ||
72 | .Fn SSL_set_shutdown | ||
73 | itself. | ||
74 | .Sh RETURN VALUES | ||
75 | .Fn SSL_set_shutdown | ||
76 | does not return diagnostic information. | ||
77 | .Pp | ||
78 | .Fn SSL_get_shutdown | ||
79 | returns the current setting. | ||
80 | .Sh SEE ALSO | ||
81 | .Xr ssl 3 , | ||
82 | .Xr SSL_clear 3 , | ||
83 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
84 | .Xr SSL_free 3 , | ||
85 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_set_verify_result.3 b/src/lib/libssl/doc/SSL_set_verify_result.3 new file mode 100644 index 0000000000..3c7f0540fb --- /dev/null +++ b/src/lib/libssl/doc/SSL_set_verify_result.3 | |||
@@ -0,0 +1,39 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_VERIFY_RESULT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_verify_result | ||
6 | .Nd override result of peer certificate verification | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_set_verify_result "SSL *ssl" "long verify_result" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_verify_result | ||
13 | sets | ||
14 | .Fa verify_result | ||
15 | of the object | ||
16 | .Fa ssl | ||
17 | to be the result of the verification of the X509 certificate presented by the | ||
18 | peer, if any. | ||
19 | .Sh NOTES | ||
20 | .Fn SSL_set_verify_result | ||
21 | overrides the verification result. | ||
22 | It only changes the verification result of the | ||
23 | .Fa ssl | ||
24 | object. | ||
25 | It does not become part of the established session, so if the session is to be | ||
26 | reused later, the original value will reappear. | ||
27 | .Pp | ||
28 | The valid codes for | ||
29 | .Fa verify_result | ||
30 | are documented in | ||
31 | .Xr verify 1 . | ||
32 | .Sh RETURN VALUES | ||
33 | .Fn SSL_set_verify_result | ||
34 | does not provide a return value. | ||
35 | .Sh SEE ALSO | ||
36 | .Xr verify 1 , | ||
37 | .Xr ssl 3 , | ||
38 | .Xr SSL_get_peer_certificate 3 , | ||
39 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/doc/SSL_shutdown.3 b/src/lib/libssl/doc/SSL_shutdown.3 new file mode 100644 index 0000000000..aa8d483b24 --- /dev/null +++ b/src/lib/libssl/doc/SSL_shutdown.3 | |||
@@ -0,0 +1,201 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_shutdown | ||
6 | .Nd shut down a TLS/SSL connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_shutdown "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_shutdown | ||
13 | shuts down an active TLS/SSL connection. | ||
14 | It sends the | ||
15 | .Dq close notify | ||
16 | shutdown alert to the peer. | ||
17 | .Sh NOTES | ||
18 | .Fn SSL_shutdown | ||
19 | tries to send the | ||
20 | .Dq close notify | ||
21 | shutdown alert to the peer. | ||
22 | Whether the operation succeeds or not, the | ||
23 | .Dv SSL_SENT_SHUTDOWN | ||
24 | flag is set and a currently open session is considered closed and good and will | ||
25 | be kept in the session cache for further reuse. | ||
26 | .Pp | ||
27 | The shutdown procedure consists of 2 steps: the sending of the | ||
28 | .Dq close notify | ||
29 | shutdown alert and the reception of the peer's | ||
30 | .Dq close notify | ||
31 | shutdown alert. | ||
32 | According to the TLS standard, it is acceptable for an application to only send | ||
33 | its shutdown alert and then close the underlying connection without waiting for | ||
34 | the peer's response (this way resources can be saved, as the process can | ||
35 | already terminate or serve another connection). | ||
36 | When the underlying connection shall be used for more communications, | ||
37 | the complete shutdown procedure (bidirectional | ||
38 | .Dq close notify | ||
39 | alerts) must be performed, so that the peers stay synchronized. | ||
40 | .Pp | ||
41 | .Fn SSL_shutdown | ||
42 | supports both uni- and bidirectional shutdown by its 2 step behavior. | ||
43 | .Pp | ||
44 | When the application is the first party to send the | ||
45 | .Dq close notify | ||
46 | alert, | ||
47 | .Fn SSL_shutdown | ||
48 | will only send the alert and then set the | ||
49 | .Dv SSL_SENT_SHUTDOWN | ||
50 | flag (so that the session is considered good and will be kept in cache). | ||
51 | .Fn SSL_shutdown | ||
52 | will then return 0. | ||
53 | If a unidirectional shutdown is enough | ||
54 | (the underlying connection shall be closed anyway), this first call to | ||
55 | .Fn SSL_shutdown | ||
56 | is sufficient. | ||
57 | In order to complete the bidirectional shutdown handshake, | ||
58 | .Fn SSL_shutdown | ||
59 | must be called again. | ||
60 | The second call will make | ||
61 | .Fn SSL_shutdown | ||
62 | wait for the peer's | ||
63 | .Dq close notify | ||
64 | shutdown alert. | ||
65 | On success, the second call to | ||
66 | .Fn SSL_shutdown | ||
67 | will return 1. | ||
68 | .Pp | ||
69 | If the peer already sent the | ||
70 | .Dq close notify | ||
71 | alert and it was already processed implicitly inside another function | ||
72 | .Pq Xr SSL_read 3 , | ||
73 | the | ||
74 | .Dv SSL_RECEIVED_SHUTDOWN | ||
75 | flag is set. | ||
76 | .Fn SSL_shutdown | ||
77 | will send the | ||
78 | .Dq close notify | ||
79 | alert, set the | ||
80 | .Dv SSL_SENT_SHUTDOWN | ||
81 | flag and will immediately return with 1. | ||
82 | Whether | ||
83 | .Dv SSL_RECEIVED_SHUTDOWN | ||
84 | is already set can be checked using the | ||
85 | .Fn SSL_get_shutdown | ||
86 | (see also the | ||
87 | .Xr SSL_set_shutdown 3 | ||
88 | call). | ||
89 | .Pp | ||
90 | It is therefore recommended to check the return value of | ||
91 | .Fn SSL_shutdown | ||
92 | and call | ||
93 | .Fn SSL_shutdown | ||
94 | again, if the bidirectional shutdown is not yet complete (return value of the | ||
95 | first call is 0). | ||
96 | As the shutdown is not specially handled in the SSLv2 protocol, | ||
97 | .Fn SSL_shutdown | ||
98 | will succeed on the first call. | ||
99 | .Pp | ||
100 | The behaviour of | ||
101 | .Fn SSL_shutdown | ||
102 | additionally depends on the underlying | ||
103 | .Vt BIO . | ||
104 | .Pp | ||
105 | If the underlying | ||
106 | .Vt BIO | ||
107 | is | ||
108 | .Em blocking , | ||
109 | .Fn SSL_shutdown | ||
110 | will only return once the | ||
111 | handshake step has been finished or an error occurred. | ||
112 | .Pp | ||
113 | If the underlying | ||
114 | .Vt BIO | ||
115 | is | ||
116 | .Em non-blocking , | ||
117 | .Fn SSL_shutdown | ||
118 | will also return when the underlying | ||
119 | .Vt BIO | ||
120 | could not satisfy the needs of | ||
121 | .Fn SSL_shutdown | ||
122 | to continue the handshake. | ||
123 | In this case a call to | ||
124 | .Xr SSL_get_error 3 | ||
125 | with the | ||
126 | return value of | ||
127 | .Fn SSL_shutdown | ||
128 | will yield | ||
129 | .Dv SSL_ERROR_WANT_READ | ||
130 | or | ||
131 | .Dv SSL_ERROR_WANT_WRITE . | ||
132 | The calling process then must repeat the call after taking appropriate action | ||
133 | to satisfy the needs of | ||
134 | .Fn SSL_shutdown . | ||
135 | The action depends on the underlying | ||
136 | .Vt BIO . | ||
137 | When using a non-blocking socket, nothing is to be done, but | ||
138 | .Xr select 2 | ||
139 | can be used to check for the required condition. | ||
140 | When using a buffering | ||
141 | .Vt BIO , | ||
142 | like a | ||
143 | .Vt BIO | ||
144 | pair, data must be written into or retrieved out of the | ||
145 | .Vt BIO | ||
146 | before being able to continue. | ||
147 | .Pp | ||
148 | .Fn SSL_shutdown | ||
149 | can be modified to only set the connection to | ||
150 | .Dq shutdown | ||
151 | state but not actually send the | ||
152 | .Dq close notify | ||
153 | alert messages; see | ||
154 | .Xr SSL_CTX_set_quiet_shutdown 3 . | ||
155 | When | ||
156 | .Dq quiet shutdown | ||
157 | is enabled, | ||
158 | .Fn SSL_shutdown | ||
159 | will always succeed and return 1. | ||
160 | .Sh RETURN VALUES | ||
161 | The following return values can occur: | ||
162 | .Bl -tag -width Ds | ||
163 | .It 0 | ||
164 | The shutdown is not yet finished. | ||
165 | Call | ||
166 | .Fn SSL_shutdown | ||
167 | for a second time, if a bidirectional shutdown shall be performed. | ||
168 | The output of | ||
169 | .Xr SSL_get_error 3 | ||
170 | may be misleading, as an erroneous | ||
171 | .Dv SSL_ERROR_SYSCALL | ||
172 | may be flagged even though no error occurred. | ||
173 | .It 1 | ||
174 | The shutdown was successfully completed. | ||
175 | The | ||
176 | .Dq close notify | ||
177 | alert was sent and the peer's | ||
178 | .Dq close notify | ||
179 | alert was received. | ||
180 | .It \(mi1 | ||
181 | The shutdown was not successful because a fatal error occurred either | ||
182 | at the protocol level or a connection failure occurred. | ||
183 | It can also occur if action is need to continue the operation for non-blocking | ||
184 | .Vt BIO Ns | ||
185 | s. | ||
186 | Call | ||
187 | .Xr SSL_get_error 3 | ||
188 | with the return value | ||
189 | .Fa ret | ||
190 | to find out the reason. | ||
191 | .El | ||
192 | .Sh SEE ALSO | ||
193 | .Xr bio 3 , | ||
194 | .Xr ssl 3 , | ||
195 | .Xr SSL_accept 3 , | ||
196 | .Xr SSL_clear 3 , | ||
197 | .Xr SSL_connect 3 , | ||
198 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
199 | .Xr SSL_free 3 , | ||
200 | .Xr SSL_get_error 3 , | ||
201 | .Xr SSL_set_shutdown 3 | ||
diff --git a/src/lib/libssl/doc/SSL_state_string.3 b/src/lib/libssl/doc/SSL_state_string.3 new file mode 100644 index 0000000000..828b8f351a --- /dev/null +++ b/src/lib/libssl/doc/SSL_state_string.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_STATE_STRING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_state_string , | ||
6 | .Nm SSL_state_string_long | ||
7 | .Nd get textual description of state of an SSL object | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_state_string "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_state_string_long "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_state_string | ||
16 | returns a 6 letter string indicating the current state of the | ||
17 | .Vt SSL | ||
18 | object | ||
19 | .Fa ssl . | ||
20 | .Pp | ||
21 | .Fn SSL_state_string_long | ||
22 | returns a string indicating the current state of the | ||
23 | .Vt SSL | ||
24 | object | ||
25 | .Fa ssl . | ||
26 | .Sh NOTES | ||
27 | During its use, an | ||
28 | .Vt SSL | ||
29 | object passes several states. | ||
30 | The state is internally maintained. | ||
31 | Querying the state information is not very informative before or when a | ||
32 | connection has been established. | ||
33 | It however can be of significant interest during the handshake. | ||
34 | .Pp | ||
35 | When using non-blocking sockets, | ||
36 | the function call performing the handshake may return with | ||
37 | .Dv SSL_ERROR_WANT_READ | ||
38 | or | ||
39 | .Dv SSL_ERROR_WANT_WRITE | ||
40 | condition, so that | ||
41 | .Fn SSL_state_string[_long] | ||
42 | may be called. | ||
43 | .Pp | ||
44 | For both blocking or non-blocking sockets, | ||
45 | the details state information can be used within the | ||
46 | .Fn info_callback | ||
47 | function set with the | ||
48 | .Xr SSL_set_info_callback 3 | ||
49 | call. | ||
50 | .Sh RETURN VALUES | ||
51 | Detailed description of possible states to be included later. | ||
52 | .Sh SEE ALSO | ||
53 | .Xr ssl 3 , | ||
54 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/doc/SSL_want.3 b/src/lib/libssl/doc/SSL_want.3 new file mode 100644 index 0000000000..5f9d89ea92 --- /dev/null +++ b/src/lib/libssl/doc/SSL_want.3 | |||
@@ -0,0 +1,100 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_WANT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_want , | ||
6 | .Nm SSL_want_nothing , | ||
7 | .Nm SSL_want_read , | ||
8 | .Nm SSL_want_write , | ||
9 | .Nm SSL_want_x509_lookup | ||
10 | .Nd obtain state information TLS/SSL I/O operation | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/ssl.h | ||
13 | .Ft int | ||
14 | .Fn SSL_want "const SSL *ssl" | ||
15 | .Ft int | ||
16 | .Fn SSL_want_nothing "const SSL *ssl" | ||
17 | .Ft int | ||
18 | .Fn SSL_want_read "const SSL *ssl" | ||
19 | .Ft int | ||
20 | .Fn SSL_want_write "const SSL *ssl" | ||
21 | .Ft int | ||
22 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_want | ||
25 | returns state information for the | ||
26 | .Vt SSL | ||
27 | object | ||
28 | .Fa ssl . | ||
29 | .Pp | ||
30 | The other | ||
31 | .Fn SSL_want_* | ||
32 | calls are shortcuts for the possible states returned by | ||
33 | .Fn SSL_want . | ||
34 | .Sh NOTES | ||
35 | .Fn SSL_want | ||
36 | examines the internal state information of the | ||
37 | .Vt SSL | ||
38 | object. | ||
39 | Its return values are similar to those of | ||
40 | .Xr SSL_get_error 3 . | ||
41 | Unlike | ||
42 | .Xr SSL_get_error 3 , | ||
43 | which also evaluates the error queue, | ||
44 | the results are obtained by examining an internal state flag only. | ||
45 | The information must therefore only be used for normal operation under | ||
46 | non-blocking I/O. | ||
47 | Error conditions are not handled and must be treated using | ||
48 | .Xr SSL_get_error 3 . | ||
49 | .Pp | ||
50 | The result returned by | ||
51 | .Fn SSL_want | ||
52 | should always be consistent with the result of | ||
53 | .Xr SSL_get_error 3 . | ||
54 | .Sh RETURN VALUES | ||
55 | The following return values can currently occur for | ||
56 | .Fn SSL_want : | ||
57 | .Bl -tag -width Ds | ||
58 | .It .Dv SSL_NOTHING | ||
59 | There is no data to be written or to be read. | ||
60 | .It .Dv SSL_WRITING | ||
61 | There are data in the SSL buffer that must be written to the underlying | ||
62 | .Vt BIO | ||
63 | layer in order to complete the actual | ||
64 | .Fn SSL_* | ||
65 | operation. | ||
66 | A call to | ||
67 | .Xr SSL_get_error 3 | ||
68 | should return | ||
69 | .Dv SSL_ERROR_WANT_WRITE . | ||
70 | .It Dv SSL_READING | ||
71 | More data must be read from the underlying | ||
72 | .Vt BIO | ||
73 | layer in order to | ||
74 | complete the actual | ||
75 | .Fn SSL_* | ||
76 | operation. | ||
77 | A call to | ||
78 | .Xr SSL_get_error 3 | ||
79 | should return | ||
80 | .Dv SSL_ERROR_WANT_READ. | ||
81 | .It Dv SSL_X509_LOOKUP | ||
82 | The operation did not complete because an application callback set by | ||
83 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
84 | has asked to be called again. | ||
85 | A call to | ||
86 | .Xr SSL_get_error 3 | ||
87 | should return | ||
88 | .Dv SSL_ERROR_WANT_X509_LOOKUP . | ||
89 | .El | ||
90 | .Pp | ||
91 | .Fn SSL_want_nothing , | ||
92 | .Fn SSL_want_read , | ||
93 | .Fn SSL_want_write , | ||
94 | and | ||
95 | .Fn SSL_want_x509_lookup | ||
96 | return 1 when the corresponding condition is true or 0 otherwise. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr err 3 , | ||
99 | .Xr ssl 3 , | ||
100 | .Xr SSL_get_error 3 | ||
diff --git a/src/lib/libssl/doc/SSL_write.3 b/src/lib/libssl/doc/SSL_write.3 new file mode 100644 index 0000000000..19dfffae1b --- /dev/null +++ b/src/lib/libssl/doc/SSL_write.3 | |||
@@ -0,0 +1,172 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_WRITE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_write | ||
6 | .Nd write bytes to a TLS/SSL connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_write | ||
13 | writes | ||
14 | .Fa num | ||
15 | bytes from the buffer | ||
16 | .Fa buf | ||
17 | into the specified | ||
18 | .Fa ssl | ||
19 | connection. | ||
20 | .Sh NOTES | ||
21 | If necessary, | ||
22 | .Fn SSL_write | ||
23 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
24 | .Xr SSL_connect 3 | ||
25 | or | ||
26 | .Xr SSL_accept 3 . | ||
27 | If the peer requests a re-negotiation, | ||
28 | it will be performed transparently during the | ||
29 | .Fn SSL_write | ||
30 | operation. | ||
31 | The behaviour of | ||
32 | .Fn SSL_write | ||
33 | depends on the underlying | ||
34 | .Vt BIO . | ||
35 | .Pp | ||
36 | For the transparent negotiation to succeed, the | ||
37 | .Fa ssl | ||
38 | must have been initialized to client or server mode. | ||
39 | This is being done by calling | ||
40 | .Xr SSL_set_connect_state 3 | ||
41 | or | ||
42 | .Xr SSL_set_accept_state 3 | ||
43 | before the first call to an | ||
44 | .Xr SSL_read 3 | ||
45 | or | ||
46 | .Fn SSL_write | ||
47 | function. | ||
48 | .Pp | ||
49 | If the underlying | ||
50 | .Vt BIO | ||
51 | is | ||
52 | .Em blocking , | ||
53 | .Fn SSL_write | ||
54 | will only return once the write operation has been finished or an error | ||
55 | occurred, except when a renegotiation take place, in which case a | ||
56 | .Dv SSL_ERROR_WANT_READ | ||
57 | may occur. | ||
58 | This behaviour can be controlled with the | ||
59 | .Dv SSL_MODE_AUTO_RETRY | ||
60 | flag of the | ||
61 | .Xr SSL_CTX_set_mode 3 | ||
62 | call. | ||
63 | .Pp | ||
64 | If the underlying | ||
65 | .Vt BIO | ||
66 | is | ||
67 | .Em non-blocking , | ||
68 | .Fn SSL_write | ||
69 | will also return when the underlying | ||
70 | .Vt BIO | ||
71 | could not satisfy the needs of | ||
72 | .Fn SSL_write | ||
73 | to continue the operation. | ||
74 | In this case a call to | ||
75 | .Xr SSL_get_error 3 | ||
76 | with the return value of | ||
77 | .Fn SSL_write | ||
78 | will yield | ||
79 | .Dv SSL_ERROR_WANT_READ | ||
80 | or | ||
81 | .Dv SSL_ERROR_WANT_WRITE . | ||
82 | As at any time a re-negotiation is possible, a call to | ||
83 | .Fn SSL_write | ||
84 | can also cause read operations! | ||
85 | The calling process then must repeat the call after taking appropriate action | ||
86 | to satisfy the needs of | ||
87 | .Fn SSL_write . | ||
88 | The action depends on the underlying | ||
89 | .Vt BIO . | ||
90 | When using a non-blocking socket, nothing is to be done, but | ||
91 | .Xr select 2 | ||
92 | can be used to check for the required condition. | ||
93 | When using a buffering | ||
94 | .Vt BIO , | ||
95 | like a | ||
96 | .Vt BIO | ||
97 | pair, data must be written into or retrieved out of the BIO before being able | ||
98 | to continue. | ||
99 | .Pp | ||
100 | .Fn SSL_write | ||
101 | will only return with success, when the complete contents of | ||
102 | .Fa buf | ||
103 | of length | ||
104 | .Fa num | ||
105 | have been written. | ||
106 | This default behaviour can be changed with the | ||
107 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
108 | option of | ||
109 | .Xr SSL_CTX_set_mode 3 . | ||
110 | When this flag is set, | ||
111 | .Fn SSL_write | ||
112 | will also return with success when a partial write has been successfully | ||
113 | completed. | ||
114 | In this case the | ||
115 | .Fn SSL_write | ||
116 | operation is considered completed. | ||
117 | The bytes are sent and a new | ||
118 | .Fn SSL_write | ||
119 | operation with a new buffer (with the already sent bytes removed) must be | ||
120 | started. | ||
121 | A partial write is performed with the size of a message block, which is 16kB | ||
122 | for SSLv3/TLSv1. | ||
123 | .Sh WARNING | ||
124 | When an | ||
125 | .Fn SSL_write | ||
126 | operation has to be repeated because of | ||
127 | .Dv SSL_ERROR_WANT_READ | ||
128 | or | ||
129 | .Dv SSL_ERROR_WANT_WRITE , | ||
130 | it must be repeated with the same arguments. | ||
131 | .Pp | ||
132 | When calling | ||
133 | .Fn SSL_write | ||
134 | with | ||
135 | .Fa num Ns | ||
136 | =0 bytes to be sent the behaviour is undefined. | ||
137 | .Sh RETURN VALUES | ||
138 | The following return values can occur: | ||
139 | .Bl -tag -width Ds | ||
140 | .It >0 | ||
141 | The write operation was successful. | ||
142 | The return value is the number of bytes actually written to the TLS/SSL | ||
143 | connection. | ||
144 | .It 0 | ||
145 | The write operation was not successful. | ||
146 | Probably the underlying connection was closed. | ||
147 | Call | ||
148 | .Xr SSL_get_error 3 | ||
149 | with the return value to find out whether an error occurred or the connection | ||
150 | was shut down cleanly | ||
151 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
152 | .Pp | ||
153 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
154 | be detected whether the underlying connection was closed. | ||
155 | It cannot be checked why the closure happened. | ||
156 | .It <0 | ||
157 | The write operation was not successful, because either an error occurred or | ||
158 | action must be taken by the calling process. | ||
159 | Call | ||
160 | .Xr SSL_get_error 3 | ||
161 | with the return value to find out the reason. | ||
162 | .El | ||
163 | .Sh SEE ALSO | ||
164 | .Xr bio 3 , | ||
165 | .Xr ssl 3 , | ||
166 | .Xr SSL_accept 3 , | ||
167 | .Xr SSL_connect 3 , | ||
168 | .Xr SSL_CTX_new 3 , | ||
169 | .Xr SSL_CTX_set_mode 3 , | ||
170 | .Xr SSL_get_error 3 , | ||
171 | .Xr SSL_read 3 , | ||
172 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/doc/d2i_SSL_SESSION.3 b/src/lib/libssl/doc/d2i_SSL_SESSION.3 new file mode 100644 index 0000000000..3a40c32e69 --- /dev/null +++ b/src/lib/libssl/doc/d2i_SSL_SESSION.3 | |||
@@ -0,0 +1,126 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt D2I_SSL_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_SSL_SESSION , | ||
6 | .Nm i2d_SSL_SESSION | ||
7 | .Nd convert SSL_SESSION object from/to ASN1 representation | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft SSL_SESSION * | ||
11 | .Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" | ||
12 | .Ft int | ||
13 | .Fn i2d_SSL_SESSION "SSL_SESSION *in" "unsigned char **pp" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn d2i_SSL_SESSION | ||
16 | transforms the external ASN1 representation of an SSL/TLS session, | ||
17 | stored as binary data at location | ||
18 | .Fa pp | ||
19 | with length | ||
20 | .Fa length , | ||
21 | into | ||
22 | an | ||
23 | .Vt SSL_SESSION | ||
24 | object. | ||
25 | .Pp | ||
26 | .Fn i2d_SSL_SESSION | ||
27 | transforms the | ||
28 | .Vt SSL_SESSION | ||
29 | object | ||
30 | .Fa in | ||
31 | into the ASN1 representation and stores it into the memory location pointed to | ||
32 | by | ||
33 | .Fa pp . | ||
34 | The length of the resulting ASN1 representation is returned. | ||
35 | If | ||
36 | .Fa pp | ||
37 | is the | ||
38 | .Dv NULL | ||
39 | pointer, only the length is calculated and returned. | ||
40 | .Sh NOTES | ||
41 | The | ||
42 | .Vt SSL_SESSION | ||
43 | object is built from several | ||
44 | .Xr malloc 3 Ns | ||
45 | -ed parts; it can therefore not be moved, copied or stored directly. | ||
46 | In order to store session data on disk or into a database, | ||
47 | it must be transformed into a binary ASN1 representation. | ||
48 | .Pp | ||
49 | When using | ||
50 | .Fn d2i_SSL_SESSION , | ||
51 | the | ||
52 | .Vt SSL_SESSION | ||
53 | object is automatically allocated. | ||
54 | The reference count is 1, so that the session must be explicitly removed using | ||
55 | .Xr SSL_SESSION_free 3 , | ||
56 | unless the | ||
57 | .Vt SSL_SESSION | ||
58 | object is completely taken over, when being called inside the | ||
59 | .Xr get_session_cb 3 | ||
60 | (see | ||
61 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
62 | .Pp | ||
63 | .Vt SSL_SESSION | ||
64 | objects keep internal link information about the session cache list when being | ||
65 | inserted into one | ||
66 | .Vt SSL_CTX | ||
67 | object's session cache. | ||
68 | One | ||
69 | .Vt SSL_SESSION | ||
70 | object, regardless of its reference count, must therefore only be used with one | ||
71 | .Vt SSL_CTX | ||
72 | object (and the | ||
73 | .Vt SSL | ||
74 | objects created from this | ||
75 | .Vt SSL_CTX | ||
76 | object). | ||
77 | .Pp | ||
78 | When using | ||
79 | .Fn i2d_SSL_SESSION , | ||
80 | the memory location pointed to by | ||
81 | .Fa pp | ||
82 | must be large enough to hold the binary representation of the session. | ||
83 | There is no known limit on the size of the created ASN1 representation, | ||
84 | so the necessary amount of space should be obtained by first calling | ||
85 | .Fn i2d_SSL_SESSION | ||
86 | with | ||
87 | .Fa pp Ns | ||
88 | = Ns | ||
89 | .Dv NULL , | ||
90 | and obtain the size needed, then allocate the memory and call | ||
91 | .Fn i2d_SSL_SESSION | ||
92 | again. | ||
93 | Note that this will advance the value contained in | ||
94 | .Fa *pp | ||
95 | so it is necessary to save a copy of the original allocation. | ||
96 | For example: | ||
97 | .Bd -literal | ||
98 | int i, j; | ||
99 | |||
100 | char *p, *temp; | ||
101 | |||
102 | i = i2d_SSL_SESSION(sess, NULL); | ||
103 | p = temp = malloc(i); | ||
104 | if (temp != NULL) { | ||
105 | j = i2d_SSL_SESSION(sess, &temp); | ||
106 | assert(i == j); | ||
107 | assert(p + i == temp); | ||
108 | } | ||
109 | .Ed | ||
110 | .Sh RETURN VALUES | ||
111 | .Fn d2i_SSL_SESSION | ||
112 | returns a pointer to the newly allocated | ||
113 | .Vt SSL_SESSION | ||
114 | object. | ||
115 | In case of failure a | ||
116 | .Dv NULL | ||
117 | pointer is returned and the error message can be retrieved from the error | ||
118 | stack. | ||
119 | .Pp | ||
120 | .Fn i2d_SSL_SESSION | ||
121 | returns the size of the ASN1 representation in bytes. | ||
122 | When the session is not valid, 0 is returned and no operation is performed. | ||
123 | .Sh SEE ALSO | ||
124 | .Xr ssl 3 , | ||
125 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
126 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/doc/ssl.3 b/src/lib/libssl/doc/ssl.3 new file mode 100644 index 0000000000..901e1fdfc1 --- /dev/null +++ b/src/lib/libssl/doc/ssl.3 | |||
@@ -0,0 +1,1317 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL | ||
6 | .Nd OpenSSL SSL/TLS library | ||
7 | .Sh SYNOPSIS | ||
8 | .Sh DESCRIPTION | ||
9 | The OpenSSL | ||
10 | .Nm ssl | ||
11 | library implements the Secure Sockets Layer (SSL v2/v3) and | ||
12 | Transport Layer Security (TLS v1) protocols. | ||
13 | It provides a rich API which is documented here. | ||
14 | .Pp | ||
15 | At first the library must be initialized; see | ||
16 | .Xr SSL_library_init 3 . | ||
17 | .Pp | ||
18 | Then an | ||
19 | .Vt SSL_CTX | ||
20 | object is created as a framework to establish TLS/SSL enabled connections (see | ||
21 | .Xr SSL_CTX_new 3 ) . | ||
22 | Various options regarding certificates, algorithms, etc., can be set in this | ||
23 | object. | ||
24 | .Pp | ||
25 | When a network connection has been created, it can be assigned to an | ||
26 | .Vt SSL | ||
27 | object. | ||
28 | After the | ||
29 | .Vt SSL | ||
30 | object has been created using | ||
31 | .Xr SSL_new 3 , | ||
32 | .Xr SSL_set_fd 3 | ||
33 | or | ||
34 | .Xr SSL_set_bio 3 | ||
35 | can be used to associate the network connection with the object. | ||
36 | .Pp | ||
37 | Then the TLS/SSL handshake is performed using | ||
38 | .Xr SSL_accept 3 | ||
39 | or | ||
40 | .Xr SSL_connect 3 | ||
41 | respectively. | ||
42 | .Xr SSL_read 3 | ||
43 | and | ||
44 | .Xr SSL_write 3 | ||
45 | are used to read and write data on the TLS/SSL connection. | ||
46 | .Xr SSL_shutdown 3 | ||
47 | can be used to shut down the TLS/SSL connection. | ||
48 | .Sh DATA STRUCTURES | ||
49 | Currently the OpenSSL | ||
50 | .Nm ssl | ||
51 | library functions deals with the following data structures: | ||
52 | .Bl -tag -width Ds | ||
53 | .It Vt SSL_METHOD No (SSL Method) | ||
54 | That's a dispatch structure describing the internal | ||
55 | .Nm ssl | ||
56 | library methods/functions which implement the various protocol versions | ||
57 | (SSLv1, SSLv2 and TLSv1). | ||
58 | It's needed to create an | ||
59 | .Vt SSL_CTX . | ||
60 | .It Vt SSL_CIPHER No (SSL Cipher) | ||
61 | This structure holds the algorithm information for a particular cipher which | ||
62 | is a core part of the SSL/TLS protocol. | ||
63 | The available ciphers are configured on an | ||
64 | .Vt SSL_CTX | ||
65 | basis and the actually used ones are then part of the | ||
66 | .Vt SSL_SESSION . | ||
67 | .It Vt SSL_CTX No (SSL Context) | ||
68 | That's the global context structure which is created by a server or client | ||
69 | once per program lifetime and which holds mainly default values for the | ||
70 | .Vt SSL | ||
71 | structures which are later created for the connections. | ||
72 | .It Vt SSL_SESSION No (SSL Session) | ||
73 | This is a structure containing the current TLS/SSL session details for a | ||
74 | connection: | ||
75 | .Vt SSL_CIPHER Ns s, client and server certificates, keys, etc. | ||
76 | .It Vt SSL No (SSL Connection) | ||
77 | That's the main SSL/TLS structure which is created by a server or client per | ||
78 | established connection. | ||
79 | This actually is the core structure in the SSL API. | ||
80 | Under run-time the application usually deals with this structure which has | ||
81 | links to mostly all other structures. | ||
82 | .El | ||
83 | .Sh HEADER FILES | ||
84 | Currently the OpenSSL | ||
85 | .Nm ssl | ||
86 | library provides the following C header files containing the prototypes for the | ||
87 | data structures and functions: | ||
88 | .Bl -tag -width Ds | ||
89 | .It Pa ssl.h | ||
90 | That's the common header file for the SSL/TLS API. | ||
91 | Include it into your program to make the API of the | ||
92 | .Nm ssl | ||
93 | library available. | ||
94 | It internally includes both more private SSL headers and headers from the | ||
95 | .Em crypto | ||
96 | library. | ||
97 | Whenever you need hardcore details on the internals of the SSL API, look inside | ||
98 | this header file. | ||
99 | .It Pa ssl2.h | ||
100 | That's the sub header file dealing with the SSLv2 protocol only. | ||
101 | .Bf Em | ||
102 | Usually you don't have to include it explicitly because it's already included | ||
103 | by | ||
104 | .Pa ssl.h . | ||
105 | .Ef | ||
106 | .It Pa ssl3.h | ||
107 | That's the sub header file dealing with the SSLv3 protocol only. | ||
108 | .Bf Em | ||
109 | Usually you don't have to include it explicitly because it's already included | ||
110 | by | ||
111 | .Pa ssl.h . | ||
112 | .Ef | ||
113 | .It Pa ssl23.h | ||
114 | That's the sub header file dealing with the combined use of the SSLv2 and SSLv3 | ||
115 | protocols. | ||
116 | .Bf Em | ||
117 | Usually you don't have to include it explicitly because it's already included | ||
118 | by | ||
119 | .Pa ssl.h . | ||
120 | .Ef | ||
121 | .It Pa tls1.h | ||
122 | That's the sub header file dealing with the TLSv1 protocol only. | ||
123 | .Bf Em | ||
124 | Usually you don't have to include it explicitly because it's already included | ||
125 | by | ||
126 | .Pa ssl.h . | ||
127 | .Ef | ||
128 | .El | ||
129 | .Sh API FUNCTIONS | ||
130 | The functions that the OpenSSL | ||
131 | .Nm ssl | ||
132 | library exports are documented below: | ||
133 | .Ss DEALING WITH PROTOCOL METHODS | ||
134 | Here we document the various API functions which deal with the SSL/TLS protocol | ||
135 | methods defined in | ||
136 | .Vt SSL_METHOD | ||
137 | structures. | ||
138 | .Bl -tag -width Ds | ||
139 | .It Xo | ||
140 | .Ft const SSL_METHOD * | ||
141 | .Fn SSLv2_client_method void | ||
142 | .Xc | ||
143 | Constructor for the SSLv2 | ||
144 | .Vt SSL_METHOD | ||
145 | structure for a dedicated client. | ||
146 | .It Xo | ||
147 | .Ft const SSL_METHOD * | ||
148 | .Fn SSLv2_server_method void | ||
149 | .Xc | ||
150 | Constructor for the SSLv2 | ||
151 | .Vt SSL_METHOD | ||
152 | structure for a dedicated server. | ||
153 | .It Xo | ||
154 | .Ft const SSL_METHOD * | ||
155 | .Fn SSLv2_method void | ||
156 | .Xc | ||
157 | Constructor for the SSLv2 | ||
158 | .Vt SSL_METHOD | ||
159 | structure for combined client and server. | ||
160 | .It Xo | ||
161 | .Ft const SSL_METHOD * | ||
162 | .Fn SSLv3_client_method void | ||
163 | .Xc | ||
164 | Constructor for the SSLv3 | ||
165 | .Vt SSL_METHOD | ||
166 | structure for a dedicated client. | ||
167 | .It Xo | ||
168 | .Ft const SSL_METHOD * | ||
169 | .Fn SSLv3_server_method void | ||
170 | .Xc | ||
171 | Constructor for the SSLv3 | ||
172 | .Vt SSL_METHOD | ||
173 | structure for a dedicated server. | ||
174 | .It Xo | ||
175 | .Ft const SSL_METHOD * | ||
176 | .Fn SSLv3_method void | ||
177 | .Xc | ||
178 | Constructor for the SSLv3 | ||
179 | .Vt SSL_METHOD | ||
180 | structure for combined client and server. | ||
181 | .It Xo | ||
182 | .Ft const SSL_METHOD * | ||
183 | .Fn TLSv1_client_method void | ||
184 | .Xc | ||
185 | Constructor for the TLSv1 | ||
186 | .Vt SSL_METHOD | ||
187 | structure for a dedicated client. | ||
188 | .It Xo | ||
189 | .Ft const SSL_METHOD * | ||
190 | .Fn TLSv1_server_method void | ||
191 | .Xc | ||
192 | Constructor for the TLSv1 | ||
193 | .Vt SSL_METHOD | ||
194 | structure for a dedicated server. | ||
195 | .It Xo | ||
196 | .Ft const SSL_METHOD * | ||
197 | .Fn TLSv1_method void | ||
198 | .Xc | ||
199 | Constructor for the TLSv1 | ||
200 | .Vt SSL_METHOD | ||
201 | structure for combined client and server. | ||
202 | .El | ||
203 | .Ss DEALING WITH CIPHERS | ||
204 | Here we document the various API functions which deal with the SSL/TLS ciphers | ||
205 | defined in | ||
206 | .Vt SSL_CIPHER | ||
207 | structures. | ||
208 | .Bl -tag -width Ds | ||
209 | .It Xo | ||
210 | .Ft char * | ||
211 | .Fn SSL_CIPHER_description "SSL_CIPHER *cipher" "char *buf" "int len" | ||
212 | .Xc | ||
213 | Write a string to | ||
214 | .Fa buf | ||
215 | (with a maximum size of | ||
216 | .Fa len ) | ||
217 | containing a human readable description of | ||
218 | .Fa cipher . | ||
219 | Returns | ||
220 | .Fa buf . | ||
221 | .It Xo | ||
222 | .Ft int | ||
223 | .Fn SSL_CIPHER_get_bits "SSL_CIPHER *cipher" "int *alg_bits" | ||
224 | .Xc | ||
225 | Determine the number of bits in | ||
226 | .Fa cipher . | ||
227 | Because of export crippled ciphers there are two bits: | ||
228 | the bits the algorithm supports in general (stored to | ||
229 | .Fa alg_bits ) | ||
230 | and the bits which are actually used (the return value). | ||
231 | .It Xo | ||
232 | .Ft const char * | ||
233 | .Fn SSL_CIPHER_get_name "SSL_CIPHER *cipher" | ||
234 | .Xc | ||
235 | Return the internal name of | ||
236 | .Fa cipher | ||
237 | as a string. | ||
238 | These are the various strings defined by the | ||
239 | .Dv SSL2_TXT_xxx , | ||
240 | .Dv SSL3_TXT_xxx | ||
241 | and | ||
242 | .Dv TLS1_TXT_xxx | ||
243 | definitions in the header files. | ||
244 | .It Xo | ||
245 | .Ft char * | ||
246 | .Fn SSL_CIPHER_get_version "SSL_CIPHER *cipher" | ||
247 | .Xc | ||
248 | Returns a string like | ||
249 | Qq TLSv1/SSLv3 | ||
250 | or | ||
251 | Qq SSLv2 | ||
252 | which indicates the SSL/TLS protocol version to which | ||
253 | .Fa cipher | ||
254 | belongs (i.e., where it was defined in the specification the first time). | ||
255 | .El | ||
256 | .Ss DEALING WITH PROTOCOL CONTEXTS | ||
257 | Here we document the various API functions which deal with the SSL/TLS | ||
258 | protocol context defined in the | ||
259 | .Vt SSL_CTX | ||
260 | structure. | ||
261 | .Bl -tag -width Ds | ||
262 | .It Xo | ||
263 | .Ft int | ||
264 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *x" | ||
265 | .Xc | ||
266 | .It Xo | ||
267 | .Ft long | ||
268 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" | ||
269 | .Xc | ||
270 | .It Xo | ||
271 | .Ft int | ||
272 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
273 | .Xc | ||
274 | .It Xo | ||
275 | .Ft int | ||
276 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
277 | .Xc | ||
278 | .It Xo | ||
279 | .Ft long | ||
280 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "char *parg" | ||
281 | .Xc | ||
282 | .It Xo | ||
283 | .Ft void | ||
284 | .Fn SSL_CTX_flush_sessions "SSL_CTX *s" "long t" | ||
285 | .Xc | ||
286 | .It Xo | ||
287 | .Ft void | ||
288 | .Fn SSL_CTX_free "SSL_CTX *a" | ||
289 | .Xc | ||
290 | .It Xo | ||
291 | .Ft char * | ||
292 | .Fn SSL_CTX_get_app_data "SSL_CTX *ctx" | ||
293 | .Xc | ||
294 | .It Xo | ||
295 | .Ft X509_STORE * | ||
296 | .Fn SSL_CTX_get_cert_store "SSL_CTX *ctx" | ||
297 | .Xc | ||
298 | .It Xo | ||
299 | .Ft STACK * | ||
300 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
301 | .Xc | ||
302 | .It Xo | ||
303 | .Ft int | ||
304 | .Fn "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
305 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
306 | .Xc | ||
307 | .It Xo | ||
308 | .Ft char * | ||
309 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *s" "int idx" | ||
310 | .Xc | ||
311 | .It Xo | ||
312 | .Ft int | ||
313 | .Fo SSL_CTX_get_ex_new_index | ||
314 | .Fa "long argl" | ||
315 | .Fa "void *argp" | ||
316 | .Fa "CRYPTO_EX_new *new_func" | ||
317 | .Fa "CRYPTO_EX_dup *dup_func" | ||
318 | .Fa "CRYPTO_EX_free *free_func" | ||
319 | .Fc | ||
320 | .Xc | ||
321 | .It Xo | ||
322 | .Ft void | ||
323 | .Fo "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
324 | .Fa "SSL *ssl" | ||
325 | .Fa "int cb" | ||
326 | .Fa "int ret" | ||
327 | .Fc | ||
328 | .Xc | ||
329 | .It Xo | ||
330 | .Ft int | ||
331 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
332 | .Xc | ||
333 | .It Xo | ||
334 | .Ft int | ||
335 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX *ctx" | ||
336 | .Xc | ||
337 | .It Xo | ||
338 | .Ft long | ||
339 | .Fn SSL_CTX_get_timeout "const SSL_CTX *ctx" | ||
340 | .Xc | ||
341 | .It Xo | ||
342 | .Ft int | ||
343 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
344 | .Fa "int ok" | ||
345 | .Fa "X509_STORE_CTX *ctx" | ||
346 | .Fc | ||
347 | .Xc | ||
348 | .It Xo | ||
349 | .Ft int | ||
350 | .Fn SSL_CTX_get_verify_mode "SSL_CTX *ctx" | ||
351 | .Xc | ||
352 | .It Xo | ||
353 | .Ft int | ||
354 | .Fn SSL_CTX_load_verify_locations "SSL_CTX *ctx" "char *CAfile" "char *CApath" | ||
355 | .Xc | ||
356 | .It Xo | ||
357 | .Ft long | ||
358 | .Fn SSL_CTX_need_tmp_RSA "SSL_CTX *ctx" | ||
359 | .Xc | ||
360 | .It Xo | ||
361 | .Ft SSL_CTX * | ||
362 | .Fn SSL_CTX_new "const SSL_METHOD *meth" | ||
363 | .Xc | ||
364 | .It Xo | ||
365 | .Ft int | ||
366 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
367 | .Xc | ||
368 | .It Xo | ||
369 | .Ft int | ||
370 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
371 | .Xc | ||
372 | .It Xo | ||
373 | .Ft int | ||
374 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
375 | .Xc | ||
376 | .It Xo | ||
377 | .Ft int | ||
378 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
379 | .Xc | ||
380 | .It Xo | ||
381 | .Ft int | ||
382 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
383 | .Xc | ||
384 | .It Xo | ||
385 | .Ft int | ||
386 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
387 | .Xc | ||
388 | .It Xo | ||
389 | .Ft int | ||
390 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
391 | .Xc | ||
392 | .It Xo | ||
393 | .Ft int | ||
394 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
395 | .Xc | ||
396 | .It Xo | ||
397 | .Ft int | ||
398 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
399 | .Xc | ||
400 | .It Xo | ||
401 | .Ft int | ||
402 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
403 | .Xc | ||
404 | .It Xo | ||
405 | .Ft SSL_SESSION * | ||
406 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
407 | .Fa "SSL *ssl" | ||
408 | .Fa "unsigned char *data" | ||
409 | .Fa "int len" | ||
410 | .Fa "int *copy" | ||
411 | .Fc | ||
412 | .Xc | ||
413 | .It Xo | ||
414 | .Ft int | ||
415 | .Fn "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" "SSL *ssl" "SSL_SESSION *sess" | ||
416 | .Xc | ||
417 | .It Xo | ||
418 | .Ft void | ||
419 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
420 | .Fa "SSL_CTX *ctx" | ||
421 | .Fa "SSL_SESSION *sess" | ||
422 | .Fc | ||
423 | .Xc | ||
424 | .It Xo | ||
425 | .Ft int | ||
426 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
427 | .Xc | ||
428 | .It Xo | ||
429 | .Ft int | ||
430 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
431 | .Xc | ||
432 | .It Xo | ||
433 | .Ft int | ||
434 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
435 | .Xc | ||
436 | .It Xo | ||
437 | .Ft void | ||
438 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
439 | .Xc | ||
440 | .It Xo | ||
441 | .Ft void | ||
442 | .Fo SSL_CTX_sess_set_get_cb | ||
443 | .Fa "SSL_CTX *ctx" | ||
444 | .Fa "SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)" | ||
445 | .Fc | ||
446 | .Xc | ||
447 | .It Xo | ||
448 | .Ft void | ||
449 | .Fo SSL_CTX_sess_set_new_cb | ||
450 | .Fa "SSL_CTX *ctx" | ||
451 | .Fa "int (*cb)(SSL *ssl, SSL_SESSION *sess)" | ||
452 | .Fc | ||
453 | .Xc | ||
454 | .It Xo | ||
455 | .Ft void | ||
456 | .Fo SSL_CTX_sess_set_remove_cb | ||
457 | .Fa "SSL_CTX *ctx" | ||
458 | .Fa "void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)" | ||
459 | .Fc | ||
460 | .Xc | ||
461 | .It Xo | ||
462 | .Ft int | ||
463 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
464 | .Xc | ||
465 | .It Xo | ||
466 | .Ft LHASH * | ||
467 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
468 | .Xc | ||
469 | .It Xo | ||
470 | .Ft void | ||
471 | .Fn SSL_CTX_set_app_data "SSL_CTX *ctx" "void *arg" | ||
472 | .Xc | ||
473 | .It Xo | ||
474 | .Ft void | ||
475 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *cs" | ||
476 | .Xc | ||
477 | .It Xo | ||
478 | .Ft void | ||
479 | .Fn SSL_CTX_set_cert_verify_cb "SSL_CTX *ctx" "int (*cb)()" "char *arg" | ||
480 | .Xc | ||
481 | .It Xo | ||
482 | .Ft int | ||
483 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "char *str" | ||
484 | .Xc | ||
485 | .It Xo | ||
486 | .Ft void | ||
487 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK *list" | ||
488 | .Xc | ||
489 | .It Xo | ||
490 | .Ft void | ||
491 | .Fo SSL_CTX_set_client_cert_cb | ||
492 | .Fa "SSL_CTX *ctx" | ||
493 | .Fa "int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
494 | .Fc | ||
495 | .Xc | ||
496 | .It Xo | ||
497 | .Ft void | ||
498 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
499 | .Xc | ||
500 | .It Xo | ||
501 | .Ft void | ||
502 | .Fn SSL_CTX_set_default_read_ahead "SSL_CTX *ctx" "int m" | ||
503 | .Xc | ||
504 | .It Xo | ||
505 | .Ft int | ||
506 | .Fn SSL_CTX_set_default_verify_paths "SSL_CTX *ctx" | ||
507 | .Xc | ||
508 | .It Xo | ||
509 | .Ft int | ||
510 | .Fn SSL_CTX_set_ex_data "SSL_CTX *s" "int idx" "char *arg" | ||
511 | .Xc | ||
512 | .It Xo | ||
513 | .Ft void | ||
514 | .Fo SSL_CTX_set_info_callback | ||
515 | .Fa "SSL_CTX *ctx" | ||
516 | .Fa "void (*cb)(SSL *ssl, int cb, int ret)" | ||
517 | .Fc | ||
518 | .Xc | ||
519 | .It Xo | ||
520 | .Ft void | ||
521 | .Fo SSL_CTX_set_msg_callback | ||
522 | .Fa "SSL_CTX *ctx" | ||
523 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
524 | size_t len, SSL *ssl, void *arg)" | ||
525 | .Fc | ||
526 | .Xc | ||
527 | .It Xo | ||
528 | .Ft void | ||
529 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
530 | .Xc | ||
531 | .It Xo | ||
532 | .Ft void | ||
533 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "unsigned long op" | ||
534 | .Xc | ||
535 | .It Xo | ||
536 | .Ft void | ||
537 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
538 | .Xc | ||
539 | .It Xo | ||
540 | .Ft void | ||
541 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX *ctx" "int mode" | ||
542 | .Xc | ||
543 | .It Xo | ||
544 | .Ft int | ||
545 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *meth" | ||
546 | .Xc | ||
547 | .It Xo | ||
548 | .Ft void | ||
549 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
550 | .Xc | ||
551 | .It Xo | ||
552 | .Ft long | ||
553 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX* ctx" "DH *dh" | ||
554 | .Xc | ||
555 | .It Xo | ||
556 | .Ft long | ||
557 | .Fn SSL_CTX_set_tmp_dh_callback "SSL_CTX *ctx" "DH *(*cb)(void)" | ||
558 | .Xc | ||
559 | .It Xo | ||
560 | .Ft long | ||
561 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
562 | .Xc | ||
563 | .It Xo | ||
564 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
565 | .Xc | ||
566 | .Ft long | ||
567 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
568 | .Fa "SSL_CTX *ctx" | ||
569 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
570 | .Fc | ||
571 | .Pp | ||
572 | Sets the callback which will be called when a temporary private key is | ||
573 | required. | ||
574 | The | ||
575 | .Fa export | ||
576 | flag will be set if the reason for needing a temp key is that an export | ||
577 | ciphersuite is in use, in which case, | ||
578 | .Fa keylength | ||
579 | will contain the required keylength in bits. | ||
580 | .\" XXX using what? | ||
581 | Generate a key of appropriate size (using ???) and return it. | ||
582 | .It Xo | ||
583 | .Fn SSL_set_tmp_rsa_callback | ||
584 | .Xc | ||
585 | .Ft long | ||
586 | .Fo SSL_set_tmp_rsa_callback | ||
587 | .Fa "SSL *ssl" | ||
588 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
589 | .Fc | ||
590 | .Pp | ||
591 | The same as | ||
592 | .Fn SSL_CTX_set_tmp_rsa_callback , | ||
593 | except it operates on an | ||
594 | .Vt SSL | ||
595 | session instead of a context. | ||
596 | .It Xo | ||
597 | .Ft void | ||
598 | .Fn SSL_CTX_set_verify "SSL_CTX *ctx" "int mode" "int (*cb)(void)" | ||
599 | .Xc | ||
600 | .It Xo | ||
601 | .Ft int | ||
602 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
603 | .Xc | ||
604 | .It Xo | ||
605 | .Ft int | ||
606 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
607 | .Fa "int type" | ||
608 | .Fa "SSL_CTX *ctx" | ||
609 | .Fa "unsigned char *d" | ||
610 | .Fa "long len" | ||
611 | .Fc | ||
612 | .Xc | ||
613 | .It Xo | ||
614 | .Ft int | ||
615 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
616 | .Xc | ||
617 | .It Xo | ||
618 | .Ft int | ||
619 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
620 | .Xc | ||
621 | .It Xo | ||
622 | .Ft int | ||
623 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
624 | .Xc | ||
625 | .It Xo | ||
626 | .Ft int | ||
627 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
628 | .Xc | ||
629 | .It Xo | ||
630 | .Ft int | ||
631 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
632 | .Xc | ||
633 | .It Xo | ||
634 | .Ft int | ||
635 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
636 | .Xc | ||
637 | .It Xo | ||
638 | .Ft int | ||
639 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "char *file" "int type" | ||
640 | .Xc | ||
641 | .It Xo | ||
642 | .Ft void | ||
643 | .Fo SSL_CTX_set_psk_client_callback | ||
644 | .Fa "SSL_CTX *ctx" | ||
645 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
646 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
647 | .Fc | ||
648 | .Xc | ||
649 | .It Xo | ||
650 | .Ft int | ||
651 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
652 | .Xc | ||
653 | .It Xo | ||
654 | .Ft void | ||
655 | .Fo SSL_CTX_set_psk_server_callback | ||
656 | .Fa "SSL_CTX *ctx" | ||
657 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
658 | unsigned char *psk, int max_psk_len)" | ||
659 | .Fc | ||
660 | .Xc | ||
661 | .El | ||
662 | .Ss DEALING WITH SESSIONS | ||
663 | Here we document the various API functions which deal with the SSL/TLS sessions | ||
664 | defined in the | ||
665 | .Vt SSL_SESSION | ||
666 | structures. | ||
667 | .Bl -tag -width Ds | ||
668 | .It Xo | ||
669 | .Ft int | ||
670 | .Fn SSL_SESSION_cmp "const SSL_SESSION *a" "const SSL_SESSION *b" | ||
671 | .Xc | ||
672 | .It Xo | ||
673 | .Ft void | ||
674 | .Fn SSL_SESSION_free "SSL_SESSION *ss" | ||
675 | .Xc | ||
676 | .It Xo | ||
677 | .Ft char * | ||
678 | .Fn SSL_SESSION_get_app_data "SSL_SESSION *s" | ||
679 | .Xc | ||
680 | .It Xo | ||
681 | .Ft char * | ||
682 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *s" "int idx" | ||
683 | .Xc | ||
684 | .It Xo | ||
685 | .Ft int | ||
686 | .Fo SSL_SESSION_get_ex_new_index | ||
687 | .Fa "long argl" | ||
688 | .Fa "char *argp" | ||
689 | .Fa "int (*new_func)(void)" | ||
690 | .Fa "int (*dup_func)(void), void (*free_func)(void)" | ||
691 | .Fc | ||
692 | .Xc | ||
693 | .It Xo | ||
694 | .Ft long | ||
695 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
696 | .Xc | ||
697 | .It Xo | ||
698 | .Ft long | ||
699 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
700 | .Xc | ||
701 | .It Xo | ||
702 | .Ft unsigned long | ||
703 | .Fn SSL_SESSION_hash "const SSL_SESSION *a" | ||
704 | .Xc | ||
705 | .It Xo | ||
706 | .Ft SSL_SESSION * | ||
707 | .Fn SSL_SESSION_new void | ||
708 | .Xc | ||
709 | .It Xo | ||
710 | .Ft int | ||
711 | .Fn SSL_SESSION_print "BIO *bp" "const SSL_SESSION *x" | ||
712 | .Xc | ||
713 | .It Xo | ||
714 | .Ft int | ||
715 | .Fn SSL_SESSION_print_fp "FILE *fp" "const SSL_SESSION *x" | ||
716 | .Xc | ||
717 | .It Xo | ||
718 | .Ft void | ||
719 | .Fn SSL_SESSION_set_app_data "SSL_SESSION *s" "char *a" | ||
720 | .Xc | ||
721 | .It Xo | ||
722 | .Ft int | ||
723 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *s" "int idx" "char *arg" | ||
724 | .Xc | ||
725 | .It Xo | ||
726 | .Ft long | ||
727 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long t" | ||
728 | .Xc | ||
729 | .It Xo | ||
730 | .Ft long | ||
731 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long t" | ||
732 | .Xc | ||
733 | .El | ||
734 | .Ss DEALING WITH CONNECTIONS | ||
735 | Here we document the various API functions which deal with the SSL/TLS | ||
736 | connection defined in the | ||
737 | .Vt SSL | ||
738 | structure. | ||
739 | .Bl -tag -width Ds | ||
740 | .It Xo | ||
741 | .Ft int | ||
742 | .Fn SSL_accept "SSL *ssl" | ||
743 | .Xc | ||
744 | .It Xo | ||
745 | .Ft int | ||
746 | .Fn SSL_add_dir_cert_subjects_to_stack "STACK *stack" "const char *dir" | ||
747 | .Xc | ||
748 | .It Xo | ||
749 | .Ft int | ||
750 | .Fn SSL_add_file_cert_subjects_to_stack "STACK *stack" "const char *file" | ||
751 | .Xc | ||
752 | .It Xo | ||
753 | .Ft int | ||
754 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *x" | ||
755 | .Xc | ||
756 | .It Xo | ||
757 | .Ft char * | ||
758 | .Fn SSL_alert_desc_string "int value" | ||
759 | .Xc | ||
760 | .It Xo | ||
761 | .Ft char * | ||
762 | .Fn SSL_alert_desc_string_long "int value" | ||
763 | .Xc | ||
764 | .It Xo | ||
765 | .Ft char * | ||
766 | .Fn SSL_alert_type_string "int value" | ||
767 | .Xc | ||
768 | .It Xo | ||
769 | .Ft char * | ||
770 | .Fn SSL_alert_type_string_long "int value" | ||
771 | .Xc | ||
772 | .It Xo | ||
773 | .Ft int | ||
774 | .Fn SSL_check_private_key "const SSL *ssl" | ||
775 | .Xc | ||
776 | .It Xo | ||
777 | .Ft void | ||
778 | .Fn SSL_clear "SSL *ssl" | ||
779 | .Xc | ||
780 | .It Xo | ||
781 | .Ft long | ||
782 | .Fn SSL_clear_num_renegotiations "SSL *ssl" | ||
783 | .Xc | ||
784 | .It Xo | ||
785 | .Ft int | ||
786 | .Fn SSL_connect "SSL *ssl" | ||
787 | .Xc | ||
788 | .It Xo | ||
789 | .Ft void | ||
790 | .Fn SSL_copy_session_id "SSL *t" "const SSL *f" | ||
791 | .Xc | ||
792 | .It Xo | ||
793 | .Ft long | ||
794 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "char *parg" | ||
795 | .Xc | ||
796 | .It Xo | ||
797 | .Ft int | ||
798 | .Fn SSL_do_handshake "SSL *ssl" | ||
799 | .Xc | ||
800 | .It Xo | ||
801 | .Ft SSL * | ||
802 | .Fn SSL_dup "SSL *ssl" | ||
803 | .Xc | ||
804 | .It Xo | ||
805 | .Ft STACK * | ||
806 | .Fn SSL_dup_CA_list "STACK *sk" | ||
807 | .Xc | ||
808 | .It Xo | ||
809 | .Ft void | ||
810 | .Fn SSL_free "SSL *ssl" | ||
811 | .Xc | ||
812 | .It Xo | ||
813 | .Ft SSL_CTX * | ||
814 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
815 | .Xc | ||
816 | .It Xo | ||
817 | .Ft char * | ||
818 | .Fn SSL_get_app_data "SSL *ssl" | ||
819 | .Xc | ||
820 | .It Xo | ||
821 | .Ft X509 * | ||
822 | .Fn SSL_get_certificate "const SSL *ssl" | ||
823 | .Xc | ||
824 | .It Xo | ||
825 | .Ft const char * | ||
826 | .Fn SSL_get_cipher "const SSL *ssl" | ||
827 | .Xc | ||
828 | .It Xo | ||
829 | .Ft int | ||
830 | .Fn SSL_get_cipher_bits "const SSL *ssl" "int *alg_bits" | ||
831 | .Xc | ||
832 | .It Xo | ||
833 | .Ft char * | ||
834 | .Fn SSL_get_cipher_list "const SSL *ssl" "int n" | ||
835 | .Xc | ||
836 | .It Xo | ||
837 | .Ft char * | ||
838 | .Fn SSL_get_cipher_name "const SSL *ssl" | ||
839 | .Xc | ||
840 | .It Xo | ||
841 | .Ft char * | ||
842 | .Fn SSL_get_cipher_version "const SSL *ssl" | ||
843 | .Xc | ||
844 | .It Xo | ||
845 | .Ft STACK * | ||
846 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
847 | .Xc | ||
848 | .It Xo | ||
849 | .Ft STACK * | ||
850 | .Fn SSL_get_client_CA_list "const SSL *ssl" | ||
851 | .Xc | ||
852 | .It Xo | ||
853 | .Ft SSL_CIPHER * | ||
854 | .Fn SSL_get_current_cipher "SSL *ssl" | ||
855 | .Xc | ||
856 | .It Xo | ||
857 | .Ft long | ||
858 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
859 | .Xc | ||
860 | .It Xo | ||
861 | .Ft int | ||
862 | .Fn SSL_get_error "const SSL *ssl" "int i" | ||
863 | .Xc | ||
864 | .It Xo | ||
865 | .Ft char * | ||
866 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
867 | .Xc | ||
868 | .It Xo | ||
869 | .Ft int | ||
870 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
871 | .Xc | ||
872 | .It Xo | ||
873 | .Ft int | ||
874 | .Fo SSL_get_ex_new_index | ||
875 | .Fa "long argl" | ||
876 | .Fa "char *argp" | ||
877 | .Fa "int (*new_func)(void)" | ||
878 | .Fa "int (*dup_func)(void)" | ||
879 | .Fa "void (*free_func)(void)" | ||
880 | .Fc | ||
881 | .Xc | ||
882 | .It Xo | ||
883 | .Ft int | ||
884 | .Fn SSL_get_fd "const SSL *ssl" | ||
885 | .Xc | ||
886 | .It Xo | ||
887 | .Ft void | ||
888 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
889 | .Xc | ||
890 | .It Xo | ||
891 | .Ft STACK * | ||
892 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
893 | .Xc | ||
894 | .It Xo | ||
895 | .Ft X509 * | ||
896 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
897 | .Xc | ||
898 | .It Xo | ||
899 | .Ft EVP_PKEY * | ||
900 | .Fn SSL_get_privatekey "SSL *ssl" | ||
901 | .Xc | ||
902 | .It Xo | ||
903 | .Ft int | ||
904 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
905 | .Xc | ||
906 | .It Xo | ||
907 | .Ft BIO * | ||
908 | .Fn SSL_get_rbio "const SSL *ssl" | ||
909 | .Xc | ||
910 | .It Xo | ||
911 | .Ft int | ||
912 | .Fn SSL_get_read_ahead "const SSL *ssl" | ||
913 | .Xc | ||
914 | .It Xo | ||
915 | .Ft SSL_SESSION * | ||
916 | .Fn SSL_get_session "const SSL *ssl" | ||
917 | .Xc | ||
918 | .It Xo | ||
919 | .Ft char * | ||
920 | .Fn SSL_get_shared_ciphers "const SSL *ssl" "char *buf" "int len" | ||
921 | .Xc | ||
922 | .It Xo | ||
923 | .Ft int | ||
924 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
925 | .Xc | ||
926 | .It Xo | ||
927 | .Ft const SSL_METHOD * | ||
928 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
929 | .Xc | ||
930 | .It Xo | ||
931 | .Ft int | ||
932 | .Fn SSL_get_state "const SSL *ssl" | ||
933 | .Xc | ||
934 | .It Xo | ||
935 | .Ft long | ||
936 | .Fn SSL_get_time "const SSL *ssl" | ||
937 | .Xc | ||
938 | .It Xo | ||
939 | .Ft long | ||
940 | .Fn SSL_get_timeout "const SSL *ssl" | ||
941 | .Xc | ||
942 | .It Xo | ||
943 | .Ft int | ||
944 | .Fn "(*SSL_get_verify_callback(const SSL *ssl))" int "X509_STORE_CTX *" | ||
945 | .Xc | ||
946 | .It Xo | ||
947 | .Ft int | ||
948 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
949 | .Xc | ||
950 | .It Xo | ||
951 | .Ft long | ||
952 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
953 | .Xc | ||
954 | .It Xo | ||
955 | .Ft char * | ||
956 | .Fn SSL_get_version "const SSL *ssl" | ||
957 | .Xc | ||
958 | .It Xo | ||
959 | .Ft BIO * | ||
960 | .Fn SSL_get_wbio "const SSL *ssl" | ||
961 | .Xc | ||
962 | .It Xo | ||
963 | .Ft int | ||
964 | .Fn SSL_in_accept_init "SSL *ssl" | ||
965 | .Xc | ||
966 | .It Xo | ||
967 | .Ft int | ||
968 | .Fn SSL_in_before "SSL *ssl" | ||
969 | .Xc | ||
970 | .It Xo | ||
971 | .Ft int | ||
972 | .Fn SSL_in_connect_init "SSL *ssl" | ||
973 | .Xc | ||
974 | .It Xo | ||
975 | .Ft int | ||
976 | .Fn SSL_in_init "SSL *ssl" | ||
977 | .Xc | ||
978 | .It Xo | ||
979 | .Ft int | ||
980 | .Fn SSL_is_init_finished "SSL *ssl" | ||
981 | .Xc | ||
982 | .It Xo | ||
983 | .Ft STACK * | ||
984 | .Fn SSL_load_client_CA_file "char *file" | ||
985 | .Xc | ||
986 | .It Xo | ||
987 | .Ft void | ||
988 | .Fn SSL_load_error_strings "void" | ||
989 | .Xc | ||
990 | .It Xo | ||
991 | .Ft SSL * | ||
992 | .Fn SSL_new "SSL_CTX *ctx" | ||
993 | .Xc | ||
994 | .It Xo | ||
995 | .Ft long | ||
996 | .Fn SSL_num_renegotiations "SSL *ssl" | ||
997 | .Xc | ||
998 | .It Xo | ||
999 | .Ft int | ||
1000 | .Fn SSL_peek "SSL *ssl" "void *buf" "int num" | ||
1001 | .Xc | ||
1002 | .It Xo | ||
1003 | .Ft int | ||
1004 | .Fn SSL_pending "const SSL *ssl" | ||
1005 | .Xc | ||
1006 | .It Xo | ||
1007 | .Ft int | ||
1008 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
1009 | .Xc | ||
1010 | .It Xo | ||
1011 | .Ft int | ||
1012 | .Fn SSL_renegotiate "SSL *ssl" | ||
1013 | .Xc | ||
1014 | .It Xo | ||
1015 | .Ft char * | ||
1016 | .Fn SSL_rstate_string "SSL *ssl" | ||
1017 | .Xc | ||
1018 | .It Xo | ||
1019 | .Ft char * | ||
1020 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
1021 | .Xc | ||
1022 | .It Xo | ||
1023 | .Ft long | ||
1024 | .Fn SSL_session_reused "SSL *ssl" | ||
1025 | .Xc | ||
1026 | .It Xo | ||
1027 | .Ft void | ||
1028 | .Fn SSL_set_accept_state "SSL *ssl" | ||
1029 | .Xc | ||
1030 | .It Xo | ||
1031 | .Ft void | ||
1032 | .Fn SSL_set_app_data "SSL *ssl" "char *arg" | ||
1033 | .Xc | ||
1034 | .It Xo | ||
1035 | .Ft void | ||
1036 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
1037 | .Xc | ||
1038 | .It Xo | ||
1039 | .Ft int | ||
1040 | .Fn SSL_set_cipher_list "SSL *ssl" "char *str" | ||
1041 | .Xc | ||
1042 | .It Xo | ||
1043 | .Ft void | ||
1044 | .Fn SSL_set_client_CA_list "SSL *ssl" "STACK *list" | ||
1045 | .Xc | ||
1046 | .It Xo | ||
1047 | .Ft void | ||
1048 | .Fn SSL_set_connect_state "SSL *ssl" | ||
1049 | .Xc | ||
1050 | .It Xo | ||
1051 | .Ft int | ||
1052 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "char *arg" | ||
1053 | .Xc | ||
1054 | .It Xo | ||
1055 | .Ft int | ||
1056 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
1057 | .Xc | ||
1058 | .It Xo | ||
1059 | .Ft void | ||
1060 | .Fn SSL_set_info_callback "SSL *ssl" "void (*cb)(void)" | ||
1061 | .Xc | ||
1062 | .It Xo | ||
1063 | .Ft void | ||
1064 | .Fo SSL_set_msg_callback | ||
1065 | .Fa "SSL *ctx" | ||
1066 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
1067 | size_t len, SSL *ssl, void *arg)" | ||
1068 | .Fc | ||
1069 | .Xc | ||
1070 | .It Xo | ||
1071 | .Ft void | ||
1072 | .Fn SSL_set_msg_callback_arg "SSL *ctx" "void *arg" | ||
1073 | .Xc | ||
1074 | .It Xo | ||
1075 | .Ft void | ||
1076 | .Fn SSL_set_options "SSL *ssl" "unsigned long op" | ||
1077 | .Xc | ||
1078 | .It Xo | ||
1079 | .Ft void | ||
1080 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
1081 | .Xc | ||
1082 | .It Xo | ||
1083 | .Ft void | ||
1084 | .Fn SSL_set_read_ahead "SSL *ssl" "int yes" | ||
1085 | .Xc | ||
1086 | .It Xo | ||
1087 | .Ft int | ||
1088 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
1089 | .Xc | ||
1090 | .It Xo | ||
1091 | .Ft int | ||
1092 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
1093 | .Xc | ||
1094 | .It Xo | ||
1095 | .Ft void | ||
1096 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
1097 | .Xc | ||
1098 | .It Xo | ||
1099 | .Ft int | ||
1100 | .Fn SSL_set_ssl_method "SSL *ssl" "const SSL_METHOD *meth" | ||
1101 | .Xc | ||
1102 | .It Xo | ||
1103 | .Ft void | ||
1104 | .Fn SSL_set_time "SSL *ssl" "long t" | ||
1105 | .Xc | ||
1106 | .It Xo | ||
1107 | .Ft void | ||
1108 | .Fn SSL_set_timeout "SSL *ssl" "long t" | ||
1109 | .Xc | ||
1110 | .It Xo | ||
1111 | .Ft void | ||
1112 | .Fn SSL_set_verify "SSL *ssl" "int mode" "int (*callback)(void)" | ||
1113 | .Xc | ||
1114 | .It Xo | ||
1115 | .Ft void | ||
1116 | .Fn SSL_set_verify_result "SSL *ssl" "long arg" | ||
1117 | .Xc | ||
1118 | .It Xo | ||
1119 | .Ft int | ||
1120 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
1121 | .Xc | ||
1122 | .It Xo | ||
1123 | .Ft int | ||
1124 | .Fn SSL_shutdown "SSL *ssl" | ||
1125 | .Xc | ||
1126 | .It Xo | ||
1127 | .Ft int | ||
1128 | .Fn SSL_state "const SSL *ssl" | ||
1129 | .Xc | ||
1130 | .It Xo | ||
1131 | .Ft char * | ||
1132 | .Fn SSL_state_string "const SSL *ssl" | ||
1133 | .Xc | ||
1134 | .It Xo | ||
1135 | .Ft char * | ||
1136 | .Fn SSL_state_string_long "const SSL *ssl" | ||
1137 | .Xc | ||
1138 | .It Xo | ||
1139 | .Ft long | ||
1140 | .Fn SSL_total_renegotiations "SSL *ssl" | ||
1141 | .Xc | ||
1142 | .It Xo | ||
1143 | .Ft int | ||
1144 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
1145 | .Xc | ||
1146 | .It Xo | ||
1147 | .Ft int | ||
1148 | .Fn SSL_use_PrivateKey_ASN1 "int type" "SSL *ssl" "unsigned char *d" "long len" | ||
1149 | .Xc | ||
1150 | .It Xo | ||
1151 | .Ft int | ||
1152 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "char *file" "int type" | ||
1153 | .Xc | ||
1154 | .It Xo | ||
1155 | .Ft int | ||
1156 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
1157 | .Xc | ||
1158 | .It Xo | ||
1159 | .Ft int | ||
1160 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
1161 | .Xc | ||
1162 | .It Xo | ||
1163 | .Ft int | ||
1164 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "char *file" "int type" | ||
1165 | .Xc | ||
1166 | .It Xo | ||
1167 | .Ft int | ||
1168 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
1169 | .Xc | ||
1170 | .It Xo | ||
1171 | .Ft int | ||
1172 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "int len" "unsigned char *d" | ||
1173 | .Xc | ||
1174 | .It Xo | ||
1175 | .Ft int | ||
1176 | .Fn SSL_use_certificate_file "SSL *ssl" "char *file" "int type" | ||
1177 | .Xc | ||
1178 | .It Xo | ||
1179 | .Ft int | ||
1180 | .Fn SSL_version "const SSL *ssl" | ||
1181 | .Xc | ||
1182 | .It Xo | ||
1183 | .Ft int | ||
1184 | .Fn SSL_want "const SSL *ssl" | ||
1185 | .Xc | ||
1186 | .It Xo | ||
1187 | .Ft int | ||
1188 | .Fn SSL_want_nothing "const SSL *ssl" | ||
1189 | .Xc | ||
1190 | .It Xo | ||
1191 | .Ft int | ||
1192 | .Fn SSL_want_read "const SSL *ssl" | ||
1193 | .Xc | ||
1194 | .It Xo | ||
1195 | .Ft int | ||
1196 | .Fn SSL_want_write "const SSL *ssl" | ||
1197 | .Xc | ||
1198 | .It Xo | ||
1199 | .Ft int | ||
1200 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
1201 | .Xc | ||
1202 | .It Xo | ||
1203 | .Ft int | ||
1204 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
1205 | .Xc | ||
1206 | .It Xo | ||
1207 | .Ft void | ||
1208 | .Fo SSL_set_psk_client_callback | ||
1209 | .Fa "SSL *ssl" | ||
1210 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
1211 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
1212 | .Fc | ||
1213 | .Xc | ||
1214 | .It Xo | ||
1215 | .Ft int | ||
1216 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
1217 | .Xc | ||
1218 | .It Xo | ||
1219 | .Ft void | ||
1220 | .Fo SSL_set_psk_server_callback | ||
1221 | .Fa "SSL *ssl" | ||
1222 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
1223 | unsigned char *psk, int max_psk_len)" | ||
1224 | .Fc | ||
1225 | .Xc | ||
1226 | .It Xo | ||
1227 | .Ft const char * | ||
1228 | .Fn SSL_get_psk_identity_hint "SSL *ssl" | ||
1229 | .Xc | ||
1230 | .It Xo | ||
1231 | .Ft const char * | ||
1232 | .Fn SSL_get_psk_identity "SSL *ssl" | ||
1233 | .Xc | ||
1234 | .El | ||
1235 | .Sh SEE ALSO | ||
1236 | .Xr openssl 1 , | ||
1237 | .Xr crypto 3 , | ||
1238 | .Xr d2i_SSL_SESSION 3 , | ||
1239 | .Xr SSL_accept 3 , | ||
1240 | .Xr SSL_alert_type_string 3 , | ||
1241 | .Xr SSL_CIPHER_get_name 3 , | ||
1242 | .Xr SSL_clear 3 , | ||
1243 | .Xr SSL_COMP_add_compression_method 3 , | ||
1244 | .Xr SSL_connect 3 , | ||
1245 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
1246 | .Xr SSL_CTX_add_session 3 , | ||
1247 | .Xr SSL_CTX_ctrl 3 , | ||
1248 | .Xr SSL_CTX_flush_sessions 3 , | ||
1249 | .Xr SSL_CTX_get_ex_new_index 3 , | ||
1250 | .Xr SSL_CTX_get_verify_mode 3 , | ||
1251 | .Xr SSL_CTX_load_verify_locations 3 , | ||
1252 | .Xr SSL_CTX_new 3 , | ||
1253 | .Xr SSL_CTX_sess_number 3 , | ||
1254 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
1255 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
1256 | .Xr SSL_CTX_sessions 3 , | ||
1257 | .Xr SSL_CTX_set_cert_store 3 , | ||
1258 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
1259 | .Xr SSL_CTX_set_cipher_list 3 , | ||
1260 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
1261 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
1262 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
1263 | .Xr SSL_CTX_set_generate_session_id 3 , | ||
1264 | .Xr SSL_CTX_set_info_callback 3 , | ||
1265 | .Xr SSL_CTX_set_max_cert_list 3 , | ||
1266 | .Xr SSL_CTX_set_mode 3 , | ||
1267 | .Xr SSL_CTX_set_msg_callback 3 , | ||
1268 | .Xr SSL_CTX_set_options 3 , | ||
1269 | .Xr SSL_CTX_set_psk_client_callback 3 , | ||
1270 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
1271 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
1272 | .Xr SSL_CTX_set_session_id_context 3 , | ||
1273 | .Xr SSL_CTX_set_ssl_version 3 , | ||
1274 | .Xr SSL_CTX_set_timeout 3 , | ||
1275 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
1276 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
1277 | .Xr SSL_CTX_set_verify 3 , | ||
1278 | .Xr SSL_CTX_use_certificate 3 , | ||
1279 | .Xr SSL_CTX_use_psk_identity_hint 3 , | ||
1280 | .Xr SSL_do_handshake 3 , | ||
1281 | .Xr SSL_get_ciphers 3 , | ||
1282 | .Xr SSL_get_client_CA_list 3 , | ||
1283 | .Xr SSL_get_default_timeout 3 , | ||
1284 | .Xr SSL_get_error 3 , | ||
1285 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
1286 | .Xr SSL_get_ex_new_index 3 , | ||
1287 | .Xr SSL_get_fd 3 , | ||
1288 | .Xr SSL_get_peer_cert_chain 3 , | ||
1289 | .Xr SSL_get_psk_identity 3 , | ||
1290 | .Xr SSL_get_rbio 3 , | ||
1291 | .Xr SSL_get_session 3 , | ||
1292 | .Xr SSL_get_SSL_CTX 3 , | ||
1293 | .Xr SSL_get_verify_result 3 , | ||
1294 | .Xr SSL_get_version 3 , | ||
1295 | .Xr SSL_library_init 3 , | ||
1296 | .Xr SSL_load_client_CA_file 3 , | ||
1297 | .Xr SSL_new 3 , | ||
1298 | .Xr SSL_pending 3 , | ||
1299 | .Xr SSL_read 3 , | ||
1300 | .Xr SSL_rstate_string 3 , | ||
1301 | .Xr SSL_SESSION_free 3 , | ||
1302 | .Xr SSL_SESSION_get_ex_new_index 3 , | ||
1303 | .Xr SSL_SESSION_get_time 3 , | ||
1304 | .Xr SSL_session_reused 3 , | ||
1305 | .Xr SSL_set_bio 3 , | ||
1306 | .Xr SSL_set_connect_state 3 , | ||
1307 | .Xr SSL_set_fd 3 , | ||
1308 | .Xr SSL_set_session 3 , | ||
1309 | .Xr SSL_set_shutdown 3 , | ||
1310 | .Xr SSL_shutdown 3 , | ||
1311 | .Xr SSL_state_string 3 , | ||
1312 | .Xr SSL_want 3 , | ||
1313 | .Xr SSL_write 3 | ||
1314 | .Sh HISTORY | ||
1315 | The | ||
1316 | .Xr ssl 3 | ||
1317 | document appeared in OpenSSL 0.9.2. | ||
diff --git a/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 b/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 new file mode 100644 index 0000000000..31c9963edb --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/BIO_f_ssl.3 | |||
@@ -0,0 +1,475 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt BIO_F_SSL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm BIO_f_ssl , | ||
6 | .Nm BIO_set_ssl , | ||
7 | .Nm BIO_get_ssl , | ||
8 | .Nm BIO_set_ssl_mode , | ||
9 | .Nm BIO_set_ssl_renegotiate_bytes , | ||
10 | .Nm BIO_get_num_renegotiates , | ||
11 | .Nm BIO_set_ssl_renegotiate_timeout , | ||
12 | .Nm BIO_new_ssl , | ||
13 | .Nm BIO_new_ssl_connect , | ||
14 | .Nm BIO_new_buffer_ssl_connect , | ||
15 | .Nm BIO_ssl_copy_session_id , | ||
16 | .Nm BIO_ssl_shutdown | ||
17 | .Nd SSL BIO | ||
18 | .Sh SYNOPSIS | ||
19 | .In openssl/bio.h | ||
20 | .In openssl/ssl.h | ||
21 | .Ft BIO_METHOD * | ||
22 | .Fn BIO_f_ssl void | ||
23 | .Fd #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) | ||
24 | .Fd #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) | ||
25 | .Fd #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) | ||
26 | .Fd #define BIO_set_ssl_renegotiate_bytes(b,num) \ | ||
27 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) | ||
28 | .Fd #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ | ||
29 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) | ||
30 | .Fd #define BIO_get_num_renegotiates(b) \ | ||
31 | BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL) | ||
32 | .Ft BIO * | ||
33 | .Fn BIO_new_ssl "SSL_CTX *ctx" "int client" | ||
34 | .Ft BIO * | ||
35 | .Fn BIO_new_ssl_connect "SSL_CTX *ctx" | ||
36 | .Ft BIO * | ||
37 | .Fn BIO_new_buffer_ssl_connect "SSL_CTX *ctx" | ||
38 | .Ft int | ||
39 | .Fn BIO_ssl_copy_session_id "BIO *to" "BIO *from" | ||
40 | .Ft void | ||
41 | .Fn BIO_ssl_shutdown "BIO *bio" | ||
42 | .Fd #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | ||
43 | .Sh DESCRIPTION | ||
44 | .Fn BIO_f_ssl | ||
45 | returns the | ||
46 | .Vt SSL | ||
47 | .Vt BIO | ||
48 | method. | ||
49 | This is a filter | ||
50 | .Vt BIO | ||
51 | which is a wrapper around the OpenSSL | ||
52 | .Vt SSL | ||
53 | routines adding a | ||
54 | .Vt BIO | ||
55 | .Dq flavor | ||
56 | to SSL I/O. | ||
57 | .Pp | ||
58 | I/O performed on an | ||
59 | .Vt SSL | ||
60 | .Vt BIO | ||
61 | communicates using the SSL protocol with | ||
62 | the | ||
63 | .Vt SSL Ns 's | ||
64 | read and write | ||
65 | .Vt BIO Ns s. | ||
66 | If an SSL connection is not established then an attempt is made to establish | ||
67 | one on the first I/O call. | ||
68 | .Pp | ||
69 | If a | ||
70 | .Vt BIO | ||
71 | is appended to an | ||
72 | .Vt SSL | ||
73 | .Vt BIO | ||
74 | using | ||
75 | .Xr BIO_push 3 | ||
76 | it is automatically used as the | ||
77 | .Vt SSL | ||
78 | .Vt BIO Ns 's read and write | ||
79 | .Vt BIO Ns s. | ||
80 | .Pp | ||
81 | Calling | ||
82 | .Xr BIO_reset 3 | ||
83 | on an | ||
84 | .Vt SSL | ||
85 | .Vt BIO | ||
86 | closes down any current SSL connection by calling | ||
87 | .Xr SSL_shutdown 3 . | ||
88 | .Xr BIO_reset | ||
89 | is then sent to the next | ||
90 | .Vt BIO | ||
91 | in the chain; this will typically disconnect the underlying transport. | ||
92 | The | ||
93 | .Vt SSL | ||
94 | .Vt BIO | ||
95 | is then reset to the initial accept or connect state. | ||
96 | .Pp | ||
97 | If the close flag is set when an | ||
98 | .Vt SSL | ||
99 | .Vt BIO | ||
100 | is freed then the internal | ||
101 | .Vt SSL | ||
102 | structure is also freed using | ||
103 | .Xr SSL_free 3 . | ||
104 | .Pp | ||
105 | .Fn BIO_set_ssl | ||
106 | sets the internal | ||
107 | .Vt SSL | ||
108 | pointer of | ||
109 | .Vt BIO | ||
110 | .Fa b | ||
111 | to | ||
112 | .Fa ssl | ||
113 | using | ||
114 | the close flag | ||
115 | .Fa c . | ||
116 | .Pp | ||
117 | .Fn BIO_get_ssl | ||
118 | retrieves the | ||
119 | .Vt SSL | ||
120 | pointer of | ||
121 | .Vt BIO | ||
122 | .Fa b ; | ||
123 | it can then be manipulated using the standard SSL library functions. | ||
124 | .Pp | ||
125 | .Fn BIO_set_ssl_mode | ||
126 | sets the | ||
127 | .Vt SSL | ||
128 | .Vt BIO | ||
129 | mode to | ||
130 | .Fa client . | ||
131 | If | ||
132 | .Fa client | ||
133 | is 1, client mode is set. | ||
134 | If | ||
135 | .Fa client | ||
136 | is 0, server mode is set. | ||
137 | .Pp | ||
138 | .Fn BIO_set_ssl_renegotiate_bytes | ||
139 | sets the renegotiate byte count to | ||
140 | .Fa num . | ||
141 | When set after every | ||
142 | .Fa num | ||
143 | bytes of I/O (read and write) the SSL session is automatically renegotiated. | ||
144 | .Fa num | ||
145 | must be at least 512 bytes. | ||
146 | .Pp | ||
147 | .Fn BIO_set_ssl_renegotiate_timeout | ||
148 | sets the renegotiate timeout to | ||
149 | .Fa seconds . | ||
150 | When the renegotiate timeout elapses the session is automatically renegotiated. | ||
151 | .Pp | ||
152 | .Fn BIO_get_num_renegotiates | ||
153 | returns the total number of session renegotiations due to I/O or timeout. | ||
154 | .Pp | ||
155 | .Fn BIO_new_ssl | ||
156 | allocates an | ||
157 | .Vt SSL | ||
158 | .Vt BIO | ||
159 | using | ||
160 | .Vt SSL_CTX | ||
161 | .Va ctx | ||
162 | and using client mode if | ||
163 | .Fa client | ||
164 | is nonzero. | ||
165 | .Pp | ||
166 | .Fn BIO_new_ssl_connect | ||
167 | creates a new | ||
168 | .Vt BIO | ||
169 | chain consisting of an | ||
170 | .Vt SSL | ||
171 | .Vt BIO | ||
172 | (using | ||
173 | .Fa ctx ) | ||
174 | followed by a connect BIO. | ||
175 | .Pp | ||
176 | .Fn BIO_new_buffer_ssl_connect | ||
177 | creates a new | ||
178 | .Vt BIO | ||
179 | chain consisting of a buffering | ||
180 | .Vt BIO , | ||
181 | an | ||
182 | .Vt SSL | ||
183 | .Vt BIO | ||
184 | (using | ||
185 | .Fa ctx ) | ||
186 | and a connect | ||
187 | .Vt BIO . | ||
188 | .Pp | ||
189 | .Fn BIO_ssl_copy_session_id | ||
190 | copies an SSL session id between | ||
191 | .Vt BIO | ||
192 | chains | ||
193 | .Fa from | ||
194 | and | ||
195 | .Fa to . | ||
196 | It does this by locating the | ||
197 | .Vt SSL | ||
198 | .Vt BIO Ns s | ||
199 | in each chain and calling | ||
200 | .Xr SSL_copy_session_id 3 | ||
201 | on the internal | ||
202 | .Vt SSL | ||
203 | pointer. | ||
204 | .Pp | ||
205 | .Fn BIO_ssl_shutdown | ||
206 | closes down an SSL connection on | ||
207 | .Vt BIO | ||
208 | chain | ||
209 | .Fa bio . | ||
210 | It does this by locating the | ||
211 | .Vt SSL | ||
212 | .Vt BIO | ||
213 | in the | ||
214 | chain and calling | ||
215 | .Xr SSL_shutdown 3 | ||
216 | on its internal | ||
217 | .Vt SSL | ||
218 | pointer. | ||
219 | .Pp | ||
220 | .Fn BIO_do_handshake | ||
221 | attempts to complete an SSL handshake on the supplied | ||
222 | .Vt BIO | ||
223 | and establish the SSL connection. | ||
224 | It returns 1 if the connection was established successfully. | ||
225 | A zero or negative value is returned if the connection could not be | ||
226 | established; the call | ||
227 | .Xr BIO_should_retry 3 | ||
228 | should be used for non blocking connect | ||
229 | .Vt BIO Ns s | ||
230 | to determine if the call should be retried. | ||
231 | If an SSL connection has already been established this call has no effect. | ||
232 | .Sh NOTES | ||
233 | .Vt SSL | ||
234 | .Vt BIO Ns s | ||
235 | are exceptional in that if the underlying transport is non-blocking they can | ||
236 | still request a retry in exceptional circumstances. | ||
237 | Specifically this will happen if a session renegotiation takes place during a | ||
238 | .Xr BIO_read 3 | ||
239 | operation. | ||
240 | One case where this happens is when SGC or step up occurs. | ||
241 | .Pp | ||
242 | In OpenSSL 0.9.6 and later the SSL flag | ||
243 | .Dv SSL_AUTO_RETRY | ||
244 | can be set to disable this behaviour. | ||
245 | In other words, when this flag is set an | ||
246 | .Vt SSL | ||
247 | .Vt BIO | ||
248 | using a blocking transport will never request a retry. | ||
249 | .Pp | ||
250 | Since unknown | ||
251 | .Xr BIO_ctrl 3 | ||
252 | operations are sent through filter | ||
253 | .Vt BIO Ns s | ||
254 | the server name and port can be set using | ||
255 | .Xr BIO_set_host 3 | ||
256 | on the | ||
257 | .Vt BIO | ||
258 | returned by | ||
259 | .Fn BIO_new_ssl_connect | ||
260 | without having to locate the connect | ||
261 | .Vt BIO | ||
262 | first. | ||
263 | .Pp | ||
264 | Applications do not have to call | ||
265 | .Fn BIO_do_handshake | ||
266 | but may wish to do so to separate the handshake process from other I/O | ||
267 | processing. | ||
268 | .Sh RETURN VALUES | ||
269 | .\" XXX | ||
270 | This section is incomplete. | ||
271 | .Sh EXAMPLE | ||
272 | This SSL/TLS client example attempts to retrieve a page from an SSL/TLS web | ||
273 | server. | ||
274 | The I/O routines are identical to those of the unencrypted example in | ||
275 | .Xr BIO_s_connect 3 . | ||
276 | .Bd -literal | ||
277 | BIO *sbio, *out; | ||
278 | int len; | ||
279 | char tmpbuf[1024]; | ||
280 | SSL_CTX *ctx; | ||
281 | SSL *ssl; | ||
282 | |||
283 | ERR_load_crypto_strings(); | ||
284 | ERR_load_SSL_strings(); | ||
285 | OpenSSL_add_all_algorithms(); | ||
286 | |||
287 | /* | ||
288 | * We would seed the PRNG here if the platform didn't do it automatically | ||
289 | */ | ||
290 | |||
291 | ctx = SSL_CTX_new(SSLv23_client_method()); | ||
292 | |||
293 | /* | ||
294 | * We'd normally set some stuff like the verify paths and mode here because | ||
295 | * as things stand this will connect to any server whose certificate is | ||
296 | * signed by any CA. | ||
297 | */ | ||
298 | |||
299 | sbio = BIO_new_ssl_connect(ctx); | ||
300 | |||
301 | BIO_get_ssl(sbio, &ssl); | ||
302 | |||
303 | if (!ssl) { | ||
304 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
305 | /* whatever ... */ | ||
306 | } | ||
307 | |||
308 | /* Don't want any retries */ | ||
309 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
310 | |||
311 | /* We might want to do other things with ssl here */ | ||
312 | |||
313 | BIO_set_conn_hostname(sbio, "localhost:https"); | ||
314 | |||
315 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
316 | if (BIO_do_connect(sbio) <= 0) { | ||
317 | fprintf(stderr, "Error connecting to server\en"); | ||
318 | ERR_print_errors_fp(stderr); | ||
319 | /* whatever ... */ | ||
320 | } | ||
321 | |||
322 | if (BIO_do_handshake(sbio) <= 0) { | ||
323 | fprintf(stderr, "Error establishing SSL connection\en"); | ||
324 | ERR_print_errors_fp(stderr); | ||
325 | /* whatever ... */ | ||
326 | } | ||
327 | |||
328 | /* Could examine ssl here to get connection info */ | ||
329 | |||
330 | BIO_puts(sbio, "GET / HTTP/1.0\en\en"); | ||
331 | for (;;) { | ||
332 | len = BIO_read(sbio, tmpbuf, 1024); | ||
333 | if(len <= 0) break; | ||
334 | BIO_write(out, tmpbuf, len); | ||
335 | } | ||
336 | BIO_free_all(sbio); | ||
337 | BIO_free(out); | ||
338 | .Ed | ||
339 | .Pp | ||
340 | Here is a simple server example. | ||
341 | It makes use of a buffering | ||
342 | .Vt BIO | ||
343 | to allow lines to be read from the | ||
344 | .Vt SSL | ||
345 | .Vt BIO | ||
346 | using | ||
347 | .Xr BIO_gets 3 . | ||
348 | It creates a pseudo web page containing the actual request from a client and | ||
349 | also echoes the request to standard output. | ||
350 | .Bd -literal | ||
351 | BIO *sbio, *bbio, *acpt, *out; | ||
352 | int len; | ||
353 | char tmpbuf[1024]; | ||
354 | SSL_CTX *ctx; | ||
355 | SSL *ssl; | ||
356 | |||
357 | ERR_load_crypto_strings(); | ||
358 | ERR_load_SSL_strings(); | ||
359 | OpenSSL_add_all_algorithms(); | ||
360 | |||
361 | /* Might seed PRNG here */ | ||
362 | |||
363 | ctx = SSL_CTX_new(SSLv23_server_method()); | ||
364 | |||
365 | if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
366 | || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
367 | || !SSL_CTX_check_private_key(ctx)) { | ||
368 | fprintf(stderr, "Error setting up SSL_CTX\en"); | ||
369 | ERR_print_errors_fp(stderr); | ||
370 | return 0; | ||
371 | } | ||
372 | |||
373 | /* | ||
374 | * Might do other things here like setting verify locations and DH and/or | ||
375 | * RSA temporary key callbacks | ||
376 | */ | ||
377 | |||
378 | /* New SSL BIO setup as server */ | ||
379 | sbio = BIO_new_ssl(ctx,0); | ||
380 | |||
381 | BIO_get_ssl(sbio, &ssl); | ||
382 | |||
383 | if (!ssl) { | ||
384 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
385 | /* whatever ... */ | ||
386 | } | ||
387 | |||
388 | /* Don't want any retries */ | ||
389 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
390 | |||
391 | /* Create the buffering BIO */ | ||
392 | |||
393 | bbio = BIO_new(BIO_f_buffer()); | ||
394 | |||
395 | /* Add to chain */ | ||
396 | sbio = BIO_push(bbio, sbio); | ||
397 | |||
398 | acpt = BIO_new_accept("4433"); | ||
399 | |||
400 | /* | ||
401 | * By doing this when a new connection is established we automatically | ||
402 | * have sbio inserted into it. The BIO chain is now 'swallowed' by the | ||
403 | * accept BIO and will be freed when the accept BIO is freed. | ||
404 | */ | ||
405 | |||
406 | BIO_set_accept_bios(acpt,sbio); | ||
407 | |||
408 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
409 | |||
410 | /* Setup accept BIO */ | ||
411 | if (BIO_do_accept(acpt) <= 0) { | ||
412 | fprintf(stderr, "Error setting up accept BIO\en"); | ||
413 | ERR_print_errors_fp(stderr); | ||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | /* Now wait for incoming connection */ | ||
418 | if (BIO_do_accept(acpt) <= 0) { | ||
419 | fprintf(stderr, "Error in connection\en"); | ||
420 | ERR_print_errors_fp(stderr); | ||
421 | return 0; | ||
422 | } | ||
423 | |||
424 | /* We only want one connection so remove and free accept BIO */ | ||
425 | |||
426 | sbio = BIO_pop(acpt); | ||
427 | |||
428 | BIO_free_all(acpt); | ||
429 | |||
430 | if (BIO_do_handshake(sbio) <= 0) { | ||
431 | fprintf(stderr, "Error in SSL handshake\en"); | ||
432 | ERR_print_errors_fp(stderr); | ||
433 | return 0; | ||
434 | } | ||
435 | |||
436 | BIO_puts(sbio, "HTTP/1.0 200 OK\er\enContent-type: text/plain\er\en\er\en"); | ||
437 | BIO_puts(sbio, "\er\enConnection Established\er\enRequest headers:\er\en"); | ||
438 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
439 | |||
440 | for (;;) { | ||
441 | len = BIO_gets(sbio, tmpbuf, 1024); | ||
442 | if (len <= 0) | ||
443 | break; | ||
444 | BIO_write(sbio, tmpbuf, len); | ||
445 | BIO_write(out, tmpbuf, len); | ||
446 | /* Look for blank line signifying end of headers */ | ||
447 | if ((tmpbuf[0] == '\er') || (tmpbuf[0] == '\en')) | ||
448 | break; | ||
449 | } | ||
450 | |||
451 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
452 | BIO_puts(sbio, "\er\en"); | ||
453 | |||
454 | /* Since there is a buffering BIO present we had better flush it */ | ||
455 | BIO_flush(sbio); | ||
456 | |||
457 | BIO_free_all(sbio); | ||
458 | .Ed | ||
459 | .Sh BUGS | ||
460 | In OpenSSL versions before 1.0.0 the | ||
461 | .Xr BIO_pop 3 | ||
462 | call was handled incorrectly: | ||
463 | the I/O BIO reference count was incorrectly incremented (instead of | ||
464 | decremented) and dissociated with the | ||
465 | .Vt SSL | ||
466 | .Vt BIO | ||
467 | even if the | ||
468 | .Vt SSL | ||
469 | .Vt BIO | ||
470 | was not | ||
471 | explicitly being popped (e.g., a pop higher up the chain). | ||
472 | Applications which included workarounds for this bug (e.g., freeing BIOs more | ||
473 | than once) should be modified to handle this fix or they may free up an already | ||
474 | freed | ||
475 | .Vt BIO . | ||
diff --git a/src/lib/libssl/src/doc/ssl/BIO_f_ssl.pod b/src/lib/libssl/src/doc/ssl/BIO_f_ssl.pod deleted file mode 100644 index dfd7833b13..0000000000 --- a/src/lib/libssl/src/doc/ssl/BIO_f_ssl.pod +++ /dev/null | |||
@@ -1,322 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | BIO_f_ssl, BIO_set_ssl, BIO_get_ssl, BIO_set_ssl_mode, | ||
6 | BIO_set_ssl_renegotiate_bytes, BIO_get_num_renegotiates, | ||
7 | BIO_set_ssl_renegotiate_timeout, BIO_new_ssl, BIO_new_ssl_connect, | ||
8 | BIO_new_buffer_ssl_connect, BIO_ssl_copy_session_id, BIO_ssl_shutdown - SSL BIO | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/bio.h> | ||
13 | #include <openssl/ssl.h> | ||
14 | |||
15 | BIO_METHOD *BIO_f_ssl(void); | ||
16 | |||
17 | #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) | ||
18 | #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) | ||
19 | #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) | ||
20 | #define BIO_set_ssl_renegotiate_bytes(b,num) \ | ||
21 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL); | ||
22 | #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ | ||
23 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL); | ||
24 | #define BIO_get_num_renegotiates(b) \ | ||
25 | BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL); | ||
26 | |||
27 | BIO *BIO_new_ssl(SSL_CTX *ctx,int client); | ||
28 | BIO *BIO_new_ssl_connect(SSL_CTX *ctx); | ||
29 | BIO *BIO_new_buffer_ssl_connect(SSL_CTX *ctx); | ||
30 | int BIO_ssl_copy_session_id(BIO *to,BIO *from); | ||
31 | void BIO_ssl_shutdown(BIO *bio); | ||
32 | |||
33 | #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | ||
34 | |||
35 | =head1 DESCRIPTION | ||
36 | |||
37 | BIO_f_ssl() returns the SSL BIO method. This is a filter BIO which | ||
38 | is a wrapper round the OpenSSL SSL routines adding a BIO "flavour" to | ||
39 | SSL I/O. | ||
40 | |||
41 | I/O performed on an SSL BIO communicates using the SSL protocol with | ||
42 | the SSLs read and write BIOs. If an SSL connection is not established | ||
43 | then an attempt is made to establish one on the first I/O call. | ||
44 | |||
45 | If a BIO is appended to an SSL BIO using BIO_push() it is automatically | ||
46 | used as the SSL BIOs read and write BIOs. | ||
47 | |||
48 | Calling BIO_reset() on an SSL BIO closes down any current SSL connection | ||
49 | by calling SSL_shutdown(). BIO_reset() is then sent to the next BIO in | ||
50 | the chain: this will typically disconnect the underlying transport. | ||
51 | The SSL BIO is then reset to the initial accept or connect state. | ||
52 | |||
53 | If the close flag is set when an SSL BIO is freed then the internal | ||
54 | SSL structure is also freed using SSL_free(). | ||
55 | |||
56 | BIO_set_ssl() sets the internal SSL pointer of BIO B<b> to B<ssl> using | ||
57 | the close flag B<c>. | ||
58 | |||
59 | BIO_get_ssl() retrieves the SSL pointer of BIO B<b>, it can then be | ||
60 | manipulated using the standard SSL library functions. | ||
61 | |||
62 | BIO_set_ssl_mode() sets the SSL BIO mode to B<client>. If B<client> | ||
63 | is 1 client mode is set. If B<client> is 0 server mode is set. | ||
64 | |||
65 | BIO_set_ssl_renegotiate_bytes() sets the renegotiate byte count | ||
66 | to B<num>. When set after every B<num> bytes of I/O (read and write) | ||
67 | the SSL session is automatically renegotiated. B<num> must be at | ||
68 | least 512 bytes. | ||
69 | |||
70 | BIO_set_ssl_renegotiate_timeout() sets the renegotiate timeout to | ||
71 | B<seconds>. When the renegotiate timeout elapses the session is | ||
72 | automatically renegotiated. | ||
73 | |||
74 | BIO_get_num_renegotiates() returns the total number of session | ||
75 | renegotiations due to I/O or timeout. | ||
76 | |||
77 | BIO_new_ssl() allocates an SSL BIO using SSL_CTX B<ctx> and using | ||
78 | client mode if B<client> is non zero. | ||
79 | |||
80 | BIO_new_ssl_connect() creates a new BIO chain consisting of an | ||
81 | SSL BIO (using B<ctx>) followed by a connect BIO. | ||
82 | |||
83 | BIO_new_buffer_ssl_connect() creates a new BIO chain consisting | ||
84 | of a buffering BIO, an SSL BIO (using B<ctx>) and a connect | ||
85 | BIO. | ||
86 | |||
87 | BIO_ssl_copy_session_id() copies an SSL session id between | ||
88 | BIO chains B<from> and B<to>. It does this by locating the | ||
89 | SSL BIOs in each chain and calling SSL_copy_session_id() on | ||
90 | the internal SSL pointer. | ||
91 | |||
92 | BIO_ssl_shutdown() closes down an SSL connection on BIO | ||
93 | chain B<bio>. It does this by locating the SSL BIO in the | ||
94 | chain and calling SSL_shutdown() on its internal SSL | ||
95 | pointer. | ||
96 | |||
97 | BIO_do_handshake() attempts to complete an SSL handshake on the | ||
98 | supplied BIO and establish the SSL connection. It returns 1 | ||
99 | if the connection was established successfully. A zero or negative | ||
100 | value is returned if the connection could not be established, the | ||
101 | call BIO_should_retry() should be used for non blocking connect BIOs | ||
102 | to determine if the call should be retried. If an SSL connection has | ||
103 | already been established this call has no effect. | ||
104 | |||
105 | =head1 NOTES | ||
106 | |||
107 | SSL BIOs are exceptional in that if the underlying transport | ||
108 | is non blocking they can still request a retry in exceptional | ||
109 | circumstances. Specifically this will happen if a session | ||
110 | renegotiation takes place during a BIO_read() operation, one | ||
111 | case where this happens is when SGC or step up occurs. | ||
112 | |||
113 | In OpenSSL 0.9.6 and later the SSL flag SSL_AUTO_RETRY can be | ||
114 | set to disable this behaviour. That is when this flag is set | ||
115 | an SSL BIO using a blocking transport will never request a | ||
116 | retry. | ||
117 | |||
118 | Since unknown BIO_ctrl() operations are sent through filter | ||
119 | BIOs the servers name and port can be set using BIO_set_host() | ||
120 | on the BIO returned by BIO_new_ssl_connect() without having | ||
121 | to locate the connect BIO first. | ||
122 | |||
123 | Applications do not have to call BIO_do_handshake() but may wish | ||
124 | to do so to separate the handshake process from other I/O | ||
125 | processing. | ||
126 | |||
127 | =head1 RETURN VALUES | ||
128 | |||
129 | TBA | ||
130 | |||
131 | =head1 EXAMPLE | ||
132 | |||
133 | This SSL/TLS client example, attempts to retrieve a page from an | ||
134 | SSL/TLS web server. The I/O routines are identical to those of the | ||
135 | unencrypted example in L<BIO_s_connect(3)|BIO_s_connect(3)>. | ||
136 | |||
137 | BIO *sbio, *out; | ||
138 | int len; | ||
139 | char tmpbuf[1024]; | ||
140 | SSL_CTX *ctx; | ||
141 | SSL *ssl; | ||
142 | |||
143 | ERR_load_crypto_strings(); | ||
144 | ERR_load_SSL_strings(); | ||
145 | OpenSSL_add_all_algorithms(); | ||
146 | |||
147 | /* We would seed the PRNG here if the platform didn't | ||
148 | * do it automatically | ||
149 | */ | ||
150 | |||
151 | ctx = SSL_CTX_new(SSLv23_client_method()); | ||
152 | |||
153 | /* We'd normally set some stuff like the verify paths and | ||
154 | * mode here because as things stand this will connect to | ||
155 | * any server whose certificate is signed by any CA. | ||
156 | */ | ||
157 | |||
158 | sbio = BIO_new_ssl_connect(ctx); | ||
159 | |||
160 | BIO_get_ssl(sbio, &ssl); | ||
161 | |||
162 | if(!ssl) { | ||
163 | fprintf(stderr, "Can't locate SSL pointer\n"); | ||
164 | /* whatever ... */ | ||
165 | } | ||
166 | |||
167 | /* Don't want any retries */ | ||
168 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
169 | |||
170 | /* We might want to do other things with ssl here */ | ||
171 | |||
172 | BIO_set_conn_hostname(sbio, "localhost:https"); | ||
173 | |||
174 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
175 | if(BIO_do_connect(sbio) <= 0) { | ||
176 | fprintf(stderr, "Error connecting to server\n"); | ||
177 | ERR_print_errors_fp(stderr); | ||
178 | /* whatever ... */ | ||
179 | } | ||
180 | |||
181 | if(BIO_do_handshake(sbio) <= 0) { | ||
182 | fprintf(stderr, "Error establishing SSL connection\n"); | ||
183 | ERR_print_errors_fp(stderr); | ||
184 | /* whatever ... */ | ||
185 | } | ||
186 | |||
187 | /* Could examine ssl here to get connection info */ | ||
188 | |||
189 | BIO_puts(sbio, "GET / HTTP/1.0\n\n"); | ||
190 | for(;;) { | ||
191 | len = BIO_read(sbio, tmpbuf, 1024); | ||
192 | if(len <= 0) break; | ||
193 | BIO_write(out, tmpbuf, len); | ||
194 | } | ||
195 | BIO_free_all(sbio); | ||
196 | BIO_free(out); | ||
197 | |||
198 | Here is a simple server example. It makes use of a buffering | ||
199 | BIO to allow lines to be read from the SSL BIO using BIO_gets. | ||
200 | It creates a pseudo web page containing the actual request from | ||
201 | a client and also echoes the request to standard output. | ||
202 | |||
203 | BIO *sbio, *bbio, *acpt, *out; | ||
204 | int len; | ||
205 | char tmpbuf[1024]; | ||
206 | SSL_CTX *ctx; | ||
207 | SSL *ssl; | ||
208 | |||
209 | ERR_load_crypto_strings(); | ||
210 | ERR_load_SSL_strings(); | ||
211 | OpenSSL_add_all_algorithms(); | ||
212 | |||
213 | /* Might seed PRNG here */ | ||
214 | |||
215 | ctx = SSL_CTX_new(SSLv23_server_method()); | ||
216 | |||
217 | if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
218 | || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
219 | || !SSL_CTX_check_private_key(ctx)) { | ||
220 | |||
221 | fprintf(stderr, "Error setting up SSL_CTX\n"); | ||
222 | ERR_print_errors_fp(stderr); | ||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /* Might do other things here like setting verify locations and | ||
227 | * DH and/or RSA temporary key callbacks | ||
228 | */ | ||
229 | |||
230 | /* New SSL BIO setup as server */ | ||
231 | sbio=BIO_new_ssl(ctx,0); | ||
232 | |||
233 | BIO_get_ssl(sbio, &ssl); | ||
234 | |||
235 | if(!ssl) { | ||
236 | fprintf(stderr, "Can't locate SSL pointer\n"); | ||
237 | /* whatever ... */ | ||
238 | } | ||
239 | |||
240 | /* Don't want any retries */ | ||
241 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
242 | |||
243 | /* Create the buffering BIO */ | ||
244 | |||
245 | bbio = BIO_new(BIO_f_buffer()); | ||
246 | |||
247 | /* Add to chain */ | ||
248 | sbio = BIO_push(bbio, sbio); | ||
249 | |||
250 | acpt=BIO_new_accept("4433"); | ||
251 | |||
252 | /* By doing this when a new connection is established | ||
253 | * we automatically have sbio inserted into it. The | ||
254 | * BIO chain is now 'swallowed' by the accept BIO and | ||
255 | * will be freed when the accept BIO is freed. | ||
256 | */ | ||
257 | |||
258 | BIO_set_accept_bios(acpt,sbio); | ||
259 | |||
260 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
261 | |||
262 | /* Setup accept BIO */ | ||
263 | if(BIO_do_accept(acpt) <= 0) { | ||
264 | fprintf(stderr, "Error setting up accept BIO\n"); | ||
265 | ERR_print_errors_fp(stderr); | ||
266 | return 0; | ||
267 | } | ||
268 | |||
269 | /* Now wait for incoming connection */ | ||
270 | if(BIO_do_accept(acpt) <= 0) { | ||
271 | fprintf(stderr, "Error in connection\n"); | ||
272 | ERR_print_errors_fp(stderr); | ||
273 | return 0; | ||
274 | } | ||
275 | |||
276 | /* We only want one connection so remove and free | ||
277 | * accept BIO | ||
278 | */ | ||
279 | |||
280 | sbio = BIO_pop(acpt); | ||
281 | |||
282 | BIO_free_all(acpt); | ||
283 | |||
284 | if(BIO_do_handshake(sbio) <= 0) { | ||
285 | fprintf(stderr, "Error in SSL handshake\n"); | ||
286 | ERR_print_errors_fp(stderr); | ||
287 | return 0; | ||
288 | } | ||
289 | |||
290 | BIO_puts(sbio, "HTTP/1.0 200 OK\r\nContent-type: text/plain\r\n\r\n"); | ||
291 | BIO_puts(sbio, "\r\nConnection Established\r\nRequest headers:\r\n"); | ||
292 | BIO_puts(sbio, "--------------------------------------------------\r\n"); | ||
293 | |||
294 | for(;;) { | ||
295 | len = BIO_gets(sbio, tmpbuf, 1024); | ||
296 | if(len <= 0) break; | ||
297 | BIO_write(sbio, tmpbuf, len); | ||
298 | BIO_write(out, tmpbuf, len); | ||
299 | /* Look for blank line signifying end of headers*/ | ||
300 | if((tmpbuf[0] == '\r') || (tmpbuf[0] == '\n')) break; | ||
301 | } | ||
302 | |||
303 | BIO_puts(sbio, "--------------------------------------------------\r\n"); | ||
304 | BIO_puts(sbio, "\r\n"); | ||
305 | |||
306 | /* Since there is a buffering BIO present we had better flush it */ | ||
307 | BIO_flush(sbio); | ||
308 | |||
309 | BIO_free_all(sbio); | ||
310 | |||
311 | =head1 BUGS | ||
312 | |||
313 | In OpenSSL versions before 1.0.0 the BIO_pop() call was handled incorrectly, | ||
314 | the I/O BIO reference count was incorrectly incremented (instead of | ||
315 | decremented) and dissociated with the SSL BIO even if the SSL BIO was not | ||
316 | explicitly being popped (e.g. a pop higher up the chain). Applications which | ||
317 | included workarounds for this bug (e.g. freeing BIOs more than once) should | ||
318 | be modified to handle this fix or they may free up an already freed BIO. | ||
319 | |||
320 | =head1 SEE ALSO | ||
321 | |||
322 | TBA | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.3 b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.3 new file mode 100644 index 0000000000..0c6cccd1cc --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.3 | |||
@@ -0,0 +1,193 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CIPHER_GET_NAME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CIPHER_get_name , | ||
6 | .Nm SSL_CIPHER_get_bits , | ||
7 | .Nm SSL_CIPHER_get_version , | ||
8 | .Nm SSL_CIPHER_description | ||
9 | .Nd get SSL_CIPHER properties | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft const char * | ||
13 | .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" | ||
14 | .Ft int | ||
15 | .Fn SSL_CIPHER_get_bits "const SSL_CIPHER *cipher" "int *alg_bits" | ||
16 | .Ft char * | ||
17 | .Fn SSL_CIPHER_get_version "const SSL_CIPHER *cipher" | ||
18 | .Ft char * | ||
19 | .Fn SSL_CIPHER_description "const SSL_CIPHER *cipher" "char *buf" "int size" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CIPHER_get_name | ||
22 | returns a pointer to the name of | ||
23 | .Fa cipher . | ||
24 | If the | ||
25 | argument is the | ||
26 | .Dv NULL | ||
27 | pointer, a pointer to the constant value | ||
28 | .Qq NONE | ||
29 | is returned. | ||
30 | .Pp | ||
31 | .Fn SSL_CIPHER_get_bits | ||
32 | returns the number of secret bits used for | ||
33 | .Fa cipher . | ||
34 | If | ||
35 | .Fa alg_bits | ||
36 | is not | ||
37 | .Dv NULL , | ||
38 | it contains the number of bits processed by the | ||
39 | chosen algorithm. | ||
40 | If | ||
41 | .Fa cipher | ||
42 | is | ||
43 | .Dv NULL , | ||
44 | 0 is returned. | ||
45 | .Pp | ||
46 | .Fn SSL_CIPHER_get_version | ||
47 | returns a string which indicates the SSL/TLS protocol version that first | ||
48 | defined the cipher. | ||
49 | This is currently | ||
50 | .Qq SSLv2 | ||
51 | or | ||
52 | .Qq TLSv1/SSLv3 . | ||
53 | In some cases it should possibly return | ||
54 | .Qq TLSv1.2 | ||
55 | but the function does not; use | ||
56 | .Xr SSL_CIPHER_description 3 | ||
57 | instead. | ||
58 | If | ||
59 | .Fa cipher | ||
60 | is | ||
61 | .Dv NULL , | ||
62 | .Qq (NONE) | ||
63 | is returned. | ||
64 | .Pp | ||
65 | .Fn SSL_CIPHER_description | ||
66 | returns a textual description of the cipher used into the buffer | ||
67 | .Fa buf | ||
68 | of length | ||
69 | .Fa len | ||
70 | provided. | ||
71 | If | ||
72 | .Fa buf | ||
73 | is | ||
74 | .Dv NULL , | ||
75 | a buffer is allocated using | ||
76 | .Xr asprintf 3 ; | ||
77 | that buffer should be freed using the | ||
78 | .Xr free 3 | ||
79 | function. | ||
80 | If | ||
81 | .Fa len | ||
82 | is too small, or if | ||
83 | .Fa buf | ||
84 | is | ||
85 | .Dv NULL | ||
86 | and the allocation fails, a pointer to the string | ||
87 | .Qq Buffer too small | ||
88 | is returned. | ||
89 | .Sh NOTES | ||
90 | The number of bits processed can be different from the secret bits. | ||
91 | For example, an export cipher like EXP-RC4-MD5 has only 40 secret bits. | ||
92 | The algorithm does use the full 128 bits (which would be returned for | ||
93 | .Fa alg_bits ) , | ||
94 | but 88 bits are fixed. | ||
95 | The search space is hence only 40 bits. | ||
96 | .Pp | ||
97 | The string returned by | ||
98 | .Fn SSL_CIPHER_description | ||
99 | in case of success consists | ||
100 | of cleartext information separated by one or more blanks in the following | ||
101 | sequence: | ||
102 | .Bl -tag -width Ds | ||
103 | .It Aq Ar ciphername | ||
104 | Textual representation of the cipher name. | ||
105 | .It Aq Ar protocol version | ||
106 | Protocol version: | ||
107 | .Em SSLv2 , | ||
108 | .Em SSLv3 , | ||
109 | .Em TLSv1.2 . | ||
110 | The TLSv1.0 ciphers are flagged with SSLv3. | ||
111 | No new ciphers were added by TLSv1.1. | ||
112 | .It Kx= Ns Aq Ar key exchange | ||
113 | Key exchange method: | ||
114 | .Em RSA | ||
115 | (for export ciphers as | ||
116 | .Em RSA(512) | ||
117 | or | ||
118 | .Em RSA(1024) ) , | ||
119 | .Em DH | ||
120 | (for export ciphers as | ||
121 | .Em DH(512) | ||
122 | or | ||
123 | .Em DH(1024) ) , | ||
124 | .Em DH/RSA , | ||
125 | .Em DH/DSS , | ||
126 | .Em Fortezza . | ||
127 | .It Au= Ns Aq Ar authentication | ||
128 | Authentication method: | ||
129 | .Em RSA , | ||
130 | .Em DSS , | ||
131 | .Em DH , | ||
132 | .Em None . | ||
133 | .Em None | ||
134 | is the representation of anonymous ciphers. | ||
135 | .It Enc= Ns Aq Ar symmetric encryption method | ||
136 | Encryption method with number of secret bits: | ||
137 | .Em DES(40) , | ||
138 | .Em DES(56) , | ||
139 | .Em 3DES(168) , | ||
140 | .Em RC4(40) , | ||
141 | .Em RC4(56) , | ||
142 | .Em RC4(64) , | ||
143 | .Em RC4(128) , | ||
144 | .Em RC2(40) , | ||
145 | .Em RC2(56) , | ||
146 | .Em RC2(128) , | ||
147 | .Em IDEA(128) , | ||
148 | .Em Fortezza , | ||
149 | .Em None . | ||
150 | .It Mac= Ns Aq Ar message authentication code | ||
151 | Message digest: | ||
152 | .Em MD5 , | ||
153 | .Em SHA1 . | ||
154 | .It Aq Ar export flag | ||
155 | If the cipher is flagged exportable with respect to old US crypto | ||
156 | regulations, the word | ||
157 | .Dq export | ||
158 | is printed. | ||
159 | .El | ||
160 | .Sh RETURN VALUES | ||
161 | See | ||
162 | .Sx DESCRIPTION | ||
163 | .Sh EXAMPLES | ||
164 | Some examples for the output of | ||
165 | .Fn SSL_CIPHER_description : | ||
166 | .D1 "EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1" | ||
167 | .D1 "EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1" | ||
168 | .D1 "RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5" | ||
169 | .D1 "EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export" | ||
170 | .Pp | ||
171 | A complete list can be retrieved by invoking the following command: | ||
172 | .Pp | ||
173 | .Dl $ openssl ciphers -v ALL | ||
174 | .Sh SEE ALSO | ||
175 | .Xr ciphers 1 , | ||
176 | .Xr ssl 3 , | ||
177 | .Xr SSL_get_ciphers 3 , | ||
178 | .Xr SSL_get_current_cipher 3 | ||
179 | .Sh BUGS | ||
180 | If | ||
181 | .Fn SSL_CIPHER_description | ||
182 | is called with | ||
183 | .Fa cipher | ||
184 | being | ||
185 | .Dv NULL , | ||
186 | the library crashes. | ||
187 | .Pp | ||
188 | If | ||
189 | .Fn SSL_CIPHER_description | ||
190 | cannot handle a built-in cipher, | ||
191 | the according description of the cipher property is | ||
192 | .Qq unknown . | ||
193 | This case should not occur. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod b/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod deleted file mode 100644 index 3ed016ee2c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CIPHER_get_name.pod +++ /dev/null | |||
@@ -1,122 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CIPHER_get_name, SSL_CIPHER_get_bits, SSL_CIPHER_get_version, | ||
6 | SSL_CIPHER_description - get SSL_CIPHER properties | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | const char *SSL_CIPHER_get_name(const SSL_CIPHER *cipher); | ||
13 | int SSL_CIPHER_get_bits(const SSL_CIPHER *cipher, int *alg_bits); | ||
14 | char *SSL_CIPHER_get_version(const SSL_CIPHER *cipher); | ||
15 | char *SSL_CIPHER_description(const SSL_CIPHER *cipher, char *buf, int size); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CIPHER_get_name() returns a pointer to the name of B<cipher>. If the | ||
20 | argument is the NULL pointer, a pointer to the constant value "NONE" is | ||
21 | returned. | ||
22 | |||
23 | SSL_CIPHER_get_bits() returns the number of secret bits used for B<cipher>. If | ||
24 | B<alg_bits> is not NULL, it contains the number of bits processed by the | ||
25 | chosen algorithm. If B<cipher> is NULL, 0 is returned. | ||
26 | |||
27 | SSL_CIPHER_get_version() returns string which indicates the SSL/TLS protocol | ||
28 | version that first defined the cipher. | ||
29 | This is currently B<SSLv2> or B<TLSv1/SSLv3>. | ||
30 | In some cases it should possibly return "TLSv1.2" but the function does not; | ||
31 | use SSL_CIPHER_description() instead. | ||
32 | If B<cipher> is NULL, "(NONE)" is returned. | ||
33 | |||
34 | SSL_CIPHER_description() returns a textual description of the cipher used | ||
35 | into the buffer B<buf> of length B<len> provided. | ||
36 | If B<buf> is NULL, a buffer is allocated using asprintf(); that | ||
37 | buffer should be freed up using the B<free> function. | ||
38 | If B<len> is too small, or if B<buf> is NULL and the allocation fails, a | ||
39 | pointer to the string "Buffer too small" is returned. | ||
40 | |||
41 | =head1 NOTES | ||
42 | |||
43 | The number of bits processed can be different from the secret bits. An | ||
44 | export cipher like e.g. EXP-RC4-MD5 has only 40 secret bits. The algorithm | ||
45 | does use the full 128 bits (which would be returned for B<alg_bits>), of | ||
46 | which however 88bits are fixed. The search space is hence only 40 bits. | ||
47 | |||
48 | The string returned by SSL_CIPHER_description() in case of success consists | ||
49 | of cleartext information separated by one or more blanks in the following | ||
50 | sequence: | ||
51 | |||
52 | =over 4 | ||
53 | |||
54 | =item <ciphername> | ||
55 | |||
56 | Textual representation of the cipher name. | ||
57 | |||
58 | =item <protocol version> | ||
59 | |||
60 | Protocol version: B<SSLv2>, B<SSLv3>, B<TLSv1.2>. The TLSv1.0 ciphers are | ||
61 | flagged with SSLv3. No new ciphers were added by TLSv1.1. | ||
62 | |||
63 | =item Kx=<key exchange> | ||
64 | |||
65 | Key exchange method: B<RSA> (for export ciphers as B<RSA(512)> or | ||
66 | B<RSA(1024)>), B<DH> (for export ciphers as B<DH(512)> or B<DH(1024)>), | ||
67 | B<DH/RSA>, B<DH/DSS>, B<Fortezza>. | ||
68 | |||
69 | =item Au=<authentication> | ||
70 | |||
71 | Authentication method: B<RSA>, B<DSS>, B<DH>, B<None>. None is the | ||
72 | representation of anonymous ciphers. | ||
73 | |||
74 | =item Enc=<symmetric encryption method> | ||
75 | |||
76 | Encryption method with number of secret bits: B<DES(40)>, B<DES(56)>, | ||
77 | B<3DES(168)>, B<RC4(40)>, B<RC4(56)>, B<RC4(64)>, B<RC4(128)>, | ||
78 | B<RC2(40)>, B<RC2(56)>, B<RC2(128)>, B<IDEA(128)>, B<Fortezza>, B<None>. | ||
79 | |||
80 | =item Mac=<message authentication code> | ||
81 | |||
82 | Message digest: B<MD5>, B<SHA1>. | ||
83 | |||
84 | =item <export flag> | ||
85 | |||
86 | If the cipher is flagged exportable with respect to old US crypto | ||
87 | regulations, the word "B<export>" is printed. | ||
88 | |||
89 | =back | ||
90 | |||
91 | =head1 EXAMPLES | ||
92 | |||
93 | Some examples for the output of SSL_CIPHER_description(): | ||
94 | |||
95 | EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1 | ||
96 | EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1 | ||
97 | RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5 | ||
98 | EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export | ||
99 | |||
100 | A complete list can be retrieved by invoking the following command: | ||
101 | |||
102 | openssl ciphers -v ALL | ||
103 | |||
104 | =head1 BUGS | ||
105 | |||
106 | If SSL_CIPHER_description() is called with B<cipher> being NULL, the | ||
107 | library crashes. | ||
108 | |||
109 | If SSL_CIPHER_description() cannot handle a built-in cipher, the according | ||
110 | description of the cipher property is B<unknown>. This case should not | ||
111 | occur. | ||
112 | |||
113 | =head1 RETURN VALUES | ||
114 | |||
115 | See DESCRIPTION | ||
116 | |||
117 | =head1 SEE ALSO | ||
118 | |||
119 | L<ssl(3)|ssl(3)>, L<SSL_get_current_cipher(3)|SSL_get_current_cipher(3)>, | ||
120 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, L<ciphers(1)|ciphers(1)> | ||
121 | |||
122 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.3 b/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.3 new file mode 100644 index 0000000000..c23d676930 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_COMP_add_compression_method | ||
6 | .Nd handle SSL/TLS integrated compression methods | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_COMP_add_compression_method "int id" "COMP_METHOD *cm" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_COMP_add_compression_method | ||
13 | adds the compression method | ||
14 | .Fa cm | ||
15 | with the identifier | ||
16 | .Fa id | ||
17 | to the list of available compression methods. | ||
18 | This list is globally maintained for all SSL operations within this application. | ||
19 | It cannot be set for specific SSL_CTX or SSL objects. | ||
20 | .Sh NOTES | ||
21 | The TLS standard (or SSLv3) allows the integration of compression methods | ||
22 | into the communication. | ||
23 | The TLS RFC does however not specify compression methods or their corresponding | ||
24 | identifiers, so there is currently no compatible way to integrate compression | ||
25 | with unknown peers. | ||
26 | It is therefore currently not recommended to integrate compression into | ||
27 | applications. | ||
28 | Applications for non-public use may agree on certain compression methods. | ||
29 | Using different compression methods with the same identifier will lead to | ||
30 | connection failure. | ||
31 | .Pp | ||
32 | An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) | ||
33 | will unconditionally send the list of all compression methods enabled with | ||
34 | .Fn SSL_COMP_add_compression_method | ||
35 | to the server during the handshake. | ||
36 | Unlike the mechanisms to set a cipher list, there is no method available to | ||
37 | restrict the list of compression method on a per connection basis. | ||
38 | .Pp | ||
39 | An OpenSSL server will match the identifiers listed by a client against | ||
40 | its own compression methods and will unconditionally activate compression | ||
41 | when a matching identifier is found. | ||
42 | There is no way to restrict the list of compression methods supported on a per | ||
43 | connection basis. | ||
44 | .Pp | ||
45 | The OpenSSL library has the compression methods | ||
46 | .Fn COMP_rle | ||
47 | and (when especially enabled during compilation) | ||
48 | .Fn COMP_zlib | ||
49 | available. | ||
50 | .Sh WARNINGS | ||
51 | Once the identities of the compression methods for the TLS protocol have | ||
52 | been standardized, the compression API will most likely be changed. | ||
53 | Using it in the current state is not recommended. | ||
54 | .Sh RETURN VALUES | ||
55 | .Fn SSL_COMP_add_compression_method | ||
56 | may return the following values: | ||
57 | .Bl -tag -width Ds | ||
58 | .It 0 | ||
59 | The operation succeeded. | ||
60 | .It 1 | ||
61 | The operation failed. | ||
62 | Check the error queue to find out the reason. | ||
63 | .El | ||
64 | .Sh SEE ALSO | ||
65 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod b/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod deleted file mode 100644 index 80175a3c17..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_COMP_add_compression_method.pod +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_COMP_add_compression_method - handle SSL/TLS integrated compression methods | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_COMP_add_compression_method(int id, COMP_METHOD *cm); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_COMP_add_compression_method() adds the compression method B<cm> with | ||
16 | the identifier B<id> to the list of available compression methods. This | ||
17 | list is globally maintained for all SSL operations within this application. | ||
18 | It cannot be set for specific SSL_CTX or SSL objects. | ||
19 | |||
20 | =head1 NOTES | ||
21 | |||
22 | The TLS standard (or SSLv3) allows the integration of compression methods | ||
23 | into the communication. The TLS RFC does however not specify compression | ||
24 | methods or their corresponding identifiers, so there is currently no compatible | ||
25 | way to integrate compression with unknown peers. It is therefore currently not | ||
26 | recommended to integrate compression into applications. Applications for | ||
27 | non-public use may agree on certain compression methods. Using different | ||
28 | compression methods with the same identifier will lead to connection failure. | ||
29 | |||
30 | An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) | ||
31 | will unconditionally send the list of all compression methods enabled with | ||
32 | SSL_COMP_add_compression_method() to the server during the handshake. | ||
33 | Unlike the mechanisms to set a cipher list, there is no method available to | ||
34 | restrict the list of compression method on a per connection basis. | ||
35 | |||
36 | An OpenSSL server will match the identifiers listed by a client against | ||
37 | its own compression methods and will unconditionally activate compression | ||
38 | when a matching identifier is found. There is no way to restrict the list | ||
39 | of compression methods supported on a per connection basis. | ||
40 | |||
41 | The OpenSSL library has the compression methods B<COMP_rle()> and (when | ||
42 | especially enabled during compilation) B<COMP_zlib()> available. | ||
43 | |||
44 | =head1 WARNINGS | ||
45 | |||
46 | Once the identities of the compression methods for the TLS protocol have | ||
47 | been standardized, the compression API will most likely be changed. Using | ||
48 | it in the current state is not recommended. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | SSL_COMP_add_compression_method() may return the following values: | ||
53 | |||
54 | =over 4 | ||
55 | |||
56 | =item C<0> | ||
57 | |||
58 | The operation succeeded. | ||
59 | |||
60 | =item C<1> | ||
61 | |||
62 | The operation failed. Check the error queue to find out the reason. | ||
63 | |||
64 | =back | ||
65 | |||
66 | =head1 SEE ALSO | ||
67 | |||
68 | L<ssl(3)|ssl(3)> | ||
69 | |||
70 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.3 new file mode 100644 index 0000000000..2664c67a5a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.3 | |||
@@ -0,0 +1,42 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_add_extra_chain_cert | ||
6 | .Nd add certificate to chain | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX ctx" "X509 *x509" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_add_extra_chain_cert | ||
13 | adds the certificate | ||
14 | .Fa x509 | ||
15 | to the certificate chain presented together with the certificate. | ||
16 | Several certificates can be added one after the other. | ||
17 | .Sh NOTES | ||
18 | When constructing the certificate chain, the chain will be formed from | ||
19 | these certificates explicitly specified. | ||
20 | If no chain is specified, the library will try to complete the chain from the | ||
21 | available CA certificates in the trusted CA storage, see | ||
22 | .Xr SSL_CTX_load_verify_locations 3 . | ||
23 | .Pp | ||
24 | The x509 certificate provided to | ||
25 | .Fn SSL_CTX_add_extra_chain_cert | ||
26 | will be freed by the library when the | ||
27 | .Vt SSL_CTX | ||
28 | is destroyed. | ||
29 | An application | ||
30 | .Em should not | ||
31 | free the | ||
32 | .Fa x509 | ||
33 | object. | ||
34 | .Sh RETURN VALUES | ||
35 | .Fn SSL_CTX_add_extra_chain_cert | ||
36 | returns 1 on success. | ||
37 | Check out the error stack to find out the reason for failure otherwise. | ||
38 | .Sh SEE ALSO | ||
39 | .Xr ssl 3 , | ||
40 | .Xr SSL_CTX_load_verify_locations 3 , | ||
41 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
42 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod deleted file mode 100644 index df5441caec..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_extra_chain_cert.pod +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_add_extra_chain_cert - add certificate to chain | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_CTX_add_extra_chain_cert(SSL_CTX ctx, X509 *x509) | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_add_extra_chain_cert() adds the certificate B<x509> to the certificate | ||
16 | chain presented together with the certificate. Several certificates | ||
17 | can be added one after the other. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | When constructing the certificate chain, the chain will be formed from | ||
22 | these certificates explicitly specified. If no chain is specified, | ||
23 | the library will try to complete the chain from the available CA | ||
24 | certificates in the trusted CA storage, see | ||
25 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. | ||
26 | |||
27 | The B<x509> certificate provided to SSL_CTX_add_extra_chain_cert() will be | ||
28 | freed by the library when the B<SSL_CTX> is destroyed. An application B<should | ||
29 | not> free the B<x509> object. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | SSL_CTX_add_extra_chain_cert() returns 1 on success. Check out the | ||
34 | error stack to find out the reason for failure otherwise. | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<ssl(3)|ssl(3)>, | ||
39 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
40 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
41 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
42 | |||
43 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.3 new file mode 100644 index 0000000000..74b4481496 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.3 | |||
@@ -0,0 +1,87 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_ADD_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_add_session , | ||
6 | .Nm SSL_add_session , | ||
7 | .Nm SSL_CTX_remove_session , | ||
8 | .Nm SSL_remove_session | ||
9 | .Nd manipulate session cache | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft int | ||
13 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
14 | .Ft int | ||
15 | .Fn SSL_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
16 | .Ft int | ||
17 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
18 | .Ft int | ||
19 | .Fn SSL_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_add_session | ||
22 | adds the session | ||
23 | .Fa c | ||
24 | to the context | ||
25 | .Fa ctx . | ||
26 | The reference count for session | ||
27 | .Fa c | ||
28 | is incremented by 1. | ||
29 | If a session with the same session id already exists, | ||
30 | the old session is removed by calling | ||
31 | .Xr SSL_SESSION_free 3 . | ||
32 | .Pp | ||
33 | .Fn SSL_CTX_remove_session | ||
34 | removes the session | ||
35 | .Fa c | ||
36 | from the context | ||
37 | .Fa ctx . | ||
38 | .Xr SSL_SESSION_free 3 | ||
39 | is called once for | ||
40 | .Fa c . | ||
41 | .Pp | ||
42 | .Fn SSL_add_session | ||
43 | and | ||
44 | .Fn SSL_remove_session | ||
45 | are synonyms for their | ||
46 | .Fn SSL_CTX_* | ||
47 | counterparts. | ||
48 | .Sh NOTES | ||
49 | When adding a new session to the internal session cache, it is examined | ||
50 | whether a session with the same session id already exists. | ||
51 | In this case it is assumed that both sessions are identical. | ||
52 | If the same session is stored in a different | ||
53 | .Vt SSL_SESSION | ||
54 | object, the old session is removed and replaced by the new session. | ||
55 | If the session is actually identical (the | ||
56 | .Vt SSL_SESSION | ||
57 | object is identical), | ||
58 | .Fn SSL_CTX_add_session | ||
59 | is a no-op, and the return value is 0. | ||
60 | .Pp | ||
61 | If a server | ||
62 | .Vt SSL_CTX | ||
63 | is configured with the | ||
64 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
65 | flag then the internal cache will not be populated automatically by new | ||
66 | sessions negotiated by the SSL/TLS implementation, even though the internal | ||
67 | cache will be searched automatically for session-resume requests (the | ||
68 | latter can be suppressed by | ||
69 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP ) . | ||
70 | So the application can use | ||
71 | .Fn SSL_CTX_add_session | ||
72 | directly to have full control over the sessions that can be resumed if desired. | ||
73 | .Sh RETURN VALUES | ||
74 | The following values are returned by all functions: | ||
75 | .Bl -tag -width Ds | ||
76 | .It 0 | ||
77 | The operation failed. | ||
78 | In case of the add operation, it was tried to add the same (identical) session | ||
79 | twice. | ||
80 | In case of the remove operation, the session was not found in the cache. | ||
81 | .It 1 | ||
82 | The operation succeeded. | ||
83 | .El | ||
84 | .Sh SEE ALSO | ||
85 | .Xr ssl 3 , | ||
86 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
87 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.pod deleted file mode 100644 index 7f1a1d5ee6..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_add_session.pod +++ /dev/null | |||
@@ -1,74 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_add_session, SSL_add_session, SSL_CTX_remove_session, | ||
6 | SSL_remove_session - manipulate session cache | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_add_session(SSL_CTX *ctx, SSL_SESSION *c); | ||
13 | int SSL_add_session(SSL_CTX *ctx, SSL_SESSION *c); | ||
14 | |||
15 | int SSL_CTX_remove_session(SSL_CTX *ctx, SSL_SESSION *c); | ||
16 | int SSL_remove_session(SSL_CTX *ctx, SSL_SESSION *c); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_add_session() adds the session B<c> to the context B<ctx>. The | ||
21 | reference count for session B<c> is incremented by 1. If a session with | ||
22 | the same session id already exists, the old session is removed by calling | ||
23 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>. | ||
24 | |||
25 | SSL_CTX_remove_session() removes the session B<c> from the context B<ctx>. | ||
26 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> is called once for B<c>. | ||
27 | |||
28 | SSL_add_session() and SSL_remove_session() are synonyms for their | ||
29 | SSL_CTX_*() counterparts. | ||
30 | |||
31 | =head1 NOTES | ||
32 | |||
33 | When adding a new session to the internal session cache, it is examined | ||
34 | whether a session with the same session id already exists. In this case | ||
35 | it is assumed that both sessions are identical. If the same session is | ||
36 | stored in a different SSL_SESSION object, The old session is | ||
37 | removed and replaced by the new session. If the session is actually | ||
38 | identical (the SSL_SESSION object is identical), SSL_CTX_add_session() | ||
39 | is a no-op, and the return value is 0. | ||
40 | |||
41 | If a server SSL_CTX is configured with the SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
42 | flag then the internal cache will not be populated automatically by new | ||
43 | sessions negotiated by the SSL/TLS implementation, even though the internal | ||
44 | cache will be searched automatically for session-resume requests (the | ||
45 | latter can be suppressed by SSL_SESS_CACHE_NO_INTERNAL_LOOKUP). So the | ||
46 | application can use SSL_CTX_add_session() directly to have full control | ||
47 | over the sessions that can be resumed if desired. | ||
48 | |||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | The following values are returned by all functions: | ||
53 | |||
54 | =over 4 | ||
55 | |||
56 | =item C<0> | ||
57 | |||
58 | The operation failed. In case of the add operation, it was tried to add | ||
59 | the same (identical) session twice. In case of the remove operation, the | ||
60 | session was not found in the cache. | ||
61 | |||
62 | =item C<1> | ||
63 | |||
64 | The operation succeeded. | ||
65 | |||
66 | =back | ||
67 | |||
68 | =head1 SEE ALSO | ||
69 | |||
70 | L<ssl(3)|ssl(3)>, | ||
71 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
72 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
73 | |||
74 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.3 new file mode 100644 index 0000000000..d0a4ffd554 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.3 | |||
@@ -0,0 +1,46 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_CTRL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_ctrl , | ||
6 | .Nm SSL_CTX_callback_ctrl , | ||
7 | .Nm SSL_ctrl , | ||
8 | .Nm SSL_callback_ctrl | ||
9 | .Nd internal handling functions for SSL_CTX and SSL objects | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" | ||
14 | .Ft long | ||
15 | .Fn SSL_CTX_callback_ctrl "SSL_CTX *" "int cmd" "void (*fp)()" | ||
16 | .Ft long | ||
17 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "void *parg" | ||
18 | .Ft long | ||
19 | .Fn SSL_callback_ctrl "SSL *" "int cmd" "void (*fp)()" | ||
20 | .Sh DESCRIPTION | ||
21 | The | ||
22 | .Fn SSL_*_ctrl | ||
23 | family of functions is used to manipulate settings of | ||
24 | the | ||
25 | .Vt SSL_CTX | ||
26 | and | ||
27 | .Vt SSL | ||
28 | objects. | ||
29 | Depending on the command | ||
30 | .Fa cmd | ||
31 | the arguments | ||
32 | .Fa larg , | ||
33 | .Fa parg , | ||
34 | or | ||
35 | .Fa fp | ||
36 | are evaluated. | ||
37 | These functions should never be called directly. | ||
38 | All functionalities needed are made available via other functions or macros. | ||
39 | .Sh RETURN VALUES | ||
40 | The return values of the | ||
41 | .Fn SSL*_ctrl | ||
42 | functions depend on the command supplied via the | ||
43 | .Fn cmd | ||
44 | parameter. | ||
45 | .Sh SEE ALSO | ||
46 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod deleted file mode 100644 index 8133689940..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_ctrl.pod +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_ctrl, SSL_CTX_callback_ctrl, SSL_ctrl, SSL_callback_ctrl - internal | ||
6 | handling functions for SSL_CTX and SSL objects | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_ctrl(SSL_CTX *ctx, int cmd, long larg, void *parg); | ||
13 | long SSL_CTX_callback_ctrl(SSL_CTX *, int cmd, void (*fp)()); | ||
14 | |||
15 | long SSL_ctrl(SSL *ssl, int cmd, long larg, void *parg); | ||
16 | long SSL_callback_ctrl(SSL *, int cmd, void (*fp)()); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | The SSL_*_ctrl() family of functions is used to manipulate settings of | ||
21 | the SSL_CTX and SSL objects. Depending on the command B<cmd> the arguments | ||
22 | B<larg>, B<parg>, or B<fp> are evaluated. These functions should never | ||
23 | be called directly. All functionalities needed are made available via | ||
24 | other functions or macros. | ||
25 | |||
26 | =head1 RETURN VALUES | ||
27 | |||
28 | The return values of the SSL*_ctrl() functions depend on the command | ||
29 | supplied via the B<cmd> parameter. | ||
30 | |||
31 | =head1 SEE ALSO | ||
32 | |||
33 | L<ssl(3)|ssl(3)> | ||
34 | |||
35 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.3 new file mode 100644 index 0000000000..6431008c4f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_FLUSH_SESSIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_flush_sessions , | ||
6 | .Nm SSL_flush_sessions | ||
7 | .Nd remove expired sessions | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" | ||
12 | .Ft void | ||
13 | .Fn SSL_flush_sessions "SSL_CTX *ctx" "long tm" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_flush_sessions | ||
16 | causes a run through the session cache of | ||
17 | .Fa ctx | ||
18 | to remove sessions expired at time | ||
19 | .Fa tm . | ||
20 | .Pp | ||
21 | .Fn SSL_flush_sessions | ||
22 | is a synonym for | ||
23 | .Fn SSL_CTX_flush_sessions . | ||
24 | .Sh NOTES | ||
25 | If enabled, the internal session cache will collect all sessions established | ||
26 | up to the specified maximum number (see | ||
27 | .Fn SSL_CTX_sess_set_cache_size ) . | ||
28 | As sessions will not be reused ones they are expired, they should be | ||
29 | removed from the cache to save resources. | ||
30 | This can either be done automatically whenever 255 new sessions were | ||
31 | established (see | ||
32 | .Xr SSL_CTX_set_session_cache_mode 3 ) | ||
33 | or manually by calling | ||
34 | .Fn SSL_CTX_flush_sessions . | ||
35 | .Pp | ||
36 | The parameter | ||
37 | .Fa tm | ||
38 | specifies the time which should be used for the | ||
39 | expiration test, in most cases the actual time given by | ||
40 | .Fn time 0 | ||
41 | will be used. | ||
42 | .Pp | ||
43 | .Fn SSL_CTX_flush_sessions | ||
44 | will only check sessions stored in the internal cache. | ||
45 | When a session is found and removed, the | ||
46 | .Va remove_session_cb | ||
47 | is however called to synchronize with the external cache (see | ||
48 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
49 | .Sh RETURN VALUES | ||
50 | .Sh SEE ALSO | ||
51 | .Xr ssl 3 , | ||
52 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
53 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
54 | .Xr SSL_CTX_set_timeout 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.pod deleted file mode 100644 index 8fb0f1dbaf..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_flush_sessions.pod +++ /dev/null | |||
@@ -1,49 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_flush_sessions, SSL_flush_sessions - remove expired sessions | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_flush_sessions(SSL_CTX *ctx, long tm); | ||
12 | void SSL_flush_sessions(SSL_CTX *ctx, long tm); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_CTX_flush_sessions() causes a run through the session cache of | ||
17 | B<ctx> to remove sessions expired at time B<tm>. | ||
18 | |||
19 | SSL_flush_sessions() is a synonym for SSL_CTX_flush_sessions(). | ||
20 | |||
21 | =head1 NOTES | ||
22 | |||
23 | If enabled, the internal session cache will collect all sessions established | ||
24 | up to the specified maximum number (see SSL_CTX_sess_set_cache_size()). | ||
25 | As sessions will not be reused ones they are expired, they should be | ||
26 | removed from the cache to save resources. This can either be done | ||
27 | automatically whenever 255 new sessions were established (see | ||
28 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) | ||
29 | or manually by calling SSL_CTX_flush_sessions(). | ||
30 | |||
31 | The parameter B<tm> specifies the time which should be used for the | ||
32 | expiration test, in most cases the actual time given by time(0) | ||
33 | will be used. | ||
34 | |||
35 | SSL_CTX_flush_sessions() will only check sessions stored in the internal | ||
36 | cache. When a session is found and removed, the remove_session_cb is however | ||
37 | called to synchronize with the external cache (see | ||
38 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>). | ||
39 | |||
40 | =head1 RETURN VALUES | ||
41 | |||
42 | =head1 SEE ALSO | ||
43 | |||
44 | L<ssl(3)|ssl(3)>, | ||
45 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
46 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, | ||
47 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> | ||
48 | |||
49 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_free.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.3 new file mode 100644 index 0000000000..9cf5934303 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.3 | |||
@@ -0,0 +1,44 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_free | ||
6 | .Nd free an allocated SSL_CTX object | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_CTX_free "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_free | ||
13 | decrements the reference count of | ||
14 | .Fa ctx , | ||
15 | and removes the | ||
16 | .Vt SSL_CTX | ||
17 | object pointed to by | ||
18 | .Fa ctx | ||
19 | and frees up the allocated memory if the reference count has reached 0. | ||
20 | .Pp | ||
21 | It also calls the | ||
22 | .Xr free 3 Ns ing procedures for indirectly affected items, if applicable: | ||
23 | the session cache, the list of ciphers, the list of Client CAs, | ||
24 | the certificates and keys. | ||
25 | .Sh WARNINGS | ||
26 | If a session-remove callback is set | ||
27 | .Pq Xr SSL_CTX_sess_set_remove_cb 3 , | ||
28 | this callback will be called for each session being freed from | ||
29 | .Fa ctx Ns 's | ||
30 | session cache. | ||
31 | This implies that all corresponding sessions from an external session cache are | ||
32 | removed as well. | ||
33 | If this is not desired, the user should explicitly unset the callback by | ||
34 | calling | ||
35 | .Fn SSL_CTX_sess_set_remove_cb ctx NULL | ||
36 | prior to calling | ||
37 | .Fn SSL_CTX_free . | ||
38 | .Sh RETURN VALUES | ||
39 | .Fn SSL_CTX_free | ||
40 | does not provide diagnostic information. | ||
41 | .Sh SEE ALSO | ||
42 | .Xr ssl 3 , | ||
43 | .Xr SSL_CTX_new 3 , | ||
44 | .Xr SSL_CTX_sess_set_get_cb 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod deleted file mode 100644 index 51d8676968..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_free.pod +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_free - free an allocated SSL_CTX object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_free(SSL_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_free() decrements the reference count of B<ctx>, and removes the | ||
16 | SSL_CTX object pointed to by B<ctx> and frees up the allocated memory if the | ||
17 | the reference count has reached 0. | ||
18 | |||
19 | It also calls the free()ing procedures for indirectly affected items, if | ||
20 | applicable: the session cache, the list of ciphers, the list of Client CAs, | ||
21 | the certificates and keys. | ||
22 | |||
23 | =head1 WARNINGS | ||
24 | |||
25 | If a session-remove callback is set (SSL_CTX_sess_set_remove_cb()), this | ||
26 | callback will be called for each session being freed from B<ctx>'s | ||
27 | session cache. This implies, that all corresponding sessions from an | ||
28 | external session cache are removed as well. If this is not desired, the user | ||
29 | should explicitly unset the callback by calling | ||
30 | SSL_CTX_sess_set_remove_cb(B<ctx>, NULL) prior to calling SSL_CTX_free(). | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | SSL_CTX_free() does not provide diagnostic information. | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<ssl(3)|ssl(3)>, | ||
39 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.3 new file mode 100644 index 0000000000..593f39c24c --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.3 | |||
@@ -0,0 +1,67 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_get_ex_new_index , | ||
6 | .Nm SSL_CTX_set_ex_data , | ||
7 | .Nm SSL_CTX_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_CTX_get_ex_new_index | ||
13 | .Fa long argl | ||
14 | .Fa void *argp | ||
15 | .Fa CRYPTO_EX_new *new_func | ||
16 | .Fa CRYPTO_EX_dup *dup_func | ||
17 | .Fa CRYPTO_EX_free *free_func | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_CTX_set_ex_data "SSL_CTX *ctx" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *ctx" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate application | ||
34 | specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_CTX_get_ex_new_index | ||
37 | is used to register a new index for application specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa ctx | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa ctx . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality can be found in | ||
57 | .Xr RSA_get_ex_new_index 3 . | ||
58 | The | ||
59 | .Fn *_get_ex_data | ||
60 | and | ||
61 | .Fn *_set_ex_data | ||
62 | functionality is described in | ||
63 | .Xr CRYPTO_set_ex_data 3 . | ||
64 | .Sh SEE ALSO | ||
65 | .Xr CRYPTO_set_ex_data 3 , | ||
66 | .Xr RSA_get_ex_new_index 3 , | ||
67 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod deleted file mode 100644 index 5a03844114..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_ex_new_index.pod +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_get_ex_new_index, SSL_CTX_set_ex_data, SSL_CTX_get_ex_data - internal | ||
6 | application specific data functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_get_ex_new_index(long argl, void *argp, | ||
13 | CRYPTO_EX_new *new_func, | ||
14 | CRYPTO_EX_dup *dup_func, | ||
15 | CRYPTO_EX_free *free_func); | ||
16 | |||
17 | int SSL_CTX_set_ex_data(SSL_CTX *ctx, int idx, void *arg); | ||
18 | |||
19 | void *SSL_CTX_get_ex_data(const SSL_CTX *ctx, int idx); | ||
20 | |||
21 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
22 | int idx, long argl, void *argp); | ||
23 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
24 | int idx, long argl, void *argp); | ||
25 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
26 | int idx, long argl, void *argp); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | Several OpenSSL structures can have application specific data attached to them. | ||
31 | These functions are used internally by OpenSSL to manipulate application | ||
32 | specific data attached to a specific structure. | ||
33 | |||
34 | SSL_CTX_get_ex_new_index() is used to register a new index for application | ||
35 | specific data. | ||
36 | |||
37 | SSL_CTX_set_ex_data() is used to store application data at B<arg> for B<idx> | ||
38 | into the B<ctx> object. | ||
39 | |||
40 | SSL_CTX_get_ex_data() is used to retrieve the information for B<idx> from | ||
41 | B<ctx>. | ||
42 | |||
43 | A detailed description for the B<*_get_ex_new_index()> functionality | ||
44 | can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. | ||
45 | The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in | ||
46 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, | ||
51 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | ||
52 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.3 new file mode 100644 index 0000000000..4139229d7b --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.3 | |||
@@ -0,0 +1,70 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_GET_VERIFY_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_get_verify_mode , | ||
6 | .Nm SSL_get_verify_mode , | ||
7 | .Nm SSL_CTX_get_verify_depth , | ||
8 | .Nm SSL_get_verify_depth , | ||
9 | .Nm SSL_get_verify_callback , | ||
10 | .Nm SSL_CTX_get_verify_callback | ||
11 | .Nd get currently set verification parameters | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft int | ||
15 | .Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" | ||
16 | .Ft int | ||
17 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
18 | .Ft int | ||
19 | .Fn SSL_CTX_get_verify_depth "const SSL_CTX *ctx" | ||
20 | .Ft int | ||
21 | .Fn SSL_get_verify_depth "const SSL *ssl" | ||
22 | .Ft int | ||
23 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
24 | .Fa int "X509_STORE_CTX *" | ||
25 | .Fc | ||
26 | .Ft int | ||
27 | .Fo "(*SSL_get_verify_callback(const SSL *ssl))" | ||
28 | .Fa int "X509_STORE_CTX *" | ||
29 | .Fc | ||
30 | .Sh DESCRIPTION | ||
31 | .Fn SSL_CTX_get_verify_mode | ||
32 | returns the verification mode currently set in | ||
33 | .Fa ctx . | ||
34 | .Pp | ||
35 | .Fn SSL_get_verify_mode | ||
36 | returns the verification mode currently set in | ||
37 | .Fa ssl . | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_get_verify_depth | ||
40 | returns the verification depth limit currently set | ||
41 | in | ||
42 | .Fa ctx . | ||
43 | If no limit has been explicitly set, | ||
44 | \(mi1 is returned and the default value will be used. | ||
45 | .Pp | ||
46 | .Fn SSL_get_verify_depth | ||
47 | returns the verification depth limit currently set in | ||
48 | .Fa ssl . | ||
49 | If no limit has been explicitly set, | ||
50 | \(mi1 is returned and the default value will be used. | ||
51 | .Pp | ||
52 | .Fn SSL_CTX_get_verify_callback | ||
53 | returns a function pointer to the verification callback currently set in | ||
54 | .Fa ctx . | ||
55 | If no callback was explicitly set, the | ||
56 | .Dv NULL | ||
57 | pointer is returned and the default callback will be used. | ||
58 | .Pp | ||
59 | .Fn SSL_get_verify_callback | ||
60 | returns a function pointer to the verification callback currently set in | ||
61 | .Fa ssl . | ||
62 | If no callback was explicitly set, the | ||
63 | .Dv NULL | ||
64 | pointer is returned and the default callback will be used. | ||
65 | .Sh RETURN VALUES | ||
66 | See | ||
67 | .Sx DESCRIPTION | ||
68 | .Sh SEE ALSO | ||
69 | .Xr ssl 3 , | ||
70 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod deleted file mode 100644 index d0201bf263..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_get_verify_mode.pod +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_get_verify_mode, SSL_get_verify_mode, SSL_CTX_get_verify_depth, | ||
6 | SSL_get_verify_depth, SSL_get_verify_callback, SSL_CTX_get_verify_callback - | ||
7 | get currently set verification parameters | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | int SSL_CTX_get_verify_mode(const SSL_CTX *ctx); | ||
14 | int SSL_get_verify_mode(const SSL *ssl); | ||
15 | int SSL_CTX_get_verify_depth(const SSL_CTX *ctx); | ||
16 | int SSL_get_verify_depth(const SSL *ssl); | ||
17 | int (*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))(int, X509_STORE_CTX *); | ||
18 | int (*SSL_get_verify_callback(const SSL *ssl))(int, X509_STORE_CTX *); | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | SSL_CTX_get_verify_mode() returns the verification mode currently set in | ||
23 | B<ctx>. | ||
24 | |||
25 | SSL_get_verify_mode() returns the verification mode currently set in | ||
26 | B<ssl>. | ||
27 | |||
28 | SSL_CTX_get_verify_depth() returns the verification depth limit currently set | ||
29 | in B<ctx>. If no limit has been explicitly set, -1 is returned and the | ||
30 | default value will be used. | ||
31 | |||
32 | SSL_get_verify_depth() returns the verification depth limit currently set | ||
33 | in B<ssl>. If no limit has been explicitly set, -1 is returned and the | ||
34 | default value will be used. | ||
35 | |||
36 | SSL_CTX_get_verify_callback() returns a function pointer to the verification | ||
37 | callback currently set in B<ctx>. If no callback was explicitly set, the | ||
38 | NULL pointer is returned and the default callback will be used. | ||
39 | |||
40 | SSL_get_verify_callback() returns a function pointer to the verification | ||
41 | callback currently set in B<ssl>. If no callback was explicitly set, the | ||
42 | NULL pointer is returned and the default callback will be used. | ||
43 | |||
44 | =head1 RETURN VALUES | ||
45 | |||
46 | See DESCRIPTION | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.3 new file mode 100644 index 0000000000..1e494032f4 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.3 | |||
@@ -0,0 +1,158 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_load_verify_locations | ||
6 | .Nd set default locations for trusted CA certificates | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fo SSL_CTX_load_verify_locations | ||
11 | .Fa "SSL_CTX *ctx" "const char *CAfile" "const char *CApath" | ||
12 | .Fc | ||
13 | .Sh DESCRIPTION | ||
14 | .Fn SSL_CTX_load_verify_locations | ||
15 | specifies the locations for | ||
16 | .Fa ctx , | ||
17 | at which CA certificates for verification purposes are located. | ||
18 | The certificates available via | ||
19 | .Fa CAfile | ||
20 | and | ||
21 | .Fa CApath | ||
22 | are trusted. | ||
23 | .Sh NOTES | ||
24 | If | ||
25 | .Fa CAfile | ||
26 | is not | ||
27 | .Dv NULL , | ||
28 | it points to a file of CA certificates in PEM format. | ||
29 | The file can contain several CA certificates identified by sequences of: | ||
30 | .Bd -literal | ||
31 | -----BEGIN CERTIFICATE----- | ||
32 | ... (CA certificate in base64 encoding) ... | ||
33 | -----END CERTIFICATE----- | ||
34 | .Ed | ||
35 | Before, between, and after the certificates arbitrary text is allowed which can | ||
36 | be used, e.g., for descriptions of the certificates. | ||
37 | .Pp | ||
38 | The | ||
39 | .Fa CAfile | ||
40 | is processed on execution of the | ||
41 | .Fn SSL_CTX_load_verify_locations | ||
42 | function. | ||
43 | .Pp | ||
44 | If | ||
45 | .Fa CApath | ||
46 | is not NULL, it points to a directory containing CA certificates in PEM format. | ||
47 | The files each contain one CA certificate. | ||
48 | The files are looked up by the CA subject name hash value, | ||
49 | which must hence be available. | ||
50 | If more than one CA certificate with the same name hash value exist, | ||
51 | the extension must be different (e.g., | ||
52 | .Pa 9d66eef0.0 , | ||
53 | .Pa 9d66eef0.1 , | ||
54 | etc.). | ||
55 | The search is performed in the ordering of the extension number, | ||
56 | regardless of other properties of the certificates. | ||
57 | .Pp | ||
58 | The certificates in | ||
59 | .Fa CApath | ||
60 | are only looked up when required, e.g., when building the certificate chain or | ||
61 | when actually performing the verification of a peer certificate. | ||
62 | .Pp | ||
63 | When looking up CA certificates, the OpenSSL library will first search the | ||
64 | certificates in | ||
65 | .Fa CAfile , | ||
66 | then those in | ||
67 | .Fa CApath . | ||
68 | Certificate matching is done based on the subject name, the key identifier (if | ||
69 | present), and the serial number as taken from the certificate to be verified. | ||
70 | If these data do not match, the next certificate will be tried. | ||
71 | If a first certificate matching the parameters is found, | ||
72 | the verification process will be performed; | ||
73 | no other certificates for the same parameters will be searched in case of | ||
74 | failure. | ||
75 | .Pp | ||
76 | In server mode, when requesting a client certificate, the server must send | ||
77 | the list of CAs of which it will accept client certificates. | ||
78 | This list is not influenced by the contents of | ||
79 | .Fa CAfile | ||
80 | or | ||
81 | .Fa CApath | ||
82 | and must explicitly be set using the | ||
83 | .Xr SSL_CTX_set_client_CA_list 3 | ||
84 | family of functions. | ||
85 | .Pp | ||
86 | When building its own certificate chain, an OpenSSL client/server will try to | ||
87 | fill in missing certificates from | ||
88 | .Fa CAfile Ns / Fa CApath , | ||
89 | if the | ||
90 | certificate chain was not explicitly specified (see | ||
91 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
92 | and | ||
93 | .Xr SSL_CTX_use_certificate 3 ) . | ||
94 | .Sh WARNINGS | ||
95 | If several CA certificates matching the name, key identifier, and serial | ||
96 | number condition are available, only the first one will be examined. | ||
97 | This may lead to unexpected results if the same CA certificate is available | ||
98 | with different expiration dates. | ||
99 | If a | ||
100 | .Dq certificate expired | ||
101 | verification error occurs, no other certificate will be searched. | ||
102 | Make sure to not have expired certificates mixed with valid ones. | ||
103 | .Sh RETURN VALUES | ||
104 | The following return values can occur: | ||
105 | .Bl -tag -width Ds | ||
106 | .It 0 | ||
107 | The operation failed because | ||
108 | .Fa CAfile | ||
109 | and | ||
110 | .Fa CApath | ||
111 | are | ||
112 | .Dv NULL | ||
113 | or the processing at one of the locations specified failed. | ||
114 | Check the error stack to find out the reason. | ||
115 | .It 1 | ||
116 | The operation succeeded. | ||
117 | .El | ||
118 | .Sh EXAMPLES | ||
119 | Generate a CA certificate file with descriptive text from the CA certificates | ||
120 | .Pa ca1.pem | ||
121 | .Pa ca2.pem | ||
122 | .Pa ca3.pem : | ||
123 | .Bd -literal | ||
124 | #!/bin/sh | ||
125 | rm CAfile.pem | ||
126 | for i in ca1.pem ca2.pem ca3.pem; do | ||
127 | openssl x509 -in $i -text >> CAfile.pem | ||
128 | done | ||
129 | .Ed | ||
130 | .Pp | ||
131 | Prepare the directory /some/where/certs containing several CA certificates | ||
132 | for use as | ||
133 | .Fa CApath : | ||
134 | .Bd -literal | ||
135 | $ cd /some/where/certs | ||
136 | $ rm -f *.[0-9]* *.r[0-9]* | ||
137 | $ for c in *.pem; do | ||
138 | > [ "$c" = "*.pem" ] && continue | ||
139 | > hash=$(openssl x509 -noout -hash -in "$c") | ||
140 | > if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then | ||
141 | > suf=0 | ||
142 | > while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done | ||
143 | > ln -s "$c" $hash.$suf | ||
144 | > fi | ||
145 | > if egrep -q -- '-BEGIN X509 CRL-' "$c"; then | ||
146 | > suf=0 | ||
147 | > while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done | ||
148 | > ln -s "$c" $hash.r$suf | ||
149 | > fi | ||
150 | > done | ||
151 | .Ed | ||
152 | .Sh SEE ALSO | ||
153 | .Xr ssl 3 , | ||
154 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
155 | .Xr SSL_CTX_set_cert_store 3 , | ||
156 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
157 | .Xr SSL_CTX_use_certificate 3 , | ||
158 | .Xr SSL_get_client_CA_list 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod deleted file mode 100644 index cd78dd285f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_load_verify_locations.pod +++ /dev/null | |||
@@ -1,137 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_load_verify_locations - set default locations for trusted CA | ||
6 | certificates | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_load_verify_locations(SSL_CTX *ctx, const char *CAfile, | ||
13 | const char *CApath); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_load_verify_locations() specifies the locations for B<ctx>, at | ||
18 | which CA certificates for verification purposes are located. The certificates | ||
19 | available via B<CAfile> and B<CApath> are trusted. | ||
20 | |||
21 | =head1 NOTES | ||
22 | |||
23 | If B<CAfile> is not NULL, it points to a file of CA certificates in PEM | ||
24 | format. The file can contain several CA certificates identified by | ||
25 | |||
26 | -----BEGIN CERTIFICATE----- | ||
27 | ... (CA certificate in base64 encoding) ... | ||
28 | -----END CERTIFICATE----- | ||
29 | |||
30 | sequences. Before, between, and after the certificates text is allowed | ||
31 | which can be used e.g. for descriptions of the certificates. | ||
32 | |||
33 | The B<CAfile> is processed on execution of the SSL_CTX_load_verify_locations() | ||
34 | function. | ||
35 | |||
36 | If B<CApath> is not NULL, it points to a directory containing CA certificates | ||
37 | in PEM format. The files each contain one CA certificate. The files are | ||
38 | looked up by the CA subject name hash value, which must hence be available. | ||
39 | If more than one CA certificate with the same name hash value exist, the | ||
40 | extension must be different (e.g. 9d66eef0.0, 9d66eef0.1 etc). The search | ||
41 | is performed in the ordering of the extension number, regardless of other | ||
42 | properties of the certificates. | ||
43 | |||
44 | The certificates in B<CApath> are only looked up when required, e.g. when | ||
45 | building the certificate chain or when actually performing the verification | ||
46 | of a peer certificate. | ||
47 | |||
48 | When looking up CA certificates, the OpenSSL library will first search the | ||
49 | certificates in B<CAfile>, then those in B<CApath>. Certificate matching | ||
50 | is done based on the subject name, the key identifier (if present), and the | ||
51 | serial number as taken from the certificate to be verified. If these data | ||
52 | do not match, the next certificate will be tried. If a first certificate | ||
53 | matching the parameters is found, the verification process will be performed; | ||
54 | no other certificates for the same parameters will be searched in case of | ||
55 | failure. | ||
56 | |||
57 | In server mode, when requesting a client certificate, the server must send | ||
58 | the list of CAs of which it will accept client certificates. This list | ||
59 | is not influenced by the contents of B<CAfile> or B<CApath> and must | ||
60 | explicitly be set using the | ||
61 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> | ||
62 | family of functions. | ||
63 | |||
64 | When building its own certificate chain, an OpenSSL client/server will | ||
65 | try to fill in missing certificates from B<CAfile>/B<CApath>, if the | ||
66 | certificate chain was not explicitly specified (see | ||
67 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | ||
68 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>. | ||
69 | |||
70 | =head1 WARNINGS | ||
71 | |||
72 | If several CA certificates matching the name, key identifier, and serial | ||
73 | number condition are available, only the first one will be examined. This | ||
74 | may lead to unexpected results if the same CA certificate is available | ||
75 | with different expiration dates. If a "certificate expired" verification | ||
76 | error occurs, no other certificate will be searched. Make sure to not | ||
77 | have expired certificates mixed with valid ones. | ||
78 | |||
79 | =head1 EXAMPLES | ||
80 | |||
81 | Generate a CA certificate file with descriptive text from the CA certificates | ||
82 | ca1.pem ca2.pem ca3.pem: | ||
83 | |||
84 | #!/bin/sh | ||
85 | rm CAfile.pem | ||
86 | for i in ca1.pem ca2.pem ca3.pem ; do | ||
87 | openssl x509 -in $i -text >> CAfile.pem | ||
88 | done | ||
89 | |||
90 | Prepare the directory /some/where/certs containing several CA certificates | ||
91 | for use as B<CApath>: | ||
92 | |||
93 | cd /some/where/certs | ||
94 | rm -f *.[0-9]* *.r[0-9]* | ||
95 | for c in *.pem; do | ||
96 | [ "$c" = "*.pem" ] && continue | ||
97 | hash=$(openssl x509 -noout -hash -in "$c") | ||
98 | if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then | ||
99 | suf=0 | ||
100 | while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done | ||
101 | ln -s "$c" $hash.$suf | ||
102 | fi | ||
103 | if egrep -q -- '-BEGIN X509 CRL-' "$c"; then | ||
104 | suf=0 | ||
105 | while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done | ||
106 | ln -s "$c" $hash.r$suf | ||
107 | fi | ||
108 | done | ||
109 | |||
110 | =head1 RETURN VALUES | ||
111 | |||
112 | The following return values can occur: | ||
113 | |||
114 | =over 4 | ||
115 | |||
116 | =item C<0> | ||
117 | |||
118 | The operation failed because B<CAfile> and B<CApath> are NULL or the | ||
119 | processing at one of the locations specified failed. Check the error | ||
120 | stack to find out the reason. | ||
121 | |||
122 | =item C<1> | ||
123 | |||
124 | The operation succeeded. | ||
125 | |||
126 | =back | ||
127 | |||
128 | =head1 SEE ALSO | ||
129 | |||
130 | L<ssl(3)|ssl(3)>, | ||
131 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | ||
132 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | ||
133 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
134 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | ||
135 | L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)> | ||
136 | |||
137 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_new.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.3 new file mode 100644 index 0000000000..b798d10a9e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.3 | |||
@@ -0,0 +1,108 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_new , | ||
6 | .Nm SSLv3_method , | ||
7 | .Nm SSLv3_server_method , | ||
8 | .Nm SSLv3_client_method , | ||
9 | .Nm TLSv1_method , | ||
10 | .Nm TLSv1_server_method , | ||
11 | .Nm TLSv1_client_method , | ||
12 | .Nm TLSv1_1_method , | ||
13 | .Nm TLSv1_1_server_method , | ||
14 | .Nm TLSv1_1_client_method , | ||
15 | .Nm SSLv23_method , | ||
16 | .Nm SSLv23_server_method , | ||
17 | .Nm SSLv23_client_method | ||
18 | .Nd create a new SSL_CTX object as framework for TLS/SSL enabled functions | ||
19 | .Sh SYNOPSIS | ||
20 | .In openssl/ssl.h | ||
21 | .Ft SSL_CTX * | ||
22 | .Fn SSL_CTX_new "const SSL_METHOD *method" | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_CTX_new | ||
25 | creates a new | ||
26 | .Vt SSL_CTX | ||
27 | object as framework to establish TLS/SSL enabled connections. | ||
28 | .Sh NOTES | ||
29 | The | ||
30 | .Vt SSL_CTX | ||
31 | object uses | ||
32 | .Fa method | ||
33 | as its connection method. | ||
34 | The methods exist in a generic type (for client and server use), | ||
35 | a server only type, and a client only type. | ||
36 | .Fa method | ||
37 | can be of the following types: | ||
38 | .Bl -tag -width Ds | ||
39 | .It Fn SSLv3_method void , Fn SSLv3_server_method void , \ | ||
40 | Fn SSLv3_client_method void | ||
41 | A TLS/SSL connection established with these methods will only understand the | ||
42 | SSLv3 protocol. | ||
43 | A client will send out SSLv3 client hello messages and will indicate that it | ||
44 | only understands SSLv3. | ||
45 | A server will only understand SSLv3 client hello messages. | ||
46 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
47 | which are widely used for compatibility reasons; see | ||
48 | .Fn SSLv23_*_method . | ||
49 | .It Fn TLSv1_method void , Fn TLSv1_server_method void , \ | ||
50 | Fn TLSv1_client_method void | ||
51 | A TLS/SSL connection established with these methods will only understand the | ||
52 | TLSv1 protocol. | ||
53 | A client will send out TLSv1 client hello messages and will indicate that it | ||
54 | only understands TLSv1. | ||
55 | A server will only understand TLSv1 client hello messages. | ||
56 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
57 | which are widely used for compatibility reasons; see | ||
58 | .Fn SSLv23_*_method . | ||
59 | It will also not understand SSLv3 client hello messages. | ||
60 | .It Fn SSLv23_method void , Fn SSLv23_server_method void , \ | ||
61 | Fn SSLv23_client_method void | ||
62 | A TLS/SSL connection established with these methods may understand the SSLv3, | ||
63 | TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
64 | .Pp | ||
65 | A client will send out TLSv1 client hello messages including extensions and | ||
66 | will indicate that it also understands TLSv1.1, TLSv1.2 and permits a fallback | ||
67 | to SSLv3. | ||
68 | A server will support SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
69 | This is the best choice when compatibility is a concern. | ||
70 | .El | ||
71 | .Pp | ||
72 | The list of protocols available can later be limited using the | ||
73 | .Dv SSL_OP_NO_SSLv3 , | ||
74 | .Dv SSL_OP_NO_TLSv1 , | ||
75 | .Dv SSL_OP_NO_TLSv1_1 , | ||
76 | and | ||
77 | .Dv SSL_OP_NO_TLSv1_2 | ||
78 | options of the | ||
79 | .Fn SSL_CTX_set_options | ||
80 | or | ||
81 | .Fn SSL_set_options | ||
82 | functions. | ||
83 | Using these options it is possible to choose, for example, | ||
84 | .Fn SSLv23_server_method | ||
85 | and be able to negotiate with all possible clients, | ||
86 | but to only allow newer protocols like TLSv1, TLSv1.1 or TLS v1.2. | ||
87 | .Pp | ||
88 | .Fn SSL_CTX_new | ||
89 | initializes the list of ciphers, the session cache setting, the callbacks, | ||
90 | the keys and certificates, and the options to its default values. | ||
91 | .Sh RETURN VALUES | ||
92 | The following return values can occur: | ||
93 | .Bl -tag -width Ds | ||
94 | .It Dv NULL | ||
95 | The creation of a new | ||
96 | .Vt SSL_CTX | ||
97 | object failed. | ||
98 | Check the error stack to find out the reason. | ||
99 | .It Pointer to an SSL_CTX object | ||
100 | The return value points to an allocated | ||
101 | .Vt SSL_CTX | ||
102 | object. | ||
103 | .El | ||
104 | .Sh SEE ALSO | ||
105 | .Xr ssl 3 , | ||
106 | .Xr SSL_accept 3 , | ||
107 | .Xr SSL_CTX_free 3 , | ||
108 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod deleted file mode 100644 index 023be38c0a..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_new.pod +++ /dev/null | |||
@@ -1,93 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_new, SSLv3_method, SSLv3_server_method, SSLv3_client_method, | ||
6 | TLSv1_method, TLSv1_server_method, TLSv1_client_method, | ||
7 | TLSv1_1_method, TLSv1_1_server_method, TLSv1_1_client_method, SSLv23_method, | ||
8 | SSLv23_server_method, SSLv23_client_method - create a new SSL_CTX object as framework for TLS/SSL enabled functions | ||
9 | |||
10 | =head1 SYNOPSIS | ||
11 | |||
12 | #include <openssl/ssl.h> | ||
13 | |||
14 | SSL_CTX *SSL_CTX_new(const SSL_METHOD *method); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_CTX_new() creates a new B<SSL_CTX> object as framework to establish | ||
19 | TLS/SSL enabled connections. | ||
20 | |||
21 | =head1 NOTES | ||
22 | |||
23 | The SSL_CTX object uses B<method> as connection method. The methods exist | ||
24 | in a generic type (for client and server use), a server only type, and a | ||
25 | client only type. B<method> can be of the following types: | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item SSLv3_method(void), SSLv3_server_method(void), SSLv3_client_method(void) | ||
30 | |||
31 | A TLS/SSL connection established with these methods will only understand the | ||
32 | SSLv3 protocol. A client will send out SSLv3 client hello messages | ||
33 | and will indicate that it only understands SSLv3. A server will only understand | ||
34 | SSLv3 client hello messages. This especially means, that it will | ||
35 | not understand SSLv2 client hello messages which are widely used for | ||
36 | compatibility reasons, see SSLv23_*_method(). | ||
37 | |||
38 | =item TLSv1_method(void), TLSv1_server_method(void), TLSv1_client_method(void) | ||
39 | |||
40 | A TLS/SSL connection established with these methods will only understand the | ||
41 | TLSv1 protocol. A client will send out TLSv1 client hello messages | ||
42 | and will indicate that it only understands TLSv1. A server will only understand | ||
43 | TLSv1 client hello messages. This especially means, that it will | ||
44 | not understand SSLv2 client hello messages which are widely used for | ||
45 | compatibility reasons, see SSLv23_*_method(). It will also not understand | ||
46 | SSLv3 client hello messages. | ||
47 | |||
48 | =item SSLv23_method(void), SSLv23_server_method(void), SSLv23_client_method(void) | ||
49 | |||
50 | A TLS/SSL connection established with these methods may understand the | ||
51 | SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
52 | |||
53 | A client will send out TLSv1 client hello messages including extensions and | ||
54 | will indicate that it also understands TLSv1.1, TLSv1.2 and permits a | ||
55 | fallback to SSLv3. A server will support SSLv3, TLSv1, TLSv1.1 and TLSv1.2 | ||
56 | protocols. This is the best choice when compatibility is a concern. | ||
57 | |||
58 | =back | ||
59 | |||
60 | The list of protocols available can later be limited using the | ||
61 | SSL_OP_NO_SSLv3, SSL_OP_NO_TLSv1, SSL_OP_NO_TLSv1_1 and SSL_OP_NO_TLSv1_2 | ||
62 | options of the SSL_CTX_set_options() or SSL_set_options() functions. | ||
63 | Using these options it is possible to choose e.g. SSLv23_server_method() and | ||
64 | be able to negotiate with all possible clients, but to only allow newer | ||
65 | protocols like TLSv1, TLSv1.1 or TLS v1.2. | ||
66 | |||
67 | SSL_CTX_new() initializes the list of ciphers, the session cache setting, | ||
68 | the callbacks, the keys and certificates and the options to its default | ||
69 | values. | ||
70 | |||
71 | =head1 RETURN VALUES | ||
72 | |||
73 | The following return values can occur: | ||
74 | |||
75 | =over 4 | ||
76 | |||
77 | =item NULL | ||
78 | |||
79 | The creation of a new SSL_CTX object failed. Check the error stack to | ||
80 | find out the reason. | ||
81 | |||
82 | =item Pointer to an SSL_CTX object | ||
83 | |||
84 | The return value points to an allocated SSL_CTX object. | ||
85 | |||
86 | =back | ||
87 | |||
88 | =head1 SEE ALSO | ||
89 | |||
90 | L<SSL_CTX_free(3)|SSL_CTX_free(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
91 | L<ssl(3)|ssl(3)>, L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> | ||
92 | |||
93 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.3 new file mode 100644 index 0000000000..862576ca50 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.3 | |||
@@ -0,0 +1,101 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_NUMBER 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_number , | ||
6 | .Nm SSL_CTX_sess_connect , | ||
7 | .Nm SSL_CTX_sess_connect_good , | ||
8 | .Nm SSL_CTX_sess_connect_renegotiate , | ||
9 | .Nm SSL_CTX_sess_accept , | ||
10 | .Nm SSL_CTX_sess_accept_good , | ||
11 | .Nm SSL_CTX_sess_accept_renegotiate , | ||
12 | .Nm SSL_CTX_sess_hits , | ||
13 | .Nm SSL_CTX_sess_cb_hits , | ||
14 | .Nm SSL_CTX_sess_misses , | ||
15 | .Nm SSL_CTX_sess_timeouts , | ||
16 | .Nm SSL_CTX_sess_cache_full | ||
17 | .Nd obtain session cache statistics | ||
18 | .Sh SYNOPSIS | ||
19 | .In openssl/ssl.h | ||
20 | .Ft long | ||
21 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
22 | .Ft long | ||
23 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
24 | .Ft long | ||
25 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
26 | .Ft long | ||
27 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
28 | .Ft long | ||
29 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
30 | .Ft long | ||
31 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
32 | .Ft long | ||
33 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
34 | .Ft long | ||
35 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
36 | .Ft long | ||
37 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
38 | .Ft long | ||
39 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
40 | .Ft long | ||
41 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
42 | .Ft long | ||
43 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
44 | .Sh DESCRIPTION | ||
45 | .Fn SSL_CTX_sess_number | ||
46 | returns the current number of sessions in the internal session cache. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_sess_connect | ||
49 | returns the number of started SSL/TLS handshakes in client mode. | ||
50 | .Pp | ||
51 | .Fn SSL_CTX_sess_connect_good | ||
52 | returns the number of successfully established SSL/TLS sessions in client mode. | ||
53 | .Pp | ||
54 | .Fn SSL_CTX_sess_connect_renegotiate | ||
55 | returns the number of start renegotiations in client mode. | ||
56 | .Pp | ||
57 | .Fn SSL_CTX_sess_accept | ||
58 | returns the number of started SSL/TLS handshakes in server mode. | ||
59 | .Pp | ||
60 | .Fn SSL_CTX_sess_accept_good | ||
61 | returns the number of successfully established SSL/TLS sessions in server mode. | ||
62 | .Pp | ||
63 | .Fn SSL_CTX_sess_accept_renegotiate | ||
64 | returns the number of start renegotiations in server mode. | ||
65 | .Pp | ||
66 | .Fn SSL_CTX_sess_hits | ||
67 | returns the number of successfully reused sessions. | ||
68 | In client mode a session set with | ||
69 | .Xr SSL_set_session 3 | ||
70 | successfully reused is counted as a hit. | ||
71 | In server mode a session successfully retrieved from internal or external cache | ||
72 | is counted as a hit. | ||
73 | .Pp | ||
74 | .Fn SSL_CTX_sess_cb_hits | ||
75 | returns the number of successfully retrieved sessions from the external session | ||
76 | cache in server mode. | ||
77 | .Pp | ||
78 | .Fn SSL_CTX_sess_misses | ||
79 | returns the number of sessions proposed by clients that were not found in the | ||
80 | internal session cache in server mode. | ||
81 | .Pp | ||
82 | .Fn SSL_CTX_sess_timeouts | ||
83 | returns the number of sessions proposed by clients and either found in the | ||
84 | internal or external session cache in server mode, | ||
85 | but that were invalid due to timeout. | ||
86 | These sessions are not included in the | ||
87 | .Fn SSL_CTX_sess_hits | ||
88 | count. | ||
89 | .Pp | ||
90 | .Fn SSL_CTX_sess_cache_full | ||
91 | returns the number of sessions that were removed because the maximum session | ||
92 | cache size was exceeded. | ||
93 | .Sh RETURN VALUES | ||
94 | The functions return the values indicated in the | ||
95 | .Sx DESCRIPTION | ||
96 | section. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr ssl 3 , | ||
99 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
100 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
101 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.pod deleted file mode 100644 index f7192eb761..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_number.pod +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_sess_number, SSL_CTX_sess_connect, SSL_CTX_sess_connect_good, | ||
6 | SSL_CTX_sess_connect_renegotiate, SSL_CTX_sess_accept, | ||
7 | SSL_CTX_sess_accept_good, SSL_CTX_sess_accept_renegotiate, SSL_CTX_sess_hits, | ||
8 | SSL_CTX_sess_cb_hits, SSL_CTX_sess_misses, SSL_CTX_sess_timeouts, | ||
9 | SSL_CTX_sess_cache_full - obtain session cache statistics | ||
10 | |||
11 | =head1 SYNOPSIS | ||
12 | |||
13 | #include <openssl/ssl.h> | ||
14 | |||
15 | long SSL_CTX_sess_number(SSL_CTX *ctx); | ||
16 | long SSL_CTX_sess_connect(SSL_CTX *ctx); | ||
17 | long SSL_CTX_sess_connect_good(SSL_CTX *ctx); | ||
18 | long SSL_CTX_sess_connect_renegotiate(SSL_CTX *ctx); | ||
19 | long SSL_CTX_sess_accept(SSL_CTX *ctx); | ||
20 | long SSL_CTX_sess_accept_good(SSL_CTX *ctx); | ||
21 | long SSL_CTX_sess_accept_renegotiate(SSL_CTX *ctx); | ||
22 | long SSL_CTX_sess_hits(SSL_CTX *ctx); | ||
23 | long SSL_CTX_sess_cb_hits(SSL_CTX *ctx); | ||
24 | long SSL_CTX_sess_misses(SSL_CTX *ctx); | ||
25 | long SSL_CTX_sess_timeouts(SSL_CTX *ctx); | ||
26 | long SSL_CTX_sess_cache_full(SSL_CTX *ctx); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | SSL_CTX_sess_number() returns the current number of sessions in the internal | ||
31 | session cache. | ||
32 | |||
33 | SSL_CTX_sess_connect() returns the number of started SSL/TLS handshakes in | ||
34 | client mode. | ||
35 | |||
36 | SSL_CTX_sess_connect_good() returns the number of successfully established | ||
37 | SSL/TLS sessions in client mode. | ||
38 | |||
39 | SSL_CTX_sess_connect_renegotiate() returns the number of start renegotiations | ||
40 | in client mode. | ||
41 | |||
42 | SSL_CTX_sess_accept() returns the number of started SSL/TLS handshakes in | ||
43 | server mode. | ||
44 | |||
45 | SSL_CTX_sess_accept_good() returns the number of successfully established | ||
46 | SSL/TLS sessions in server mode. | ||
47 | |||
48 | SSL_CTX_sess_accept_renegotiate() returns the number of start renegotiations | ||
49 | in server mode. | ||
50 | |||
51 | SSL_CTX_sess_hits() returns the number of successfully reused sessions. | ||
52 | In client mode a session set with L<SSL_set_session(3)|SSL_set_session(3)> | ||
53 | successfully reused is counted as a hit. In server mode a session successfully | ||
54 | retrieved from internal or external cache is counted as a hit. | ||
55 | |||
56 | SSL_CTX_sess_cb_hits() returns the number of successfully retrieved sessions | ||
57 | from the external session cache in server mode. | ||
58 | |||
59 | SSL_CTX_sess_misses() returns the number of sessions proposed by clients | ||
60 | that were not found in the internal session cache in server mode. | ||
61 | |||
62 | SSL_CTX_sess_timeouts() returns the number of sessions proposed by clients | ||
63 | and either found in the internal or external session cache in server mode, | ||
64 | but that were invalid due to timeout. These sessions are not included in | ||
65 | the SSL_CTX_sess_hits() count. | ||
66 | |||
67 | SSL_CTX_sess_cache_full() returns the number of sessions that were removed | ||
68 | because the maximum session cache size was exceeded. | ||
69 | |||
70 | =head1 RETURN VALUES | ||
71 | |||
72 | The functions return the values indicated in the DESCRIPTION section. | ||
73 | |||
74 | =head1 SEE ALSO | ||
75 | |||
76 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, | ||
77 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | ||
78 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)> | ||
79 | |||
80 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.3 new file mode 100644 index 0000000000..ad434e8496 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.3 | |||
@@ -0,0 +1,52 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_set_cache_size , | ||
6 | .Nm SSL_CTX_sess_get_cache_size | ||
7 | .Nd manipulate session cache size | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_sess_set_cache_size | ||
16 | sets the size of the internal session cache of context | ||
17 | .Fa ctx | ||
18 | to | ||
19 | .Fa t . | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_sess_get_cache_size | ||
22 | returns the currently valid session cache size. | ||
23 | .Sh NOTES | ||
24 | The internal session cache size is | ||
25 | .Dv SSL_SESSION_CACHE_MAX_SIZE_DEFAULT , | ||
26 | currently 1024\(mu20, so that up to 20000 sessions can be held. | ||
27 | This size can be modified using the | ||
28 | .Fn SSL_CTX_sess_set_cache_size | ||
29 | call. | ||
30 | A special case is the size 0, which is used for unlimited size. | ||
31 | .Pp | ||
32 | When the maximum number of sessions is reached, | ||
33 | no more new sessions are added to the cache. | ||
34 | New space may be added by calling | ||
35 | .Xr SSL_CTX_flush_sessions 3 | ||
36 | to remove expired sessions. | ||
37 | .Pp | ||
38 | If the size of the session cache is reduced and more sessions are already in | ||
39 | the session cache, | ||
40 | old session will be removed the next time a session shall be added. | ||
41 | This removal is not synchronized with the expiration of sessions. | ||
42 | .Sh RETURN VALUES | ||
43 | .Fn SSL_CTX_sess_set_cache_size | ||
44 | returns the previously valid size. | ||
45 | .Pp | ||
46 | .Fn SSL_CTX_sess_get_cache_size | ||
47 | returns the currently valid size. | ||
48 | .Sh SEE ALSO | ||
49 | .Xr ssl 3 , | ||
50 | .Xr SSL_CTX_flush_sessions 3 , | ||
51 | .Xr SSL_CTX_sess_number 3 , | ||
52 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.pod deleted file mode 100644 index a8d1bd5e3f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_cache_size.pod +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_sess_set_cache_size, SSL_CTX_sess_get_cache_size - manipulate session | ||
6 | cache size | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_sess_set_cache_size(SSL_CTX *ctx, long t); | ||
13 | long SSL_CTX_sess_get_cache_size(SSL_CTX *ctx); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_sess_set_cache_size() sets the size of the internal session cache | ||
18 | of context B<ctx> to B<t>. | ||
19 | |||
20 | SSL_CTX_sess_get_cache_size() returns the currently valid session cache size. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The internal session cache size is SSL_SESSION_CACHE_MAX_SIZE_DEFAULT, | ||
25 | currently 1024*20, so that up to 20000 sessions can be held. This size | ||
26 | can be modified using the SSL_CTX_sess_set_cache_size() call. A special | ||
27 | case is the size 0, which is used for unlimited size. | ||
28 | |||
29 | When the maximum number of sessions is reached, no more new sessions are | ||
30 | added to the cache. New space may be added by calling | ||
31 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> to remove | ||
32 | expired sessions. | ||
33 | |||
34 | If the size of the session cache is reduced and more sessions are already | ||
35 | in the session cache, old session will be removed at the next time a | ||
36 | session shall be added. This removal is not synchronized with the | ||
37 | expiration of sessions. | ||
38 | |||
39 | =head1 RETURN VALUES | ||
40 | |||
41 | SSL_CTX_sess_set_cache_size() returns the previously valid size. | ||
42 | |||
43 | SSL_CTX_sess_get_cache_size() returns the currently valid size. | ||
44 | |||
45 | =head1 SEE ALSO | ||
46 | |||
47 | L<ssl(3)|ssl(3)>, | ||
48 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
49 | L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, | ||
50 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.3 new file mode 100644 index 0000000000..d5c506cec8 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.3 | |||
@@ -0,0 +1,156 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESS_SET_GET_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sess_set_new_cb , | ||
6 | .Nm SSL_CTX_sess_set_remove_cb , | ||
7 | .Nm SSL_CTX_sess_set_get_cb , | ||
8 | .Nm SSL_CTX_sess_get_new_cb , | ||
9 | .Nm SSL_CTX_sess_get_remove_cb , | ||
10 | .Nm SSL_CTX_sess_get_get_cb | ||
11 | .Nd provide callback functions for server side external session caching | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft void | ||
15 | .Fo SSL_CTX_sess_set_new_cb | ||
16 | .Fa "SSL_CTX *ctx" | ||
17 | .Fa "int (*new_session_cb)(SSL *, SSL_SESSION *)" | ||
18 | .Fc | ||
19 | .Ft void | ||
20 | .Fo SSL_CTX_sess_set_remove_cb | ||
21 | .Fa "SSL_CTX *ctx" | ||
22 | .Fa "void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fo SSL_CTX_sess_set_get_cb | ||
26 | .Fa "SSL_CTX *ctx" | ||
27 | .Fa "SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)" | ||
28 | .Fc | ||
29 | .Ft int | ||
30 | .Fo "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" | ||
31 | .Fa "struct ssl_st *ssl" | ||
32 | .Fa "SSL_SESSION *sess" | ||
33 | .Fc | ||
34 | .Ft void | ||
35 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
36 | .Fa "struct ssl_ctx_st *ctx" | ||
37 | .Fa "SSL_SESSION *sess" | ||
38 | .Fc | ||
39 | .Ft SSL_SESSION * | ||
40 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
41 | .Fa "struct ssl_st *ssl" | ||
42 | .Fa "unsigned char *data" | ||
43 | .Fa "int len" | ||
44 | .Fa "int *copy" | ||
45 | .Fc | ||
46 | .Ft int | ||
47 | .Fo "(*new_session_cb)" | ||
48 | .Fa "struct ssl_st *ssl" | ||
49 | .Fa "SSL_SESSION *sess" | ||
50 | .Fc | ||
51 | .Ft void | ||
52 | .Fo "(*remove_session_cb)" | ||
53 | .Fa "struct ssl_ctx_st *ctx" | ||
54 | .Fa "SSL_SESSION *sess" | ||
55 | .Fc | ||
56 | .Ft SSL_SESSION * | ||
57 | .Fo "(*get_session_cb)" | ||
58 | .Fa "struct ssl_st *ssl" | ||
59 | .Fa "unsigned char *data" | ||
60 | .Fa "int len" | ||
61 | .Fa "int *copy" | ||
62 | .Fc | ||
63 | .Sh DESCRIPTION | ||
64 | .Fn SSL_CTX_sess_set_new_cb | ||
65 | sets the callback function which is automatically called whenever a new session | ||
66 | was negotiated. | ||
67 | .Pp | ||
68 | .Fn SSL_CTX_sess_set_remove_cb | ||
69 | sets the callback function which is automatically called whenever a session is | ||
70 | removed by the SSL engine (because it is considered faulty or the session has | ||
71 | become obsolete because of exceeding the timeout value). | ||
72 | .Pp | ||
73 | .Fn SSL_CTX_sess_set_get_cb | ||
74 | sets the callback function which is called whenever a SSL/TLS client proposes | ||
75 | to resume a session but the session cannot be found in the internal session | ||
76 | cache (see | ||
77 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
78 | (SSL/TLS server only.) | ||
79 | .Pp | ||
80 | .Fn SSL_CTX_sess_get_new_cb , | ||
81 | .Fn SSL_CTX_sess_get_remove_cb , | ||
82 | and | ||
83 | .Fn SSL_CTX_sess_get_get_cb | ||
84 | retrieve the function pointers of the provided callback functions. | ||
85 | If a callback function has not been set, the | ||
86 | .Dv NULL | ||
87 | pointer is returned. | ||
88 | .Sh NOTES | ||
89 | In order to allow external session caching, synchronization with the internal | ||
90 | session cache is realized via callback functions. | ||
91 | Inside these callback functions, session can be saved to disk or put into a | ||
92 | database using the | ||
93 | .Xr d2i_SSL_SESSION 3 | ||
94 | interface. | ||
95 | .Pp | ||
96 | The | ||
97 | .Fn new_session_cb | ||
98 | function is called whenever a new session has been negotiated and session | ||
99 | caching is enabled (see | ||
100 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
101 | The | ||
102 | .Fn new_session_cb | ||
103 | is passed the | ||
104 | .Fa ssl | ||
105 | connection and the ssl session | ||
106 | .Fa sess . | ||
107 | If the callback returns 0, the session will be immediately removed again. | ||
108 | .Pp | ||
109 | The | ||
110 | .Fn remove_session_cb | ||
111 | is called whenever the SSL engine removes a session from the internal cache. | ||
112 | This happens when the session is removed because it is expired or when a | ||
113 | connection was not shut down cleanly. | ||
114 | It also happens for all sessions in the internal session cache when | ||
115 | .Xr SSL_CTX_free 3 | ||
116 | is called. | ||
117 | The | ||
118 | .Fn remove_session_cb | ||
119 | function is passed the | ||
120 | .Fa ctx | ||
121 | and the | ||
122 | .Vt ssl | ||
123 | session | ||
124 | .Fa sess . | ||
125 | It does not provide any feedback. | ||
126 | .Pp | ||
127 | The | ||
128 | .Fn get_session_cb | ||
129 | function is only called on SSL/TLS servers with the session id proposed by the | ||
130 | client. | ||
131 | The | ||
132 | .Fn get_session_cb | ||
133 | function is always called, also when session caching was disabled. | ||
134 | The | ||
135 | .Fn get_session_cb | ||
136 | is passed the | ||
137 | .Fa ssl | ||
138 | connection, the session id of length | ||
139 | .Fa length | ||
140 | at the memory location | ||
141 | .Fa data . | ||
142 | With the parameter | ||
143 | .Fa copy | ||
144 | the callback can require the SSL engine to increment the reference count of the | ||
145 | .Vt SSL_SESSION | ||
146 | object, | ||
147 | Normally the reference count is not incremented and therefore the session must | ||
148 | not be explicitly freed with | ||
149 | .Xr SSL_SESSION_free 3 . | ||
150 | .Sh SEE ALSO | ||
151 | .Xr d2i_SSL_SESSION 3 , | ||
152 | .Xr ssl 3 , | ||
153 | .Xr SSL_CTX_flush_sessions 3 , | ||
154 | .Xr SSL_CTX_free 3 , | ||
155 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
156 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod deleted file mode 100644 index d39c088e7c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_sess_set_get_cb.pod +++ /dev/null | |||
@@ -1,89 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_sess_set_new_cb, SSL_CTX_sess_set_remove_cb, SSL_CTX_sess_set_get_cb, | ||
6 | SSL_CTX_sess_get_new_cb, SSL_CTX_sess_get_remove_cb, SSL_CTX_sess_get_get_cb - | ||
7 | provide callback functions for server side external session caching | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | void SSL_CTX_sess_set_new_cb(SSL_CTX *ctx, | ||
14 | int (*new_session_cb)(SSL *, SSL_SESSION *)); | ||
15 | void SSL_CTX_sess_set_remove_cb(SSL_CTX *ctx, | ||
16 | void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)); | ||
17 | void SSL_CTX_sess_set_get_cb(SSL_CTX *ctx, | ||
18 | SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)); | ||
19 | |||
20 | int (*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))(struct ssl_st *ssl, SSL_SESSION *sess); | ||
21 | void (*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))(struct ssl_ctx_st *ctx, SSL_SESSION *sess); | ||
22 | SSL_SESSION *(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))(struct ssl_st *ssl, unsigned char *data, int len, int *copy); | ||
23 | |||
24 | int (*new_session_cb)(struct ssl_st *ssl, SSL_SESSION *sess); | ||
25 | void (*remove_session_cb)(struct ssl_ctx_st *ctx, SSL_SESSION *sess); | ||
26 | SSL_SESSION *(*get_session_cb)(struct ssl_st *ssl, unsigned char *data, | ||
27 | int len, int *copy); | ||
28 | |||
29 | =head1 DESCRIPTION | ||
30 | |||
31 | SSL_CTX_sess_set_new_cb() sets the callback function, which is automatically | ||
32 | called whenever a new session was negotiated. | ||
33 | |||
34 | SSL_CTX_sess_set_remove_cb() sets the callback function, which is | ||
35 | automatically called whenever a session is removed by the SSL engine, | ||
36 | because it is considered faulty or the session has become obsolete because | ||
37 | of exceeding the timeout value. | ||
38 | |||
39 | SSL_CTX_sess_set_get_cb() sets the callback function which is called, | ||
40 | whenever a SSL/TLS client proposed to resume a session but the session | ||
41 | could not be found in the internal session cache (see | ||
42 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>). | ||
43 | (SSL/TLS server only.) | ||
44 | |||
45 | SSL_CTX_sess_get_new_cb(), SSL_CTX_sess_get_remove_cb(), and | ||
46 | SSL_CTX_sess_get_get_cb() allow to retrieve the function pointers of the | ||
47 | provided callback functions. If a callback function has not been set, | ||
48 | the NULL pointer is returned. | ||
49 | |||
50 | =head1 NOTES | ||
51 | |||
52 | In order to allow external session caching, synchronization with the internal | ||
53 | session cache is realized via callback functions. Inside these callback | ||
54 | functions, session can be saved to disk or put into a database using the | ||
55 | L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> interface. | ||
56 | |||
57 | The new_session_cb() is called, whenever a new session has been negotiated | ||
58 | and session caching is enabled (see | ||
59 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>). | ||
60 | The new_session_cb() is passed the B<ssl> connection and the ssl session | ||
61 | B<sess>. If the callback returns B<0>, the session will be immediately | ||
62 | removed again. | ||
63 | |||
64 | The remove_session_cb() is called, whenever the SSL engine removes a session | ||
65 | from the internal cache. This happens when the session is removed because | ||
66 | it is expired or when a connection was not shutdown cleanly. It also happens | ||
67 | for all sessions in the internal session cache when | ||
68 | L<SSL_CTX_free(3)|SSL_CTX_free(3)> is called. The remove_session_cb() is passed | ||
69 | the B<ctx> and the ssl session B<sess>. It does not provide any feedback. | ||
70 | |||
71 | The get_session_cb() is only called on SSL/TLS servers with the session id | ||
72 | proposed by the client. The get_session_cb() is always called, also when | ||
73 | session caching was disabled. The get_session_cb() is passed the | ||
74 | B<ssl> connection, the session id of length B<length> at the memory location | ||
75 | B<data>. With the parameter B<copy> the callback can require the | ||
76 | SSL engine to increment the reference count of the SSL_SESSION object, | ||
77 | Normally the reference count is not incremented and therefore the | ||
78 | session must not be explicitly freed with | ||
79 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>. | ||
80 | |||
81 | =head1 SEE ALSO | ||
82 | |||
83 | L<ssl(3)|ssl(3)>, L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>, | ||
84 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
85 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
86 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
87 | L<SSL_CTX_free(3)|SSL_CTX_free(3)> | ||
88 | |||
89 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.3 new file mode 100644 index 0000000000..96aa018289 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.3 | |||
@@ -0,0 +1,31 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SESSIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_sessions | ||
6 | .Nd access internal session cache | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft struct lhash_st * | ||
10 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_CTX_sessions | ||
13 | returns a pointer to the lhash databases containing the internal session cache | ||
14 | for | ||
15 | .Fa ctx . | ||
16 | .Sh NOTES | ||
17 | The sessions in the internal session cache are kept in an | ||
18 | .Xr lhash 3 | ||
19 | type database. | ||
20 | It is possible to directly access this database, e.g., for searching. | ||
21 | In parallel, | ||
22 | the sessions form a linked list which is maintained separately from the | ||
23 | .Xr lhash 3 | ||
24 | operations, so that the database must not be modified directly but by using the | ||
25 | .Xr SSL_CTX_add_session 3 | ||
26 | family of functions. | ||
27 | .Sh SEE ALSO | ||
28 | .Xr lhash 3 , | ||
29 | .Xr ssl 3 , | ||
30 | .Xr SSL_CTX_add_session 3 , | ||
31 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.pod deleted file mode 100644 index e05aab3c1b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_sessions.pod +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_sessions - access internal session cache | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | struct lhash_st *SSL_CTX_sessions(SSL_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_sessions() returns a pointer to the lhash databases containing the | ||
16 | internal session cache for B<ctx>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | The sessions in the internal session cache are kept in an | ||
21 | L<lhash(3)|lhash(3)> type database. It is possible to directly | ||
22 | access this database e.g. for searching. In parallel, the sessions | ||
23 | form a linked list which is maintained separately from the | ||
24 | L<lhash(3)|lhash(3)> operations, so that the database must not be | ||
25 | modified directly but by using the | ||
26 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)> family of functions. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<ssl(3)|ssl(3)>, L<lhash(3)|lhash(3)>, | ||
31 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, | ||
32 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.3 new file mode 100644 index 0000000000..f80670ce78 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.3 | |||
@@ -0,0 +1,77 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CERT_STORE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cert_store , | ||
6 | .Nm SSL_CTX_get_cert_store | ||
7 | .Nd manipulate X509 certificate verification storage | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" | ||
12 | .Ft X509_STORE * | ||
13 | .Fn SSL_CTX_get_cert_store "const SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_cert_store | ||
16 | setsthe verification storage of | ||
17 | .Fa ctx | ||
18 | to or replaces it with | ||
19 | .Fa store . | ||
20 | If another | ||
21 | .Vt X509_STORE | ||
22 | object is currently set in | ||
23 | .Fa ctx , | ||
24 | it will be | ||
25 | .Xr X509_STORE_free 3 Ns ed. | ||
26 | .Pp | ||
27 | .Fn SSL_CTX_get_cert_store | ||
28 | returns a pointer to the current certificate verification storage. | ||
29 | .Sh NOTES | ||
30 | In order to verify the certificates presented by the peer, trusted CA | ||
31 | certificates must be accessed. | ||
32 | These CA certificates are made available via lookup methods, handled inside the | ||
33 | .Vt X509_STORE . | ||
34 | From the | ||
35 | .Vt X509_STORE | ||
36 | the | ||
37 | .Vt X509_STORE_CTX | ||
38 | used when verifying certificates is created. | ||
39 | .Pp | ||
40 | Typically the trusted certificate store is handled indirectly via using | ||
41 | .Xr SSL_CTX_load_verify_locations 3 . | ||
42 | Using the | ||
43 | .Fn SSL_CTX_set_cert_store | ||
44 | and | ||
45 | .Fn SSL_CTX_get_cert_store | ||
46 | functions it is possible to manipulate the | ||
47 | .Vt X509_STORE | ||
48 | object beyond the | ||
49 | .Xr SSL_CTX_load_verify_locations 3 | ||
50 | call. | ||
51 | .Pp | ||
52 | Currently no detailed documentation on how to use the | ||
53 | .Vt X509_STORE | ||
54 | object is available. | ||
55 | Not all members of the | ||
56 | .Vt X509_STORE | ||
57 | are used when the verification takes place. | ||
58 | So will, for example, the | ||
59 | .Fn verify_callback | ||
60 | be overridden with the | ||
61 | .Fn verify_callback | ||
62 | set via the | ||
63 | .Xr SSL_CTX_set_verify 3 | ||
64 | family of functions. | ||
65 | This document must therefore be updated when documentation about the | ||
66 | .Vt X509_STORE | ||
67 | object and its handling becomes available. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_CTX_set_cert_store | ||
70 | does not return diagnostic output. | ||
71 | .Pp | ||
72 | .Fn SSL_CTX_get_cert_store | ||
73 | returns the current setting. | ||
74 | .Sh SEE ALSO | ||
75 | .Xr ssl 3 , | ||
76 | .Xr SSL_CTX_load_verify_locations 3 , | ||
77 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod deleted file mode 100644 index 2f3980fded..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_store.pod +++ /dev/null | |||
@@ -1,58 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cert_store, SSL_CTX_get_cert_store - manipulate X509 certificate | ||
6 | verification storage | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_cert_store(SSL_CTX *ctx, X509_STORE *store); | ||
13 | X509_STORE *SSL_CTX_get_cert_store(const SSL_CTX *ctx); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_cert_store() sets/replaces the certificate verification storage | ||
18 | of B<ctx> to/with B<store>. If another X509_STORE object is currently | ||
19 | set in B<ctx>, it will be X509_STORE_free()ed. | ||
20 | |||
21 | SSL_CTX_get_cert_store() returns a pointer to the current certificate | ||
22 | verification storage. | ||
23 | |||
24 | =head1 NOTES | ||
25 | |||
26 | In order to verify the certificates presented by the peer, trusted CA | ||
27 | certificates must be accessed. These CA certificates are made available | ||
28 | via lookup methods, handled inside the X509_STORE. From the X509_STORE | ||
29 | the X509_STORE_CTX used when verifying certificates is created. | ||
30 | |||
31 | Typically the trusted certificate store is handled indirectly via using | ||
32 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. | ||
33 | Using the SSL_CTX_set_cert_store() and SSL_CTX_get_cert_store() functions | ||
34 | it is possible to manipulate the X509_STORE object beyond the | ||
35 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
36 | call. | ||
37 | |||
38 | Currently no detailed documentation on how to use the X509_STORE | ||
39 | object is available. Not all members of the X509_STORE are used when | ||
40 | the verification takes place. So will e.g. the verify_callback() be | ||
41 | overridden with the verify_callback() set via the | ||
42 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> family of functions. | ||
43 | This document must therefore be updated when documentation about the | ||
44 | X509_STORE object and its handling becomes available. | ||
45 | |||
46 | =head1 RETURN VALUES | ||
47 | |||
48 | SSL_CTX_set_cert_store() does not return diagnostic output. | ||
49 | |||
50 | SSL_CTX_get_cert_store() returns the current setting. | ||
51 | |||
52 | =head1 SEE ALSO | ||
53 | |||
54 | L<ssl(3)|ssl(3)>, | ||
55 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | ||
56 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
57 | |||
58 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.3 new file mode 100644 index 0000000000..b34d3a6003 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.3 | |||
@@ -0,0 +1,109 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cert_verify_callback | ||
6 | .Nd set peer certificate verification procedure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fo SSL_CTX_set_cert_verify_callback | ||
11 | .Fa "SSL_CTX *ctx" | ||
12 | .Fa "int (*callback)(X509_STORE_CTX *, void *)" | ||
13 | .Fa "void *arg" | ||
14 | .Fc | ||
15 | .Sh DESCRIPTION | ||
16 | .Fn SSL_CTX_set_cert_verify_callback | ||
17 | sets the verification callback function for | ||
18 | .Fa ctx . | ||
19 | .Vt SSL | ||
20 | objects that are created from | ||
21 | .Fa ctx | ||
22 | inherit the setting valid at the time when | ||
23 | .Xr SSL_new 3 | ||
24 | is called. | ||
25 | .Sh NOTES | ||
26 | Whenever a certificate is verified during a SSL/TLS handshake, | ||
27 | a verification function is called. | ||
28 | If the application does not explicitly specify a verification callback | ||
29 | function, the built-in verification function is used. | ||
30 | If a verification callback | ||
31 | .Fa callback | ||
32 | is specified via | ||
33 | .Fn SSL_CTX_set_cert_verify_callback , | ||
34 | the supplied callback function is called instead. | ||
35 | By setting | ||
36 | .Fa callback | ||
37 | to | ||
38 | .Dv NULL , | ||
39 | the default behaviour is restored. | ||
40 | .Pp | ||
41 | When the verification must be performed, | ||
42 | .Fa callback | ||
43 | will be called with the arguments | ||
44 | .Fn callback "X509_STORE_CTX *x509_store_ctx" "void *arg" . | ||
45 | The argument | ||
46 | .Fa arg | ||
47 | is specified by the application when setting | ||
48 | .Fa callback . | ||
49 | .Pp | ||
50 | .Fa callback | ||
51 | should return 1 to indicate verification success and 0 to indicate verification | ||
52 | failure. | ||
53 | If | ||
54 | .Dv SSL_VERIFY_PEER | ||
55 | is set and | ||
56 | .Fa callback | ||
57 | returns 0, the handshake will fail. | ||
58 | As the verification procedure may allow the connection to continue in case of | ||
59 | failure (by always returning 1) the verification result must be set in any case | ||
60 | using the | ||
61 | .Fa error | ||
62 | member of | ||
63 | .Fa x509_store_ctx | ||
64 | so that the calling application will be informed about the detailed result of | ||
65 | the verification procedure! | ||
66 | .Pp | ||
67 | Within | ||
68 | .Fa x509_store_ctx , | ||
69 | .Fa callback | ||
70 | has access to the | ||
71 | .Fa verify_callback | ||
72 | function set using | ||
73 | .Xr SSL_CTX_set_verify 3 . | ||
74 | .Sh WARNINGS | ||
75 | Do not mix the verification callback described in this function with the | ||
76 | .Fa verify_callback | ||
77 | function called during the verification process. | ||
78 | The latter is set using the | ||
79 | .Xr SSL_CTX_set_verify 3 | ||
80 | family of functions. | ||
81 | .Pp | ||
82 | Providing a complete verification procedure including certificate purpose | ||
83 | settings, etc., is a complex task. | ||
84 | The built-in procedure is quite powerful and in most cases it should be | ||
85 | sufficient to modify its behaviour using the | ||
86 | .Fa verify_callback | ||
87 | function. | ||
88 | .Sh RETURN VALUES | ||
89 | .Fn SSL_CTX_set_cert_verify_callback | ||
90 | does not provide diagnostic information. | ||
91 | .Sh SEE ALSO | ||
92 | .Xr ssl 3 , | ||
93 | .Xr SSL_CTX_load_verify_locations 3 , | ||
94 | .Xr SSL_CTX_set_verify 3 , | ||
95 | .Xr SSL_get_verify_result 3 | ||
96 | .Sh HISTORY | ||
97 | Previous to OpenSSL 0.9.7, the | ||
98 | .Fa arg | ||
99 | argument to | ||
100 | .Fn SSL_CTX_set_cert_verify_callback | ||
101 | was ignored, and | ||
102 | .Fa callback | ||
103 | was called | ||
104 | simply as | ||
105 | .Ft int | ||
106 | .Fn (*callback) "X509_STORE_CTX *" . | ||
107 | To compile software written for previous versions of OpenSSL, | ||
108 | a dummy argument will have to be added to | ||
109 | .Fa callback . | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod deleted file mode 100644 index 713b223a63..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cert_verify_callback.pod +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cert_verify_callback - set peer certificate verification procedure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_CTX_set_cert_verify_callback(SSL_CTX *ctx, int (*callback)(X509_STORE_CTX *,void *), void *arg); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_CTX_set_cert_verify_callback() sets the verification callback function for | ||
16 | I<ctx>. SSL objects that are created from I<ctx> inherit the setting valid at | ||
17 | the time when L<SSL_new(3)|SSL_new(3)> is called. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | Whenever a certificate is verified during a SSL/TLS handshake, a verification | ||
22 | function is called. If the application does not explicitly specify a | ||
23 | verification callback function, the built-in verification function is used. | ||
24 | If a verification callback I<callback> is specified via | ||
25 | SSL_CTX_set_cert_verify_callback(), the supplied callback function is called | ||
26 | instead. By setting I<callback> to NULL, the default behaviour is restored. | ||
27 | |||
28 | When the verification must be performed, I<callback> will be called with | ||
29 | the arguments callback(X509_STORE_CTX *x509_store_ctx, void *arg). The | ||
30 | argument I<arg> is specified by the application when setting I<callback>. | ||
31 | |||
32 | I<callback> should return 1 to indicate verification success and 0 to | ||
33 | indicate verification failure. If SSL_VERIFY_PEER is set and I<callback> | ||
34 | returns 0, the handshake will fail. As the verification procedure may | ||
35 | allow to continue the connection in case of failure (by always returning 1) | ||
36 | the verification result must be set in any case using the B<error> | ||
37 | member of I<x509_store_ctx> so that the calling application will be informed | ||
38 | about the detailed result of the verification procedure! | ||
39 | |||
40 | Within I<x509_store_ctx>, I<callback> has access to the I<verify_callback> | ||
41 | function set using L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>. | ||
42 | |||
43 | =head1 WARNINGS | ||
44 | |||
45 | Do not mix the verification callback described in this function with the | ||
46 | B<verify_callback> function called during the verification process. The | ||
47 | latter is set using the L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
48 | family of functions. | ||
49 | |||
50 | Providing a complete verification procedure including certificate purpose | ||
51 | settings etc is a complex task. The built-in procedure is quite powerful | ||
52 | and in most cases it should be sufficient to modify its behaviour using | ||
53 | the B<verify_callback> function. | ||
54 | |||
55 | =head1 BUGS | ||
56 | |||
57 | =head1 RETURN VALUES | ||
58 | |||
59 | SSL_CTX_set_cert_verify_callback() does not provide diagnostic information. | ||
60 | |||
61 | =head1 SEE ALSO | ||
62 | |||
63 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | ||
64 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
65 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
66 | |||
67 | =head1 HISTORY | ||
68 | |||
69 | Previous to OpenSSL 0.9.7, the I<arg> argument to | ||
70 | B<SSL_CTX_set_cert_verify_callback> was ignored, and I<callback> was called | ||
71 | simply as int (*callback)(X509_STORE_CTX *) To compile software written for | ||
72 | previous versions of OpenSSL, a dummy argument will have to be added to | ||
73 | I<callback>. | ||
74 | |||
75 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.3 new file mode 100644 index 0000000000..c3ee5304e3 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.3 | |||
@@ -0,0 +1,79 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CIPHER_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_cipher_list , | ||
6 | .Nm SSL_set_cipher_list | ||
7 | .Nd choose list of available SSL_CIPHERs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft int | ||
11 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *str" | ||
12 | .Ft int | ||
13 | .Fn SSL_set_cipher_list "SSL *ssl" "const char *str" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_cipher_list | ||
16 | sets the list of available ciphers for | ||
17 | .Fa ctx | ||
18 | using the control string | ||
19 | .Fa str . | ||
20 | The format of the string is described | ||
21 | in | ||
22 | .Xr ciphers 1 . | ||
23 | The list of ciphers is inherited by all | ||
24 | .Fa ssl | ||
25 | objects created from | ||
26 | .Fa ctx . | ||
27 | .Pp | ||
28 | .Fn SSL_set_cipher_list | ||
29 | sets the list of ciphers only for | ||
30 | .Fa ssl . | ||
31 | .Sh NOTES | ||
32 | The control string | ||
33 | .Fa str | ||
34 | should be universally usable and not depend on details of the library | ||
35 | configuration (ciphers compiled in). | ||
36 | Thus no syntax checking takes place. | ||
37 | Items that are not recognized, because the corresponding ciphers are not | ||
38 | compiled in or because they are mistyped, are simply ignored. | ||
39 | Failure is only flagged if no ciphers could be collected at all. | ||
40 | .Pp | ||
41 | It should be noted that inclusion of a cipher to be used into the list is a | ||
42 | necessary condition. | ||
43 | On the client side, the inclusion into the list is also sufficient. | ||
44 | On the server side, additional restrictions apply. | ||
45 | All ciphers have additional requirements. | ||
46 | ADH ciphers don't need a certificate, but DH-parameters must have been set. | ||
47 | All other ciphers need a corresponding certificate and key. | ||
48 | .Pp | ||
49 | A RSA cipher can only be chosen when a RSA certificate is available. | ||
50 | RSA export ciphers with a keylength of 512 bits for the RSA key require a | ||
51 | temporary 512 bit RSA key, as typically the supplied key has a length of 1024 | ||
52 | bits (see | ||
53 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
54 | RSA ciphers using EDH need a certificate and key and additional DH-parameters | ||
55 | (see | ||
56 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
57 | .Pp | ||
58 | A DSA cipher can only be chosen when a DSA certificate is available. | ||
59 | DSA ciphers always use DH key exchange and therefore need DH-parameters (see | ||
60 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
61 | .Pp | ||
62 | When these conditions are not met for any cipher in the list (for example, a | ||
63 | client only supports export RSA ciphers with an asymmetric key length of 512 | ||
64 | bits and the server is not configured to use temporary RSA keys), the | ||
65 | .Dq no shared cipher | ||
66 | .Pq Dv SSL_R_NO_SHARED_CIPHER | ||
67 | error is generated and the handshake will fail. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_CTX_set_cipher_list | ||
70 | and | ||
71 | .Fn SSL_set_cipher_list | ||
72 | return 1 if any cipher could be selected and 0 on complete failure. | ||
73 | .Sh SEE ALSO | ||
74 | .Xr ciphers 1 , | ||
75 | .Xr ssl 3 , | ||
76 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
77 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
78 | .Xr SSL_CTX_use_certificate 3 , | ||
79 | .Xr SSL_get_ciphers 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod deleted file mode 100644 index 83e9c6b7e3..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_cipher_list.pod +++ /dev/null | |||
@@ -1,71 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_cipher_list, SSL_set_cipher_list - choose list of available | ||
6 | SSL_CIPHERs | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_set_cipher_list(SSL_CTX *ctx, const char *str); | ||
13 | int SSL_set_cipher_list(SSL *ssl, const char *str); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_cipher_list() sets the list of available ciphers for B<ctx> | ||
18 | using the control string B<str>. The format of the string is described | ||
19 | in L<ciphers(1)|ciphers(1)>. The list of ciphers is inherited by all | ||
20 | B<ssl> objects created from B<ctx>. | ||
21 | |||
22 | SSL_set_cipher_list() sets the list of ciphers only for B<ssl>. | ||
23 | |||
24 | =head1 NOTES | ||
25 | |||
26 | The control string B<str> should be universally usable and not depend | ||
27 | on details of the library configuration (ciphers compiled in). Thus no | ||
28 | syntax checking takes place. Items that are not recognized, because the | ||
29 | corresponding ciphers are not compiled in or because they are mistyped, | ||
30 | are simply ignored. Failure is only flagged if no ciphers could be collected | ||
31 | at all. | ||
32 | |||
33 | It should be noted, that inclusion of a cipher to be used into the list is | ||
34 | a necessary condition. On the client side, the inclusion into the list is | ||
35 | also sufficient. On the server side, additional restrictions apply. All ciphers | ||
36 | have additional requirements. ADH ciphers don't need a certificate, but | ||
37 | DH-parameters must have been set. All other ciphers need a corresponding | ||
38 | certificate and key. | ||
39 | |||
40 | A RSA cipher can only be chosen, when a RSA certificate is available. | ||
41 | RSA export ciphers with a keylength of 512 bits for the RSA key require | ||
42 | a temporary 512 bit RSA key, as typically the supplied key has a length | ||
43 | of 1024 bit (see | ||
44 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). | ||
45 | RSA ciphers using EDH need a certificate and key and additional DH-parameters | ||
46 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
47 | |||
48 | A DSA cipher can only be chosen, when a DSA certificate is available. | ||
49 | DSA ciphers always use DH key exchange and therefore need DH-parameters | ||
50 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
51 | |||
52 | When these conditions are not met for any cipher in the list (e.g. a | ||
53 | client only supports export RSA ciphers with a asymmetric key length | ||
54 | of 512 bits and the server is not configured to use temporary RSA | ||
55 | keys), the "no shared cipher" (SSL_R_NO_SHARED_CIPHER) error is generated | ||
56 | and the handshake will fail. | ||
57 | |||
58 | =head1 RETURN VALUES | ||
59 | |||
60 | SSL_CTX_set_cipher_list() and SSL_set_cipher_list() return 1 if any cipher | ||
61 | could be selected and 0 on complete failure. | ||
62 | |||
63 | =head1 SEE ALSO | ||
64 | |||
65 | L<ssl(3)|ssl(3)>, L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | ||
66 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
67 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
68 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
69 | L<ciphers(1)|ciphers(1)> | ||
70 | |||
71 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.3 new file mode 100644 index 0000000000..5d6fa9bea1 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.3 | |||
@@ -0,0 +1,129 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CLIENT_CA_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_client_CA_list , | ||
6 | .Nm SSL_set_client_CA_list , | ||
7 | .Nm SSL_CTX_add_client_CA , | ||
8 | .Nm SSL_add_client_CA | ||
9 | .Nd set list of CAs sent to the client when requesting a client certificate | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" | ||
14 | .Ft void | ||
15 | .Fn SSL_set_client_CA_list "SSL *s" "STACK_OF(X509_NAME) *list" | ||
16 | .Ft int | ||
17 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *cacert" | ||
18 | .Ft int | ||
19 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *cacert" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_client_CA_list | ||
22 | sets the | ||
23 | .Fa list | ||
24 | of CAs sent to the client when requesting a client certificate for | ||
25 | .Fa ctx . | ||
26 | .Pp | ||
27 | .Fn SSL_set_client_CA_list | ||
28 | sets the | ||
29 | .Fa list | ||
30 | of CAs sent to the client when requesting a client certificate for the chosen | ||
31 | .Fa ssl , | ||
32 | overriding the setting valid for | ||
33 | .Fa ssl Ns 's | ||
34 | .Vt SSL_CTX | ||
35 | object. | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_add_client_CA | ||
38 | adds the CA name extracted from | ||
39 | .Fa cacert | ||
40 | to the list of CAs sent to the client when requesting a client certificate for | ||
41 | .Fa ctx . | ||
42 | .Pp | ||
43 | .Fn SSL_add_client_CA | ||
44 | adds the CA name extracted from | ||
45 | .Fa cacert | ||
46 | to the list of CAs sent to the client when requesting a client certificate for | ||
47 | the chosen | ||
48 | .Fa ssl , | ||
49 | overriding the setting valid for | ||
50 | .Fa ssl Ns 's | ||
51 | .Va SSL_CTX | ||
52 | object. | ||
53 | .Sh NOTES | ||
54 | When a TLS/SSL server requests a client certificate (see | ||
55 | .Fn SSL_CTX_set_verify ) , | ||
56 | it sends a list of CAs for which it will accept certificates to the client. | ||
57 | .Pp | ||
58 | This list must explicitly be set using | ||
59 | .Fn SSL_CTX_set_client_CA_list | ||
60 | for | ||
61 | .Fa ctx | ||
62 | and | ||
63 | .Fn SSL_set_client_CA_list | ||
64 | for the specific | ||
65 | .Fa ssl . | ||
66 | The list specified overrides the previous setting. | ||
67 | The CAs listed do not become trusted | ||
68 | .Po | ||
69 | .Fa list | ||
70 | only contains the names, not the complete certificates | ||
71 | .Pc ; | ||
72 | use | ||
73 | .Xr SSL_CTX_load_verify_locations 3 | ||
74 | to additionally load them for verification. | ||
75 | .Pp | ||
76 | If the list of acceptable CAs is compiled in a file, the | ||
77 | .Xr SSL_load_client_CA_file 3 | ||
78 | function can be used to help importing the necessary data. | ||
79 | .Pp | ||
80 | .Fn SSL_CTX_add_client_CA | ||
81 | and | ||
82 | .Fn SSL_add_client_CA | ||
83 | can be used to add additional items the list of client CAs. | ||
84 | If no list was specified before using | ||
85 | .Fn SSL_CTX_set_client_CA_list | ||
86 | or | ||
87 | .Fn SSL_set_client_CA_list , | ||
88 | a new client CA list for | ||
89 | .Fa ctx | ||
90 | or | ||
91 | .Fa ssl | ||
92 | (as appropriate) is opened. | ||
93 | .Pp | ||
94 | These functions are only useful for TLS/SSL servers. | ||
95 | .Sh RETURN VALUES | ||
96 | .Fn SSL_CTX_set_client_CA_list | ||
97 | and | ||
98 | .Fn SSL_set_client_CA_list | ||
99 | do not return diagnostic information. | ||
100 | .Pp | ||
101 | .Fn SSL_CTX_add_client_CA | ||
102 | and | ||
103 | .Fn SSL_add_client_CA | ||
104 | have the following return values: | ||
105 | .Bl -tag -width Ds | ||
106 | .It 0 | ||
107 | A failure while manipulating the | ||
108 | .Dv STACK_OF Ns | ||
109 | .Pq Vt X509_NAME | ||
110 | object occurred or the | ||
111 | .Vt X509_NAME | ||
112 | could not be extracted from | ||
113 | .Fa cacert . | ||
114 | Check the error stack to find out the reason. | ||
115 | .It 1 | ||
116 | The operation succeeded. | ||
117 | .El | ||
118 | .Sh EXAMPLES | ||
119 | Scan all certificates in | ||
120 | .Fa CAfile | ||
121 | and list them as acceptable CAs: | ||
122 | .Bd -literal | ||
123 | SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile)); | ||
124 | .Ed | ||
125 | .Sh SEE ALSO | ||
126 | .Xr ssl 3 , | ||
127 | .Xr SSL_CTX_load_verify_locations 3 , | ||
128 | .Xr SSL_get_client_CA_list 3 , | ||
129 | .Xr SSL_load_client_CA_file 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod deleted file mode 100644 index d1758a7d20..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_CA_list.pod +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_client_CA_list, SSL_set_client_CA_list, SSL_CTX_add_client_CA, | ||
6 | SSL_add_client_CA - set list of CAs sent to the client when requesting a | ||
7 | client certificate | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | void SSL_CTX_set_client_CA_list(SSL_CTX *ctx, STACK_OF(X509_NAME) *list); | ||
14 | void SSL_set_client_CA_list(SSL *s, STACK_OF(X509_NAME) *list); | ||
15 | int SSL_CTX_add_client_CA(SSL_CTX *ctx, X509 *cacert); | ||
16 | int SSL_add_client_CA(SSL *ssl, X509 *cacert); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_client_CA_list() sets the B<list> of CAs sent to the client when | ||
21 | requesting a client certificate for B<ctx>. | ||
22 | |||
23 | SSL_set_client_CA_list() sets the B<list> of CAs sent to the client when | ||
24 | requesting a client certificate for the chosen B<ssl>, overriding the | ||
25 | setting valid for B<ssl>'s SSL_CTX object. | ||
26 | |||
27 | SSL_CTX_add_client_CA() adds the CA name extracted from B<cacert> to the | ||
28 | list of CAs sent to the client when requesting a client certificate for | ||
29 | B<ctx>. | ||
30 | |||
31 | SSL_add_client_CA() adds the CA name extracted from B<cacert> to the | ||
32 | list of CAs sent to the client when requesting a client certificate for | ||
33 | the chosen B<ssl>, overriding the setting valid for B<ssl>'s SSL_CTX object. | ||
34 | |||
35 | =head1 NOTES | ||
36 | |||
37 | When a TLS/SSL server requests a client certificate (see | ||
38 | B<SSL_CTX_set_verify(3)>), it sends a list of CAs, for which | ||
39 | it will accept certificates, to the client. | ||
40 | |||
41 | This list must explicitly be set using SSL_CTX_set_client_CA_list() for | ||
42 | B<ctx> and SSL_set_client_CA_list() for the specific B<ssl>. The list | ||
43 | specified overrides the previous setting. The CAs listed do not become | ||
44 | trusted (B<list> only contains the names, not the complete certificates); use | ||
45 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
46 | to additionally load them for verification. | ||
47 | |||
48 | If the list of acceptable CAs is compiled in a file, the | ||
49 | L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)> | ||
50 | function can be used to help importing the necessary data. | ||
51 | |||
52 | SSL_CTX_add_client_CA() and SSL_add_client_CA() can be used to add additional | ||
53 | items the list of client CAs. If no list was specified before using | ||
54 | SSL_CTX_set_client_CA_list() or SSL_set_client_CA_list(), a new client | ||
55 | CA list for B<ctx> or B<ssl> (as appropriate) is opened. | ||
56 | |||
57 | These functions are only useful for TLS/SSL servers. | ||
58 | |||
59 | =head1 RETURN VALUES | ||
60 | |||
61 | SSL_CTX_set_client_CA_list() and SSL_set_client_CA_list() do not return | ||
62 | diagnostic information. | ||
63 | |||
64 | SSL_CTX_add_client_CA() and SSL_add_client_CA() have the following return | ||
65 | values: | ||
66 | |||
67 | =over 4 | ||
68 | |||
69 | =item C<0> | ||
70 | |||
71 | A failure while manipulating the STACK_OF(X509_NAME) object occurred or | ||
72 | the X509_NAME could not be extracted from B<cacert>. Check the error stack | ||
73 | to find out the reason. | ||
74 | |||
75 | =item C<1> | ||
76 | |||
77 | The operation succeeded. | ||
78 | |||
79 | =back | ||
80 | |||
81 | =head1 EXAMPLES | ||
82 | |||
83 | Scan all certificates in B<CAfile> and list them as acceptable CAs: | ||
84 | |||
85 | SSL_CTX_set_client_CA_list(ctx,SSL_load_client_CA_file(CAfile)); | ||
86 | |||
87 | =head1 SEE ALSO | ||
88 | |||
89 | L<ssl(3)|ssl(3)>, | ||
90 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | ||
91 | L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, | ||
92 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
93 | |||
94 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.3 new file mode 100644 index 0000000000..6aaa5f1016 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.3 | |||
@@ -0,0 +1,140 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_CLIENT_CERT_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_client_cert_cb , | ||
6 | .Nm SSL_CTX_get_client_cert_cb | ||
7 | .Nd handle client certificate callback function | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fo SSL_CTX_set_client_cert_cb | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa "int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
14 | .Fc | ||
15 | .Ft int | ||
16 | .Fo "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
17 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn "(*client_cert_cb)" "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
21 | .Sh DESCRIPTION | ||
22 | .Fn SSL_CTX_set_client_cert_cb | ||
23 | sets the | ||
24 | .Fa client_cert_cb() | ||
25 | callback that is called when a client certificate is requested by a server and | ||
26 | no certificate was yet set for the SSL object. | ||
27 | .Pp | ||
28 | When | ||
29 | .Fa client_cert_cb | ||
30 | is | ||
31 | .Dv NULL , | ||
32 | no callback function is used. | ||
33 | .Pp | ||
34 | .Fn SSL_CTX_get_client_cert_cb | ||
35 | returns a pointer to the currently set callback function. | ||
36 | .Pp | ||
37 | .Fn client_cert_cb | ||
38 | is the application-defined callback. | ||
39 | If it wants to set a certificate, | ||
40 | a certificate/private key combination must be set using the | ||
41 | .Fa x509 | ||
42 | and | ||
43 | .Fa pkey | ||
44 | arguments and 1 must be returned. | ||
45 | The certificate will be installed into | ||
46 | .Fa ssl ; | ||
47 | see the | ||
48 | .Sx NOTES | ||
49 | and | ||
50 | .Sx BUGS | ||
51 | sections. | ||
52 | If no certificate should be set, | ||
53 | 0 has to be returned and no certificate will be sent. | ||
54 | A negative return value will suspend the handshake and the handshake function | ||
55 | will return immediately. | ||
56 | .Xr SSL_get_error 3 | ||
57 | will return | ||
58 | .Dv SSL_ERROR_WANT_X509_LOOKUP | ||
59 | to indicate that the handshake was suspended. | ||
60 | The next call to the handshake function will again lead to the call of | ||
61 | .Fa client_cert_cb() . | ||
62 | It is the job of the | ||
63 | .Fa client_cert_cb() | ||
64 | to store information | ||
65 | about the state of the last call, if required to continue. | ||
66 | .Sh NOTES | ||
67 | During a handshake (or renegotiation) | ||
68 | a server may request a certificate from the client. | ||
69 | A client certificate must only be sent when the server did send the request. | ||
70 | .Pp | ||
71 | When a certificate has been set using the | ||
72 | .Xr SSL_CTX_use_certificate 3 | ||
73 | family of functions, | ||
74 | it will be sent to the server. | ||
75 | The TLS standard requires that only a certificate is sent if it matches the | ||
76 | list of acceptable CAs sent by the server. | ||
77 | This constraint is violated by the default behavior of the OpenSSL library. | ||
78 | Using the callback function it is possible to implement a proper selection | ||
79 | routine or to allow a user interaction to choose the certificate to be sent. | ||
80 | .Pp | ||
81 | If a callback function is defined and no certificate was yet defined for the | ||
82 | .Vt SSL | ||
83 | object, the callback function will be called. | ||
84 | If the callback function returns a certificate, the OpenSSL library | ||
85 | will try to load the private key and certificate data into the | ||
86 | .Vt SSL | ||
87 | object using the | ||
88 | .Fn SSL_use_certificate | ||
89 | and | ||
90 | .Fn SSL_use_private_key | ||
91 | functions. | ||
92 | Thus it will permanently install the certificate and key for this SSL object. | ||
93 | It will not be reset by calling | ||
94 | .Xr SSL_clear 3 . | ||
95 | If the callback returns no certificate, the OpenSSL library will not send a | ||
96 | certificate. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr ssl 3 , | ||
99 | .Xr SSL_clear 3 , | ||
100 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
101 | .Xr SSL_CTX_use_certificate 3 , | ||
102 | .Xr SSL_free 3 , | ||
103 | .Xr SSL_get_client_CA_list 3 | ||
104 | .Sh BUGS | ||
105 | The | ||
106 | .Fa client_cert_cb() | ||
107 | cannot return a complete certificate chain; | ||
108 | it can only return one client certificate. | ||
109 | If the chain only has a length of 2, | ||
110 | the root CA certificate may be omitted according to the TLS standard and | ||
111 | thus a standard conforming answer can be sent to the server. | ||
112 | For a longer chain, the client must send the complete chain | ||
113 | (with the option to leave out the root CA certificate). | ||
114 | This can be accomplished only by either adding the intermediate CA certificates | ||
115 | into the trusted certificate store for the | ||
116 | .Vt SSL_CTX | ||
117 | object (resulting in having to add CA certificates that otherwise maybe would | ||
118 | not be trusted), or by adding the chain certificates using the | ||
119 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
120 | function, which is only available for the | ||
121 | .Vt SSL_CTX | ||
122 | object as a whole and that therefore probably can only apply for one client | ||
123 | certificate, making the concept of the callback function | ||
124 | (to allow the choice from several certificates) questionable. | ||
125 | .Pp | ||
126 | Once the | ||
127 | .Vt SSL | ||
128 | object has been used in conjunction with the callback function, | ||
129 | the certificate will be set for the | ||
130 | .Vt SSL | ||
131 | object and will not be cleared even when | ||
132 | .Xr SSL_clear 3 | ||
133 | is called. | ||
134 | It is therefore | ||
135 | .Em mandatory | ||
136 | to destroy the | ||
137 | .Vt SSL | ||
138 | object using | ||
139 | .Xr SSL_free 3 | ||
140 | and create a new one to return to the previous state. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod deleted file mode 100644 index 0462bbebac..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_client_cert_cb.pod +++ /dev/null | |||
@@ -1,95 +0,0 @@ | |||
1 | 3=pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_client_cert_cb, SSL_CTX_get_client_cert_cb - handle client | ||
6 | certificate callback function | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_client_cert_cb(SSL_CTX *ctx, int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); | ||
13 | int (*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
14 | int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_CTX_set_client_cert_cb() sets the B<client_cert_cb()> callback, that is | ||
19 | called when a client certificate is requested by a server and no certificate | ||
20 | was yet set for the SSL object. | ||
21 | |||
22 | When B<client_cert_cb()> is NULL, no callback function is used. | ||
23 | |||
24 | SSL_CTX_get_client_cert_cb() returns a pointer to the currently set callback | ||
25 | function. | ||
26 | |||
27 | client_cert_cb() is the application defined callback. If it wants to | ||
28 | set a certificate, a certificate/private key combination must be set | ||
29 | using the B<x509> and B<pkey> arguments and "1" must be returned. The | ||
30 | certificate will be installed into B<ssl>, see the NOTES and BUGS sections. | ||
31 | If no certificate should be set, "0" has to be returned and no certificate | ||
32 | will be sent. A negative return value will suspend the handshake and the | ||
33 | handshake function will return immediately. L<SSL_get_error(3)|SSL_get_error(3)> | ||
34 | will return SSL_ERROR_WANT_X509_LOOKUP to indicate, that the handshake was | ||
35 | suspended. The next call to the handshake function will again lead to the call | ||
36 | of client_cert_cb(). It is the job of the client_cert_cb() to store information | ||
37 | about the state of the last call, if required to continue. | ||
38 | |||
39 | =head1 NOTES | ||
40 | |||
41 | During a handshake (or renegotiation) a server may request a certificate | ||
42 | from the client. A client certificate must only be sent, when the server | ||
43 | did send the request. | ||
44 | |||
45 | When a certificate was set using the | ||
46 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)> family of functions, | ||
47 | it will be sent to the server. The TLS standard requires that only a | ||
48 | certificate is sent, if it matches the list of acceptable CAs sent by the | ||
49 | server. This constraint is violated by the default behavior of the OpenSSL | ||
50 | library. Using the callback function it is possible to implement a proper | ||
51 | selection routine or to allow a user interaction to choose the certificate to | ||
52 | be sent. | ||
53 | |||
54 | If a callback function is defined and no certificate was yet defined for the | ||
55 | SSL object, the callback function will be called. | ||
56 | If the callback function returns a certificate, the OpenSSL library | ||
57 | will try to load the private key and certificate data into the SSL | ||
58 | object using the SSL_use_certificate() and SSL_use_private_key() functions. | ||
59 | Thus it will permanently install the certificate and key for this SSL | ||
60 | object. It will not be reset by calling L<SSL_clear(3)|SSL_clear(3)>. | ||
61 | If the callback returns no certificate, the OpenSSL library will not send | ||
62 | a certificate. | ||
63 | |||
64 | =head1 BUGS | ||
65 | |||
66 | The client_cert_cb() cannot return a complete certificate chain, it can | ||
67 | only return one client certificate. If the chain only has a length of 2, | ||
68 | the root CA certificate may be omitted according to the TLS standard and | ||
69 | thus a standard conforming answer can be sent to the server. For a | ||
70 | longer chain, the client must send the complete chain (with the option | ||
71 | to leave out the root CA certificate). This can only be accomplished by | ||
72 | either adding the intermediate CA certificates into the trusted | ||
73 | certificate store for the SSL_CTX object (resulting in having to add | ||
74 | CA certificates that otherwise maybe would not be trusted), or by adding | ||
75 | the chain certificates using the | ||
76 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | ||
77 | function, which is only available for the SSL_CTX object as a whole and that | ||
78 | therefore probably can only apply for one client certificate, making | ||
79 | the concept of the callback function (to allow the choice from several | ||
80 | certificates) questionable. | ||
81 | |||
82 | Once the SSL object has been used in conjunction with the callback function, | ||
83 | the certificate will be set for the SSL object and will not be cleared | ||
84 | even when L<SSL_clear(3)|SSL_clear(3)> is being called. It is therefore | ||
85 | mandatory to destroy the SSL object using L<SSL_free(3)|SSL_free(3)> | ||
86 | and create a new one to return to the previous state. | ||
87 | |||
88 | =head1 SEE ALSO | ||
89 | |||
90 | L<ssl(3)|ssl(3)>, L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
91 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | ||
92 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | ||
93 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | ||
94 | |||
95 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.3 new file mode 100644 index 0000000000..2c35ed501c --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.3 | |||
@@ -0,0 +1,92 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_default_passwd_cb , | ||
6 | .Nm SSL_CTX_set_default_passwd_cb_userdata | ||
7 | .Nd set passwd callback for encrypted PEM file handling | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_default_passwd_cb_userdata "SSL_CTX *ctx" "void *u" | ||
14 | .Ft int | ||
15 | .Fn pem_passwd_cb "char *buf" "int size" "int rwflag" "void *userdata" | ||
16 | .Sh DESCRIPTION | ||
17 | .Fn SSL_CTX_set_default_passwd_cb | ||
18 | sets the default password callback called when loading/storing a PEM | ||
19 | certificate with encryption. | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
22 | sets a pointer to userdata | ||
23 | .Fa u | ||
24 | which will be provided to the password callback on invocation. | ||
25 | .Pp | ||
26 | The | ||
27 | .Fn pem_passwd_cb , | ||
28 | which must be provided by the application, | ||
29 | hands back the password to be used during decryption. | ||
30 | On invocation a pointer to | ||
31 | .Fa userdata | ||
32 | is provided. | ||
33 | The pem_passwd_cb must write the password into the provided buffer | ||
34 | .Fa buf | ||
35 | which is of size | ||
36 | .Fa size . | ||
37 | The actual length of the password must be returned to the calling function. | ||
38 | .Fa rwflag | ||
39 | indicates whether the callback is used for reading/decryption | ||
40 | .Pq Fa rwflag No = 0 | ||
41 | or writing/encryption | ||
42 | .Pq Fa rwflag No = 1 . | ||
43 | .Sh NOTES | ||
44 | When loading or storing private keys, a password might be supplied to protect | ||
45 | the private key. | ||
46 | The way this password can be supplied may depend on the application. | ||
47 | If only one private key is handled, it can be practical to have | ||
48 | .Fn pem_passwd_cb | ||
49 | handle the password dialog interactively. | ||
50 | If several keys have to be handled, it can be practical to ask for the password | ||
51 | once, then keep it in memory and use it several times. | ||
52 | In the last case, the password could be stored into the | ||
53 | .Fa userdata | ||
54 | storage and the | ||
55 | .Fn pem_passwd_cb | ||
56 | only returns the password already stored. | ||
57 | .Pp | ||
58 | When asking for the password interactively, | ||
59 | .Fn pem_passwd_cb | ||
60 | can use | ||
61 | .Fa rwflag | ||
62 | to check whether an item shall be encrypted | ||
63 | .Pq Fa rwflag No = 1 . | ||
64 | In this case the password dialog may ask for the same password twice for | ||
65 | comparison in order to catch typos which would make decryption impossible. | ||
66 | .Pp | ||
67 | Other items in PEM formatting (certificates) can also be encrypted; it is | ||
68 | however atypical, as certificate information is considered public. | ||
69 | .Sh RETURN VALUES | ||
70 | .Fn SSL_CTX_set_default_passwd_cb | ||
71 | and | ||
72 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
73 | do not provide diagnostic information. | ||
74 | .Sh EXAMPLES | ||
75 | The following example returns the password provided as | ||
76 | .Fa userdata | ||
77 | to the calling function. | ||
78 | The password is considered to be a | ||
79 | .Sq \e0 | ||
80 | terminated string. | ||
81 | If the password does not fit into the buffer, the password is truncated. | ||
82 | .Bd -literal | ||
83 | int pem_passwd_cb(char *buf, int size, int rwflag, void *password) | ||
84 | { | ||
85 | strncpy(buf, (char *)password, size); | ||
86 | buf[size - 1] = '\e0'; | ||
87 | return strlen(buf); | ||
88 | } | ||
89 | .Ed | ||
90 | .Sh SEE ALSO | ||
91 | .Xr ssl 3 , | ||
92 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod deleted file mode 100644 index f7bfc64930..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_default_passwd_cb.pod +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_default_passwd_cb, SSL_CTX_set_default_passwd_cb_userdata - set | ||
6 | passwd callback for encrypted PEM file handling | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_default_passwd_cb(SSL_CTX *ctx, pem_password_cb *cb); | ||
13 | void SSL_CTX_set_default_passwd_cb_userdata(SSL_CTX *ctx, void *u); | ||
14 | |||
15 | int pem_passwd_cb(char *buf, int size, int rwflag, void *userdata); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_default_passwd_cb() sets the default password callback called | ||
20 | when loading/storing a PEM certificate with encryption. | ||
21 | |||
22 | SSL_CTX_set_default_passwd_cb_userdata() sets a pointer to B<userdata> which | ||
23 | will be provided to the password callback on invocation. | ||
24 | |||
25 | The pem_passwd_cb(), which must be provided by the application, hands back the | ||
26 | password to be used during decryption. On invocation a pointer to B<userdata> | ||
27 | is provided. The pem_passwd_cb must write the password into the provided buffer | ||
28 | B<buf> which is of size B<size>. The actual length of the password must | ||
29 | be returned to the calling function. B<rwflag> indicates whether the | ||
30 | callback is used for reading/decryption (rwflag=0) or writing/encryption | ||
31 | (rwflag=1). | ||
32 | |||
33 | =head1 NOTES | ||
34 | |||
35 | When loading or storing private keys, a password might be supplied to | ||
36 | protect the private key. The way this password can be supplied may depend | ||
37 | on the application. If only one private key is handled, it can be practical | ||
38 | to have pem_passwd_cb() handle the password dialog interactively. If several | ||
39 | keys have to be handled, it can be practical to ask for the password once, | ||
40 | then keep it in memory and use it several times. In the last case, the | ||
41 | password could be stored into the B<userdata> storage and the | ||
42 | pem_passwd_cb() only returns the password already stored. | ||
43 | |||
44 | When asking for the password interactively, pem_passwd_cb() can use | ||
45 | B<rwflag> to check, whether an item shall be encrypted (rwflag=1). | ||
46 | In this case the password dialog may ask for the same password twice | ||
47 | for comparison in order to catch typos, that would make decryption | ||
48 | impossible. | ||
49 | |||
50 | Other items in PEM formatting (certificates) can also be encrypted, it is | ||
51 | however not usual, as certificate information is considered public. | ||
52 | |||
53 | =head1 RETURN VALUES | ||
54 | |||
55 | SSL_CTX_set_default_passwd_cb() and SSL_CTX_set_default_passwd_cb_userdata() | ||
56 | do not provide diagnostic information. | ||
57 | |||
58 | =head1 EXAMPLES | ||
59 | |||
60 | The following example returns the password provided as B<userdata> to the | ||
61 | calling function. The password is considered to be a '\0' terminated | ||
62 | string. If the password does not fit into the buffer, the password is | ||
63 | truncated. | ||
64 | |||
65 | int pem_passwd_cb(char *buf, int size, int rwflag, void *password) | ||
66 | { | ||
67 | strncpy(buf, (char *)(password), size); | ||
68 | buf[size - 1] = '\0'; | ||
69 | return(strlen(buf)); | ||
70 | } | ||
71 | |||
72 | =head1 SEE ALSO | ||
73 | |||
74 | L<ssl(3)|ssl(3)>, | ||
75 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)> | ||
76 | |||
77 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.3 new file mode 100644 index 0000000000..e2e2a70362 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.3 | |||
@@ -0,0 +1,193 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_generate_session_id , | ||
6 | .Nm SSL_set_generate_session_id , | ||
7 | .Nm SSL_has_matching_session_id | ||
8 | .Nd manipulate generation of SSL session IDs (server only) | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Bd -literal | ||
12 | typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, | ||
13 | unsigned int *id_len); | ||
14 | .Ed | ||
15 | .Ft int | ||
16 | .Fn SSL_CTX_set_generate_session_id "SSL_CTX *ctx" "GEN_SESSION_CB cb" | ||
17 | .Ft int | ||
18 | .Fn SSL_set_generate_session_id "SSL *ssl" "GEN_SESSION_CB" "cb);" | ||
19 | .Ft int | ||
20 | .Fo SSL_has_matching_session_id | ||
21 | .Fa "const SSL *ssl" "const unsigned char *id" "unsigned int id_len" | ||
22 | .Fc | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_CTX_set_generate_session_id | ||
25 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
26 | for | ||
27 | .Fa ctx | ||
28 | to be | ||
29 | .Fa cb . | ||
30 | .Pp | ||
31 | .Fn SSL_set_generate_session_id | ||
32 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
33 | for | ||
34 | .Fa ssl | ||
35 | to be | ||
36 | .Fa cb . | ||
37 | .Pp | ||
38 | .Fn SSL_has_matching_session_id | ||
39 | checks, whether a session with id | ||
40 | .Fa id | ||
41 | (of length | ||
42 | .Fa id_len ) | ||
43 | is already contained in the internal session cache | ||
44 | of the parent context of | ||
45 | .Fa ssl . | ||
46 | .Sh NOTES | ||
47 | When a new session is established between client and server, | ||
48 | the server generates a session id. | ||
49 | The session id is an arbitrary sequence of bytes. | ||
50 | The length of the session id is 16 bytes for SSLv2 sessions and between 1 and | ||
51 | 32 bytes for SSLv3/TLSv1. | ||
52 | The session id is not security critical but must be unique for the server. | ||
53 | Additionally, the session id is transmitted in the clear when reusing the | ||
54 | session so it must not contain sensitive information. | ||
55 | .Pp | ||
56 | Without a callback being set, an OpenSSL server will generate a unique session | ||
57 | id from pseudo random numbers of the maximum possible length. | ||
58 | Using the callback function, the session id can be changed to contain | ||
59 | additional information like, e.g., a host id in order to improve load balancing | ||
60 | or external caching techniques. | ||
61 | .Pp | ||
62 | The callback function receives a pointer to the memory location to put | ||
63 | .Fa id | ||
64 | into and a pointer to the maximum allowed length | ||
65 | .Fa id_len . | ||
66 | The buffer at location | ||
67 | .Fa id | ||
68 | is only guaranteed to have the size | ||
69 | .Fa id_len . | ||
70 | The callback is only allowed to generate a shorter id and reduce | ||
71 | .Fa id_len ; | ||
72 | the callback | ||
73 | .Em must never | ||
74 | increase | ||
75 | .Fa id_len | ||
76 | or write to the location | ||
77 | .Fa id | ||
78 | exceeding the given limit. | ||
79 | .Pp | ||
80 | If a SSLv2 session id is generated and | ||
81 | .Fa id_len | ||
82 | is reduced, it will be restored after the callback has finished and the session | ||
83 | id will be padded with 0x00. | ||
84 | It is not recommended to change the | ||
85 | .Fa id_len | ||
86 | for SSLv2 sessions. | ||
87 | The callback can use the | ||
88 | .Xr SSL_get_version 3 | ||
89 | function to check whether the session is of type SSLv2. | ||
90 | .Pp | ||
91 | The location | ||
92 | .Fa id | ||
93 | is filled with 0x00 before the callback is called, | ||
94 | so the callback may only fill part of the possible length and leave | ||
95 | .Fa id_len | ||
96 | untouched while maintaining reproducibility. | ||
97 | .Pp | ||
98 | Since the sessions must be distinguished, session ids must be unique. | ||
99 | Without the callback a random number is used, | ||
100 | so that the probability of generating the same session id is extremely small | ||
101 | (2^128 possible ids for an SSLv2 session, 2^256 for SSLv3/TLSv1). | ||
102 | In order to ensure the uniqueness of the generated session id, | ||
103 | the callback must call | ||
104 | .Fn SSL_has_matching_session_id | ||
105 | and generate another id if a conflict occurs. | ||
106 | If an id conflict is not resolved, the handshake will fail. | ||
107 | If the application codes, e.g., a unique host id, a unique process number, and | ||
108 | a unique sequence number into the session id, uniqueness could easily be | ||
109 | achieved without randomness added (it should however be taken care that | ||
110 | no confidential information is leaked this way). | ||
111 | If the application cannot guarantee uniqueness, | ||
112 | it is recommended to use the maximum | ||
113 | .Fa id_len | ||
114 | and fill in the bytes not used to code special information with random data to | ||
115 | avoid collisions. | ||
116 | .Pp | ||
117 | .Fn SSL_has_matching_session_id | ||
118 | will only query the internal session cache, not the external one. | ||
119 | Since the session id is generated before the handshake is completed, | ||
120 | it is not immediately added to the cache. | ||
121 | If another thread is using the same internal session cache, | ||
122 | a race condition can occur in that another thread generates the same session id. | ||
123 | Collisions can also occur when using an external session cache, | ||
124 | since the external cache is not tested with | ||
125 | .Fn SSL_has_matching_session_id | ||
126 | and the same race condition applies. | ||
127 | .Pp | ||
128 | When calling | ||
129 | .Fn SSL_has_matching_session_id | ||
130 | for an SSLv2 session with reduced | ||
131 | .Fa id_len Ns , | ||
132 | the match operation will be performed using the fixed length required and with | ||
133 | a 0x00 padded id. | ||
134 | .Pp | ||
135 | The callback must return 0 if it cannot generate a session id for whatever | ||
136 | reason and return 1 on success. | ||
137 | .Sh RETURN VALUES | ||
138 | .Fn SSL_CTX_set_generate_session_id | ||
139 | and | ||
140 | .Fn SSL_set_generate_session_id | ||
141 | always return 1. | ||
142 | .Pp | ||
143 | .Fn SSL_has_matching_session_id | ||
144 | returns 1 if another session with the same id is already in the cache. | ||
145 | .Sh EXAMPLES | ||
146 | The callback function listed will generate a session id with the server id | ||
147 | given, and will fill the rest with pseudo random bytes: | ||
148 | .Bd -literal | ||
149 | const char session_id_prefix = "www-18"; | ||
150 | |||
151 | #define MAX_SESSION_ID_ATTEMPTS 10 | ||
152 | static int | ||
153 | generate_session_id(const SSL *ssl, unsigned char *id, | ||
154 | unsigned int *id_len) | ||
155 | { | ||
156 | unsigned int count = 0; | ||
157 | const char *version; | ||
158 | |||
159 | version = SSL_get_version(ssl); | ||
160 | if (!strcmp(version, "SSLv2")) { | ||
161 | /* we must not change id_len */ | ||
162 | ; | ||
163 | } | ||
164 | |||
165 | do { | ||
166 | RAND_pseudo_bytes(id, *id_len); | ||
167 | /* | ||
168 | * Prefix the session_id with the required prefix. NB: If | ||
169 | * our prefix is too long, clip it \(en but there will be | ||
170 | * worse effects anyway, e.g., the server could only | ||
171 | * possibly create one session ID (the prefix!) so all | ||
172 | * future session negotiations will fail due to conflicts. | ||
173 | */ | ||
174 | memcpy(id, session_id_prefix, | ||
175 | (strlen(session_id_prefix) < *id_len) ? | ||
176 | strlen(session_id_prefix) : *id_len); | ||
177 | } while (SSL_has_matching_session_id(ssl, id, *id_len) && | ||
178 | (++count < MAX_SESSION_ID_ATTEMPTS)); | ||
179 | |||
180 | if (count >= MAX_SESSION_ID_ATTEMPTS) | ||
181 | return 0; | ||
182 | return 1; | ||
183 | } | ||
184 | .Ed | ||
185 | .Sh SEE ALSO | ||
186 | .Xr ssl 3 , | ||
187 | .Xr SSL_get_version 3 | ||
188 | .Sh HISTORY | ||
189 | .Fn SSL_CTX_set_generate_session_id , | ||
190 | .Fn SSL_set_generate_session_id | ||
191 | and | ||
192 | .Fn SSL_has_matching_session_id | ||
193 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod deleted file mode 100644 index c04588a03c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_generate_session_id.pod +++ /dev/null | |||
@@ -1,152 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_generate_session_id, SSL_set_generate_session_id, | ||
6 | SSL_has_matching_session_id - manipulate generation of SSL session IDs (server | ||
7 | only) | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, | ||
14 | unsigned int *id_len); | ||
15 | |||
16 | int SSL_CTX_set_generate_session_id(SSL_CTX *ctx, GEN_SESSION_CB cb); | ||
17 | int SSL_set_generate_session_id(SSL *ssl, GEN_SESSION_CB, cb); | ||
18 | int SSL_has_matching_session_id(const SSL *ssl, const unsigned char *id, | ||
19 | unsigned int id_len); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | SSL_CTX_set_generate_session_id() sets the callback function for generating | ||
24 | new session ids for SSL/TLS sessions for B<ctx> to be B<cb>. | ||
25 | |||
26 | SSL_set_generate_session_id() sets the callback function for generating | ||
27 | new session ids for SSL/TLS sessions for B<ssl> to be B<cb>. | ||
28 | |||
29 | SSL_has_matching_session_id() checks, whether a session with id B<id> | ||
30 | (of length B<id_len>) is already contained in the internal session cache | ||
31 | of the parent context of B<ssl>. | ||
32 | |||
33 | =head1 NOTES | ||
34 | |||
35 | When a new session is established between client and server, the server | ||
36 | generates a session id. The session id is an arbitrary sequence of bytes. | ||
37 | The length of the session id is 16 bytes for SSLv2 sessions and between | ||
38 | 1 and 32 bytes for SSLv3/TLSv1. The session id is not security critical | ||
39 | but must be unique for the server. Additionally, the session id is | ||
40 | transmitted in the clear when reusing the session so it must not contain | ||
41 | sensitive information. | ||
42 | |||
43 | Without a callback being set, an OpenSSL server will generate a unique | ||
44 | session id from pseudo random numbers of the maximum possible length. | ||
45 | Using the callback function, the session id can be changed to contain | ||
46 | additional information like e.g. a host id in order to improve load balancing | ||
47 | or external caching techniques. | ||
48 | |||
49 | The callback function receives a pointer to the memory location to put | ||
50 | B<id> into and a pointer to the maximum allowed length B<id_len>. The | ||
51 | buffer at location B<id> is only guaranteed to have the size B<id_len>. | ||
52 | The callback is only allowed to generate a shorter id and reduce B<id_len>; | ||
53 | the callback B<must never> increase B<id_len> or write to the location | ||
54 | B<id> exceeding the given limit. | ||
55 | |||
56 | If a SSLv2 session id is generated and B<id_len> is reduced, it will be | ||
57 | restored after the callback has finished and the session id will be padded | ||
58 | with 0x00. It is not recommended to change the B<id_len> for SSLv2 sessions. | ||
59 | The callback can use the L<SSL_get_version(3)|SSL_get_version(3)> function | ||
60 | to check, whether the session is of type SSLv2. | ||
61 | |||
62 | The location B<id> is filled with 0x00 before the callback is called, so the | ||
63 | callback may only fill part of the possible length and leave B<id_len> | ||
64 | untouched while maintaining reproducibility. | ||
65 | |||
66 | Since the sessions must be distinguished, session ids must be unique. | ||
67 | Without the callback a random number is used, so that the probability | ||
68 | of generating the same session id is extremely small (2^128 possible ids | ||
69 | for an SSLv2 session, 2^256 for SSLv3/TLSv1). In order to assure the | ||
70 | uniqueness of the generated session id, the callback must call | ||
71 | SSL_has_matching_session_id() and generate another id if a conflict occurs. | ||
72 | If an id conflict is not resolved, the handshake will fail. | ||
73 | If the application codes e.g. a unique host id, a unique process number, and | ||
74 | a unique sequence number into the session id, uniqueness could easily be | ||
75 | achieved without randomness added (it should however be taken care that | ||
76 | no confidential information is leaked this way). If the application can not | ||
77 | guarantee uniqueness, it is recommended to use the maximum B<id_len> and | ||
78 | fill in the bytes not used to code special information with random data | ||
79 | to avoid collisions. | ||
80 | |||
81 | SSL_has_matching_session_id() will only query the internal session cache, | ||
82 | not the external one. Since the session id is generated before the | ||
83 | handshake is completed, it is not immediately added to the cache. If | ||
84 | another thread is using the same internal session cache, a race condition | ||
85 | can occur in that another thread generates the same session id. | ||
86 | Collisions can also occur when using an external session cache, since | ||
87 | the external cache is not tested with SSL_has_matching_session_id() | ||
88 | and the same race condition applies. | ||
89 | |||
90 | When calling SSL_has_matching_session_id() for an SSLv2 session with | ||
91 | reduced B<id_len>, the match operation will be performed using the | ||
92 | fixed length required and with a 0x00 padded id. | ||
93 | |||
94 | The callback must return 0 if it cannot generate a session id for whatever | ||
95 | reason and return 1 on success. | ||
96 | |||
97 | =head1 EXAMPLES | ||
98 | |||
99 | The callback function listed will generate a session id with the | ||
100 | server id given, and will fill the rest with pseudo random bytes: | ||
101 | |||
102 | const char session_id_prefix = "www-18"; | ||
103 | |||
104 | #define MAX_SESSION_ID_ATTEMPTS 10 | ||
105 | static int generate_session_id(const SSL *ssl, unsigned char *id, | ||
106 | unsigned int *id_len) | ||
107 | { | ||
108 | unsigned int count = 0; | ||
109 | const char *version; | ||
110 | |||
111 | version = SSL_get_version(ssl); | ||
112 | if (!strcmp(version, "SSLv2")) | ||
113 | /* we must not change id_len */; | ||
114 | |||
115 | do { | ||
116 | RAND_pseudo_bytes(id, *id_len); | ||
117 | /* Prefix the session_id with the required prefix. NB: If our | ||
118 | * prefix is too long, clip it - but there will be worse effects | ||
119 | * anyway, eg. the server could only possibly create 1 session | ||
120 | * ID (ie. the prefix!) so all future session negotiations will | ||
121 | * fail due to conflicts. */ | ||
122 | memcpy(id, session_id_prefix, | ||
123 | (strlen(session_id_prefix) < *id_len) ? | ||
124 | strlen(session_id_prefix) : *id_len); | ||
125 | } | ||
126 | while(SSL_has_matching_session_id(ssl, id, *id_len) && | ||
127 | (++count < MAX_SESSION_ID_ATTEMPTS)); | ||
128 | if(count >= MAX_SESSION_ID_ATTEMPTS) | ||
129 | return 0; | ||
130 | return 1; | ||
131 | } | ||
132 | |||
133 | |||
134 | =head1 RETURN VALUES | ||
135 | |||
136 | SSL_CTX_set_generate_session_id() and SSL_set_generate_session_id() | ||
137 | always return 1. | ||
138 | |||
139 | SSL_has_matching_session_id() returns 1 if another session with the | ||
140 | same id is already in the cache. | ||
141 | |||
142 | =head1 SEE ALSO | ||
143 | |||
144 | L<ssl(3)|ssl(3)>, L<SSL_get_version(3)|SSL_get_version(3)> | ||
145 | |||
146 | =head1 HISTORY | ||
147 | |||
148 | SSL_CTX_set_generate_session_id(), SSL_set_generate_session_id() | ||
149 | and SSL_has_matching_session_id() have been introduced in | ||
150 | OpenSSL 0.9.7. | ||
151 | |||
152 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.3 new file mode 100644 index 0000000000..dcf298addf --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.3 | |||
@@ -0,0 +1,164 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_INFO_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_info_callback , | ||
6 | .Nm SSL_CTX_get_info_callback , | ||
7 | .Nm SSL_set_info_callback , | ||
8 | .Nm SSL_get_info_callback | ||
9 | .Nd handle information callback for SSL connections | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_info_callback "SSL_CTX *ctx" "void (*callback)()" | ||
14 | .Ft void | ||
15 | .Fn "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
16 | .Ft void | ||
17 | .Fn SSL_set_info_callback "SSL *ssl" "void (*callback)()" | ||
18 | .Ft void | ||
19 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_info_callback | ||
22 | sets the | ||
23 | .Fa callback | ||
24 | function that can be used to obtain state information for SSL objects created | ||
25 | from | ||
26 | .Fa ctx | ||
27 | during connection setup and use. | ||
28 | The setting for | ||
29 | .Fa ctx | ||
30 | is overridden from the setting for a specific SSL object, if specified. | ||
31 | When | ||
32 | .Fa callback | ||
33 | is | ||
34 | .Dv NULL , | ||
35 | no callback function is used. | ||
36 | .Pp | ||
37 | .Fn SSL_set_info_callback | ||
38 | sets the | ||
39 | .Fa callback | ||
40 | function that can be used to | ||
41 | obtain state information for | ||
42 | .Fa ssl | ||
43 | during connection setup and use. | ||
44 | When | ||
45 | .Fa callback | ||
46 | is | ||
47 | .Dv NULL , | ||
48 | the callback setting currently valid for | ||
49 | .Fa ctx | ||
50 | is used. | ||
51 | .Pp | ||
52 | .Fn SSL_CTX_get_info_callback | ||
53 | returns a pointer to the currently set information callback function for | ||
54 | .Fa ctx . | ||
55 | .Pp | ||
56 | .Fn SSL_get_info_callback | ||
57 | returns a pointer to the currently set information callback function for | ||
58 | .Fa ssl . | ||
59 | .Sh NOTES | ||
60 | When setting up a connection and during use, | ||
61 | it is possible to obtain state information from the SSL/TLS engine. | ||
62 | When set, an information callback function is called whenever the state changes, | ||
63 | an alert appears, or an error occurs. | ||
64 | .Pp | ||
65 | The callback function is called as | ||
66 | .Fn callback "SSL *ssl" "int where" "int ret" . | ||
67 | The | ||
68 | .Fa where | ||
69 | argument specifies information about where (in which context) | ||
70 | the callback function was called. | ||
71 | If | ||
72 | .Fa ret | ||
73 | is 0, an error condition occurred. | ||
74 | If an alert is handled, | ||
75 | .Dv SSL_CB_ALERT | ||
76 | is set and | ||
77 | .Fa ret | ||
78 | specifies the alert information. | ||
79 | .Pp | ||
80 | .Fa where | ||
81 | is a bitmask made up of the following bits: | ||
82 | .Bl -tag -width Ds | ||
83 | .It Dv SSL_CB_LOOP | ||
84 | Callback has been called to indicate state change inside a loop. | ||
85 | .It Dv SSL_CB_EXIT | ||
86 | Callback has been called to indicate error exit of a handshake function. | ||
87 | (May be soft error with retry option for non-blocking setups.) | ||
88 | .It Dv SSL_CB_READ | ||
89 | Callback has been called during read operation. | ||
90 | .It Dv SSL_CB_WRITE | ||
91 | Callback has been called during write operation. | ||
92 | .It Dv SSL_CB_ALERT | ||
93 | Callback has been called due to an alert being sent or received. | ||
94 | .It Dv SSL_CB_READ_ALERT | ||
95 | .It Dv SSL_CB_WRITE_ALERT | ||
96 | .It Dv SSL_CB_ACCEPT_LOOP | ||
97 | .It Dv SSL_CB_ACCEPT_EXIT | ||
98 | .It Dv SSL_CB_CONNECT_LOOP | ||
99 | .It Dv SSL_CB_CONNECT_EXIT | ||
100 | .It Dv SSL_CB_HANDSHAKE_START | ||
101 | Callback has been called because a new handshake is started. | ||
102 | .It Dv SSL_CB_HANDSHAKE_DONE | ||
103 | Callback has been called because a handshake is finished. | ||
104 | .El | ||
105 | .Pp | ||
106 | The current state information can be obtained using the | ||
107 | .Xr SSL_state_string 3 | ||
108 | family of functions. | ||
109 | .Pp | ||
110 | The | ||
111 | .Fa ret | ||
112 | information can be evaluated using the | ||
113 | .Xr SSL_alert_type_string 3 | ||
114 | family of functions. | ||
115 | .Sh RETURN VALUES | ||
116 | .Fn SSL_set_info_callback | ||
117 | does not provide diagnostic information. | ||
118 | .Pp | ||
119 | .Fn SSL_get_info_callback | ||
120 | returns the current setting. | ||
121 | .Sh EXAMPLES | ||
122 | The following example callback function prints state strings, | ||
123 | information about alerts being handled and error messages to the | ||
124 | .Va bio_err | ||
125 | .Vt BIO . | ||
126 | .Bd -literal | ||
127 | void | ||
128 | apps_ssl_info_callback(SSL *s, int where, int ret) | ||
129 | { | ||
130 | const char *str; | ||
131 | int w; | ||
132 | |||
133 | w = where & ~SSL_ST_MASK; | ||
134 | |||
135 | if (w & SSL_ST_CONNECT) | ||
136 | str = "SSL_connect"; | ||
137 | else if (w & SSL_ST_ACCEPT) | ||
138 | str = "SSL_accept"; | ||
139 | else | ||
140 | str = "undefined"; | ||
141 | |||
142 | if (where & SSL_CB_LOOP) { | ||
143 | BIO_printf(bio_err, "%s:%s\en", str, | ||
144 | SSL_state_string_long(s)); | ||
145 | } else if (where & SSL_CB_ALERT) { | ||
146 | str = (where & SSL_CB_READ) ? "read" : "write"; | ||
147 | BIO_printf(bio_err, "SSL3 alert %s:%s:%s\en", str, | ||
148 | SSL_alert_type_string_long(ret), | ||
149 | SSL_alert_desc_string_long(ret)); | ||
150 | } else if (where & SSL_CB_EXIT) { | ||
151 | if (ret == 0) | ||
152 | BIO_printf(bio_err, "%s:failed in %s\en", | ||
153 | str, SSL_state_string_long(s)); | ||
154 | else if (ret < 0) { | ||
155 | BIO_printf(bio_err, "%s:error in %s\en", | ||
156 | str, SSL_state_string_long(s)); | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | .Ed | ||
161 | .Sh SEE ALSO | ||
162 | .Xr ssl 3 , | ||
163 | .Xr SSL_alert_type_string 3 , | ||
164 | .Xr SSL_state_string 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod deleted file mode 100644 index f7923dedc1..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_info_callback.pod +++ /dev/null | |||
@@ -1,154 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_info_callback, SSL_CTX_get_info_callback, SSL_set_info_callback, | ||
6 | SSL_get_info_callback - handle information callback for SSL connections | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_info_callback(SSL_CTX *ctx, void (*callback)()); | ||
13 | void (*SSL_CTX_get_info_callback(const SSL_CTX *ctx))(); | ||
14 | |||
15 | void SSL_set_info_callback(SSL *ssl, void (*callback)()); | ||
16 | void (*SSL_get_info_callback(const SSL *ssl))(); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_info_callback() sets the B<callback> function, that can be used to | ||
21 | obtain state information for SSL objects created from B<ctx> during connection | ||
22 | setup and use. The setting for B<ctx> is overridden from the setting for | ||
23 | a specific SSL object, if specified. | ||
24 | When B<callback> is NULL, no callback function is used. | ||
25 | |||
26 | SSL_set_info_callback() sets the B<callback> function, that can be used to | ||
27 | obtain state information for B<ssl> during connection setup and use. | ||
28 | When B<callback> is NULL, the callback setting currently valid for | ||
29 | B<ctx> is used. | ||
30 | |||
31 | SSL_CTX_get_info_callback() returns a pointer to the currently set information | ||
32 | callback function for B<ctx>. | ||
33 | |||
34 | SSL_get_info_callback() returns a pointer to the currently set information | ||
35 | callback function for B<ssl>. | ||
36 | |||
37 | =head1 NOTES | ||
38 | |||
39 | When setting up a connection and during use, it is possible to obtain state | ||
40 | information from the SSL/TLS engine. When set, an information callback function | ||
41 | is called whenever the state changes, an alert appears, or an error occurs. | ||
42 | |||
43 | The callback function is called as B<callback(SSL *ssl, int where, int ret)>. | ||
44 | The B<where> argument specifies information about where (in which context) | ||
45 | the callback function was called. If B<ret> is 0, an error condition occurred. | ||
46 | If an alert is handled, SSL_CB_ALERT is set and B<ret> specifies the alert | ||
47 | information. | ||
48 | |||
49 | B<where> is a bitmask made up of the following bits: | ||
50 | |||
51 | =over 4 | ||
52 | |||
53 | =item SSL_CB_LOOP | ||
54 | |||
55 | Callback has been called to indicate state change inside a loop. | ||
56 | |||
57 | =item SSL_CB_EXIT | ||
58 | |||
59 | Callback has been called to indicate error exit of a handshake function. | ||
60 | (May be soft error with retry option for non-blocking setups.) | ||
61 | |||
62 | =item SSL_CB_READ | ||
63 | |||
64 | Callback has been called during read operation. | ||
65 | |||
66 | =item SSL_CB_WRITE | ||
67 | |||
68 | Callback has been called during write operation. | ||
69 | |||
70 | =item SSL_CB_ALERT | ||
71 | |||
72 | Callback has been called due to an alert being sent or received. | ||
73 | |||
74 | =item SSL_CB_READ_ALERT (SSL_CB_ALERT|SSL_CB_READ) | ||
75 | |||
76 | =item SSL_CB_WRITE_ALERT (SSL_CB_ALERT|SSL_CB_WRITE) | ||
77 | |||
78 | =item SSL_CB_ACCEPT_LOOP (SSL_ST_ACCEPT|SSL_CB_LOOP) | ||
79 | |||
80 | =item SSL_CB_ACCEPT_EXIT (SSL_ST_ACCEPT|SSL_CB_EXIT) | ||
81 | |||
82 | =item SSL_CB_CONNECT_LOOP (SSL_ST_CONNECT|SSL_CB_LOOP) | ||
83 | |||
84 | =item SSL_CB_CONNECT_EXIT (SSL_ST_CONNECT|SSL_CB_EXIT) | ||
85 | |||
86 | =item SSL_CB_HANDSHAKE_START | ||
87 | |||
88 | Callback has been called because a new handshake is started. | ||
89 | |||
90 | =item SSL_CB_HANDSHAKE_DONE 0x20 | ||
91 | |||
92 | Callback has been called because a handshake is finished. | ||
93 | |||
94 | =back | ||
95 | |||
96 | The current state information can be obtained using the | ||
97 | L<SSL_state_string(3)|SSL_state_string(3)> family of functions. | ||
98 | |||
99 | The B<ret> information can be evaluated using the | ||
100 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> family of functions. | ||
101 | |||
102 | =head1 RETURN VALUES | ||
103 | |||
104 | SSL_set_info_callback() does not provide diagnostic information. | ||
105 | |||
106 | SSL_get_info_callback() returns the current setting. | ||
107 | |||
108 | =head1 EXAMPLES | ||
109 | |||
110 | The following example callback function prints state strings, information | ||
111 | about alerts being handled and error messages to the B<bio_err> BIO. | ||
112 | |||
113 | void apps_ssl_info_callback(SSL *s, int where, int ret) | ||
114 | { | ||
115 | const char *str; | ||
116 | int w; | ||
117 | |||
118 | w=where& ~SSL_ST_MASK; | ||
119 | |||
120 | if (w & SSL_ST_CONNECT) str="SSL_connect"; | ||
121 | else if (w & SSL_ST_ACCEPT) str="SSL_accept"; | ||
122 | else str="undefined"; | ||
123 | |||
124 | if (where & SSL_CB_LOOP) | ||
125 | { | ||
126 | BIO_printf(bio_err,"%s:%s\n",str,SSL_state_string_long(s)); | ||
127 | } | ||
128 | else if (where & SSL_CB_ALERT) | ||
129 | { | ||
130 | str=(where & SSL_CB_READ)?"read":"write"; | ||
131 | BIO_printf(bio_err,"SSL3 alert %s:%s:%s\n", | ||
132 | str, | ||
133 | SSL_alert_type_string_long(ret), | ||
134 | SSL_alert_desc_string_long(ret)); | ||
135 | } | ||
136 | else if (where & SSL_CB_EXIT) | ||
137 | { | ||
138 | if (ret == 0) | ||
139 | BIO_printf(bio_err,"%s:failed in %s\n", | ||
140 | str,SSL_state_string_long(s)); | ||
141 | else if (ret < 0) | ||
142 | { | ||
143 | BIO_printf(bio_err,"%s:error in %s\n", | ||
144 | str,SSL_state_string_long(s)); | ||
145 | } | ||
146 | } | ||
147 | } | ||
148 | |||
149 | =head1 SEE ALSO | ||
150 | |||
151 | L<ssl(3)|ssl(3)>, L<SSL_state_string(3)|SSL_state_string(3)>, | ||
152 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)> | ||
153 | |||
154 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.3 new file mode 100644 index 0000000000..7380884867 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.3 | |||
@@ -0,0 +1,102 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MAX_CERT_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_max_cert_list , | ||
6 | .Nm SSL_CTX_get_max_cert_list , | ||
7 | .Nm SSL_set_max_cert_list , | ||
8 | .Nm SSL_get_max_cert_list | ||
9 | .Nd manipulate allowed size for the peer's certificate chain | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" | ||
14 | .Ft long | ||
15 | .Fn SSL_CTX_get_max_cert_list "SSL_CTX *ctx" | ||
16 | .Ft long | ||
17 | .Fn SSL_set_max_cert_list "SSL *ssl" "long size" | ||
18 | .Ft long | ||
19 | .Fn SSL_get_max_cert_list "SSL *ctx" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_max_cert_list | ||
22 | sets the maximum size allowed for the peer's certificate chain for all | ||
23 | .Vt SSL | ||
24 | objects created from | ||
25 | .Fa ctx | ||
26 | to be | ||
27 | .Fa size | ||
28 | bytes. | ||
29 | The | ||
30 | .Vt SSL | ||
31 | objects inherit the setting valid for | ||
32 | .Fa ctx | ||
33 | at the time | ||
34 | .Xr SSL_new 3 | ||
35 | is being called. | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_get_max_cert_list | ||
38 | returns the currently set maximum size for | ||
39 | .Fa ctx . | ||
40 | .Pp | ||
41 | .Fn SSL_set_max_cert_list | ||
42 | sets the maximum size allowed for the peer's certificate chain for | ||
43 | .Fa ssl | ||
44 | to be | ||
45 | .Fa size | ||
46 | bytes. | ||
47 | This setting stays valid until a new value is set. | ||
48 | .Pp | ||
49 | .Fn SSL_get_max_cert_list | ||
50 | returns the currently set maximum size for | ||
51 | .Fa ssl . | ||
52 | .Sh NOTES | ||
53 | During the handshake process, the peer may send a certificate chain. | ||
54 | The TLS/SSL standard does not give any maximum size of the certificate chain. | ||
55 | The OpenSSL library handles incoming data by a dynamically allocated buffer. | ||
56 | In order to prevent this buffer from growing without bound due to data | ||
57 | received from a faulty or malicious peer, a maximum size for the certificate | ||
58 | chain is set. | ||
59 | .Pp | ||
60 | The default value for the maximum certificate chain size is 100kB (30kB | ||
61 | on the 16bit DOS platform). | ||
62 | This should be sufficient for usual certificate chains | ||
63 | (OpenSSL's default maximum chain length is 10, see | ||
64 | .Xr SSL_CTX_set_verify 3 , | ||
65 | and certificates without special extensions have a typical size of 1-2kB). | ||
66 | .Pp | ||
67 | For special applications it can be necessary to extend the maximum certificate | ||
68 | chain size allowed to be sent by the peer. | ||
69 | See for example the work on | ||
70 | .%T "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" | ||
71 | and | ||
72 | .%T "TLS Delegation Protocol" | ||
73 | at | ||
74 | .Lk http://www.ietf.org/ | ||
75 | and | ||
76 | .Lk http://www.globus.org/ . | ||
77 | .Pp | ||
78 | Under normal conditions it should never be necessary to set a value smaller | ||
79 | than the default, as the buffer is handled dynamically and only uses the | ||
80 | memory actually required by the data sent by the peer. | ||
81 | .Pp | ||
82 | If the maximum certificate chain size allowed is exceeded, the handshake will | ||
83 | fail with a | ||
84 | .Dv SSL_R_EXCESSIVE_MESSAGE_SIZE | ||
85 | error. | ||
86 | .Sh RETURN VALUES | ||
87 | .Fn SSL_CTX_set_max_cert_list | ||
88 | and | ||
89 | .Fn SSL_set_max_cert_list | ||
90 | return the previously set value. | ||
91 | .Pp | ||
92 | .Fn SSL_CTX_get_max_cert_list | ||
93 | and | ||
94 | .Fn SSL_get_max_cert_list | ||
95 | return the currently set value. | ||
96 | .Sh SEE ALSO | ||
97 | .Xr ssl 3 , | ||
98 | .Xr SSL_CTX_set_verify 3 , | ||
99 | .Xr SSL_new 3 | ||
100 | .Sh HISTORY | ||
101 | .Fn SSL*_set/get_max_cert_list | ||
102 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod deleted file mode 100644 index 5b874aa5fd..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_max_cert_list.pod +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_max_cert_list, SSL_CTX_get_max_cert_list, SSL_set_max_cert_list, | ||
6 | SSL_get_max_cert_list - manipulate allowed size for the peer's certificate chain | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_set_max_cert_list(SSL_CTX *ctx, long size); | ||
13 | long SSL_CTX_get_max_cert_list(SSL_CTX *ctx); | ||
14 | |||
15 | long SSL_set_max_cert_list(SSL *ssl, long size); | ||
16 | long SSL_get_max_cert_list(SSL *ctx); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_max_cert_list() sets the maximum size allowed for the peer's | ||
21 | certificate chain for all SSL objects created from B<ctx> to be <size> bytes. | ||
22 | The SSL objects inherit the setting valid for B<ctx> at the time | ||
23 | L<SSL_new(3)|SSL_new(3)> is being called. | ||
24 | |||
25 | SSL_CTX_get_max_cert_list() returns the currently set maximum size for B<ctx>. | ||
26 | |||
27 | SSL_set_max_cert_list() sets the maximum size allowed for the peer's | ||
28 | certificate chain for B<ssl> to be <size> bytes. This setting stays valid | ||
29 | until a new value is set. | ||
30 | |||
31 | SSL_get_max_cert_list() returns the currently set maximum size for B<ssl>. | ||
32 | |||
33 | =head1 NOTES | ||
34 | |||
35 | During the handshake process, the peer may send a certificate chain. | ||
36 | The TLS/SSL standard does not give any maximum size of the certificate chain. | ||
37 | The OpenSSL library handles incoming data by a dynamically allocated buffer. | ||
38 | In order to prevent this buffer from growing without bounds due to data | ||
39 | received from a faulty or malicious peer, a maximum size for the certificate | ||
40 | chain is set. | ||
41 | |||
42 | The default value for the maximum certificate chain size is 100kB (30kB | ||
43 | on the 16bit DOS platform). This should be sufficient for usual certificate | ||
44 | chains (OpenSSL's default maximum chain length is 10, see | ||
45 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, and certificates | ||
46 | without special extensions have a typical size of 1-2kB). | ||
47 | |||
48 | For special applications it can be necessary to extend the maximum certificate | ||
49 | chain size allowed to be sent by the peer, see e.g. the work on | ||
50 | "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" | ||
51 | and "TLS Delegation Protocol" at http://www.ietf.org/ and | ||
52 | http://www.globus.org/ . | ||
53 | |||
54 | Under normal conditions it should never be necessary to set a value smaller | ||
55 | than the default, as the buffer is handled dynamically and only uses the | ||
56 | memory actually required by the data sent by the peer. | ||
57 | |||
58 | If the maximum certificate chain size allowed is exceeded, the handshake will | ||
59 | fail with a SSL_R_EXCESSIVE_MESSAGE_SIZE error. | ||
60 | |||
61 | =head1 RETURN VALUES | ||
62 | |||
63 | SSL_CTX_set_max_cert_list() and SSL_set_max_cert_list() return the previously | ||
64 | set value. | ||
65 | |||
66 | SSL_CTX_get_max_cert_list() and SSL_get_max_cert_list() return the currently | ||
67 | set value. | ||
68 | |||
69 | =head1 SEE ALSO | ||
70 | |||
71 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
72 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
73 | |||
74 | =head1 HISTORY | ||
75 | |||
76 | SSL*_set/get_max_cert_list() have been introduced in OpenSSL 0.9.7. | ||
77 | |||
78 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.3 new file mode 100644 index 0000000000..b980d43dbe --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.3 | |||
@@ -0,0 +1,123 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_mode , | ||
6 | .Nm SSL_set_mode , | ||
7 | .Nm SSL_CTX_get_mode , | ||
8 | .Nm SSL_get_mode | ||
9 | .Nd manipulate SSL engine mode | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" | ||
14 | .Ft long | ||
15 | .Fn SSL_set_mode "SSL *ssl" "long mode" | ||
16 | .Ft long | ||
17 | .Fn SSL_CTX_get_mode "SSL_CTX *ctx" | ||
18 | .Ft long | ||
19 | .Fn SSL_get_mode "SSL *ssl" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_mode | ||
22 | adds the mode set via bitmask in | ||
23 | .Fa mode | ||
24 | to | ||
25 | .Fa ctx . | ||
26 | Options already set before are not cleared. | ||
27 | .Pp | ||
28 | .Fn SSL_set_mode | ||
29 | adds the mode set via bitmask in | ||
30 | .Fa mode | ||
31 | to | ||
32 | .Fa ssl . | ||
33 | Options already set before are not cleared. | ||
34 | .Pp | ||
35 | .Fn SSL_CTX_get_mode | ||
36 | returns the mode set for | ||
37 | .Fa ctx . | ||
38 | .Pp | ||
39 | .Fn SSL_get_mode | ||
40 | returns the mode set for | ||
41 | .Fa ssl . | ||
42 | .Sh NOTES | ||
43 | The following mode changes are available: | ||
44 | .Bl -tag -width Ds | ||
45 | .It Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
46 | Allow | ||
47 | .Fn SSL_write ... n | ||
48 | to return | ||
49 | .Ms r | ||
50 | with | ||
51 | .EQ | ||
52 | 0 < r < n | ||
53 | .EN | ||
54 | (i.e., report success when just a single record has been written). | ||
55 | When not set (the default), | ||
56 | .Xr SSL_write 3 | ||
57 | will only report success once the complete chunk was written. | ||
58 | Once | ||
59 | .Xr SSL_write 3 | ||
60 | returns with | ||
61 | .Ms r , | ||
62 | .Ms r | ||
63 | bytes have been successfully written and the next call to | ||
64 | .Xr SSL_write 3 | ||
65 | must only send the | ||
66 | .Ms n \(mi r | ||
67 | bytes left, imitating the behaviour of | ||
68 | .Xr write 2 . | ||
69 | .It Dv SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | ||
70 | Make it possible to retry | ||
71 | .Xr SSL_write 3 | ||
72 | with changed buffer location (the buffer contents must stay the same). | ||
73 | This is not the default to avoid the misconception that non-blocking | ||
74 | .Xr SSL_write 3 | ||
75 | behaves like non-blocking | ||
76 | .Xr write 2 . | ||
77 | .It Dv SSL_MODE_AUTO_RETRY | ||
78 | Never bother the application with retries if the transport is blocking. | ||
79 | If a renegotiation take place during normal operation, a | ||
80 | .Xr SSL_read 3 | ||
81 | or | ||
82 | .Xr SSL_write 3 | ||
83 | would return | ||
84 | with \(mi1 and indicate the need to retry with | ||
85 | .Dv SSL_ERROR_WANT_READ . | ||
86 | In a non-blocking environment applications must be prepared to handle | ||
87 | incomplete read/write operations. | ||
88 | In a blocking environment, applications are not always prepared to deal with | ||
89 | read/write operations returning without success report. | ||
90 | The flag | ||
91 | .Dv SSL_MODE_AUTO_RETRY | ||
92 | will cause read/write operations to only return after the handshake and | ||
93 | successful completion. | ||
94 | .It Dv SSL_MODE_RELEASE_BUFFERS | ||
95 | When we no longer need a read buffer or a write buffer for a given | ||
96 | .Vt SSL , | ||
97 | then release the memory we were using to hold it. | ||
98 | Released memory is either appended to a list of unused RAM chunks on the | ||
99 | .Vt SSL_CTX , | ||
100 | or simply freed if the list of unused chunks would become longer than | ||
101 | .Va "SSL_CTX->freelist_max_len" , | ||
102 | which defaults to 32. | ||
103 | Using this flag can save around 34k per idle SSL connection. | ||
104 | This flag has no effect on SSL v2 connections, or on DTLS connections. | ||
105 | .El | ||
106 | .Sh RETURN VALUES | ||
107 | .Fn SSL_CTX_set_mode | ||
108 | and | ||
109 | .Fn SSL_set_mode | ||
110 | return the new mode bitmask after adding | ||
111 | .Fa mode . | ||
112 | .Pp | ||
113 | .Fn SSL_CTX_get_mode | ||
114 | and | ||
115 | .Fn SSL_get_mode | ||
116 | return the current bitmask. | ||
117 | .Sh SEE ALSO | ||
118 | .Xr ssl 3 , | ||
119 | .Xr SSL_read 3 , | ||
120 | .Xr SSL_write 3 | ||
121 | .Sh HISTORY | ||
122 | .Dv SSL_MODE_AUTO_RETRY | ||
123 | was added in OpenSSL 0.9.6. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod deleted file mode 100644 index 0208d17654..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_mode.pod +++ /dev/null | |||
@@ -1,92 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_mode, SSL_set_mode, SSL_CTX_get_mode, SSL_get_mode - manipulate SSL | ||
6 | engine mode | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_set_mode(SSL_CTX *ctx, long mode); | ||
13 | long SSL_set_mode(SSL *ssl, long mode); | ||
14 | |||
15 | long SSL_CTX_get_mode(SSL_CTX *ctx); | ||
16 | long SSL_get_mode(SSL *ssl); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_mode() adds the mode set via bitmask in B<mode> to B<ctx>. | ||
21 | Options already set before are not cleared. | ||
22 | |||
23 | SSL_set_mode() adds the mode set via bitmask in B<mode> to B<ssl>. | ||
24 | Options already set before are not cleared. | ||
25 | |||
26 | SSL_CTX_get_mode() returns the mode set for B<ctx>. | ||
27 | |||
28 | SSL_get_mode() returns the mode set for B<ssl>. | ||
29 | |||
30 | =head1 NOTES | ||
31 | |||
32 | The following mode changes are available: | ||
33 | |||
34 | =over 4 | ||
35 | |||
36 | =item SSL_MODE_ENABLE_PARTIAL_WRITE | ||
37 | |||
38 | Allow SSL_write(..., n) to return r with 0 < r < n (i.e. report success | ||
39 | when just a single record has been written). When not set (the default), | ||
40 | SSL_write() will only report success once the complete chunk was written. | ||
41 | Once SSL_write() returns with r, r bytes have been successfully written | ||
42 | and the next call to SSL_write() must only send the n-r bytes left, | ||
43 | imitating the behaviour of write(). | ||
44 | |||
45 | =item SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | ||
46 | |||
47 | Make it possible to retry SSL_write() with changed buffer location | ||
48 | (the buffer contents must stay the same). This is not the default to avoid | ||
49 | the misconception that non-blocking SSL_write() behaves like | ||
50 | non-blocking write(). | ||
51 | |||
52 | =item SSL_MODE_AUTO_RETRY | ||
53 | |||
54 | Never bother the application with retries if the transport is blocking. | ||
55 | If a renegotiation take place during normal operation, a | ||
56 | L<SSL_read(3)|SSL_read(3)> or L<SSL_write(3)|SSL_write(3)> would return | ||
57 | with -1 and indicate the need to retry with SSL_ERROR_WANT_READ. | ||
58 | In a non-blocking environment applications must be prepared to handle | ||
59 | incomplete read/write operations. | ||
60 | In a blocking environment, applications are not always prepared to | ||
61 | deal with read/write operations returning without success report. The | ||
62 | flag SSL_MODE_AUTO_RETRY will cause read/write operations to only | ||
63 | return after the handshake and successful completion. | ||
64 | |||
65 | =item SSL_MODE_RELEASE_BUFFERS | ||
66 | |||
67 | When we no longer need a read buffer or a write buffer for a given SSL, | ||
68 | then release the memory we were using to hold it. Released memory is | ||
69 | either appended to a list of unused RAM chunks on the SSL_CTX, or simply | ||
70 | freed if the list of unused chunks would become longer than | ||
71 | SSL_CTX->freelist_max_len, which defaults to 32. Using this flag can | ||
72 | save around 34k per idle SSL connection. | ||
73 | This flag has no effect on SSL v2 connections, or on DTLS connections. | ||
74 | |||
75 | =back | ||
76 | |||
77 | =head1 RETURN VALUES | ||
78 | |||
79 | SSL_CTX_set_mode() and SSL_set_mode() return the new mode bitmask | ||
80 | after adding B<mode>. | ||
81 | |||
82 | SSL_CTX_get_mode() and SSL_get_mode() return the current bitmask. | ||
83 | |||
84 | =head1 SEE ALSO | ||
85 | |||
86 | L<ssl(3)|ssl(3)>, L<SSL_read(3)|SSL_read(3)>, L<SSL_write(3)|SSL_write(3)> | ||
87 | |||
88 | =head1 HISTORY | ||
89 | |||
90 | SSL_MODE_AUTO_RETRY as been added in OpenSSL 0.9.6. | ||
91 | |||
92 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.3 new file mode 100644 index 0000000000..82c1479af0 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.3 | |||
@@ -0,0 +1,132 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_MSG_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_msg_callback , | ||
6 | .Nm SSL_CTX_set_msg_callback_arg , | ||
7 | .Nm SSL_set_msg_callback , | ||
8 | .Nm SSL_get_msg_callback_arg | ||
9 | .Nd install callback for observing protocol messages | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_msg_callback | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
16 | .Fc | ||
17 | .Ft void | ||
18 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
19 | .Ft void | ||
20 | .Fo SSL_set_msg_callback | ||
21 | .Fa "SSL *ssl" | ||
22 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fn SSL_set_msg_callback_arg "SSL *ssl" "void *arg" | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_set_msg_callback | ||
28 | or | ||
29 | .Fn SSL_set_msg_callback | ||
30 | can be used to define a message callback function | ||
31 | .Fa cb | ||
32 | for observing all SSL/TLS protocol messages (such as handshake messages) | ||
33 | that are received or sent. | ||
34 | .Fn SSL_CTX_set_msg_callback_arg | ||
35 | and | ||
36 | .Fn SSL_set_msg_callback_arg | ||
37 | can be used to set argument | ||
38 | .Fa arg | ||
39 | to the callback function, which is available for arbitrary application use. | ||
40 | .Pp | ||
41 | .Fn SSL_CTX_set_msg_callback | ||
42 | and | ||
43 | .Fn SSL_CTX_set_msg_callback_arg | ||
44 | specify default settings that will be copied to new | ||
45 | .Vt SSL | ||
46 | objects by | ||
47 | .Xr SSL_new 3 . | ||
48 | .Fn SSL_set_msg_callback | ||
49 | and | ||
50 | .Fn SSL_set_msg_callback_arg | ||
51 | modify the actual settings of an | ||
52 | .Vt SSL | ||
53 | object. | ||
54 | Using a | ||
55 | .Dv NULL | ||
56 | pointer for | ||
57 | .Fa cb | ||
58 | disables the message callback. | ||
59 | .Pp | ||
60 | When | ||
61 | .Fa cb | ||
62 | is called by the SSL/TLS library for a protocol message, | ||
63 | the function arguments have the following meaning: | ||
64 | .Bl -tag -width Ds | ||
65 | .It Fa write_p | ||
66 | This flag is 0 when a protocol message has been received and 1 when a protocol | ||
67 | message has been sent. | ||
68 | .It Fa version | ||
69 | The protocol version according to which the protocol message is | ||
70 | interpreted by the library. | ||
71 | Currently, this is one of | ||
72 | .Dv SSL2_VERSION , | ||
73 | .Dv SSL3_VERSION | ||
74 | and | ||
75 | .Dv TLS1_VERSION | ||
76 | (for SSL 2.0, SSL 3.0 and TLS 1.0, respectively). | ||
77 | .It Fa content_type | ||
78 | In the case of SSL 2.0, this is always 0. | ||
79 | In the case of SSL 3.0 or TLS 1.0, this is one of the | ||
80 | .Em ContentType | ||
81 | values defined in the protocol specification | ||
82 | .Po | ||
83 | .Dq change_cipher_spec(20) , | ||
84 | .Dq alert(21) , | ||
85 | .Dq handshake(22) ; | ||
86 | but never | ||
87 | .Dq application_data(23) | ||
88 | because the callback will only be called for protocol messages. | ||
89 | .Pc | ||
90 | .It Fa buf , Fa len | ||
91 | .Fa buf | ||
92 | points to a buffer containing the protocol message, which consists of | ||
93 | .Fa len | ||
94 | bytes. | ||
95 | The buffer is no longer valid after the callback function has returned. | ||
96 | .It Fa ssl | ||
97 | The | ||
98 | .Vt SSL | ||
99 | object that received or sent the message. | ||
100 | .It Fa arg | ||
101 | The user-defined argument optionally defined by | ||
102 | .Fn SSL_CTX_set_msg_callback_arg | ||
103 | or | ||
104 | .Fn SSL_set_msg_callback_arg . | ||
105 | .El | ||
106 | .Sh NOTES | ||
107 | Protocol messages are passed to the callback function after decryption | ||
108 | and fragment collection where applicable. | ||
109 | (Thus record boundaries are not visible.) | ||
110 | .Pp | ||
111 | If processing a received protocol message results in an error, | ||
112 | the callback function may not be called. | ||
113 | For example, the callback function will never see messages that are considered | ||
114 | too large to be processed. | ||
115 | .Pp | ||
116 | Due to automatic protocol version negotiation, | ||
117 | .Fa version | ||
118 | is not necessarily the protocol version used by the sender of the message: | ||
119 | If a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, | ||
120 | .Fa version | ||
121 | will be | ||
122 | .Dv SSL3_VERSION . | ||
123 | .Sh SEE ALSO | ||
124 | .Xr ssl 3 , | ||
125 | .Xr SSL_new 3 | ||
126 | .Sh HISTORY | ||
127 | .Fn SSL_CTX_set_msg_callback , | ||
128 | .Fn SSL_CTX_set_msg_callback_arg , | ||
129 | .Fn SSL_set_msg_callback | ||
130 | and | ||
131 | .Fn SSL_get_msg_callback_arg | ||
132 | were added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod deleted file mode 100644 index 89a33e8750..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_msg_callback.pod +++ /dev/null | |||
@@ -1,101 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_msg_callback, SSL_CTX_set_msg_callback_arg, SSL_set_msg_callback, | ||
6 | SSL_get_msg_callback_arg - install callback for observing protocol messages | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_msg_callback(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
13 | void SSL_CTX_set_msg_callback_arg(SSL_CTX *ctx, void *arg); | ||
14 | |||
15 | void SSL_set_msg_callback(SSL *ssl, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
16 | void SSL_set_msg_callback_arg(SSL *ssl, void *arg); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_msg_callback() or SSL_set_msg_callback() can be used to | ||
21 | define a message callback function I<cb> for observing all SSL/TLS | ||
22 | protocol messages (such as handshake messages) that are received or | ||
23 | sent. SSL_CTX_set_msg_callback_arg() and SSL_set_msg_callback_arg() | ||
24 | can be used to set argument I<arg> to the callback function, which is | ||
25 | available for arbitrary application use. | ||
26 | |||
27 | SSL_CTX_set_msg_callback() and SSL_CTX_set_msg_callback_arg() specify | ||
28 | default settings that will be copied to new B<SSL> objects by | ||
29 | L<SSL_new(3)|SSL_new(3)>. SSL_set_msg_callback() and | ||
30 | SSL_set_msg_callback_arg() modify the actual settings of an B<SSL> | ||
31 | object. Using a B<0> pointer for I<cb> disables the message callback. | ||
32 | |||
33 | When I<cb> is called by the SSL/TLS library for a protocol message, | ||
34 | the function arguments have the following meaning: | ||
35 | |||
36 | =over 4 | ||
37 | |||
38 | =item I<write_p> | ||
39 | |||
40 | This flag is B<0> when a protocol message has been received and B<1> | ||
41 | when a protocol message has been sent. | ||
42 | |||
43 | =item I<version> | ||
44 | |||
45 | The protocol version according to which the protocol message is | ||
46 | interpreted by the library. Currently, this is one of | ||
47 | B<SSL2_VERSION>, B<SSL3_VERSION> and B<TLS1_VERSION> (for SSL 2.0, SSL | ||
48 | 3.0 and TLS 1.0, respectively). | ||
49 | |||
50 | =item I<content_type> | ||
51 | |||
52 | In the case of SSL 2.0, this is always B<0>. In the case of SSL 3.0 | ||
53 | or TLS 1.0, this is one of the B<ContentType> values defined in the | ||
54 | protocol specification (B<change_cipher_spec(20)>, B<alert(21)>, | ||
55 | B<handshake(22)>; but never B<application_data(23)> because the | ||
56 | callback will only be called for protocol messages). | ||
57 | |||
58 | =item I<buf>, I<len> | ||
59 | |||
60 | I<buf> points to a buffer containing the protocol message, which | ||
61 | consists of I<len> bytes. The buffer is no longer valid after the | ||
62 | callback function has returned. | ||
63 | |||
64 | =item I<ssl> | ||
65 | |||
66 | The B<SSL> object that received or sent the message. | ||
67 | |||
68 | =item I<arg> | ||
69 | |||
70 | The user-defined argument optionally defined by | ||
71 | SSL_CTX_set_msg_callback_arg() or SSL_set_msg_callback_arg(). | ||
72 | |||
73 | =back | ||
74 | |||
75 | =head1 NOTES | ||
76 | |||
77 | Protocol messages are passed to the callback function after decryption | ||
78 | and fragment collection where applicable. (Thus record boundaries are | ||
79 | not visible.) | ||
80 | |||
81 | If processing a received protocol message results in an error, | ||
82 | the callback function may not be called. For example, the callback | ||
83 | function will never see messages that are considered too large to be | ||
84 | processed. | ||
85 | |||
86 | Due to automatic protocol version negotiation, I<version> is not | ||
87 | necessarily the protocol version used by the sender of the message: If | ||
88 | a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, | ||
89 | I<version> will be B<SSL3_VERSION>. | ||
90 | |||
91 | =head1 SEE ALSO | ||
92 | |||
93 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> | ||
94 | |||
95 | =head1 HISTORY | ||
96 | |||
97 | SSL_CTX_set_msg_callback(), SSL_CTX_set_msg_callback_arg(), | ||
98 | SSL_set_msg_callback() and SSL_get_msg_callback_arg() were added in OpenSSL | ||
99 | 0.9.7. | ||
100 | |||
101 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.3 new file mode 100644 index 0000000000..8b2f75cc59 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.3 | |||
@@ -0,0 +1,384 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_OPTIONS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_options , | ||
6 | .Nm SSL_set_options , | ||
7 | .Nm SSL_CTX_clear_options , | ||
8 | .Nm SSL_clear_options , | ||
9 | .Nm SSL_CTX_get_options , | ||
10 | .Nm SSL_get_options , | ||
11 | .Nm SSL_get_secure_renegotiation_support | ||
12 | .Nd manipulate SSL options | ||
13 | .Sh SYNOPSIS | ||
14 | .In openssl/ssl.h | ||
15 | .Ft long | ||
16 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" | ||
17 | .Ft long | ||
18 | .Fn SSL_set_options "SSL *ssl" "long options" | ||
19 | .Ft long | ||
20 | .Fn SSL_CTX_clear_options "SSL_CTX *ctx" "long options" | ||
21 | .Ft long | ||
22 | .Fn SSL_clear_options "SSL *ssl" "long options" | ||
23 | .Ft long | ||
24 | .Fn SSL_CTX_get_options "SSL_CTX *ctx" | ||
25 | .Ft long | ||
26 | .Fn SSL_get_options "SSL *ssl" | ||
27 | .Ft long | ||
28 | .Fn SSL_get_secure_renegotiation_support "SSL *ssl" | ||
29 | .Sh DESCRIPTION | ||
30 | Note: all these functions are implemented using macros. | ||
31 | .Pp | ||
32 | .Fn SSL_CTX_set_options | ||
33 | adds the options set via bitmask in | ||
34 | .Fa options | ||
35 | to | ||
36 | .Fa ctx . | ||
37 | Options already set before are not cleared! | ||
38 | .Pp | ||
39 | .Fn SSL_set_options | ||
40 | adds the options set via bitmask in | ||
41 | .Fa options | ||
42 | to | ||
43 | .Fa ssl . | ||
44 | Options already set before are not cleared! | ||
45 | .Pp | ||
46 | .Fn SSL_CTX_clear_options | ||
47 | clears the options set via bitmask in | ||
48 | .Fa options | ||
49 | to | ||
50 | .Fa ctx . | ||
51 | .Pp | ||
52 | .Fn SSL_clear_options | ||
53 | clears the options set via bitmask in | ||
54 | .Fa options | ||
55 | to | ||
56 | .Fa ssl . | ||
57 | .Pp | ||
58 | .Fn SSL_CTX_get_options | ||
59 | returns the options set for | ||
60 | .Fa ctx . | ||
61 | .Pp | ||
62 | .Fn SSL_get_options | ||
63 | returns the options set for | ||
64 | .Fa ssl . | ||
65 | .Pp | ||
66 | .Fn SSL_get_secure_renegotiation_support | ||
67 | indicates whether the peer supports secure renegotiation. | ||
68 | .Sh NOTES | ||
69 | The behaviour of the SSL library can be changed by setting several options. | ||
70 | The options are coded as bitmasks and can be combined by a bitwise OR | ||
71 | operation (|). | ||
72 | .Pp | ||
73 | .Fn SSL_CTX_set_options | ||
74 | and | ||
75 | .Fn SSL_set_options | ||
76 | affect the (external) protocol behaviour of the SSL library. | ||
77 | The (internal) behaviour of the API can be changed by using the similar | ||
78 | .Xr SSL_CTX_set_mode 3 | ||
79 | and | ||
80 | .Xr SSL_set_mode 3 | ||
81 | functions. | ||
82 | .Pp | ||
83 | During a handshake, the option settings of the SSL object are used. | ||
84 | When a new SSL object is created from a context using | ||
85 | .Xr SSL_new 3 , | ||
86 | the current option setting is copied. | ||
87 | Changes to | ||
88 | .Fa ctx | ||
89 | do not affect already created | ||
90 | .Vt SSL | ||
91 | objects. | ||
92 | .Fn SSL_clear | ||
93 | does not affect the settings. | ||
94 | .Pp | ||
95 | The following | ||
96 | .Em bug workaround | ||
97 | options are available: | ||
98 | .Bl -tag -width Ds | ||
99 | .It Dv SSL_OP_MICROSOFT_SESS_ID_BUG | ||
100 | .Lk www.microsoft.com | ||
101 | \(en when talking SSLv2, if session-id reuse is performed, | ||
102 | the session-id passed back in the server-finished message is different from the | ||
103 | one decided upon. | ||
104 | .It Dv SSL_OP_NETSCAPE_CHALLENGE_BUG | ||
105 | Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte challenge but | ||
106 | then appears to only use 16 bytes when generating the encryption keys. | ||
107 | Using 16 bytes is ok but it should be ok to use 32. | ||
108 | According to the SSLv3 spec, one should use 32 bytes for the challenge when | ||
109 | operating in SSLv2/v3 compatibility mode, but as mentioned above, this breaks | ||
110 | this server so 16 bytes is the way to go. | ||
111 | .It Dv SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG | ||
112 | As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. | ||
113 | .It Dv SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG | ||
114 | \&... | ||
115 | .It Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER | ||
116 | \&... | ||
117 | .It Dv SSL_OP_SAFARI_ECDHE_ECDSA_BUG | ||
118 | Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. | ||
119 | OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers. | ||
120 | .It Dv SSL_OP_SSLEAY_080_CLIENT_DH_BUG | ||
121 | \&... | ||
122 | .It Dv SSL_OP_TLS_D5_BUG | ||
123 | \&... | ||
124 | .It Dv SSL_OP_TLS_BLOCK_PADDING_BUG | ||
125 | \&... | ||
126 | .It Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
127 | Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability | ||
128 | affecting CBC ciphers, which cannot be handled by some broken SSL | ||
129 | implementations. | ||
130 | This option has no effect for connections using other ciphers. | ||
131 | .It Dv SSL_OP_TLSEXT_PADDING | ||
132 | Adds a padding extension to ensure the ClientHello size is never between 256 | ||
133 | and 511 bytes in length. | ||
134 | This is needed as a workaround for some implementations. | ||
135 | .It Dv SSL_OP_ALL | ||
136 | All of the above bug workarounds. | ||
137 | .El | ||
138 | .Pp | ||
139 | It is usually safe to use | ||
140 | .Dv SSL_OP_ALL | ||
141 | to enable the bug workaround options if compatibility with somewhat broken | ||
142 | implementations is desired. | ||
143 | .Pp | ||
144 | The following | ||
145 | .Em modifying | ||
146 | options are available: | ||
147 | .Bl -tag -width Ds | ||
148 | .It Dv SSL_OP_TLS_ROLLBACK_BUG | ||
149 | Disable version rollback attack detection. | ||
150 | .Pp | ||
151 | During the client key exchange, the client must send the same information | ||
152 | about acceptable SSL/TLS protocol levels as during the first hello. | ||
153 | Some clients violate this rule by adapting to the server's answer. | ||
154 | (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, | ||
155 | the server only understands up to SSLv3. | ||
156 | In this case the client must still use the same SSLv3.1=TLSv1 announcement. | ||
157 | Some clients step down to SSLv3 with respect to the server's answer and violate | ||
158 | the version rollback protection.) | ||
159 | .It Dv SSL_OP_SINGLE_DH_USE | ||
160 | Always create a new key when using temporary/ephemeral DH parameters | ||
161 | (see | ||
162 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
163 | This option must be used to prevent small subgroup attacks, when the DH | ||
164 | parameters were not generated using | ||
165 | .Dq strong | ||
166 | primes (e.g., when using DSA-parameters, see | ||
167 | .Xr dhparam 1 ) . | ||
168 | If | ||
169 | .Dq strong | ||
170 | primes were used, it is not strictly necessary to generate a new DH key during | ||
171 | each handshake but it is also recommended. | ||
172 | .Dv SSL_OP_SINGLE_DH_USE | ||
173 | should therefore be enabled whenever temporary/ephemeral DH parameters are used. | ||
174 | .It SSL_OP_EPHEMERAL_RSA | ||
175 | Always use ephemeral (temporary) RSA key when doing RSA operations (see | ||
176 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
177 | According to the specifications, this is only done when a RSA key can only be | ||
178 | used for signature operations (namely under export ciphers with restricted RSA | ||
179 | keylength). | ||
180 | By setting this option, ephemeral RSA keys are always used. | ||
181 | This option breaks compatibility with the SSL/TLS specifications and may lead | ||
182 | to interoperability problems with clients and should therefore never be used. | ||
183 | Ciphers with EDH (ephemeral Diffie-Hellman) key exchange should be used instead. | ||
184 | .It Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
185 | When choosing a cipher, use the server's preferences instead of the client | ||
186 | preferences. | ||
187 | When not set, the SSL server will always follow the client's preferences. | ||
188 | When set, the SSLv3/TLSv1 server will choose following its own preferences. | ||
189 | Because of the different protocol, for SSLv2 the server will send its list of | ||
190 | preferences to the client and the client chooses. | ||
191 | .It Dv SSL_OP_NETSCAPE_CA_DN_BUG | ||
192 | If we accept a netscape connection, demand a client cert, have a | ||
193 | non-self-signed CA which does not have its CA in netscape, and the browser has | ||
194 | a cert, it will crash/hang. | ||
195 | Works for 3.x and 4.xbeta | ||
196 | .It Dv SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG | ||
197 | \&... | ||
198 | .It Dv SSL_OP_NO_SSLv2 | ||
199 | As of | ||
200 | .Ox 5.6 , | ||
201 | this option has no effect as SSLv2 support has been removed. | ||
202 | In previous versions it disabled use of the SSLv2 protocol. | ||
203 | .It Dv SSL_OP_NO_SSLv3 | ||
204 | Do not use the SSLv3 protocol. | ||
205 | .It Dv SSL_OP_NO_TLSv1 | ||
206 | Do not use the TLSv1.0 protocol. | ||
207 | .It Dv SSL_OP_NO_TLSv1_1 | ||
208 | Do not use the TLSv1.1 protocol. | ||
209 | .It Dv SSL_OP_NO_TLSv1_2 | ||
210 | Do not use the TLSv1.2 protocol. | ||
211 | .It Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
212 | When performing renegotiation as a server, always start a new session (i.e., | ||
213 | session resumption requests are only accepted in the initial handshake). | ||
214 | This option is not needed for clients. | ||
215 | .It Dv SSL_OP_NO_TICKET | ||
216 | Normally clients and servers will, where possible, transparently make use of | ||
217 | RFC4507bis tickets for stateless session resumption. | ||
218 | .Pp | ||
219 | If this option is set this functionality is disabled and tickets will not be | ||
220 | used by clients or servers. | ||
221 | .It Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
222 | As of | ||
223 | .Ox 5.6 , | ||
224 | this option has no effect. | ||
225 | In previous versions it allowed legacy insecure renegotiation between OpenSSL | ||
226 | and unpatched clients or servers. | ||
227 | See the | ||
228 | .Sx SECURE RENEGOTIATION | ||
229 | section for more details. | ||
230 | .It Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
231 | Allow legacy insecure renegotiation between OpenSSL and unpatched servers | ||
232 | .Em only : | ||
233 | this option is currently set by default. | ||
234 | See the | ||
235 | .Sx SECURE RENEGOTIATION | ||
236 | section for more details. | ||
237 | .El | ||
238 | .Sh SECURE RENEGOTIATION | ||
239 | OpenSSL 0.9.8m and later always attempts to use secure renegotiation as | ||
240 | described in RFC5746. | ||
241 | This counters the prefix attack described in CVE-2009-3555 and elsewhere. | ||
242 | .Pp | ||
243 | The deprecated and highly broken SSLv2 protocol does not support renegotiation | ||
244 | at all; its use is | ||
245 | .Em strongly | ||
246 | discouraged. | ||
247 | .Pp | ||
248 | This attack has far-reaching consequences which application writers should be | ||
249 | aware of. | ||
250 | In the description below an implementation supporting secure renegotiation is | ||
251 | referred to as | ||
252 | .Dq patched . | ||
253 | A server not supporting secure | ||
254 | renegotiation is referred to as | ||
255 | .Dq unpatched . | ||
256 | .Pp | ||
257 | The following sections describe the operations permitted by OpenSSL's secure | ||
258 | renegotiation implementation. | ||
259 | .Ss Patched client and server | ||
260 | Connections and renegotiation are always permitted by OpenSSL implementations. | ||
261 | .Ss Unpatched client and patched OpenSSL server | ||
262 | The initial connection succeeds but client renegotiation is denied by the | ||
263 | server with a | ||
264 | .Em no_renegotiation | ||
265 | warning alert if TLS v1.0 is used or a fatal | ||
266 | .Em handshake_failure | ||
267 | alert in SSL v3.0. | ||
268 | .Pp | ||
269 | If the patched OpenSSL server attempts to renegotiate a fatal | ||
270 | .Em handshake_failure | ||
271 | alert is sent. | ||
272 | This is because the server code may be unaware of the unpatched nature of the | ||
273 | client. | ||
274 | .Pp | ||
275 | .Em N.B.: | ||
276 | a bug in OpenSSL clients earlier than 0.9.8m (all of which are unpatched) will | ||
277 | result in the connection hanging if it receives a | ||
278 | .Em no_renegotiation | ||
279 | alert. | ||
280 | OpenSSL versions 0.9.8m and later will regard a | ||
281 | .Em no_renegotiation | ||
282 | alert as fatal and respond with a fatal | ||
283 | .Em handshake_failure | ||
284 | alert. | ||
285 | This is because the OpenSSL API currently has no provision to indicate to an | ||
286 | application that a renegotiation attempt was refused. | ||
287 | .Ss Patched OpenSSL client and unpatched server | ||
288 | If the option | ||
289 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
290 | is set then initial connections and renegotiation between patched OpenSSL | ||
291 | clients and unpatched servers succeeds. | ||
292 | If neither option is set then initial connections to unpatched servers will | ||
293 | fail. | ||
294 | .Pp | ||
295 | The option | ||
296 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
297 | is currently set by default even though it has security implications: | ||
298 | otherwise it would be impossible to connect to unpatched servers (i.e., all of | ||
299 | them initially) and this is clearly not acceptable. | ||
300 | Renegotiation is permitted because this does not add any additional security | ||
301 | issues: during an attack clients do not see any renegotiations anyway. | ||
302 | .Pp | ||
303 | As more servers become patched the option | ||
304 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
305 | will | ||
306 | .Em not | ||
307 | be set by default in a future version of OpenSSL. | ||
308 | .Pp | ||
309 | OpenSSL client applications wishing to ensure they can connect to unpatched | ||
310 | servers should always | ||
311 | .Em set | ||
312 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
313 | .Pp | ||
314 | OpenSSL client applications that want to ensure they can | ||
315 | .Em not | ||
316 | connect to unpatched servers (and thus avoid any security issues) should always | ||
317 | .Em clear | ||
318 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
319 | using | ||
320 | .Fn SSL_CTX_clear_options | ||
321 | or | ||
322 | .Fn SSL_clear_options . | ||
323 | .Sh RETURN VALUES | ||
324 | .Fn SSL_CTX_set_options | ||
325 | and | ||
326 | .Fn SSL_set_options | ||
327 | return the new options bitmask after adding | ||
328 | .Fa options . | ||
329 | .Pp | ||
330 | .Fn SSL_CTX_clear_options | ||
331 | and | ||
332 | .Fn SSL_clear_options | ||
333 | return the new options bitmask after clearing | ||
334 | .Fa options . | ||
335 | .Pp | ||
336 | .Fn SSL_CTX_get_options | ||
337 | and | ||
338 | .Fn SSL_get_options | ||
339 | return the current bitmask. | ||
340 | .Pp | ||
341 | .Fn SSL_get_secure_renegotiation_support | ||
342 | returns 1 is the peer supports secure renegotiation and 0 if it does not. | ||
343 | .Sh SEE ALSO | ||
344 | .Xr dhparam 1 , | ||
345 | .Xr ssl 3 , | ||
346 | .Xr SSL_clear 3 , | ||
347 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
348 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
349 | .Xr SSL_new 3 | ||
350 | .Sh HISTORY | ||
351 | .Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
352 | and | ||
353 | .Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
354 | have been added in | ||
355 | OpenSSL 0.9.7. | ||
356 | .Pp | ||
357 | .Dv SSL_OP_TLS_ROLLBACK_BUG | ||
358 | has been added in OpenSSL 0.9.6 and was automatically enabled with | ||
359 | .Dv SSL_OP_ALL . | ||
360 | As of 0.9.7, it is no longer included in | ||
361 | .Dv SSL_OP_ALL | ||
362 | and must be explicitly set. | ||
363 | .Pp | ||
364 | .Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
365 | has been added in OpenSSL 0.9.6e. | ||
366 | Versions up to OpenSSL 0.9.6c do not include the countermeasure that can be | ||
367 | disabled with this option (in OpenSSL 0.9.6d, it was always enabled). | ||
368 | .Pp | ||
369 | .Fn SSL_CTX_clear_options | ||
370 | and | ||
371 | .Fn SSL_clear_options | ||
372 | were first added in OpenSSL 0.9.8m. | ||
373 | .Pp | ||
374 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION , | ||
375 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
376 | and the function | ||
377 | .Fn SSL_get_secure_renegotiation_support | ||
378 | were first added in OpenSSL 0.9.8m. | ||
379 | .Pp | ||
380 | .Dv SSL_OP_NO_SSLv2 | ||
381 | and | ||
382 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
383 | were changed to have no effect in | ||
384 | .Ox 5.6 . | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod deleted file mode 100644 index c656fb2e19..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_options.pod +++ /dev/null | |||
@@ -1,350 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_options, SSL_set_options, SSL_CTX_clear_options, SSL_clear_options, | ||
6 | SSL_CTX_get_options, SSL_get_options, SSL_get_secure_renegotiation_support - | ||
7 | manipulate SSL options | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | long SSL_CTX_set_options(SSL_CTX *ctx, long options); | ||
14 | long SSL_set_options(SSL *ssl, long options); | ||
15 | |||
16 | long SSL_CTX_clear_options(SSL_CTX *ctx, long options); | ||
17 | long SSL_clear_options(SSL *ssl, long options); | ||
18 | |||
19 | long SSL_CTX_get_options(SSL_CTX *ctx); | ||
20 | long SSL_get_options(SSL *ssl); | ||
21 | |||
22 | long SSL_get_secure_renegotiation_support(SSL *ssl); | ||
23 | |||
24 | =head1 DESCRIPTION | ||
25 | |||
26 | Note: all these functions are implemented using macros. | ||
27 | |||
28 | SSL_CTX_set_options() adds the options set via bitmask in B<options> to B<ctx>. | ||
29 | Options already set before are not cleared! | ||
30 | |||
31 | SSL_set_options() adds the options set via bitmask in B<options> to B<ssl>. | ||
32 | Options already set before are not cleared! | ||
33 | |||
34 | SSL_CTX_clear_options() clears the options set via bitmask in B<options> | ||
35 | to B<ctx>. | ||
36 | |||
37 | SSL_clear_options() clears the options set via bitmask in B<options> to B<ssl>. | ||
38 | |||
39 | SSL_CTX_get_options() returns the options set for B<ctx>. | ||
40 | |||
41 | SSL_get_options() returns the options set for B<ssl>. | ||
42 | |||
43 | SSL_get_secure_renegotiation_support() indicates whether the peer supports | ||
44 | secure renegotiation. | ||
45 | |||
46 | =head1 NOTES | ||
47 | |||
48 | The behaviour of the SSL library can be changed by setting several options. | ||
49 | The options are coded as bitmasks and can be combined by a bitwise B<or> | ||
50 | operation (|). | ||
51 | |||
52 | SSL_CTX_set_options() and SSL_set_options() affect the (external) | ||
53 | protocol behaviour of the SSL library. The (internal) behaviour of | ||
54 | the API can be changed by using the similar | ||
55 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> and SSL_set_mode() functions. | ||
56 | |||
57 | During a handshake, the option settings of the SSL object are used. When | ||
58 | a new SSL object is created from a context using SSL_new(), the current | ||
59 | option setting is copied. Changes to B<ctx> do not affect already created | ||
60 | SSL objects. SSL_clear() does not affect the settings. | ||
61 | |||
62 | The following B<bug workaround> options are available: | ||
63 | |||
64 | =over 4 | ||
65 | |||
66 | =item SSL_OP_MICROSOFT_SESS_ID_BUG | ||
67 | |||
68 | www.microsoft.com - when talking SSLv2, if session-id reuse is | ||
69 | performed, the session-id passed back in the server-finished message | ||
70 | is different from the one decided upon. | ||
71 | |||
72 | =item SSL_OP_NETSCAPE_CHALLENGE_BUG | ||
73 | |||
74 | Netscape-Commerce/1.12, when talking SSLv2, accepts a 32 byte | ||
75 | challenge but then appears to only use 16 bytes when generating the | ||
76 | encryption keys. Using 16 bytes is ok but it should be ok to use 32. | ||
77 | According to the SSLv3 spec, one should use 32 bytes for the challenge | ||
78 | when operating in SSLv2/v3 compatibility mode, but as mentioned above, | ||
79 | this breaks this server so 16 bytes is the way to go. | ||
80 | |||
81 | =item SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG | ||
82 | |||
83 | As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. | ||
84 | |||
85 | =item SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG | ||
86 | |||
87 | ... | ||
88 | |||
89 | =item SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER | ||
90 | |||
91 | ... | ||
92 | |||
93 | =item SSL_OP_SAFARI_ECDHE_ECDSA_BUG | ||
94 | |||
95 | Don't prefer ECDHE-ECDSA ciphers when the client appears to be Safari on OS X. | ||
96 | OS X 10.8..10.8.3 has broken support for ECDHE-ECDSA ciphers. | ||
97 | |||
98 | =item SSL_OP_SSLEAY_080_CLIENT_DH_BUG | ||
99 | |||
100 | ... | ||
101 | |||
102 | =item SSL_OP_TLS_D5_BUG | ||
103 | |||
104 | ... | ||
105 | |||
106 | =item SSL_OP_TLS_BLOCK_PADDING_BUG | ||
107 | |||
108 | ... | ||
109 | |||
110 | =item SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
111 | |||
112 | Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol | ||
113 | vulnerability affecting CBC ciphers, which cannot be handled by some | ||
114 | broken SSL implementations. This option has no effect for connections | ||
115 | using other ciphers. | ||
116 | |||
117 | =item SSL_OP_TLSEXT_PADDING | ||
118 | |||
119 | Adds a padding extension to ensure the ClientHello size is never between | ||
120 | 256 and 511 bytes in length. This is needed as a workaround for some | ||
121 | implementations. | ||
122 | |||
123 | =item SSL_OP_ALL | ||
124 | |||
125 | All of the above bug workarounds. | ||
126 | |||
127 | =back | ||
128 | |||
129 | It is usually safe to use B<SSL_OP_ALL> to enable the bug workaround | ||
130 | options if compatibility with somewhat broken implementations is | ||
131 | desired. | ||
132 | |||
133 | The following B<modifying> options are available: | ||
134 | |||
135 | =over 4 | ||
136 | |||
137 | =item SSL_OP_TLS_ROLLBACK_BUG | ||
138 | |||
139 | Disable version rollback attack detection. | ||
140 | |||
141 | During the client key exchange, the client must send the same information | ||
142 | about acceptable SSL/TLS protocol levels as during the first hello. Some | ||
143 | clients violate this rule by adapting to the server's answer. (Example: | ||
144 | the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, the server | ||
145 | only understands up to SSLv3. In this case the client must still use the | ||
146 | same SSLv3.1=TLSv1 announcement. Some clients step down to SSLv3 with respect | ||
147 | to the server's answer and violate the version rollback protection.) | ||
148 | |||
149 | =item SSL_OP_SINGLE_DH_USE | ||
150 | |||
151 | Always create a new key when using temporary/ephemeral DH parameters | ||
152 | (see L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
153 | This option must be used to prevent small subgroup attacks, when | ||
154 | the DH parameters were not generated using "strong" primes | ||
155 | (e.g. when using DSA-parameters, see L<dhparam(1)|dhparam(1)>). | ||
156 | If "strong" primes were used, it is not strictly necessary to generate | ||
157 | a new DH key during each handshake but it is also recommended. | ||
158 | B<SSL_OP_SINGLE_DH_USE> should therefore be enabled whenever | ||
159 | temporary/ephemeral DH parameters are used. | ||
160 | |||
161 | =item SSL_OP_EPHEMERAL_RSA | ||
162 | |||
163 | Always use ephemeral (temporary) RSA key when doing RSA operations | ||
164 | (see L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>). | ||
165 | According to the specifications this is only done, when a RSA key | ||
166 | can only be used for signature operations (namely under export ciphers | ||
167 | with restricted RSA keylength). By setting this option, ephemeral | ||
168 | RSA keys are always used. This option breaks compatibility with the | ||
169 | SSL/TLS specifications and may lead to interoperability problems with | ||
170 | clients and should therefore never be used. Ciphers with EDH (ephemeral | ||
171 | Diffie-Hellman) key exchange should be used instead. | ||
172 | |||
173 | =item SSL_OP_CIPHER_SERVER_PREFERENCE | ||
174 | |||
175 | When choosing a cipher, use the server's preferences instead of the client | ||
176 | preferences. When not set, the SSL server will always follow the clients | ||
177 | preferences. When set, the SSLv3/TLSv1 server will choose following its | ||
178 | own preferences. Because of the different protocol, for SSLv2 the server | ||
179 | will send its list of preferences to the client and the client chooses. | ||
180 | |||
181 | =item SSL_OP_NETSCAPE_CA_DN_BUG | ||
182 | |||
183 | If we accept a netscape connection, demand a client cert, have a | ||
184 | non-self-signed CA which does not have its CA in netscape, and the | ||
185 | browser has a cert, it will crash/hang. Works for 3.x and 4.xbeta | ||
186 | |||
187 | =item SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG | ||
188 | |||
189 | ... | ||
190 | |||
191 | =item SSL_OP_NO_SSLv2 | ||
192 | |||
193 | As of OpenBSD 5.6, this option has no effect as SSLv2 support has been removed. | ||
194 | In previous versions it disabled use of the SSLv2 protocol. | ||
195 | |||
196 | =item SSL_OP_NO_SSLv3 | ||
197 | |||
198 | Do not use the SSLv3 protocol. | ||
199 | |||
200 | =item SSL_OP_NO_TLSv1 | ||
201 | |||
202 | Do not use the TLSv1.0 protocol. | ||
203 | |||
204 | =item SSL_OP_NO_TLSv1_1 | ||
205 | |||
206 | Do not use the TLSv1.1 protocol. | ||
207 | |||
208 | =item SSL_OP_NO_TLSv1_2 | ||
209 | |||
210 | Do not use the TLSv1.2 protocol. | ||
211 | |||
212 | =item SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
213 | |||
214 | When performing renegotiation as a server, always start a new session | ||
215 | (i.e., session resumption requests are only accepted in the initial | ||
216 | handshake). This option is not needed for clients. | ||
217 | |||
218 | =item SSL_OP_NO_TICKET | ||
219 | |||
220 | Normally clients and servers will, where possible, transparently make use | ||
221 | of RFC4507bis tickets for stateless session resumption. | ||
222 | |||
223 | If this option is set this functionality is disabled and tickets will | ||
224 | not be used by clients or servers. | ||
225 | |||
226 | =item SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
227 | |||
228 | As of OpenBSD 5.6, this option has no effect. | ||
229 | In previous versions it allowed legacy insecure renegotiation between | ||
230 | OpenSSL and unpatched clients or servers. | ||
231 | See the B<SECURE RENEGOTIATION> section for more details. | ||
232 | |||
233 | =item SSL_OP_LEGACY_SERVER_CONNECT | ||
234 | |||
235 | Allow legacy insecure renegotiation between OpenSSL and unpatched servers | ||
236 | B<only>: this option is currently set by default. See the | ||
237 | B<SECURE RENEGOTIATION> section for more details. | ||
238 | |||
239 | =back | ||
240 | |||
241 | =head1 SECURE RENEGOTIATION | ||
242 | |||
243 | OpenSSL 0.9.8m and later always attempts to use secure renegotiation as | ||
244 | described in RFC5746. This counters the prefix attack described in | ||
245 | CVE-2009-3555 and elsewhere. | ||
246 | |||
247 | The deprecated and highly broken SSLv2 protocol does not support | ||
248 | renegotiation at all: its use is B<strongly> discouraged. | ||
249 | |||
250 | This attack has far reaching consequences which application writers should be | ||
251 | aware of. In the description below an implementation supporting secure | ||
252 | renegotiation is referred to as I<patched>. A server not supporting secure | ||
253 | renegotiation is referred to as I<unpatched>. | ||
254 | |||
255 | The following sections describe the operations permitted by OpenSSL's secure | ||
256 | renegotiation implementation. | ||
257 | |||
258 | =head2 Patched client and server | ||
259 | |||
260 | Connections and renegotiation are always permitted by OpenSSL implementations. | ||
261 | |||
262 | =head2 Unpatched client and patched OpenSSL server | ||
263 | |||
264 | The initial connection succeeds but client renegotiation is denied by the | ||
265 | server with a B<no_renegotiation> warning alert if TLS v1.0 is used or a fatal | ||
266 | B<handshake_failure> alert in SSL v3.0. | ||
267 | |||
268 | If the patched OpenSSL server attempts to renegotiate a fatal | ||
269 | B<handshake_failure> alert is sent. This is because the server code may be | ||
270 | unaware of the unpatched nature of the client. | ||
271 | |||
272 | B<NB:> a bug in OpenSSL clients earlier than 0.9.8m (all of which are | ||
273 | unpatched) will result in the connection hanging if it receives a | ||
274 | B<no_renegotiation> alert. OpenSSL versions 0.9.8m and later will regard | ||
275 | a B<no_renegotiation> alert as fatal and respond with a fatal | ||
276 | B<handshake_failure> alert. This is because the OpenSSL API currently has | ||
277 | no provision to indicate to an application that a renegotiation attempt | ||
278 | was refused. | ||
279 | |||
280 | =head2 Patched OpenSSL client and unpatched server. | ||
281 | |||
282 | If the option B<SSL_OP_LEGACY_SERVER_CONNECT> is set then initial connections | ||
283 | and renegotiation between patched OpenSSL clients and unpatched servers | ||
284 | succeeds. If neither option is set then initial connections to unpatched | ||
285 | servers will fail. | ||
286 | |||
287 | The option B<SSL_OP_LEGACY_SERVER_CONNECT> is currently set by default even | ||
288 | though it has security implications: otherwise it would be impossible to | ||
289 | connect to unpatched servers (i.e. all of them initially) and this is clearly | ||
290 | not acceptable. Renegotiation is permitted because this does not add any | ||
291 | additional security issues: during an attack clients do not see any | ||
292 | renegotiations anyway. | ||
293 | |||
294 | As more servers become patched the option B<SSL_OP_LEGACY_SERVER_CONNECT> will | ||
295 | B<not> be set by default in a future version of OpenSSL. | ||
296 | |||
297 | OpenSSL client applications wishing to ensure they can connect to unpatched | ||
298 | servers should always B<set> B<SSL_OP_LEGACY_SERVER_CONNECT> | ||
299 | |||
300 | OpenSSL client applications that want to ensure they can B<not> connect to | ||
301 | unpatched servers (and thus avoid any security issues) should always B<clear> | ||
302 | B<SSL_OP_LEGACY_SERVER_CONNECT> using SSL_CTX_clear_options() or | ||
303 | SSL_clear_options(). | ||
304 | |||
305 | =head1 RETURN VALUES | ||
306 | |||
307 | SSL_CTX_set_options() and SSL_set_options() return the new options bitmask | ||
308 | after adding B<options>. | ||
309 | |||
310 | SSL_CTX_clear_options() and SSL_clear_options() return the new options bitmask | ||
311 | after clearing B<options>. | ||
312 | |||
313 | SSL_CTX_get_options() and SSL_get_options() return the current bitmask. | ||
314 | |||
315 | SSL_get_secure_renegotiation_support() returns 1 is the peer supports | ||
316 | secure renegotiation and 0 if it does not. | ||
317 | |||
318 | =head1 SEE ALSO | ||
319 | |||
320 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
321 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
322 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
323 | L<dhparam(1)|dhparam(1)> | ||
324 | |||
325 | =head1 HISTORY | ||
326 | |||
327 | B<SSL_OP_CIPHER_SERVER_PREFERENCE> and | ||
328 | B<SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION> have been added in | ||
329 | OpenSSL 0.9.7. | ||
330 | |||
331 | B<SSL_OP_TLS_ROLLBACK_BUG> has been added in OpenSSL 0.9.6 and was | ||
332 | automatically enabled with B<SSL_OP_ALL>. As of 0.9.7, it is no longer included | ||
333 | in B<SSL_OP_ALL> and must be explicitly set. | ||
334 | |||
335 | B<SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS> has been added in OpenSSL 0.9.6e. | ||
336 | Versions up to OpenSSL 0.9.6c do not include the countermeasure that | ||
337 | can be disabled with this option (in OpenSSL 0.9.6d, it was always | ||
338 | enabled). | ||
339 | |||
340 | SSL_CTX_clear_options() and SSL_clear_options() were first added in OpenSSL | ||
341 | 0.9.8m. | ||
342 | |||
343 | B<SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION>, B<SSL_OP_LEGACY_SERVER_CONNECT> | ||
344 | and the function SSL_get_secure_renegotiation_support() were first added in | ||
345 | OpenSSL 0.9.8m. | ||
346 | |||
347 | B<SSL_OP_NO_SSLv2> and B<SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION> | ||
348 | were changed to have no effect in OpenBSD 5.6. | ||
349 | |||
350 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.3 new file mode 100644 index 0000000000..9bd5c9c545 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_PSK_CLIENT_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_psk_client_callback , | ||
6 | .Nm SSL_set_psk_client_callback | ||
7 | .Nd set PSK client callback | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fo SSL_CTX_set_psk_client_callback | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
14 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
15 | .Fc | ||
16 | .Ft void | ||
17 | .Fo SSL_set_psk_client_callback | ||
18 | .Fa "SSL *ssl" | ||
19 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
20 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
21 | .Fc | ||
22 | .Sh DESCRIPTION | ||
23 | A client application must provide a callback function which is called | ||
24 | when the client is sending the ClientKeyExchange message to the server. | ||
25 | .Pp | ||
26 | The purpose of the callback function is to select the PSK identity and | ||
27 | the pre-shared key to use during the connection setup phase. | ||
28 | .Pp | ||
29 | The callback is set using functions | ||
30 | .Fn SSL_CTX_set_psk_client_callback | ||
31 | or | ||
32 | .Fn SSL_set_psk_client_callback . | ||
33 | The callback function is given the connection in parameter | ||
34 | .Fa ssl , | ||
35 | a | ||
36 | .Dv NULL Ns | ||
37 | -terminated PSK identity hint sent by the server in parameter | ||
38 | .Fa hint , | ||
39 | a buffer | ||
40 | .Fa identity | ||
41 | of length | ||
42 | .Fa max_identity_len | ||
43 | bytes where the resulting | ||
44 | .Dv NULL Ns | ||
45 | -terminated identity is to be stored, and a buffer | ||
46 | .Fa psk | ||
47 | of | ||
48 | length | ||
49 | .Fa max_psk_len | ||
50 | bytes where the resulting pre-shared key is to be stored. | ||
51 | .Sh NOTES | ||
52 | Note that parameter | ||
53 | .Fa hint | ||
54 | given to the callback may be | ||
55 | .Dv NULL . | ||
56 | .Sh RETURN VALUES | ||
57 | Return values from the client callback are interpreted as follows: | ||
58 | .Pp | ||
59 | On success (callback found a PSK identity and a pre-shared key to use) | ||
60 | the length (> 0) of | ||
61 | .Fa psk | ||
62 | in bytes is returned. | ||
63 | .Pp | ||
64 | Otherwise or on errors callback should return 0. | ||
65 | In this case the connection setup fails. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod deleted file mode 100644 index 7a85ba16d2..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_psk_client_callback.pod +++ /dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =begin comment | ||
4 | |||
5 | Copyright 2005 Nokia. All rights reserved. | ||
6 | |||
7 | The portions of the attached software ("Contribution") is developed by | ||
8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
9 | license. | ||
10 | |||
11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
13 | support (see RFC 4279) to OpenSSL. | ||
14 | |||
15 | No patent licenses or other rights except those expressly stated in | ||
16 | the OpenSSL open source license shall be deemed granted or received | ||
17 | expressly, by implication, estoppel, or otherwise. | ||
18 | |||
19 | No assurances are provided by Nokia that the Contribution does not | ||
20 | infringe the patent or other intellectual property rights of any third | ||
21 | party or that the license provides you with all the necessary rights | ||
22 | to make use of the Contribution. | ||
23 | |||
24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
28 | OTHERWISE. | ||
29 | |||
30 | =end comment | ||
31 | |||
32 | =head1 NAME | ||
33 | |||
34 | SSL_CTX_set_psk_client_callback, SSL_set_psk_client_callback - set PSK client | ||
35 | callback | ||
36 | |||
37 | =head1 SYNOPSIS | ||
38 | |||
39 | #include <openssl/ssl.h> | ||
40 | |||
41 | void SSL_CTX_set_psk_client_callback(SSL_CTX *ctx, | ||
42 | unsigned int (*callback)(SSL *ssl, const char *hint, | ||
43 | char *identity, unsigned int max_identity_len, | ||
44 | unsigned char *psk, unsigned int max_psk_len)); | ||
45 | void SSL_set_psk_client_callback(SSL *ssl, | ||
46 | unsigned int (*callback)(SSL *ssl, const char *hint, | ||
47 | char *identity, unsigned int max_identity_len, | ||
48 | unsigned char *psk, unsigned int max_psk_len)); | ||
49 | |||
50 | |||
51 | =head1 DESCRIPTION | ||
52 | |||
53 | A client application must provide a callback function which is called | ||
54 | when the client is sending the ClientKeyExchange message to the server. | ||
55 | |||
56 | The purpose of the callback function is to select the PSK identity and | ||
57 | the pre-shared key to use during the connection setup phase. | ||
58 | |||
59 | The callback is set using functions SSL_CTX_set_psk_client_callback() | ||
60 | or SSL_set_psk_client_callback(). The callback function is given the | ||
61 | connection in parameter B<ssl>, a B<NULL>-terminated PSK identity hint | ||
62 | sent by the server in parameter B<hint>, a buffer B<identity> of | ||
63 | length B<max_identity_len> bytes where the the resulting | ||
64 | B<NULL>-terminated identity is to be stored, and a buffer B<psk> of | ||
65 | length B<max_psk_len> bytes where the resulting pre-shared key is to | ||
66 | be stored. | ||
67 | |||
68 | =head1 NOTES | ||
69 | |||
70 | Note that parameter B<hint> given to the callback may be B<NULL>. | ||
71 | |||
72 | =head1 RETURN VALUES | ||
73 | |||
74 | Return values from the client callback are interpreted as follows: | ||
75 | |||
76 | On success (callback found a PSK identity and a pre-shared key to use) | ||
77 | the length (> 0) of B<psk> in bytes is returned. | ||
78 | |||
79 | Otherwise or on errors callback should return 0. In this case | ||
80 | the connection setup fails. | ||
81 | |||
82 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.3 new file mode 100644 index 0000000000..91e17350f9 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.3 | |||
@@ -0,0 +1,116 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_quiet_shutdown , | ||
6 | .Nm SSL_CTX_get_quiet_shutdown , | ||
7 | .Nm SSL_set_quiet_shutdown , | ||
8 | .Nm SSL_get_quiet_shutdown | ||
9 | .Nd manipulate shutdown behaviour | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
14 | .Ft int | ||
15 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
16 | .Ft void | ||
17 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
18 | .Ft int | ||
19 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_CTX_set_quiet_shutdown | ||
22 | sets the | ||
23 | .Dq quiet shutdown | ||
24 | flag for | ||
25 | .Fa ctx | ||
26 | to be | ||
27 | .Fa mode . | ||
28 | .Vt SSL | ||
29 | objects created from | ||
30 | .Fa ctx | ||
31 | inherit the | ||
32 | .Fa mode | ||
33 | valid at the time | ||
34 | .Xr SSL_new 3 | ||
35 | is called. | ||
36 | .Fa mode | ||
37 | may be 0 or 1. | ||
38 | .Pp | ||
39 | .Fn SSL_CTX_get_quiet_shutdown | ||
40 | returns the | ||
41 | .Dq quiet shutdown | ||
42 | setting of | ||
43 | .Fa ctx . | ||
44 | .Pp | ||
45 | .Fn SSL_set_quiet_shutdown | ||
46 | sets the | ||
47 | .Dq quiet shutdown | ||
48 | flag for | ||
49 | .Fa ssl | ||
50 | to be | ||
51 | .Fa mode . | ||
52 | The setting stays valid until | ||
53 | .Fa ssl | ||
54 | is removed with | ||
55 | .Xr SSL_free 3 | ||
56 | or | ||
57 | .Fn SSL_set_quiet_shutdown | ||
58 | is called again. | ||
59 | It is not changed when | ||
60 | .Xr SSL_clear 3 | ||
61 | is called. | ||
62 | .Fa mode | ||
63 | may be 0 or 1. | ||
64 | .Pp | ||
65 | .Fn SSL_get_quiet_shutdown | ||
66 | returns the | ||
67 | .Dq quiet shutdown | ||
68 | setting of | ||
69 | .Fa ssl . | ||
70 | .Sh NOTES | ||
71 | Normally when a SSL connection is finished, the parties must send out | ||
72 | .Dq close notify | ||
73 | alert messages using | ||
74 | .Xr SSL_shutdown 3 | ||
75 | for a clean shutdown. | ||
76 | .Pp | ||
77 | When setting the | ||
78 | .Dq quiet shutdown | ||
79 | flag to 1, | ||
80 | .Xr SSL_shutdown 3 | ||
81 | will set the internal flags to | ||
82 | .Dv SSL_SENT_SHUTDOWN Ns | ||
83 | .Pf | | ||
84 | .Dv SSL_RECEIVED_SHUTDOWN . | ||
85 | .Po | ||
86 | .Xr SSL_shutdown 3 | ||
87 | then behaves like | ||
88 | .Xr SSL_set_shutdown 3 | ||
89 | called with | ||
90 | .Dv SSL_SENT_SHUTDOWN Ns | ||
91 | .Pf | | ||
92 | .Dv SSL_RECEIVED_SHUTDOWN . | ||
93 | .Pc | ||
94 | The session is thus considered to be shut down, but no | ||
95 | .Dq close notify | ||
96 | alert is sent to the peer. | ||
97 | This behaviour violates the TLS standard. | ||
98 | .Pp | ||
99 | The default is normal shutdown behaviour as described by the TLS standard. | ||
100 | .Sh RETURN VALUES | ||
101 | .Fn SSL_CTX_set_quiet_shutdown | ||
102 | and | ||
103 | .Fn SSL_set_quiet_shutdown | ||
104 | do not return diagnostic information. | ||
105 | .Pp | ||
106 | .Fn SSL_CTX_get_quiet_shutdown | ||
107 | and | ||
108 | .Fn SSL_get_quiet_shutdown | ||
109 | return the current setting. | ||
110 | .Sh SEE ALSO | ||
111 | .Xr ssl 3 , | ||
112 | .Xr SSL_clear 3 , | ||
113 | .Xr SSL_free 3 , | ||
114 | .Xr SSL_new 3 , | ||
115 | .Xr SSL_set_shutdown 3 , | ||
116 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod deleted file mode 100644 index 32604dbd1a..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_quiet_shutdown.pod +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_quiet_shutdown, SSL_CTX_get_quiet_shutdown, SSL_set_quiet_shutdown, | ||
6 | SSL_get_quiet_shutdown - manipulate shutdown behaviour | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_quiet_shutdown(SSL_CTX *ctx, int mode); | ||
13 | int SSL_CTX_get_quiet_shutdown(const SSL_CTX *ctx); | ||
14 | |||
15 | void SSL_set_quiet_shutdown(SSL *ssl, int mode); | ||
16 | int SSL_get_quiet_shutdown(const SSL *ssl); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_CTX_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ctx> to be | ||
21 | B<mode>. SSL objects created from B<ctx> inherit the B<mode> valid at the time | ||
22 | L<SSL_new(3)|SSL_new(3)> is called. B<mode> may be 0 or 1. | ||
23 | |||
24 | SSL_CTX_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ctx>. | ||
25 | |||
26 | SSL_set_quiet_shutdown() sets the "quiet shutdown" flag for B<ssl> to be | ||
27 | B<mode>. The setting stays valid until B<ssl> is removed with | ||
28 | L<SSL_free(3)|SSL_free(3)> or SSL_set_quiet_shutdown() is called again. | ||
29 | It is not changed when L<SSL_clear(3)|SSL_clear(3)> is called. | ||
30 | B<mode> may be 0 or 1. | ||
31 | |||
32 | SSL_get_quiet_shutdown() returns the "quiet shutdown" setting of B<ssl>. | ||
33 | |||
34 | =head1 NOTES | ||
35 | |||
36 | Normally when a SSL connection is finished, the parties must send out | ||
37 | "close notify" alert messages using L<SSL_shutdown(3)|SSL_shutdown(3)> | ||
38 | for a clean shutdown. | ||
39 | |||
40 | When setting the "quiet shutdown" flag to 1, L<SSL_shutdown(3)|SSL_shutdown(3)> | ||
41 | will set the internal flags to SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN. | ||
42 | (L<SSL_shutdown(3)|SSL_shutdown(3)> then behaves like | ||
43 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> called with | ||
44 | SSL_SENT_SHUTDOWN|SSL_RECEIVED_SHUTDOWN.) | ||
45 | The session is thus considered to be shutdown, but no "close notify" alert | ||
46 | is sent to the peer. This behaviour violates the TLS standard. | ||
47 | |||
48 | The default is normal shutdown behaviour as described by the TLS standard. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | SSL_CTX_set_quiet_shutdown() and SSL_set_quiet_shutdown() do not return | ||
53 | diagnostic information. | ||
54 | |||
55 | SSL_CTX_get_quiet_shutdown() and SSL_get_quiet_shutdown return the current | ||
56 | setting. | ||
57 | |||
58 | =head1 SEE ALSO | ||
59 | |||
60 | L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
61 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
62 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | ||
63 | |||
64 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.3 new file mode 100644 index 0000000000..e7ebe2190e --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.3 | |||
@@ -0,0 +1,140 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_session_cache_mode , | ||
6 | .Nm SSL_CTX_get_session_cache_mode | ||
7 | .Nd enable/disable session caching | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_session_cache_mode | ||
16 | enables/disables session caching by setting the operational mode for | ||
17 | .Ar ctx | ||
18 | to | ||
19 | .Ar mode . | ||
20 | .Pp | ||
21 | .Fn SSL_CTX_get_session_cache_mode | ||
22 | returns the currently used cache mode. | ||
23 | .Sh NOTES | ||
24 | The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. | ||
25 | The sessions can be held in memory for each | ||
26 | .Fa ctx , | ||
27 | if more than one | ||
28 | .Vt SSL_CTX | ||
29 | object is being maintained, the sessions are unique for each | ||
30 | .Vt SSL_CTX | ||
31 | object. | ||
32 | .Pp | ||
33 | In order to reuse a session, a client must send the session's id to the server. | ||
34 | It can only send exactly one id. | ||
35 | The server then either agrees to reuse the session or it starts a full | ||
36 | handshake (to create a new session). | ||
37 | .Pp | ||
38 | A server will lookup up the session in its internal session storage. | ||
39 | If the session is not found in internal storage or lookups for the internal | ||
40 | storage have been deactivated | ||
41 | .Pq Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP , | ||
42 | the server will try the external storage if available. | ||
43 | .Pp | ||
44 | Since a client may try to reuse a session intended for use in a different | ||
45 | context, the session id context must be set by the server (see | ||
46 | .Xr SSL_CTX_set_session_id_context 3 ) . | ||
47 | .Pp | ||
48 | The following session cache modes and modifiers are available: | ||
49 | .Bl -tag -width Ds | ||
50 | .It Dv SSL_SESS_CACHE_OFF | ||
51 | No session caching for client or server takes place. | ||
52 | .It Dv SSL_SESS_CACHE_CLIENT | ||
53 | Client sessions are added to the session cache. | ||
54 | As there is no reliable way for the OpenSSL library to know whether a session | ||
55 | should be reused or which session to choose (due to the abstract BIO layer the | ||
56 | SSL engine does not have details about the connection), | ||
57 | the application must select the session to be reused by using the | ||
58 | .Xr SSL_set_session 3 | ||
59 | function. | ||
60 | This option is not activated by default. | ||
61 | .It Dv SSL_SESS_CACHE_SERVER | ||
62 | Server sessions are added to the session cache. | ||
63 | When a client proposes a session to be reused, the server looks for the | ||
64 | corresponding session in (first) the internal session cache (unless | ||
65 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
66 | is set), then (second) in the external cache if available. | ||
67 | If the session is found, the server will try to reuse the session. | ||
68 | This is the default. | ||
69 | .It Dv SSL_SESS_CACHE_BOTH | ||
70 | Enable both | ||
71 | .Dv SSL_SESS_CACHE_CLIENT | ||
72 | and | ||
73 | .Dv SSL_SESS_CACHE_SERVER | ||
74 | at the same time. | ||
75 | .It Dv SSL_SESS_CACHE_NO_AUTO_CLEAR | ||
76 | Normally the session cache is checked for expired sessions every 255 | ||
77 | connections using the | ||
78 | .Xr SSL_CTX_flush_sessions 3 | ||
79 | function. | ||
80 | Since this may lead to a delay which cannot be controlled, | ||
81 | the automatic flushing may be disabled and | ||
82 | .Xr SSL_CTX_flush_sessions 3 | ||
83 | can be called explicitly by the application. | ||
84 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
85 | By setting this flag, session-resume operations in an SSL/TLS server will not | ||
86 | automatically look up sessions in the internal cache, | ||
87 | even if sessions are automatically stored there. | ||
88 | If external session caching callbacks are in use, | ||
89 | this flag guarantees that all lookups are directed to the external cache. | ||
90 | As automatic lookup only applies for SSL/TLS servers, | ||
91 | the flag has no effect on clients. | ||
92 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
93 | Depending on the presence of | ||
94 | .Dv SSL_SESS_CACHE_CLIENT | ||
95 | and/or | ||
96 | .Dv SSL_SESS_CACHE_SERVER, | ||
97 | sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. | ||
98 | Normally a new session is added to the internal cache as well as any external | ||
99 | session caching (callback) that is configured for the | ||
100 | .Vt SSL_CTX . | ||
101 | This flag will prevent sessions being stored in the internal cache | ||
102 | (though the application can add them manually using | ||
103 | .Xr SSL_CTX_add_session 3 ) . | ||
104 | Note: | ||
105 | in any SSL/TLS servers where external caching is configured, any successful | ||
106 | session lookups in the external cache (e.g., for session-resume requests) would | ||
107 | normally be copied into the local cache before processing continues \(en this | ||
108 | flag prevents these additions to the internal cache as well. | ||
109 | .It Dv SSL_SESS_CACHE_NO_INTERNAL | ||
110 | Enable both | ||
111 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
112 | and | ||
113 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
114 | at the same time. | ||
115 | .El | ||
116 | .Pp | ||
117 | The default mode is | ||
118 | .Dv SSL_SESS_CACHE_SERVER . | ||
119 | .Sh RETURN VALUES | ||
120 | .Fn SSL_CTX_set_session_cache_mode | ||
121 | returns the previously set cache mode. | ||
122 | .Pp | ||
123 | .Fn SSL_CTX_get_session_cache_mode | ||
124 | returns the currently set cache mode. | ||
125 | .Sh SEE ALSO | ||
126 | .Xr ssl 3 , | ||
127 | .Xr SSL_CTX_add_session 3 , | ||
128 | .Xr SSL_CTX_flush_sessions 3 , | ||
129 | .Xr SSL_CTX_sess_number 3 , | ||
130 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
131 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
132 | .Xr SSL_CTX_set_session_id_context 3 , | ||
133 | .Xr SSL_CTX_set_timeout 3 , | ||
134 | .Xr SSL_session_reused 3 , | ||
135 | .Xr SSL_set_session 3 | ||
136 | .Sh HISTORY | ||
137 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
138 | and | ||
139 | .Dv SSL_SESS_CACHE_NO_INTERNAL | ||
140 | were introduced in OpenSSL 0.9.6h. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod deleted file mode 100644 index fe8ec09aee..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_cache_mode.pod +++ /dev/null | |||
@@ -1,138 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_session_cache_mode, SSL_CTX_get_session_cache_mode - enable/disable | ||
6 | session caching | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_set_session_cache_mode(SSL_CTX ctx, long mode); | ||
13 | long SSL_CTX_get_session_cache_mode(SSL_CTX ctx); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_session_cache_mode() enables/disables session caching | ||
18 | by setting the operational mode for B<ctx> to <mode>. | ||
19 | |||
20 | SSL_CTX_get_session_cache_mode() returns the currently used cache mode. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. | ||
25 | The sessions can be held in memory for each B<ctx>, if more than one | ||
26 | SSL_CTX object is being maintained, the sessions are unique for each SSL_CTX | ||
27 | object. | ||
28 | |||
29 | In order to reuse a session, a client must send the session's id to the | ||
30 | server. It can only send exactly one id. The server then either | ||
31 | agrees to reuse the session or it starts a full handshake (to create a new | ||
32 | session). | ||
33 | |||
34 | A server will lookup up the session in its internal session storage. If the | ||
35 | session is not found in internal storage or lookups for the internal storage | ||
36 | have been deactivated (SSL_SESS_CACHE_NO_INTERNAL_LOOKUP), the server will try | ||
37 | the external storage if available. | ||
38 | |||
39 | Since a client may try to reuse a session intended for use in a different | ||
40 | context, the session id context must be set by the server (see | ||
41 | L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>). | ||
42 | |||
43 | The following session cache modes and modifiers are available: | ||
44 | |||
45 | =over 4 | ||
46 | |||
47 | =item SSL_SESS_CACHE_OFF | ||
48 | |||
49 | No session caching for client or server takes place. | ||
50 | |||
51 | =item SSL_SESS_CACHE_CLIENT | ||
52 | |||
53 | Client sessions are added to the session cache. As there is no reliable way | ||
54 | for the OpenSSL library to know whether a session should be reused or which | ||
55 | session to choose (due to the abstract BIO layer the SSL engine does not | ||
56 | have details about the connection), the application must select the session | ||
57 | to be reused by using the L<SSL_set_session(3)|SSL_set_session(3)> | ||
58 | function. This option is not activated by default. | ||
59 | |||
60 | =item SSL_SESS_CACHE_SERVER | ||
61 | |||
62 | Server sessions are added to the session cache. When a client proposes a | ||
63 | session to be reused, the server looks for the corresponding session in (first) | ||
64 | the internal session cache (unless SSL_SESS_CACHE_NO_INTERNAL_LOOKUP is set), | ||
65 | then (second) in the external cache if available. If the session is found, the | ||
66 | server will try to reuse the session. This is the default. | ||
67 | |||
68 | =item SSL_SESS_CACHE_BOTH | ||
69 | |||
70 | Enable both SSL_SESS_CACHE_CLIENT and SSL_SESS_CACHE_SERVER at the same time. | ||
71 | |||
72 | =item SSL_SESS_CACHE_NO_AUTO_CLEAR | ||
73 | |||
74 | Normally the session cache is checked for expired sessions every | ||
75 | 255 connections using the | ||
76 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> function. Since | ||
77 | this may lead to a delay which cannot be controlled, the automatic | ||
78 | flushing may be disabled and | ||
79 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> can be called | ||
80 | explicitly by the application. | ||
81 | |||
82 | =item SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
83 | |||
84 | By setting this flag, session-resume operations in an SSL/TLS server will not | ||
85 | automatically look up sessions in the internal cache, even if sessions are | ||
86 | automatically stored there. If external session caching callbacks are in use, | ||
87 | this flag guarantees that all lookups are directed to the external cache. | ||
88 | As automatic lookup only applies for SSL/TLS servers, the flag has no effect on | ||
89 | clients. | ||
90 | |||
91 | =item SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
92 | |||
93 | Depending on the presence of SSL_SESS_CACHE_CLIENT and/or SSL_SESS_CACHE_SERVER, | ||
94 | sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. | ||
95 | Normally a new session is added to the internal cache as well as any external | ||
96 | session caching (callback) that is configured for the SSL_CTX. This flag will | ||
97 | prevent sessions being stored in the internal cache (though the application can | ||
98 | add them manually using L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>). Note: | ||
99 | in any SSL/TLS servers where external caching is configured, any successful | ||
100 | session lookups in the external cache (ie. for session-resume requests) would | ||
101 | normally be copied into the local cache before processing continues - this flag | ||
102 | prevents these additions to the internal cache as well. | ||
103 | |||
104 | =item SSL_SESS_CACHE_NO_INTERNAL | ||
105 | |||
106 | Enable both SSL_SESS_CACHE_NO_INTERNAL_LOOKUP and | ||
107 | SSL_SESS_CACHE_NO_INTERNAL_STORE at the same time. | ||
108 | |||
109 | |||
110 | =back | ||
111 | |||
112 | The default mode is SSL_SESS_CACHE_SERVER. | ||
113 | |||
114 | =head1 RETURN VALUES | ||
115 | |||
116 | SSL_CTX_set_session_cache_mode() returns the previously set cache mode. | ||
117 | |||
118 | SSL_CTX_get_session_cache_mode() returns the currently set cache mode. | ||
119 | |||
120 | |||
121 | =head1 SEE ALSO | ||
122 | |||
123 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, | ||
124 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
125 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, | ||
126 | L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, | ||
127 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, | ||
128 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, | ||
129 | L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, | ||
130 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, | ||
131 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> | ||
132 | |||
133 | =head1 HISTORY | ||
134 | |||
135 | SSL_SESS_CACHE_NO_INTERNAL_STORE and SSL_SESS_CACHE_NO_INTERNAL | ||
136 | were introduced in OpenSSL 0.9.6h. | ||
137 | |||
138 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.3 new file mode 100644 index 0000000000..0411c687a4 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.3 | |||
@@ -0,0 +1,102 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_session_id_context , | ||
6 | .Nm SSL_set_session_id_context | ||
7 | .Nd set context within which session can be reused (server side only) | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft int | ||
11 | .Fo SSL_CTX_set_session_id_context | ||
12 | .Fa "SSL_CTX *ctx" | ||
13 | .Fa const unsigned char *sid_ctx" | ||
14 | .Fa "unsigned int sid_ctx_len" | ||
15 | .Fc | ||
16 | .Ft int | ||
17 | .Fo SSL_set_session_id_context | ||
18 | .Fa "SSL *ssl" | ||
19 | .Fa const unsigned char *sid_ctx" | ||
20 | .Fa "unsigned int sid_ctx_len" | ||
21 | .Fc | ||
22 | .Sh DESCRIPTION | ||
23 | .Fn SSL_CTX_set_session_id_context | ||
24 | sets the context | ||
25 | .Fa sid_ctx | ||
26 | of length | ||
27 | .Fa sid_ctx_len | ||
28 | within which a session can be reused for the | ||
29 | .Fa ctx | ||
30 | object. | ||
31 | .Pp | ||
32 | .Fn SSL_set_session_id_context | ||
33 | sets the context | ||
34 | .Fa sid_ctx | ||
35 | of length | ||
36 | .Fa sid_ctx_len | ||
37 | within which a session can be reused for the | ||
38 | .Fa ssl | ||
39 | object. | ||
40 | .Sh NOTES | ||
41 | Sessions are generated within a certain context. | ||
42 | When exporting/importing sessions with | ||
43 | .Xr i2d_SSL_SESSION 3 | ||
44 | and | ||
45 | .Xr d2i_SSL_SESSION 3 , | ||
46 | it would be possible to re-import a session generated from another context | ||
47 | (e.g., another application), which might lead to malfunctions. | ||
48 | Therefore each application must set its own session id context | ||
49 | .Fa sid_ctx | ||
50 | which is used to distinguish the contexts and is stored in exported sessions. | ||
51 | The | ||
52 | .Fa sid_ctx | ||
53 | can be any kind of binary data with a given length; it is therefore possible | ||
54 | to use, for instance, the name of the application, the hostname, the service | ||
55 | name... | ||
56 | .Pp | ||
57 | The session id context becomes part of the session. | ||
58 | The session id context is set by the SSL/TLS server. | ||
59 | The | ||
60 | .Fn SSL_CTX_set_session_id_context | ||
61 | and | ||
62 | .Fn SSL_set_session_id_context | ||
63 | functions are therefore only useful on the server side. | ||
64 | .Pp | ||
65 | OpenSSL clients will check the session id context returned by the server when | ||
66 | reusing a session. | ||
67 | .Pp | ||
68 | The maximum length of the | ||
69 | .Fa sid_ctx | ||
70 | is limited to | ||
71 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
72 | .Sh WARNINGS | ||
73 | If the session id context is not set on an SSL/TLS server and client | ||
74 | certificates are used, stored sessions will not be reused but a fatal error | ||
75 | will be flagged and the handshake will fail. | ||
76 | .Pp | ||
77 | If a server returns a different session id context to an OpenSSL client | ||
78 | when reusing a session, an error will be flagged and the handshake will | ||
79 | fail. | ||
80 | OpenSSL servers will always return the correct session id context, | ||
81 | as an OpenSSL server checks the session id context itself before reusing | ||
82 | a session as described above. | ||
83 | .Sh RETURN VALUES | ||
84 | .Fn SSL_CTX_set_session_id_context | ||
85 | and | ||
86 | .Fn SSL_set_session_id_context | ||
87 | return the following values: | ||
88 | .Bl -tag -width Ds | ||
89 | .It 0 | ||
90 | The length | ||
91 | .Fa sid_ctx_len | ||
92 | of the session id context | ||
93 | .Fa sid_ctx | ||
94 | exceeded | ||
95 | the maximum allowed length of | ||
96 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
97 | The error is logged to the error stack. | ||
98 | .It 1 | ||
99 | The operation succeeded. | ||
100 | .El | ||
101 | .Sh SEE ALSO | ||
102 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod deleted file mode 100644 index 2b1ce18ed9..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_session_id_context.pod +++ /dev/null | |||
@@ -1,84 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_session_id_context, SSL_set_session_id_context - set context within | ||
6 | which session can be reused (server side only) | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_set_session_id_context(SSL_CTX *ctx, const unsigned char *sid_ctx, | ||
13 | unsigned int sid_ctx_len); | ||
14 | int SSL_set_session_id_context(SSL *ssl, const unsigned char *sid_ctx, | ||
15 | unsigned int sid_ctx_len); | ||
16 | |||
17 | =head1 DESCRIPTION | ||
18 | |||
19 | SSL_CTX_set_session_id_context() sets the context B<sid_ctx> of length | ||
20 | B<sid_ctx_len> within which a session can be reused for the B<ctx> object. | ||
21 | |||
22 | SSL_set_session_id_context() sets the context B<sid_ctx> of length | ||
23 | B<sid_ctx_len> within which a session can be reused for the B<ssl> object. | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | Sessions are generated within a certain context. When exporting/importing | ||
28 | sessions with B<i2d_SSL_SESSION>/B<d2i_SSL_SESSION> it would be possible, | ||
29 | to re-import a session generated from another context (e.g. another | ||
30 | application), which might lead to malfunctions. Therefore each application | ||
31 | must set its own session id context B<sid_ctx> which is used to distinguish | ||
32 | the contexts and is stored in exported sessions. The B<sid_ctx> can be | ||
33 | any kind of binary data with a given length, it is therefore possible | ||
34 | to use e.g. the name of the application and/or the hostname and/or service | ||
35 | name ... | ||
36 | |||
37 | The session id context becomes part of the session. The session id context | ||
38 | is set by the SSL/TLS server. The SSL_CTX_set_session_id_context() and | ||
39 | SSL_set_session_id_context() functions are therefore only useful on the | ||
40 | server side. | ||
41 | |||
42 | OpenSSL clients will check the session id context returned by the server | ||
43 | when reusing a session. | ||
44 | |||
45 | The maximum length of the B<sid_ctx> is limited to | ||
46 | B<SSL_MAX_SSL_SESSION_ID_LENGTH>. | ||
47 | |||
48 | =head1 WARNINGS | ||
49 | |||
50 | If the session id context is not set on an SSL/TLS server and client | ||
51 | certificates are used, stored sessions | ||
52 | will not be reused but a fatal error will be flagged and the handshake | ||
53 | will fail. | ||
54 | |||
55 | If a server returns a different session id context to an OpenSSL client | ||
56 | when reusing a session, an error will be flagged and the handshake will | ||
57 | fail. OpenSSL servers will always return the correct session id context, | ||
58 | as an OpenSSL server checks the session id context itself before reusing | ||
59 | a session as described above. | ||
60 | |||
61 | =head1 RETURN VALUES | ||
62 | |||
63 | SSL_CTX_set_session_id_context() and SSL_set_session_id_context() | ||
64 | return the following values: | ||
65 | |||
66 | =over 4 | ||
67 | |||
68 | =item C<0> | ||
69 | |||
70 | The length B<sid_ctx_len> of the session id context B<sid_ctx> exceeded | ||
71 | the maximum allowed length of B<SSL_MAX_SSL_SESSION_ID_LENGTH>. The error | ||
72 | is logged to the error stack. | ||
73 | |||
74 | =item C<1> | ||
75 | |||
76 | The operation succeeded. | ||
77 | |||
78 | =back | ||
79 | |||
80 | =head1 SEE ALSO | ||
81 | |||
82 | L<ssl(3)|ssl(3)> | ||
83 | |||
84 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.3 new file mode 100644 index 0000000000..f3753dac20 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.3 | |||
@@ -0,0 +1,78 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_SSL_VERSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_ssl_version , | ||
6 | .Nm SSL_set_ssl_method , | ||
7 | .Nm SSL_get_ssl_method | ||
8 | .Nd choose a new TLS/SSL method | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" | ||
13 | .Ft int | ||
14 | .Fn SSL_set_ssl_method "SSL *s" "const SSL_METHOD *method" | ||
15 | .Ft const SSL_METHOD * | ||
16 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_CTX_set_ssl_version | ||
19 | sets a new default TLS/SSL | ||
20 | .Fa method | ||
21 | for | ||
22 | .Vt SSL | ||
23 | objects newly created from this | ||
24 | .Fa ctx . | ||
25 | .Vt SSL | ||
26 | objects already created with | ||
27 | .Xr SSL_new 3 | ||
28 | are not affected, except when | ||
29 | .Xr SSL_clear 3 | ||
30 | is called. | ||
31 | .Pp | ||
32 | .Fn SSL_set_ssl_method | ||
33 | sets a new TLS/SSL | ||
34 | .Fa method | ||
35 | for a particular | ||
36 | .Vt SSL | ||
37 | object | ||
38 | .Fa s . | ||
39 | It may be reset when | ||
40 | .Xr SSL_clear 3 | ||
41 | is called. | ||
42 | .Pp | ||
43 | .Fn SSL_get_ssl_method | ||
44 | returns a function pointer to the TLS/SSL method set in | ||
45 | .Fa ssl . | ||
46 | .Sh NOTES | ||
47 | The available | ||
48 | .Fa method | ||
49 | choices are described in | ||
50 | .Xr SSL_CTX_new 3 . | ||
51 | .Pp | ||
52 | When | ||
53 | .Xr SSL_clear 3 | ||
54 | is called and no session is connected to an | ||
55 | .Vt SSL | ||
56 | object, the method of the | ||
57 | .Vt SSL | ||
58 | object is reset to the method currently set in the corresponding | ||
59 | .Vt SSL_CTX | ||
60 | object. | ||
61 | .Sh RETURN VALUES | ||
62 | The following return values can occur for | ||
63 | .Fn SSL_CTX_set_ssl_version | ||
64 | and | ||
65 | .Fn SSL_set_ssl_method : | ||
66 | .Bl -tag -width Ds | ||
67 | .It 0 | ||
68 | The new choice failed. | ||
69 | Check the error stack to find out the reason. | ||
70 | .It 1 | ||
71 | The operation succeeded. | ||
72 | .El | ||
73 | .Sh SEE ALSO | ||
74 | .Xr ssl 3 , | ||
75 | .Xr SSL_clear 3 , | ||
76 | .Xr SSL_CTX_new 3 , | ||
77 | .Xr SSL_new 3 , | ||
78 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod deleted file mode 100644 index 5ea8f0d4f6..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_ssl_version.pod +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_ssl_version, SSL_set_ssl_method, SSL_get_ssl_method | ||
6 | - choose a new TLS/SSL method | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_CTX_set_ssl_version(SSL_CTX *ctx, const SSL_METHOD *method); | ||
13 | int SSL_set_ssl_method(SSL *s, const SSL_METHOD *method); | ||
14 | const SSL_METHOD *SSL_get_ssl_method(SSL *ssl); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_CTX_set_ssl_version() sets a new default TLS/SSL B<method> for SSL objects | ||
19 | newly created from this B<ctx>. SSL objects already created with | ||
20 | L<SSL_new(3)|SSL_new(3)> are not affected, except when | ||
21 | L<SSL_clear(3)|SSL_clear(3)> is being called. | ||
22 | |||
23 | SSL_set_ssl_method() sets a new TLS/SSL B<method> for a particular B<ssl> | ||
24 | object. It may be reset, when SSL_clear() is called. | ||
25 | |||
26 | SSL_get_ssl_method() returns a function pointer to the TLS/SSL method | ||
27 | set in B<ssl>. | ||
28 | |||
29 | =head1 NOTES | ||
30 | |||
31 | The available B<method> choices are described in | ||
32 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>. | ||
33 | |||
34 | When L<SSL_clear(3)|SSL_clear(3)> is called and no session is connected to | ||
35 | an SSL object, the method of the SSL object is reset to the method currently | ||
36 | set in the corresponding SSL_CTX object. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | The following return values can occur for SSL_CTX_set_ssl_version() | ||
41 | and SSL_set_ssl_method(): | ||
42 | |||
43 | =over 4 | ||
44 | |||
45 | =item C<0> | ||
46 | |||
47 | The new choice failed, check the error stack to find out the reason. | ||
48 | |||
49 | =item C<1> | ||
50 | |||
51 | The operation succeeded. | ||
52 | |||
53 | =back | ||
54 | |||
55 | =head1 SEE ALSO | ||
56 | |||
57 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
58 | L<SSL_clear(3)|SSL_clear(3)>, L<ssl(3)|ssl(3)>, | ||
59 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> | ||
60 | |||
61 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.3 new file mode 100644 index 0000000000..c8aaee24e2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.3 | |||
@@ -0,0 +1,62 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TIMEOUT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_timeout , | ||
6 | .Nm SSL_CTX_get_timeout | ||
7 | .Nd manipulate timeout values for session caching | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft long | ||
11 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
12 | .Ft long | ||
13 | .Fn SSL_CTX_get_timeout "SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_set_timeout | ||
16 | sets the timeout for newly created sessions for | ||
17 | .Fa ctx | ||
18 | to | ||
19 | .Fa t . | ||
20 | The timeout value | ||
21 | .Fa t | ||
22 | must be given in seconds. | ||
23 | .Pp | ||
24 | .Fn SSL_CTX_get_timeout | ||
25 | returns the currently set timeout value for | ||
26 | .Fa ctx . | ||
27 | .Sh NOTES | ||
28 | Whenever a new session is created, it is assigned a maximum lifetime. | ||
29 | This lifetime is specified by storing the creation time of the session and the | ||
30 | timeout value valid at this time. | ||
31 | If the actual time is later than creation time plus timeout, | ||
32 | the session is not reused. | ||
33 | .Pp | ||
34 | Due to this realization, all sessions behave according to the timeout value | ||
35 | valid at the time of the session negotiation. | ||
36 | Changes of the timeout value do not affect already established sessions. | ||
37 | .Pp | ||
38 | The expiration time of a single session can be modified using the | ||
39 | .Xr SSL_SESSION_get_time 3 | ||
40 | family of functions. | ||
41 | .Pp | ||
42 | Expired sessions are removed from the internal session cache, whenever | ||
43 | .Xr SSL_CTX_flush_sessions 3 | ||
44 | is called, either directly by the application or automatically (see | ||
45 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
46 | .Pp | ||
47 | The default value for session timeout is decided on a per-protocol basis; see | ||
48 | .Xr SSL_get_default_timeout 3 . | ||
49 | All currently supported protocols have the same default timeout value of 300 | ||
50 | seconds. | ||
51 | .Sh RETURN VALUES | ||
52 | .Fn SSL_CTX_set_timeout | ||
53 | returns the previously set timeout value. | ||
54 | .Pp | ||
55 | .Fn SSL_CTX_get_timeout | ||
56 | returns the currently set timeout value. | ||
57 | .Sh SEE ALSO | ||
58 | .Xr ssl 3 , | ||
59 | .Xr SSL_CTX_flush_sessions 3 , | ||
60 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
61 | .Xr SSL_get_default_timeout 3 , | ||
62 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod deleted file mode 100644 index 4422373fea..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_timeout.pod +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_timeout, SSL_CTX_get_timeout - manipulate timeout values for | ||
6 | session caching | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | long SSL_CTX_set_timeout(SSL_CTX *ctx, long t); | ||
13 | long SSL_CTX_get_timeout(SSL_CTX *ctx); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_CTX_set_timeout() sets the timeout for newly created sessions for | ||
18 | B<ctx> to B<t>. The timeout value B<t> must be given in seconds. | ||
19 | |||
20 | SSL_CTX_get_timeout() returns the currently set timeout value for B<ctx>. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | Whenever a new session is created, it is assigned a maximum lifetime. This | ||
25 | lifetime is specified by storing the creation time of the session and the | ||
26 | timeout value valid at this time. If the actual time is later than creation | ||
27 | time plus timeout, the session is not reused. | ||
28 | |||
29 | Due to this realization, all sessions behave according to the timeout value | ||
30 | valid at the time of the session negotiation. Changes of the timeout value | ||
31 | do not affect already established sessions. | ||
32 | |||
33 | The expiration time of a single session can be modified using the | ||
34 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)> family of functions. | ||
35 | |||
36 | Expired sessions are removed from the internal session cache, whenever | ||
37 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> is called, either | ||
38 | directly by the application or automatically (see | ||
39 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>) | ||
40 | |||
41 | The default value for session timeout is decided on a per protocol | ||
42 | basis, see L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>. | ||
43 | All currently supported protocols have the same default timeout value | ||
44 | of 300 seconds. | ||
45 | |||
46 | =head1 RETURN VALUES | ||
47 | |||
48 | SSL_CTX_set_timeout() returns the previously set timeout value. | ||
49 | |||
50 | SSL_CTX_get_timeout() returns the currently set timeout value. | ||
51 | |||
52 | =head1 SEE ALSO | ||
53 | |||
54 | L<ssl(3)|ssl(3)>, | ||
55 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
56 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | ||
57 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
58 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
59 | |||
60 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.3 new file mode 100644 index 0000000000..f28d083f45 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.3 | |||
@@ -0,0 +1,233 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_tmp_dh_callback , | ||
6 | .Nm SSL_CTX_set_tmp_dh , | ||
7 | .Nm SSL_set_tmp_dh_callback , | ||
8 | .Nm SSL_set_tmp_dh | ||
9 | .Nd handle DH keys for ephemeral key exchange | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_tmp_dh_callback | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)" | ||
16 | .Fc | ||
17 | .Ft long | ||
18 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX *ctx" "DH *dh" | ||
19 | .Ft void | ||
20 | .Fo SSL_set_tmp_dh_callback | ||
21 | .Fa "SSL *ssl" | ||
22 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength" | ||
23 | .Fc | ||
24 | .Ft long | ||
25 | .Fn SSL_set_tmp_dh "SSL *ssl" "DH *dh" | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_set_tmp_dh_callback | ||
28 | sets the callback function for | ||
29 | .Fa ctx | ||
30 | to be used when a DH parameters are required to | ||
31 | .Fa tmp_dh_callback . | ||
32 | The callback is inherited by all | ||
33 | .Vt ssl | ||
34 | objects created from | ||
35 | .Fa ctx . | ||
36 | .Pp | ||
37 | .Fn SSL_CTX_set_tmp_dh | ||
38 | sets DH parameters to be used to be | ||
39 | .Sy dh Ns . | ||
40 | The key is inherited by all | ||
41 | .Fa ssl | ||
42 | objects created from | ||
43 | .Fa ctx . | ||
44 | .Pp | ||
45 | .Fn SSL_set_tmp_dh_callback | ||
46 | sets the callback only for | ||
47 | .Fa ssl . | ||
48 | .Pp | ||
49 | .Fn SSL_set_tmp_dh | ||
50 | sets the parameters only for | ||
51 | .Fa ssl . | ||
52 | .Pp | ||
53 | These functions apply to SSL/TLS servers only. | ||
54 | .Sh NOTES | ||
55 | When using a cipher with RSA authentication, | ||
56 | an ephemeral DH key exchange can take place. | ||
57 | Ciphers with DSA keys always use ephemeral DH keys as well. | ||
58 | In these cases, the session data are negotiated using the ephemeral/temporary | ||
59 | DH key and the key supplied and certified by the certificate chain is only used | ||
60 | for signing. | ||
61 | Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. | ||
62 | .Pp | ||
63 | Using ephemeral DH key exchange yields forward secrecy, | ||
64 | as the connection can only be decrypted when the DH key is known. | ||
65 | By generating a temporary DH key inside the server application that is lost | ||
66 | when the application is left, it becomes impossible for an attacker to decrypt | ||
67 | past sessions, even if he gets hold of the normal (certified) key, | ||
68 | as this key was only used for signing. | ||
69 | .Pp | ||
70 | In order to perform a DH key exchange the server must use a DH group | ||
71 | (DH parameters) and generate a DH key. | ||
72 | The server will always generate a new DH key during the negotiation, | ||
73 | when the DH parameters are supplied via callback and/or when the | ||
74 | .Dv SSL_OP_SINGLE_DH_USE | ||
75 | option of | ||
76 | .Xr SSL_CTX_set_options 3 | ||
77 | is set. | ||
78 | It will immediately create a DH key, when DH parameters are supplied via | ||
79 | .Fn SSL_CTX_set_tmp_dh | ||
80 | and | ||
81 | .Dv SSL_OP_SINGLE_DH_USE | ||
82 | is not set. | ||
83 | In this case, it may happen that a key is generated on initialization without | ||
84 | later being needed, while on the other hand the computer time during the | ||
85 | negotiation is being saved. | ||
86 | .Pp | ||
87 | If | ||
88 | .Dq strong | ||
89 | primes were used to generate the DH parameters, it is not strictly necessary to | ||
90 | generate a new key for each handshake but it does improve forward secrecy. | ||
91 | If it is not assured that | ||
92 | .Dq strong | ||
93 | primes were used (see especially the section about DSA parameters below), | ||
94 | .Dv SSL_OP_SINGLE_DH_USE | ||
95 | must be used in order to prevent small subgroup attacks. | ||
96 | Always using | ||
97 | .Dv SSL_OP_SINGLE_DH_USE | ||
98 | has an impact on the computer time needed during negotiation, | ||
99 | but it is not very large, | ||
100 | so application authors/users should consider always enabling this option. | ||
101 | .Pp | ||
102 | As generating DH parameters is extremely time consuming, an application should | ||
103 | not generate the parameters on the fly but supply the parameters. | ||
104 | DH parameters can be reused, | ||
105 | as the actual key is newly generated during the negotiation. | ||
106 | The risk in reusing DH parameters is that an attacker may specialize on a very | ||
107 | often used DH group. | ||
108 | Applications should therefore generate their own DH parameters during the | ||
109 | installation process using the openssl | ||
110 | .Xr dhparam 1 | ||
111 | application. | ||
112 | In order to reduce the computer time needed for this generation, | ||
113 | it is possible to use DSA parameters instead (see | ||
114 | .Xr dhparam 1 ) , | ||
115 | but in this case | ||
116 | .Dv SSL_OP_SINGLE_DH_USE | ||
117 | is mandatory. | ||
118 | .Pp | ||
119 | Application authors may compile in DH parameters. | ||
120 | Files | ||
121 | .Pa dh512.pem , | ||
122 | .Pa dh1024.pem , | ||
123 | .Pa dh2048.pem , | ||
124 | and | ||
125 | .Pa dh4096.pem | ||
126 | in the | ||
127 | .Pa apps | ||
128 | directory of the current version of the OpenSSL distribution contain the | ||
129 | .Sq SKIP | ||
130 | DH parameters, | ||
131 | which use safe primes and were generated verifiably pseudo-randomly. | ||
132 | These files can be converted into C code using the | ||
133 | .Fl C | ||
134 | option of the | ||
135 | .Xr dhparam 1 | ||
136 | application. | ||
137 | Authors may also generate their own set of parameters using | ||
138 | .Xr dhparam 1 , | ||
139 | but a user may not be sure how the parameters were generated. | ||
140 | The generation of DH parameters during installation is therefore recommended. | ||
141 | .Pp | ||
142 | An application may either directly specify the DH parameters or can supply the | ||
143 | DH parameters via a callback function. | ||
144 | The callback approach has the advantage that the callback may supply DH | ||
145 | parameters for different key lengths. | ||
146 | .Pp | ||
147 | The | ||
148 | .Fa tmp_dh_callback | ||
149 | is called with the | ||
150 | .Fa keylength | ||
151 | needed and the | ||
152 | .Fa is_export | ||
153 | information. | ||
154 | The | ||
155 | .Fa is_export | ||
156 | flag is set when the ephemeral DH key exchange is performed with an export | ||
157 | cipher. | ||
158 | .Sh RETURN VALUES | ||
159 | .Fn SSL_CTX_set_tmp_dh_callback | ||
160 | and | ||
161 | .Fn SSL_set_tmp_dh_callback | ||
162 | do not return diagnostic output. | ||
163 | .Pp | ||
164 | .Fn SSL_CTX_set_tmp_dh | ||
165 | and | ||
166 | .Fn SSL_set_tmp_dh | ||
167 | do return 1 on success and 0 on failure. | ||
168 | Check the error queue to find out the reason of failure. | ||
169 | .Sh EXAMPLES | ||
170 | Handle DH parameters for key lengths of 512 and 1024 bits. | ||
171 | (Error handling partly left out.) | ||
172 | .Bd -literal | ||
173 | \&... | ||
174 | /* Set up ephemeral DH stuff */ | ||
175 | DH *dh_512 = NULL; | ||
176 | DH *dh_1024 = NULL; | ||
177 | FILE *paramfile; | ||
178 | |||
179 | \&... | ||
180 | |||
181 | /* "openssl dhparam -out dh_param_512.pem -2 512" */ | ||
182 | paramfile = fopen("dh_param_512.pem", "r"); | ||
183 | if (paramfile) { | ||
184 | dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
185 | fclose(paramfile); | ||
186 | } | ||
187 | /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ | ||
188 | paramfile = fopen("dh_param_1024.pem", "r"); | ||
189 | if (paramfile) { | ||
190 | dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
191 | fclose(paramfile); | ||
192 | } | ||
193 | |||
194 | \&... | ||
195 | |||
196 | /* "openssl dhparam -C -2 512" etc... */ | ||
197 | DH *get_dh512() { ... } | ||
198 | DH *get_dh1024() { ... } | ||
199 | |||
200 | DH * | ||
201 | tmp_dh_callback(SSL *s, int is_export, int keylength) | ||
202 | { | ||
203 | DH *dh_tmp=NULL; | ||
204 | |||
205 | switch (keylength) { | ||
206 | case 512: | ||
207 | if (!dh_512) | ||
208 | dh_512 = get_dh512(); | ||
209 | dh_tmp = dh_512; | ||
210 | break; | ||
211 | case 1024: | ||
212 | if (!dh_1024) | ||
213 | dh_1024 = get_dh1024(); | ||
214 | dh_tmp = dh_1024; | ||
215 | break; | ||
216 | default: | ||
217 | /* | ||
218 | * Generating a key on the fly is very costly, | ||
219 | * so use what is there | ||
220 | */ | ||
221 | setup_dh_parameters_like_above(); | ||
222 | } | ||
223 | |||
224 | return(dh_tmp); | ||
225 | } | ||
226 | .Ed | ||
227 | .Sh SEE ALSO | ||
228 | .Xr ciphers 1 , | ||
229 | .Xr dhparam 1 , | ||
230 | .Xr ssl 3 , | ||
231 | .Xr SSL_CTX_set_cipher_list 3 , | ||
232 | .Xr SSL_CTX_set_options 3 , | ||
233 | .Xr SSL_CTX_set_tmp_rsa_callback 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod deleted file mode 100644 index 0fda967814..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_dh_callback.pod +++ /dev/null | |||
@@ -1,169 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_tmp_dh_callback, SSL_CTX_set_tmp_dh, SSL_set_tmp_dh_callback, | ||
6 | SSL_set_tmp_dh - handle DH keys for ephemeral key exchange | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_tmp_dh_callback(SSL_CTX *ctx, | ||
13 | DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); | ||
14 | long SSL_CTX_set_tmp_dh(SSL_CTX *ctx, DH *dh); | ||
15 | |||
16 | void SSL_set_tmp_dh_callback(SSL *ssl, | ||
17 | DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)); | ||
18 | long SSL_set_tmp_dh(SSL *ssl, DH *dh) | ||
19 | |||
20 | =head1 DESCRIPTION | ||
21 | |||
22 | SSL_CTX_set_tmp_dh_callback() sets the callback function for B<ctx> to be | ||
23 | used when a DH parameters are required to B<tmp_dh_callback>. | ||
24 | The callback is inherited by all B<ssl> objects created from B<ctx>. | ||
25 | |||
26 | SSL_CTX_set_tmp_dh() sets DH parameters to be used to be B<dh>. | ||
27 | The key is inherited by all B<ssl> objects created from B<ctx>. | ||
28 | |||
29 | SSL_set_tmp_dh_callback() sets the callback only for B<ssl>. | ||
30 | |||
31 | SSL_set_tmp_dh() sets the parameters only for B<ssl>. | ||
32 | |||
33 | These functions apply to SSL/TLS servers only. | ||
34 | |||
35 | =head1 NOTES | ||
36 | |||
37 | When using a cipher with RSA authentication, an ephemeral DH key exchange | ||
38 | can take place. Ciphers with DSA keys always use ephemeral DH keys as well. | ||
39 | In these cases, the session data are negotiated using the | ||
40 | ephemeral/temporary DH key and the key supplied and certified | ||
41 | by the certificate chain is only used for signing. | ||
42 | Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. | ||
43 | |||
44 | Using ephemeral DH key exchange yields forward secrecy, as the connection | ||
45 | can only be decrypted, when the DH key is known. By generating a temporary | ||
46 | DH key inside the server application that is lost when the application | ||
47 | is left, it becomes impossible for an attacker to decrypt past sessions, | ||
48 | even if he gets hold of the normal (certified) key, as this key was | ||
49 | only used for signing. | ||
50 | |||
51 | In order to perform a DH key exchange the server must use a DH group | ||
52 | (DH parameters) and generate a DH key. The server will always generate a new | ||
53 | DH key during the negotiation, when the DH parameters are supplied via | ||
54 | callback and/or when the SSL_OP_SINGLE_DH_USE option of | ||
55 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)> is set. It will | ||
56 | immediately create a DH key, when DH parameters are supplied via | ||
57 | SSL_CTX_set_tmp_dh() and SSL_OP_SINGLE_DH_USE is not set. In this case, | ||
58 | it may happen that a key is generated on initialization without later | ||
59 | being needed, while on the other hand the computer time during the | ||
60 | negotiation is being saved. | ||
61 | |||
62 | If "strong" primes were used to generate the DH parameters, it is not strictly | ||
63 | necessary to generate a new key for each handshake but it does improve forward | ||
64 | secrecy. If it is not assured, that "strong" primes were used (see especially | ||
65 | the section about DSA parameters below), SSL_OP_SINGLE_DH_USE must be used | ||
66 | in order to prevent small subgroup attacks. Always using SSL_OP_SINGLE_DH_USE | ||
67 | has an impact on the computer time needed during negotiation, but it is not | ||
68 | very large, so application authors/users should consider to always enable | ||
69 | this option. | ||
70 | |||
71 | As generating DH parameters is extremely time consuming, an application | ||
72 | should not generate the parameters on the fly but supply the parameters. | ||
73 | DH parameters can be reused, as the actual key is newly generated during | ||
74 | the negotiation. The risk in reusing DH parameters is that an attacker | ||
75 | may specialize on a very often used DH group. Applications should therefore | ||
76 | generate their own DH parameters during the installation process using the | ||
77 | openssl L<dhparam(1)|dhparam(1)> application. In order to reduce the computer | ||
78 | time needed for this generation, it is possible to use DSA parameters | ||
79 | instead (see L<dhparam(1)|dhparam(1)>), but in this case SSL_OP_SINGLE_DH_USE | ||
80 | is mandatory. | ||
81 | |||
82 | Application authors may compile in DH parameters. Files dh512.pem, | ||
83 | dh1024.pem, dh2048.pem, and dh4096.pem in the 'apps' directory of current | ||
84 | version of the OpenSSL distribution contain the 'SKIP' DH parameters, | ||
85 | which use safe primes and were generated verifiably pseudo-randomly. | ||
86 | These files can be converted into C code using the B<-C> option of the | ||
87 | L<dhparam(1)|dhparam(1)> application. | ||
88 | Authors may also generate their own set of parameters using | ||
89 | L<dhparam(1)|dhparam(1)>, but a user may not be sure how the parameters were | ||
90 | generated. The generation of DH parameters during installation is therefore | ||
91 | recommended. | ||
92 | |||
93 | An application may either directly specify the DH parameters or | ||
94 | can supply the DH parameters via a callback function. The callback approach | ||
95 | has the advantage, that the callback may supply DH parameters for different | ||
96 | key lengths. | ||
97 | |||
98 | The B<tmp_dh_callback> is called with the B<keylength> needed and | ||
99 | the B<is_export> information. The B<is_export> flag is set, when the | ||
100 | ephemeral DH key exchange is performed with an export cipher. | ||
101 | |||
102 | =head1 EXAMPLES | ||
103 | |||
104 | Handle DH parameters for key lengths of 512 and 1024 bits. (Error handling | ||
105 | partly left out.) | ||
106 | |||
107 | ... | ||
108 | /* Set up ephemeral DH stuff */ | ||
109 | DH *dh_512 = NULL; | ||
110 | DH *dh_1024 = NULL; | ||
111 | FILE *paramfile; | ||
112 | |||
113 | ... | ||
114 | /* "openssl dhparam -out dh_param_512.pem -2 512" */ | ||
115 | paramfile = fopen("dh_param_512.pem", "r"); | ||
116 | if (paramfile) { | ||
117 | dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
118 | fclose(paramfile); | ||
119 | } | ||
120 | /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ | ||
121 | paramfile = fopen("dh_param_1024.pem", "r"); | ||
122 | if (paramfile) { | ||
123 | dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
124 | fclose(paramfile); | ||
125 | } | ||
126 | ... | ||
127 | |||
128 | /* "openssl dhparam -C -2 512" etc... */ | ||
129 | DH *get_dh512() { ... } | ||
130 | DH *get_dh1024() { ... } | ||
131 | |||
132 | DH *tmp_dh_callback(SSL *s, int is_export, int keylength) | ||
133 | { | ||
134 | DH *dh_tmp=NULL; | ||
135 | |||
136 | switch (keylength) { | ||
137 | case 512: | ||
138 | if (!dh_512) | ||
139 | dh_512 = get_dh512(); | ||
140 | dh_tmp = dh_512; | ||
141 | break; | ||
142 | case 1024: | ||
143 | if (!dh_1024) | ||
144 | dh_1024 = get_dh1024(); | ||
145 | dh_tmp = dh_1024; | ||
146 | break; | ||
147 | default: | ||
148 | /* Generating a key on the fly is very costly, so use what is there */ | ||
149 | setup_dh_parameters_like_above(); | ||
150 | } | ||
151 | return(dh_tmp); | ||
152 | } | ||
153 | |||
154 | =head1 RETURN VALUES | ||
155 | |||
156 | SSL_CTX_set_tmp_dh_callback() and SSL_set_tmp_dh_callback() do not return | ||
157 | diagnostic output. | ||
158 | |||
159 | SSL_CTX_set_tmp_dh() and SSL_set_tmp_dh() do return 1 on success and 0 | ||
160 | on failure. Check the error queue to find out the reason of failure. | ||
161 | |||
162 | =head1 SEE ALSO | ||
163 | |||
164 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
165 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
166 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
167 | L<ciphers(1)|ciphers(1)>, L<dhparam(1)|dhparam(1)> | ||
168 | |||
169 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.3 new file mode 100644 index 0000000000..55b3aaafed --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.3 | |||
@@ -0,0 +1,228 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK.POD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_tmp_rsa_callback , | ||
6 | .Nm SSL_CTX_set_tmp_rsa , | ||
7 | .Nm SSL_CTX_need_tmp_rsa , | ||
8 | .Nm SSL_set_tmp_rsa_callback , | ||
9 | .Nm SSL_set_tmp_rsa , | ||
10 | .Nm SSL_need_tmp_rsa | ||
11 | .Nd handle RSA keys for ephemeral key exchange | ||
12 | .Sh SYNOPSIS | ||
13 | .In openssl/ssl.h | ||
14 | .Ft void | ||
15 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
16 | .Fa "SSL_CTX *ctx" | ||
17 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
18 | .Fc | ||
19 | .Ft long | ||
20 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
21 | .Ft long | ||
22 | .Fn SSL_CTX_need_tmp_rsa "SSL_CTX *ctx" | ||
23 | .Ft void | ||
24 | .Fo SSL_set_tmp_rsa_callback | ||
25 | .Fa "SSL_CTX *ctx" | ||
26 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
27 | .Fc | ||
28 | .Ft long | ||
29 | .Fn SSL_set_tmp_rsa "SSL *ssl" "RSA *rsa" | ||
30 | .Ft long | ||
31 | .Fn SSL_need_tmp_rsa "SSL *ssl" | ||
32 | .Ft RSA * | ||
33 | .Fn "(*tmp_rsa_callback)" "SSL *ssl" "int is_export" "int keylength" | ||
34 | .Sh DESCRIPTION | ||
35 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
36 | sets the callback function for | ||
37 | .Fa ctx | ||
38 | to be used when a temporary/ephemeral RSA key is required to | ||
39 | .Fa tmp_rsa_callback . | ||
40 | The callback is inherited by all | ||
41 | .Vt SSL | ||
42 | objects newly created from | ||
43 | .Fa ctx | ||
44 | with | ||
45 | .Xr SSL_new 3 . | ||
46 | Already created SSL objects are not affected. | ||
47 | .Pp | ||
48 | .Fn SSL_CTX_set_tmp_rsa | ||
49 | sets the temporary/ephemeral RSA key to be used to be | ||
50 | .Fa rsa . | ||
51 | The key is inherited by all | ||
52 | .Vt SSL | ||
53 | objects newly created from | ||
54 | .Fa ctx | ||
55 | with | ||
56 | .Xr SSL_new 3 . | ||
57 | Already created SSL objects are not affected. | ||
58 | .Pp | ||
59 | .Fn SSL_CTX_need_tmp_rsa | ||
60 | returns 1, | ||
61 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
62 | .Sq exportable | ||
63 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
64 | .Pp | ||
65 | .Fn SSL_set_tmp_rsa_callback | ||
66 | sets the callback only for | ||
67 | .Fa ssl . | ||
68 | .Pp | ||
69 | .Fn SSL_set_tmp_rsa | ||
70 | sets the key only for | ||
71 | .Fa ssl . | ||
72 | .Pp | ||
73 | .Fn SSL_need_tmp_rsa | ||
74 | returns 1, | ||
75 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
76 | .Sq exportable | ||
77 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
78 | .Pp | ||
79 | These functions apply to SSL/TLS servers only. | ||
80 | .Sh NOTES | ||
81 | When using a cipher with RSA authentication, | ||
82 | an ephemeral RSA key exchange can take place. | ||
83 | In this case the session data are negotiated using the ephemeral/temporary RSA | ||
84 | key and the RSA key supplied and certified by the certificate chain is only | ||
85 | used for signing. | ||
86 | .Pp | ||
87 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
88 | than the usual key length of 1024 bits were created. | ||
89 | To use these ciphers with RSA keys of usual length, an ephemeral key exchange | ||
90 | must be performed, as the normal (certified) key cannot be directly used. | ||
91 | .Pp | ||
92 | Using ephemeral RSA key exchange yields forward secrecy, | ||
93 | as the connection can only be decrypted when the RSA key is known. | ||
94 | By generating a temporary RSA key inside the server application that is lost | ||
95 | when the application is left, it becomes impossible for an attacker to decrypt | ||
96 | past sessions, even if he gets hold of the normal (certified) RSA key, | ||
97 | as this key was used for signing only. | ||
98 | The downside is that creating a RSA key is computationally expensive. | ||
99 | .Pp | ||
100 | Additionally, the use of ephemeral RSA key exchange is only allowed in the TLS | ||
101 | standard when the RSA key can be used for signing only, that is, | ||
102 | for export ciphers. | ||
103 | Using ephemeral RSA key exchange for other purposes violates the standard and | ||
104 | can break interoperability with clients. | ||
105 | It is therefore strongly recommended to not use ephemeral RSA key exchange and | ||
106 | use EDH (Ephemeral Diffie-Hellman) key exchange instead in order to achieve | ||
107 | forward secrecy (see | ||
108 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
109 | .Pp | ||
110 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
111 | and must be explicitly enabled using the | ||
112 | .Dv SSL_OP_EPHEMERAL_RSA | ||
113 | option of | ||
114 | .Xr SSL_CTX_set_options 3 , | ||
115 | violating the TLS/SSL | ||
116 | standard. | ||
117 | When ephemeral RSA key exchange is required for export ciphers, | ||
118 | it will automatically be used without this option! | ||
119 | .Pp | ||
120 | An application may either directly specify the key or can supply the key via | ||
121 | a callback function. | ||
122 | The callback approach has the advantage that the callback may generate the key | ||
123 | only in case it is actually needed. | ||
124 | However, as the generation of a RSA key is costly, | ||
125 | it will lead to a significant delay in the handshake procedure. | ||
126 | Another advantage of the callback function is that it can supply keys of | ||
127 | different size (e.g., for | ||
128 | .Dv SSL_OP_EPHEMERAL_RSA | ||
129 | usage) while the explicit setting of the key is only useful for key size of | ||
130 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
131 | if a longer key would be allowed. | ||
132 | .Pp | ||
133 | The | ||
134 | .Fa tmp_rsa_callback | ||
135 | is called with the | ||
136 | .Fa keylength | ||
137 | needed and the | ||
138 | .Fa is_export | ||
139 | information. | ||
140 | The | ||
141 | .Fa is_export | ||
142 | flag is set when the ephemeral RSA key exchange is performed with an export | ||
143 | cipher. | ||
144 | .Sh RETURN VALUES | ||
145 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
146 | and | ||
147 | .Fn SSL_set_tmp_rsa_callback | ||
148 | do not return diagnostic output. | ||
149 | .Pp | ||
150 | .Fn SSL_CTX_set_tmp_rsa | ||
151 | and | ||
152 | .Fn SSL_set_tmp_rsa | ||
153 | return 1 on success and 0 on failure. | ||
154 | Check the error queue to find out the reason of failure. | ||
155 | .Pp | ||
156 | .Fn SSL_CTX_need_tmp_rsa | ||
157 | and | ||
158 | .Fn SSL_need_tmp_rsa | ||
159 | return 1 if a temporary RSA key is needed and 0 otherwise. | ||
160 | .Sh EXAMPLES | ||
161 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. | ||
162 | As the generation of a RSA key costs a lot of computer time, | ||
163 | they are saved for later reuse. | ||
164 | For demonstration purposes, two keys for 512 bits and 1024 bits | ||
165 | respectively are generated. | ||
166 | .Bd -literal | ||
167 | \&... | ||
168 | |||
169 | /* Set up ephemeral RSA stuff */ | ||
170 | RSA *rsa_512 = NULL; | ||
171 | RSA *rsa_1024 = NULL; | ||
172 | |||
173 | rsa_512 = RSA_generate_key(512, RSA_F4, NULL, NULL); | ||
174 | if (rsa_512 == NULL) | ||
175 | evaluate_error_queue(); | ||
176 | |||
177 | rsa_1024 = RSA_generate_key(1024, RSA_F4, NULL, NULL); | ||
178 | if (rsa_1024 == NULL) | ||
179 | evaluate_error_queue(); | ||
180 | |||
181 | \&... | ||
182 | |||
183 | RSA * | ||
184 | tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
185 | { | ||
186 | RSA *rsa_tmp = NULL; | ||
187 | |||
188 | switch (keylength) { | ||
189 | case 512: | ||
190 | if (rsa_512) | ||
191 | rsa_tmp = rsa_512; | ||
192 | else { | ||
193 | /* | ||
194 | * generate on the fly, | ||
195 | * should not happen in this example | ||
196 | */ | ||
197 | rsa_tmp = RSA_generate_key(keylength, RSA_F4, NULL, | ||
198 | NULL); | ||
199 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
200 | } | ||
201 | break; | ||
202 | case 1024: | ||
203 | if (rsa_1024) | ||
204 | rsa_tmp = rsa_1024; | ||
205 | else | ||
206 | should_not_happen_in_this_example(); | ||
207 | break; | ||
208 | default: | ||
209 | /* | ||
210 | * Generating a key on the fly is very costly, | ||
211 | * so use what is there | ||
212 | */ | ||
213 | if (rsa_1024) | ||
214 | rsa_tmp = rsa_1024; | ||
215 | else | ||
216 | /* Use at least a shorter key */ | ||
217 | rsa_tmp = rsa_512; | ||
218 | } | ||
219 | return rsa_tmp; | ||
220 | } | ||
221 | .Ed | ||
222 | .Sh SEE ALSO | ||
223 | .Xr ciphers 1 , | ||
224 | .Xr ssl 3 , | ||
225 | .Xr SSL_CTX_set_cipher_list 3 , | ||
226 | .Xr SSL_CTX_set_options 3 , | ||
227 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
228 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod deleted file mode 100644 index 003dfdb73e..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_tmp_rsa_callback.pod +++ /dev/null | |||
@@ -1,168 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_tmp_rsa_callback, SSL_CTX_set_tmp_rsa, SSL_CTX_need_tmp_rsa, | ||
6 | SSL_set_tmp_rsa_callback, SSL_set_tmp_rsa, SSL_need_tmp_rsa - handle RSA keys | ||
7 | for ephemeral key exchange | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | void SSL_CTX_set_tmp_rsa_callback(SSL_CTX *ctx, | ||
14 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); | ||
15 | long SSL_CTX_set_tmp_rsa(SSL_CTX *ctx, RSA *rsa); | ||
16 | long SSL_CTX_need_tmp_rsa(SSL_CTX *ctx); | ||
17 | |||
18 | void SSL_set_tmp_rsa_callback(SSL_CTX *ctx, | ||
19 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)); | ||
20 | long SSL_set_tmp_rsa(SSL *ssl, RSA *rsa) | ||
21 | long SSL_need_tmp_rsa(SSL *ssl) | ||
22 | |||
23 | RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength); | ||
24 | |||
25 | =head1 DESCRIPTION | ||
26 | |||
27 | SSL_CTX_set_tmp_rsa_callback() sets the callback function for B<ctx> to be | ||
28 | used when a temporary/ephemeral RSA key is required to B<tmp_rsa_callback>. | ||
29 | The callback is inherited by all SSL objects newly created from B<ctx> | ||
30 | with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. | ||
31 | |||
32 | SSL_CTX_set_tmp_rsa() sets the temporary/ephemeral RSA key to be used to be | ||
33 | B<rsa>. The key is inherited by all SSL objects newly created from B<ctx> | ||
34 | with <SSL_new(3)|SSL_new(3)>. Already created SSL objects are not affected. | ||
35 | |||
36 | SSL_CTX_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed | ||
37 | for RSA-based strength-limited 'exportable' ciphersuites because a RSA key | ||
38 | with a keysize larger than 512 bits is installed. | ||
39 | |||
40 | SSL_set_tmp_rsa_callback() sets the callback only for B<ssl>. | ||
41 | |||
42 | SSL_set_tmp_rsa() sets the key only for B<ssl>. | ||
43 | |||
44 | SSL_need_tmp_rsa() returns 1, if a temporary/ephemeral RSA key is needed, | ||
45 | for RSA-based strength-limited 'exportable' ciphersuites because a RSA key | ||
46 | with a keysize larger than 512 bits is installed. | ||
47 | |||
48 | These functions apply to SSL/TLS servers only. | ||
49 | |||
50 | =head1 NOTES | ||
51 | |||
52 | When using a cipher with RSA authentication, an ephemeral RSA key exchange | ||
53 | can take place. In this case the session data are negotiated using the | ||
54 | ephemeral/temporary RSA key and the RSA key supplied and certified | ||
55 | by the certificate chain is only used for signing. | ||
56 | |||
57 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
58 | than the usual key length of 1024 bits were created. To use these ciphers | ||
59 | with RSA keys of usual length, an ephemeral key exchange must be performed, | ||
60 | as the normal (certified) key cannot be directly used. | ||
61 | |||
62 | Using ephemeral RSA key exchange yields forward secrecy, as the connection | ||
63 | can only be decrypted, when the RSA key is known. By generating a temporary | ||
64 | RSA key inside the server application that is lost when the application | ||
65 | is left, it becomes impossible for an attacker to decrypt past sessions, | ||
66 | even if he gets hold of the normal (certified) RSA key, as this key was | ||
67 | used for signing only. The downside is that creating a RSA key is | ||
68 | computationally expensive. | ||
69 | |||
70 | Additionally, the use of ephemeral RSA key exchange is only allowed in | ||
71 | the TLS standard, when the RSA key can be used for signing only, that is | ||
72 | for export ciphers. Using ephemeral RSA key exchange for other purposes | ||
73 | violates the standard and can break interoperability with clients. | ||
74 | It is therefore strongly recommended to not use ephemeral RSA key | ||
75 | exchange and use EDH (Ephemeral Diffie-Hellman) key exchange instead | ||
76 | in order to achieve forward secrecy (see | ||
77 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>). | ||
78 | |||
79 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
80 | and must be explicitly enabled using the SSL_OP_EPHEMERAL_RSA option of | ||
81 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, violating the TLS/SSL | ||
82 | standard. When ephemeral RSA key exchange is required for export ciphers, | ||
83 | it will automatically be used without this option! | ||
84 | |||
85 | An application may either directly specify the key or can supply the key via | ||
86 | a callback function. The callback approach has the advantage, that the | ||
87 | callback may generate the key only in case it is actually needed. As the | ||
88 | generation of a RSA key is however costly, it will lead to a significant | ||
89 | delay in the handshake procedure. Another advantage of the callback function | ||
90 | is that it can supply keys of different size (e.g. for SSL_OP_EPHEMERAL_RSA | ||
91 | usage) while the explicit setting of the key is only useful for key size of | ||
92 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
93 | if a longer key would be allowed. | ||
94 | |||
95 | The B<tmp_rsa_callback> is called with the B<keylength> needed and | ||
96 | the B<is_export> information. The B<is_export> flag is set, when the | ||
97 | ephemeral RSA key exchange is performed with an export cipher. | ||
98 | |||
99 | =head1 EXAMPLES | ||
100 | |||
101 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. As the | ||
102 | generation of a RSA key costs a lot of computer time, they saved for later | ||
103 | reuse. For demonstration purposes, two keys for 512 bits and 1024 bits | ||
104 | respectively are generated. | ||
105 | |||
106 | ... | ||
107 | /* Set up ephemeral RSA stuff */ | ||
108 | RSA *rsa_512 = NULL; | ||
109 | RSA *rsa_1024 = NULL; | ||
110 | |||
111 | rsa_512 = RSA_generate_key(512,RSA_F4,NULL,NULL); | ||
112 | if (rsa_512 == NULL) | ||
113 | evaluate_error_queue(); | ||
114 | |||
115 | rsa_1024 = RSA_generate_key(1024,RSA_F4,NULL,NULL); | ||
116 | if (rsa_1024 == NULL) | ||
117 | evaluate_error_queue(); | ||
118 | |||
119 | ... | ||
120 | |||
121 | RSA *tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
122 | { | ||
123 | RSA *rsa_tmp=NULL; | ||
124 | |||
125 | switch (keylength) { | ||
126 | case 512: | ||
127 | if (rsa_512) | ||
128 | rsa_tmp = rsa_512; | ||
129 | else { /* generate on the fly, should not happen in this example */ | ||
130 | rsa_tmp = RSA_generate_key(keylength,RSA_F4,NULL,NULL); | ||
131 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
132 | } | ||
133 | break; | ||
134 | case 1024: | ||
135 | if (rsa_1024) | ||
136 | rsa_tmp=rsa_1024; | ||
137 | else | ||
138 | should_not_happen_in_this_example(); | ||
139 | break; | ||
140 | default: | ||
141 | /* Generating a key on the fly is very costly, so use what is there */ | ||
142 | if (rsa_1024) | ||
143 | rsa_tmp=rsa_1024; | ||
144 | else | ||
145 | rsa_tmp=rsa_512; /* Use at least a shorter key */ | ||
146 | } | ||
147 | return(rsa_tmp); | ||
148 | } | ||
149 | |||
150 | =head1 RETURN VALUES | ||
151 | |||
152 | SSL_CTX_set_tmp_rsa_callback() and SSL_set_tmp_rsa_callback() do not return | ||
153 | diagnostic output. | ||
154 | |||
155 | SSL_CTX_set_tmp_rsa() and SSL_set_tmp_rsa() do return 1 on success and 0 | ||
156 | on failure. Check the error queue to find out the reason of failure. | ||
157 | |||
158 | SSL_CTX_need_tmp_rsa() and SSL_need_tmp_rsa() return 1 if a temporary | ||
159 | RSA key is needed and 0 otherwise. | ||
160 | |||
161 | =head1 SEE ALSO | ||
162 | |||
163 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
164 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
165 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
166 | L<SSL_new(3)|SSL_new(3)>, L<ciphers(1)|ciphers(1)> | ||
167 | |||
168 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.3 new file mode 100644 index 0000000000..6ce2e60089 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.3 | |||
@@ -0,0 +1,412 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_SET_VERIFY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_set_verify , | ||
6 | .Nm SSL_set_verify , | ||
7 | .Nm SSL_CTX_set_verify_depth , | ||
8 | .Nm SSL_set_verify_depth | ||
9 | .Nd set peer certificate verification parameters | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft void | ||
13 | .Fo SSL_CTX_set_verify | ||
14 | .Fa "SSL_CTX *ctx" | ||
15 | .Fa "int mode" | ||
16 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
17 | .Fc | ||
18 | .Ft void | ||
19 | .Fo SSL_set_verify | ||
20 | .Fa "SSL *s" | ||
21 | .Fa "int mode" | ||
22 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
23 | .Fc | ||
24 | .Ft void | ||
25 | .Fn SSL_CTX_set_verify_depth "SSL_CTX *ctx" "int depth" | ||
26 | .Ft void | ||
27 | .Fn SSL_set_verify_depth "SSL *s" "int depth" | ||
28 | .Ft int | ||
29 | .Fn verify_callback "int preverify_ok" "X509_STORE_CTX *x509_ctx" | ||
30 | .Sh DESCRIPTION | ||
31 | .Fn SSL_CTX_set_verify | ||
32 | sets the verification flags for | ||
33 | .Fa ctx | ||
34 | to be | ||
35 | .Fa mode | ||
36 | and | ||
37 | specifies the | ||
38 | .Fa verify_callback | ||
39 | function to be used. | ||
40 | If no callback function shall be specified, the | ||
41 | .Dv NULL | ||
42 | pointer can be used for | ||
43 | .Fa verify_callback . | ||
44 | .Pp | ||
45 | .Fn SSL_set_verify | ||
46 | sets the verification flags for | ||
47 | .Fa ssl | ||
48 | to be | ||
49 | .Fa mode | ||
50 | and specifies the | ||
51 | .Fa verify_callback | ||
52 | function to be used. | ||
53 | If no callback function shall be specified, the | ||
54 | .Dv NULL | ||
55 | pointer can be used for | ||
56 | .Fa verify_callback . | ||
57 | In this case last | ||
58 | .Fa verify_callback | ||
59 | set specifically for this | ||
60 | .Fa ssl | ||
61 | remains. | ||
62 | If no special callback was set before, the default callback for the underlying | ||
63 | .Fa ctx | ||
64 | is used, that was valid at the time | ||
65 | .Fa ssl | ||
66 | was created with | ||
67 | .Xr SSL_new 3 . | ||
68 | .Pp | ||
69 | .Fn SSL_CTX_set_verify_depth | ||
70 | sets the maximum | ||
71 | .Fa depth | ||
72 | for the certificate chain verification that shall be allowed for | ||
73 | .Fa ctx . | ||
74 | (See the | ||
75 | .Sx BUGS | ||
76 | section.) | ||
77 | .Pp | ||
78 | .Fn SSL_set_verify_depth | ||
79 | sets the maximum | ||
80 | .Fa depth | ||
81 | for the certificate chain verification that shall be allowed for | ||
82 | .Fa ssl . | ||
83 | (See the | ||
84 | .Sx BUGS | ||
85 | section.) | ||
86 | .Sh NOTES | ||
87 | The verification of certificates can be controlled by a set of bitwise ORed | ||
88 | .Fa mode | ||
89 | flags: | ||
90 | .Bl -tag -width Ds | ||
91 | .It Dv SSL_VERIFY_NONE | ||
92 | .Em Server mode: | ||
93 | the server will not send a client certificate request to the client, | ||
94 | so the client will not send a certificate. | ||
95 | .Pp | ||
96 | .Em Client mode: | ||
97 | if not using an anonymous cipher (by default disabled), | ||
98 | the server will send a certificate which will be checked. | ||
99 | The result of the certificate verification process can be checked after the | ||
100 | TLS/SSL handshake using the | ||
101 | .Xr SSL_get_verify_result 3 | ||
102 | function. | ||
103 | The handshake will be continued regardless of the verification result. | ||
104 | .It Dv SSL_VERIFY_PEER | ||
105 | .Em Server mode: | ||
106 | the server sends a client certificate request to the client. | ||
107 | The certificate returned (if any) is checked. | ||
108 | If the verification process fails, | ||
109 | the TLS/SSL handshake is immediately terminated with an alert message | ||
110 | containing the reason for the verification failure. | ||
111 | The behaviour can be controlled by the additional | ||
112 | .Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
113 | and | ||
114 | .Dv SSL_VERIFY_CLIENT_ONCE | ||
115 | flags. | ||
116 | .Pp | ||
117 | .Em Client mode: | ||
118 | the server certificate is verified. | ||
119 | If the verification process fails, | ||
120 | the TLS/SSL handshake is immediately terminated with an alert message | ||
121 | containing the reason for the verification failure. | ||
122 | If no server certificate is sent, because an anonymous cipher is used, | ||
123 | .Dv SSL_VERIFY_PEER | ||
124 | is ignored. | ||
125 | .It Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
126 | .Em Server mode: | ||
127 | if the client did not return a certificate, the TLS/SSL | ||
128 | handshake is immediately terminated with a | ||
129 | .Dq handshake failure | ||
130 | alert. | ||
131 | This flag must be used together with | ||
132 | .Dv SSL_VERIFY_PEER. | ||
133 | .Pp | ||
134 | .Em Client mode: | ||
135 | ignored | ||
136 | .It Dv SSL_VERIFY_CLIENT_ONCE | ||
137 | .Em Server mode: | ||
138 | only request a client certificate on the initial TLS/SSL handshake. | ||
139 | Do not ask for a client certificate again in case of a renegotiation. | ||
140 | This flag must be used together with | ||
141 | .Dv SSL_VERIFY_PEER . | ||
142 | .Pp | ||
143 | .Em Client mode: | ||
144 | ignored | ||
145 | .El | ||
146 | .Pp | ||
147 | Exactly one of the | ||
148 | .Fa mode | ||
149 | flags | ||
150 | .Dv SSL_VERIFY_NONE | ||
151 | and | ||
152 | .Dv SSL_VERIFY_PEER | ||
153 | must be set at any time. | ||
154 | .Pp | ||
155 | The actual verification procedure is performed either using the built-in | ||
156 | verification procedure or using another application provided verification | ||
157 | function set with | ||
158 | .Xr SSL_CTX_set_cert_verify_callback 3 . | ||
159 | The following descriptions apply in the case of the built-in procedure. | ||
160 | An application provided procedure also has access to the verify depth | ||
161 | information and the | ||
162 | .Fa verify_callback Ns () | ||
163 | function, but the way this information is used may be different. | ||
164 | .Pp | ||
165 | .Fn SSL_CTX_set_verify_depth | ||
166 | and | ||
167 | .Fn SSL_set_verify_depth | ||
168 | set the limit up to which depth certificates in a chain are used during the | ||
169 | verification procedure. | ||
170 | If the certificate chain is longer than allowed, | ||
171 | the certificates above the limit are ignored. | ||
172 | Error messages are generated as if these certificates would not be present, | ||
173 | most likely a | ||
174 | .Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY | ||
175 | will be issued. | ||
176 | The depth count is | ||
177 | .Dq level 0: peer certificate , | ||
178 | .Dq level 1: CA certificate , | ||
179 | .Dq level 2: higher level CA certificate , | ||
180 | and so on. | ||
181 | Setting the maximum depth to 2 allows the levels 0, 1, and 2. | ||
182 | The default depth limit is 100, | ||
183 | allowing for the peer certificate and an additional 100 CA certificates. | ||
184 | .Pp | ||
185 | The | ||
186 | .Fa verify_callback | ||
187 | function is used to control the behaviour when the | ||
188 | .Dv SSL_VERIFY_PEER | ||
189 | flag is set. | ||
190 | It must be supplied by the application and receives two arguments: | ||
191 | .Fa preverify_ok | ||
192 | indicates whether the verification of the certificate in question was passed | ||
193 | (preverify_ok=1) or not (preverify_ok=0). | ||
194 | .Fa x509_ctx | ||
195 | is a pointer to the complete context used | ||
196 | for the certificate chain verification. | ||
197 | .Pp | ||
198 | The certificate chain is checked starting with the deepest nesting level | ||
199 | (the root CA certificate) and worked upward to the peer's certificate. | ||
200 | At each level signatures and issuer attributes are checked. | ||
201 | Whenever a verification error is found, the error number is stored in | ||
202 | .Fa x509_ctx | ||
203 | and | ||
204 | .Fa verify_callback | ||
205 | is called with | ||
206 | .Fa preverify_ok | ||
207 | equal to 0. | ||
208 | By applying | ||
209 | .Fn X509_CTX_store_* | ||
210 | functions | ||
211 | .Fa verify_callback | ||
212 | can locate the certificate in question and perform additional steps (see | ||
213 | .Sx EXAMPLES ) . | ||
214 | If no error is found for a certificate, | ||
215 | .Fa verify_callback | ||
216 | is called with | ||
217 | .Fa preverify_ok | ||
218 | equal to 1 before advancing to the next level. | ||
219 | .Pp | ||
220 | The return value of | ||
221 | .Fa verify_callback | ||
222 | controls the strategy of the further verification process. | ||
223 | If | ||
224 | .Fa verify_callback | ||
225 | returns 0, the verification process is immediately stopped with | ||
226 | .Dq verification failed | ||
227 | state. | ||
228 | If | ||
229 | .Dv SSL_VERIFY_PEER | ||
230 | is set, a verification failure alert is sent to the peer and the TLS/SSL | ||
231 | handshake is terminated. | ||
232 | If | ||
233 | .Fa verify_callback | ||
234 | returns 1, the verification process is continued. | ||
235 | If | ||
236 | .Fa verify_callback | ||
237 | always returns 1, | ||
238 | the TLS/SSL handshake will not be terminated with respect to verification | ||
239 | failures and the connection will be established. | ||
240 | The calling process can however retrieve the error code of the last | ||
241 | verification error using | ||
242 | .Xr SSL_get_verify_result 3 | ||
243 | or by maintaining its own error storage managed by | ||
244 | .Fa verify_callback . | ||
245 | .Pp | ||
246 | If no | ||
247 | .Fa verify_callback | ||
248 | is specified, the default callback will be used. | ||
249 | Its return value is identical to | ||
250 | .Fa preverify_ok , | ||
251 | so that any verification | ||
252 | failure will lead to a termination of the TLS/SSL handshake with an | ||
253 | alert message, if | ||
254 | .Dv SSL_VERIFY_PEER | ||
255 | is set. | ||
256 | .Sh RETURN VALUES | ||
257 | The | ||
258 | .Fn SSL*_set_verify* | ||
259 | functions do not provide diagnostic information. | ||
260 | .Sh EXAMPLES | ||
261 | The following code sequence realizes an example | ||
262 | .Fa verify_callback | ||
263 | function that will always continue the TLS/SSL handshake regardless of | ||
264 | verification failure, if wished. | ||
265 | The callback realizes a verification depth limit with more informational output. | ||
266 | .Pp | ||
267 | All verification errors are printed; | ||
268 | information about the certificate chain is printed on request. | ||
269 | The example is realized for a server that does allow but not require client | ||
270 | certificates. | ||
271 | .Pp | ||
272 | The example makes use of the ex_data technique to store application data | ||
273 | into/retrieve application data from the | ||
274 | .Vt SSL | ||
275 | structure (see | ||
276 | .Xr SSL_get_ex_new_index 3 , | ||
277 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 ) . | ||
278 | .Bd -literal | ||
279 | \&... | ||
280 | |||
281 | typedef struct { | ||
282 | int verbose_mode; | ||
283 | int verify_depth; | ||
284 | int always_continue; | ||
285 | } mydata_t; | ||
286 | int mydata_index; | ||
287 | \&... | ||
288 | static int | ||
289 | verify_callback(int preverify_ok, X509_STORE_CTX *ctx) | ||
290 | { | ||
291 | char buf[256]; | ||
292 | X509 *err_cert; | ||
293 | int err, depth; | ||
294 | SSL *ssl; | ||
295 | mydata_t *mydata; | ||
296 | |||
297 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
298 | err = X509_STORE_CTX_get_error(ctx); | ||
299 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
300 | |||
301 | /* | ||
302 | * Retrieve the pointer to the SSL of the connection currently | ||
303 | * treated * and the application specific data stored into the | ||
304 | * SSL object. | ||
305 | */ | ||
306 | ssl = X509_STORE_CTX_get_ex_data(ctx, | ||
307 | SSL_get_ex_data_X509_STORE_CTX_idx()); | ||
308 | mydata = SSL_get_ex_data(ssl, mydata_index); | ||
309 | |||
310 | X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256); | ||
311 | |||
312 | /* | ||
313 | * Catch a too long certificate chain. The depth limit set using | ||
314 | * SSL_CTX_set_verify_depth() is by purpose set to "limit+1" so | ||
315 | * that whenever the "depth>verify_depth" condition is met, we | ||
316 | * have violated the limit and want to log this error condition. | ||
317 | * We must do it here, because the CHAIN_TOO_LONG error would not | ||
318 | * be found explicitly; only errors introduced by cutting off the | ||
319 | * additional certificates would be logged. | ||
320 | */ | ||
321 | if (depth > mydata->verify_depth) { | ||
322 | preverify_ok = 0; | ||
323 | err = X509_V_ERR_CERT_CHAIN_TOO_LONG; | ||
324 | X509_STORE_CTX_set_error(ctx, err); | ||
325 | } | ||
326 | if (!preverify_ok) { | ||
327 | printf("verify error:num=%d:%s:depth=%d:%s\en", err, | ||
328 | X509_verify_cert_error_string(err), depth, buf); | ||
329 | } else if (mydata->verbose_mode) { | ||
330 | printf("depth=%d:%s\en", depth, buf); | ||
331 | } | ||
332 | |||
333 | /* | ||
334 | * At this point, err contains the last verification error. | ||
335 | * We can use it for something special | ||
336 | */ | ||
337 | if (!preverify_ok && (err == | ||
338 | X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) { | ||
339 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), | ||
340 | buf, 256); | ||
341 | printf("issuer= %s\en", buf); | ||
342 | } | ||
343 | |||
344 | if (mydata->always_continue) | ||
345 | return 1; | ||
346 | else | ||
347 | return preverify_ok; | ||
348 | } | ||
349 | \&... | ||
350 | |||
351 | mydata_t mydata; | ||
352 | |||
353 | \&... | ||
354 | |||
355 | mydata_index = SSL_get_ex_new_index(0, "mydata index", NULL, NULL, NULL); | ||
356 | |||
357 | \&... | ||
358 | |||
359 | SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, | ||
360 | verify_callback); | ||
361 | |||
362 | /* | ||
363 | * Let the verify_callback catch the verify_depth error so that we get | ||
364 | * an appropriate error in the logfile. | ||
365 | */ | ||
366 | SSL_CTX_set_verify_depth(verify_depth + 1); | ||
367 | |||
368 | /* | ||
369 | * Set up the SSL specific data into "mydata" and store it into the SSL | ||
370 | * structure. | ||
371 | */ | ||
372 | mydata.verify_depth = verify_depth; ... | ||
373 | SSL_set_ex_data(ssl, mydata_index, &mydata); | ||
374 | |||
375 | \&... | ||
376 | |||
377 | SSL_accept(ssl); /* check of success left out for clarity */ | ||
378 | if (peer = SSL_get_peer_certificate(ssl)) { | ||
379 | if (SSL_get_verify_result(ssl) == X509_V_OK) { | ||
380 | /* The client sent a certificate which verified OK */ | ||
381 | } | ||
382 | } | ||
383 | .Ed | ||
384 | .Sh SEE ALSO | ||
385 | .Xr ssl 3 , | ||
386 | .Xr SSL_CTX_get_verify_mode 3 , | ||
387 | .Xr SSL_CTX_load_verify_locations 3 , | ||
388 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
389 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
390 | .Xr SSL_get_ex_new_index 3 , | ||
391 | .Xr SSL_get_peer_certificate 3 , | ||
392 | .Xr SSL_get_verify_result 3 , | ||
393 | .Xr SSL_new 3 | ||
394 | .Sh BUGS | ||
395 | In client mode, it is not checked whether the | ||
396 | .Dv SSL_VERIFY_PEER | ||
397 | flag is set, but whether | ||
398 | .Dv SSL_VERIFY_NONE | ||
399 | is not set. | ||
400 | This can lead to unexpected behaviour, if the | ||
401 | .Dv SSL_VERIFY_PEER | ||
402 | and | ||
403 | .Dv SSL_VERIFY_NONE | ||
404 | are not used as required (exactly one must be set at any time). | ||
405 | .Pp | ||
406 | The certificate verification depth set with | ||
407 | .Fn SSL[_CTX]_verify_depth | ||
408 | stops the verification at a certain depth. | ||
409 | The error message produced will be that of an incomplete certificate chain and | ||
410 | not | ||
411 | .Dv X509_V_ERR_CERT_CHAIN_TOO_LONG | ||
412 | as may be expected. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod deleted file mode 100644 index 0af8e69441..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_set_verify.pod +++ /dev/null | |||
@@ -1,295 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_set_verify, SSL_set_verify, SSL_CTX_set_verify_depth, | ||
6 | SSL_set_verify_depth - set peer certificate verification parameters | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_CTX_set_verify(SSL_CTX *ctx, int mode, | ||
13 | int (*verify_callback)(int, X509_STORE_CTX *)); | ||
14 | void SSL_set_verify(SSL *s, int mode, | ||
15 | int (*verify_callback)(int, X509_STORE_CTX *)); | ||
16 | void SSL_CTX_set_verify_depth(SSL_CTX *ctx,int depth); | ||
17 | void SSL_set_verify_depth(SSL *s, int depth); | ||
18 | |||
19 | int verify_callback(int preverify_ok, X509_STORE_CTX *x509_ctx); | ||
20 | |||
21 | =head1 DESCRIPTION | ||
22 | |||
23 | SSL_CTX_set_verify() sets the verification flags for B<ctx> to be B<mode> and | ||
24 | specifies the B<verify_callback> function to be used. If no callback function | ||
25 | shall be specified, the NULL pointer can be used for B<verify_callback>. | ||
26 | |||
27 | SSL_set_verify() sets the verification flags for B<ssl> to be B<mode> and | ||
28 | specifies the B<verify_callback> function to be used. If no callback function | ||
29 | shall be specified, the NULL pointer can be used for B<verify_callback>. In | ||
30 | this case last B<verify_callback> set specifically for this B<ssl> remains. If | ||
31 | no special B<callback> was set before, the default callback for the underlying | ||
32 | B<ctx> is used, that was valid at the time B<ssl> was created with | ||
33 | L<SSL_new(3)|SSL_new(3)>. | ||
34 | |||
35 | SSL_CTX_set_verify_depth() sets the maximum B<depth> for the certificate chain | ||
36 | verification that shall be allowed for B<ctx>. (See the BUGS section.) | ||
37 | |||
38 | SSL_set_verify_depth() sets the maximum B<depth> for the certificate chain | ||
39 | verification that shall be allowed for B<ssl>. (See the BUGS section.) | ||
40 | |||
41 | =head1 NOTES | ||
42 | |||
43 | The verification of certificates can be controlled by a set of logically | ||
44 | or'ed B<mode> flags: | ||
45 | |||
46 | =over 4 | ||
47 | |||
48 | =item SSL_VERIFY_NONE | ||
49 | |||
50 | B<Server mode:> the server will not send a client certificate request to the | ||
51 | client, so the client will not send a certificate. | ||
52 | |||
53 | B<Client mode:> if not using an anonymous cipher (by default disabled), the | ||
54 | server will send a certificate which will be checked. The result of the | ||
55 | certificate verification process can be checked after the TLS/SSL handshake | ||
56 | using the L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> function. | ||
57 | The handshake will be continued regardless of the verification result. | ||
58 | |||
59 | =item SSL_VERIFY_PEER | ||
60 | |||
61 | B<Server mode:> the server sends a client certificate request to the client. | ||
62 | The certificate returned (if any) is checked. If the verification process | ||
63 | fails, the TLS/SSL handshake is | ||
64 | immediately terminated with an alert message containing the reason for | ||
65 | the verification failure. | ||
66 | The behaviour can be controlled by the additional | ||
67 | SSL_VERIFY_FAIL_IF_NO_PEER_CERT and SSL_VERIFY_CLIENT_ONCE flags. | ||
68 | |||
69 | B<Client mode:> the server certificate is verified. If the verification process | ||
70 | fails, the TLS/SSL handshake is | ||
71 | immediately terminated with an alert message containing the reason for | ||
72 | the verification failure. If no server certificate is sent, because an | ||
73 | anonymous cipher is used, SSL_VERIFY_PEER is ignored. | ||
74 | |||
75 | =item SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
76 | |||
77 | B<Server mode:> if the client did not return a certificate, the TLS/SSL | ||
78 | handshake is immediately terminated with a "handshake failure" alert. | ||
79 | This flag must be used together with SSL_VERIFY_PEER. | ||
80 | |||
81 | B<Client mode:> ignored | ||
82 | |||
83 | =item SSL_VERIFY_CLIENT_ONCE | ||
84 | |||
85 | B<Server mode:> only request a client certificate on the initial TLS/SSL | ||
86 | handshake. Do not ask for a client certificate again in case of a | ||
87 | renegotiation. This flag must be used together with SSL_VERIFY_PEER. | ||
88 | |||
89 | B<Client mode:> ignored | ||
90 | |||
91 | =back | ||
92 | |||
93 | Exactly one of the B<mode> flags SSL_VERIFY_NONE and SSL_VERIFY_PEER must be | ||
94 | set at any time. | ||
95 | |||
96 | The actual verification procedure is performed either using the built-in | ||
97 | verification procedure or using another application provided verification | ||
98 | function set with | ||
99 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>. | ||
100 | The following descriptions apply in the case of the built-in procedure. An | ||
101 | application provided procedure also has access to the verify depth information | ||
102 | and the verify_callback() function, but the way this information is used | ||
103 | may be different. | ||
104 | |||
105 | SSL_CTX_set_verify_depth() and SSL_set_verify_depth() set the limit up | ||
106 | to which depth certificates in a chain are used during the verification | ||
107 | procedure. If the certificate chain is longer than allowed, the certificates | ||
108 | above the limit are ignored. Error messages are generated as if these | ||
109 | certificates would not be present, most likely a | ||
110 | X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY will be issued. | ||
111 | The depth count is "level 0:peer certificate", "level 1: CA certificate", | ||
112 | "level 2: higher level CA certificate", and so on. Setting the maximum | ||
113 | depth to 2 allows the levels 0, 1, and 2. The default depth limit is 100, | ||
114 | allowing for the peer certificate and additional 100 CA certificates. | ||
115 | |||
116 | The B<verify_callback> function is used to control the behaviour when the | ||
117 | SSL_VERIFY_PEER flag is set. It must be supplied by the application and | ||
118 | receives two arguments: B<preverify_ok> indicates, whether the verification of | ||
119 | the certificate in question was passed (preverify_ok=1) or not | ||
120 | (preverify_ok=0). B<x509_ctx> is a pointer to the complete context used | ||
121 | for the certificate chain verification. | ||
122 | |||
123 | The certificate chain is checked starting with the deepest nesting level | ||
124 | (the root CA certificate) and worked upward to the peer's certificate. | ||
125 | At each level signatures and issuer attributes are checked. Whenever | ||
126 | a verification error is found, the error number is stored in B<x509_ctx> | ||
127 | and B<verify_callback> is called with B<preverify_ok>=0. By applying | ||
128 | X509_CTX_store_* functions B<verify_callback> can locate the certificate | ||
129 | in question and perform additional steps (see EXAMPLES). If no error is | ||
130 | found for a certificate, B<verify_callback> is called with B<preverify_ok>=1 | ||
131 | before advancing to the next level. | ||
132 | |||
133 | The return value of B<verify_callback> controls the strategy of the further | ||
134 | verification process. If B<verify_callback> returns 0, the verification | ||
135 | process is immediately stopped with "verification failed" state. If | ||
136 | SSL_VERIFY_PEER is set, a verification failure alert is sent to the peer and | ||
137 | the TLS/SSL handshake is terminated. If B<verify_callback> returns 1, | ||
138 | the verification process is continued. If B<verify_callback> always returns | ||
139 | 1, the TLS/SSL handshake will not be terminated with respect to verification | ||
140 | failures and the connection will be established. The calling process can | ||
141 | however retrieve the error code of the last verification error using | ||
142 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> or by maintaining its | ||
143 | own error storage managed by B<verify_callback>. | ||
144 | |||
145 | If no B<verify_callback> is specified, the default callback will be used. | ||
146 | Its return value is identical to B<preverify_ok>, so that any verification | ||
147 | failure will lead to a termination of the TLS/SSL handshake with an | ||
148 | alert message, if SSL_VERIFY_PEER is set. | ||
149 | |||
150 | =head1 BUGS | ||
151 | |||
152 | In client mode, it is not checked whether the SSL_VERIFY_PEER flag | ||
153 | is set, but whether SSL_VERIFY_NONE is not set. This can lead to | ||
154 | unexpected behaviour, if the SSL_VERIFY_PEER and SSL_VERIFY_NONE are not | ||
155 | used as required (exactly one must be set at any time). | ||
156 | |||
157 | The certificate verification depth set with SSL[_CTX]_verify_depth() | ||
158 | stops the verification at a certain depth. The error message produced | ||
159 | will be that of an incomplete certificate chain and not | ||
160 | X509_V_ERR_CERT_CHAIN_TOO_LONG as may be expected. | ||
161 | |||
162 | =head1 RETURN VALUES | ||
163 | |||
164 | The SSL*_set_verify*() functions do not provide diagnostic information. | ||
165 | |||
166 | =head1 EXAMPLES | ||
167 | |||
168 | The following code sequence realizes an example B<verify_callback> function | ||
169 | that will always continue the TLS/SSL handshake regardless of verification | ||
170 | failure, if wished. The callback realizes a verification depth limit with | ||
171 | more informational output. | ||
172 | |||
173 | All verification errors are printed; information about the certificate chain | ||
174 | is printed on request. | ||
175 | The example is realized for a server that does allow but not require client | ||
176 | certificates. | ||
177 | |||
178 | The example makes use of the ex_data technique to store application data | ||
179 | into/retrieve application data from the SSL structure | ||
180 | (see L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, | ||
181 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>). | ||
182 | |||
183 | ... | ||
184 | typedef struct { | ||
185 | int verbose_mode; | ||
186 | int verify_depth; | ||
187 | int always_continue; | ||
188 | } mydata_t; | ||
189 | int mydata_index; | ||
190 | ... | ||
191 | static int verify_callback(int preverify_ok, X509_STORE_CTX *ctx) | ||
192 | { | ||
193 | char buf[256]; | ||
194 | X509 *err_cert; | ||
195 | int err, depth; | ||
196 | SSL *ssl; | ||
197 | mydata_t *mydata; | ||
198 | |||
199 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
200 | err = X509_STORE_CTX_get_error(ctx); | ||
201 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
202 | |||
203 | /* | ||
204 | * Retrieve the pointer to the SSL of the connection currently treated | ||
205 | * and the application specific data stored into the SSL object. | ||
206 | */ | ||
207 | ssl = X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); | ||
208 | mydata = SSL_get_ex_data(ssl, mydata_index); | ||
209 | |||
210 | X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256); | ||
211 | |||
212 | /* | ||
213 | * Catch a too long certificate chain. The depth limit set using | ||
214 | * SSL_CTX_set_verify_depth() is by purpose set to "limit+1" so | ||
215 | * that whenever the "depth>verify_depth" condition is met, we | ||
216 | * have violated the limit and want to log this error condition. | ||
217 | * We must do it here, because the CHAIN_TOO_LONG error would not | ||
218 | * be found explicitly; only errors introduced by cutting off the | ||
219 | * additional certificates would be logged. | ||
220 | */ | ||
221 | if (depth > mydata->verify_depth) { | ||
222 | preverify_ok = 0; | ||
223 | err = X509_V_ERR_CERT_CHAIN_TOO_LONG; | ||
224 | X509_STORE_CTX_set_error(ctx, err); | ||
225 | } | ||
226 | if (!preverify_ok) { | ||
227 | printf("verify error:num=%d:%s:depth=%d:%s\n", err, | ||
228 | X509_verify_cert_error_string(err), depth, buf); | ||
229 | } | ||
230 | else if (mydata->verbose_mode) | ||
231 | { | ||
232 | printf("depth=%d:%s\n", depth, buf); | ||
233 | } | ||
234 | |||
235 | /* | ||
236 | * At this point, err contains the last verification error. We can use | ||
237 | * it for something special | ||
238 | */ | ||
239 | if (!preverify_ok && (err == X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) | ||
240 | { | ||
241 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), buf, 256); | ||
242 | printf("issuer= %s\n", buf); | ||
243 | } | ||
244 | |||
245 | if (mydata->always_continue) | ||
246 | return 1; | ||
247 | else | ||
248 | return preverify_ok; | ||
249 | } | ||
250 | ... | ||
251 | |||
252 | mydata_t mydata; | ||
253 | |||
254 | ... | ||
255 | mydata_index = SSL_get_ex_new_index(0, "mydata index", NULL, NULL, NULL); | ||
256 | |||
257 | ... | ||
258 | SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, | ||
259 | verify_callback); | ||
260 | |||
261 | /* | ||
262 | * Let the verify_callback catch the verify_depth error so that we get | ||
263 | * an appropriate error in the logfile. | ||
264 | */ | ||
265 | SSL_CTX_set_verify_depth(verify_depth + 1); | ||
266 | |||
267 | /* | ||
268 | * Set up the SSL specific data into "mydata" and store it into th SSL | ||
269 | * structure. | ||
270 | */ | ||
271 | mydata.verify_depth = verify_depth; ... | ||
272 | SSL_set_ex_data(ssl, mydata_index, &mydata); | ||
273 | |||
274 | ... | ||
275 | SSL_accept(ssl); /* check of success left out for clarity */ | ||
276 | if (peer = SSL_get_peer_certificate(ssl)) | ||
277 | { | ||
278 | if (SSL_get_verify_result(ssl) == X509_V_OK) | ||
279 | { | ||
280 | /* The client sent a certificate which verified OK */ | ||
281 | } | ||
282 | } | ||
283 | |||
284 | =head1 SEE ALSO | ||
285 | |||
286 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, | ||
287 | L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, | ||
288 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
289 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | ||
290 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | ||
291 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, | ||
292 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, | ||
293 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)> | ||
294 | |||
295 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.3 new file mode 100644 index 0000000000..eac4d8e42c --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.3 | |||
@@ -0,0 +1,333 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_USE_CERTIFICATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_use_certificate , | ||
6 | .Nm SSL_CTX_use_certificate_ASN1 , | ||
7 | .Nm SSL_CTX_use_certificate_file , | ||
8 | .Nm SSL_use_certificate , | ||
9 | .Nm SSL_use_certificate_ASN1 , | ||
10 | .Nm SSL_use_certificate_file , | ||
11 | .Nm SSL_CTX_use_certificate_chain , | ||
12 | .Nm SSL_CTX_use_certificate_chain_file , | ||
13 | .Nm SSL_CTX_use_PrivateKey , | ||
14 | .Nm SSL_CTX_use_PrivateKey_ASN1 , | ||
15 | .Nm SSL_CTX_use_PrivateKey_file , | ||
16 | .Nm SSL_CTX_use_RSAPrivateKey , | ||
17 | .Nm SSL_CTX_use_RSAPrivateKey_ASN1 , | ||
18 | .Nm SSL_CTX_use_RSAPrivateKey_file , | ||
19 | .Nm SSL_use_PrivateKey_file , | ||
20 | .Nm SSL_use_PrivateKey_ASN1 , | ||
21 | .Nm SSL_use_PrivateKey , | ||
22 | .Nm SSL_use_RSAPrivateKey , | ||
23 | .Nm SSL_use_RSAPrivateKey_ASN1 , | ||
24 | .Nm SSL_use_RSAPrivateKey_file , | ||
25 | .Nm SSL_CTX_check_private_key , | ||
26 | .Nm SSL_check_private_key | ||
27 | .Nd load certificate and key data | ||
28 | .Sh SYNOPSIS | ||
29 | .In openssl/ssl.h | ||
30 | .Ft int | ||
31 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
32 | .Ft int | ||
33 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
34 | .Ft int | ||
35 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "const char *file" "int type" | ||
36 | .Ft int | ||
37 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
38 | .Ft int | ||
39 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "unsigned char *d" "int len" | ||
40 | .Ft int | ||
41 | .Fn SSL_use_certificate_file "SSL *ssl" "const char *file" "int type" | ||
42 | .Ft int | ||
43 | .Fn SSL_CTX_use_certificate_chain "SSL_CTX *ctx" "void *buf" "int len" | ||
44 | .Ft int | ||
45 | .Fn SSL_CTX_use_certificate_chain_file "SSL_CTX *ctx" "const char *file" | ||
46 | .Ft int | ||
47 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
48 | .Ft int | ||
49 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
50 | .Fa "int pk" "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
51 | .Fc | ||
52 | .Ft int | ||
53 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
54 | .Ft int | ||
55 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
56 | .Ft int | ||
57 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
58 | .Ft int | ||
59 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
60 | .Ft int | ||
61 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
62 | .Ft int | ||
63 | .Fn SSL_use_PrivateKey_ASN1 "int pk" "SSL *ssl" "unsigned char *d" "long len" | ||
64 | .Ft int | ||
65 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
66 | .Ft int | ||
67 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
68 | .Ft int | ||
69 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
70 | .Ft int | ||
71 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
72 | .Ft int | ||
73 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
74 | .Ft int | ||
75 | .Fn SSL_check_private_key "const SSL *ssl" | ||
76 | .Sh DESCRIPTION | ||
77 | These functions load the certificates and private keys into the | ||
78 | .Vt SSL_CTX | ||
79 | or | ||
80 | .Vt SSL | ||
81 | object, respectively. | ||
82 | .Pp | ||
83 | The | ||
84 | .Fn SSL_CTX_* | ||
85 | class of functions loads the certificates and keys into the | ||
86 | .Vt SSL_CTX | ||
87 | object | ||
88 | .Fa ctx . | ||
89 | The information is passed to | ||
90 | .Vt SSL | ||
91 | objects | ||
92 | .Fa ssl | ||
93 | created from | ||
94 | .Fa ctx | ||
95 | with | ||
96 | .Xr SSL_new 3 | ||
97 | by copying, so that changes applied to | ||
98 | .Fa ctx | ||
99 | do not propagate to already existing | ||
100 | .Vt SSL | ||
101 | objects. | ||
102 | .Pp | ||
103 | The | ||
104 | .Fn SSL_* | ||
105 | class of functions only loads certificates and keys into a specific | ||
106 | .Vt SSL | ||
107 | object. | ||
108 | The specific information is kept when | ||
109 | .Xr SSL_clear 3 | ||
110 | is called for this | ||
111 | .Vt SSL | ||
112 | object. | ||
113 | .Pp | ||
114 | .Fn SSL_CTX_use_certificate | ||
115 | loads the certificate | ||
116 | .Fa x | ||
117 | into | ||
118 | .Fa ctx ; | ||
119 | .Fn SSL_use_certificate | ||
120 | loads | ||
121 | .Fa x | ||
122 | into | ||
123 | .Fa ssl . | ||
124 | The rest of the certificates needed to form the complete certificate chain can | ||
125 | be specified using the | ||
126 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
127 | function. | ||
128 | .Pp | ||
129 | .Fn SSL_CTX_use_certificate_ASN1 | ||
130 | loads the ASN1 encoded certificate from the memory location | ||
131 | .Fa d | ||
132 | (with length | ||
133 | .Fa len ) | ||
134 | into | ||
135 | .Fa ctx ; | ||
136 | .Fn SSL_use_certificate_ASN1 | ||
137 | loads the ASN1 encoded certificate into | ||
138 | .Fa ssl . | ||
139 | .Pp | ||
140 | .Fn SSL_CTX_use_certificate_file | ||
141 | loads the first certificate stored in | ||
142 | .Fa file | ||
143 | into | ||
144 | .Fa ctx . | ||
145 | The formatting | ||
146 | .Fa type | ||
147 | of the certificate must be specified from the known types | ||
148 | .Dv SSL_FILETYPE_PEM | ||
149 | and | ||
150 | .Dv SSL_FILETYPE_ASN1 . | ||
151 | .Fn SSL_use_certificate_file | ||
152 | loads the certificate from | ||
153 | .Fa file | ||
154 | into | ||
155 | .Fa ssl . | ||
156 | See the | ||
157 | .Sx NOTES | ||
158 | section on why | ||
159 | .Fn SSL_CTX_use_certificate_chain_file | ||
160 | should be preferred. | ||
161 | .Pp | ||
162 | The | ||
163 | .Fn SSL_CTX_use_certificate_chain* | ||
164 | functions load a certificate chain into | ||
165 | .Fa ctx . | ||
166 | The certificates must be in PEM format and must be sorted starting with the | ||
167 | subject's certificate (actual client or server certificate), | ||
168 | followed by intermediate CA certificates if applicable, | ||
169 | and ending at the highest level (root) CA. | ||
170 | There is no corresponding function working on a single | ||
171 | .Vt SSL | ||
172 | object. | ||
173 | .Pp | ||
174 | .Fn SSL_CTX_use_PrivateKey | ||
175 | adds | ||
176 | .Fa pkey | ||
177 | as private key to | ||
178 | .Fa ctx . | ||
179 | .Fn SSL_CTX_use_RSAPrivateKey | ||
180 | adds the private key | ||
181 | .Fa rsa | ||
182 | of type RSA to | ||
183 | .Fa ctx . | ||
184 | .Fn SSL_use_PrivateKey | ||
185 | adds | ||
186 | .Fa pkey | ||
187 | as private key to | ||
188 | .Fa ssl ; | ||
189 | .Fn SSL_use_RSAPrivateKey | ||
190 | adds | ||
191 | .Fa rsa | ||
192 | as private key of type RSA to | ||
193 | .Fa ssl . | ||
194 | If a certificate has already been set and the private does not belong to the | ||
195 | certificate, an error is returned. | ||
196 | To change a certificate private key pair, | ||
197 | the new certificate needs to be set with | ||
198 | .Fn SSL_use_certificate | ||
199 | or | ||
200 | .Fn SSL_CTX_use_certificate | ||
201 | before setting the private key with | ||
202 | .Fn SSL_CTX_use_PrivateKey | ||
203 | or | ||
204 | .Fn SSL_use_PrivateKey . | ||
205 | .Pp | ||
206 | .Fn SSL_CTX_use_PrivateKey_ASN1 | ||
207 | adds the private key of type | ||
208 | .Fa pk | ||
209 | stored at memory location | ||
210 | .Fa d | ||
211 | (length | ||
212 | .Fa len ) | ||
213 | to | ||
214 | .Fa ctx . | ||
215 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 | ||
216 | adds the private key of type RSA stored at memory location | ||
217 | .Fa d | ||
218 | (length | ||
219 | .Fa len ) | ||
220 | to | ||
221 | .Fa ctx . | ||
222 | .Fn SSL_use_PrivateKey_ASN1 | ||
223 | and | ||
224 | .Fn SSL_use_RSAPrivateKey_ASN1 | ||
225 | add the private key to | ||
226 | .Fa ssl . | ||
227 | .Pp | ||
228 | .Fn SSL_CTX_use_PrivateKey_file | ||
229 | adds the first private key found in | ||
230 | .Fa file | ||
231 | to | ||
232 | .Fa ctx . | ||
233 | The formatting | ||
234 | .Fa type | ||
235 | of the certificate must be specified from the known types | ||
236 | .Dv SSL_FILETYPE_PEM | ||
237 | and | ||
238 | .Dv SSL_FILETYPE_ASN1 . | ||
239 | .Fn SSL_CTX_use_RSAPrivateKey_file | ||
240 | adds the first private RSA key found in | ||
241 | .Fa file | ||
242 | to | ||
243 | .Fa ctx . | ||
244 | .Fn SSL_use_PrivateKey_file | ||
245 | adds the first private key found in | ||
246 | .Fa file | ||
247 | to | ||
248 | .Fa ssl ; | ||
249 | .Fn SSL_use_RSAPrivateKey_file | ||
250 | adds the first private RSA key found to | ||
251 | .Fa ssl . | ||
252 | .Pp | ||
253 | .Fn SSL_CTX_check_private_key | ||
254 | checks the consistency of a private key with the corresponding certificate | ||
255 | loaded into | ||
256 | .Fa ctx . | ||
257 | If more than one key/certificate pair (RSA/DSA) is installed, | ||
258 | the last item installed will be checked. | ||
259 | If, e.g., the last item was a RSA certificate or key, | ||
260 | the RSA key/certificate pair will be checked. | ||
261 | .Fn SSL_check_private_key | ||
262 | performs the same check for | ||
263 | .Fa ssl . | ||
264 | If no key/certificate was explicitly added for this | ||
265 | .Fa ssl , | ||
266 | the last item added into | ||
267 | .Fa ctx | ||
268 | will be checked. | ||
269 | .Sh NOTES | ||
270 | The internal certificate store of OpenSSL can hold two private key/certificate | ||
271 | pairs at a time: | ||
272 | one key/certificate of type RSA and one key/certificate of type DSA. | ||
273 | The certificate used depends on the cipher select, see also | ||
274 | .Xr SSL_CTX_set_cipher_list 3 . | ||
275 | .Pp | ||
276 | When reading certificates and private keys from file, files of type | ||
277 | .Dv SSL_FILETYPE_ASN1 | ||
278 | (also known as | ||
279 | .Em DER , | ||
280 | binary encoding) can only contain one certificate or private key; consequently, | ||
281 | .Fn SSL_CTX_use_certificate_chain_file | ||
282 | is only applicable to PEM formatting. | ||
283 | Files of type | ||
284 | .Dv SSL_FILETYPE_PEM | ||
285 | can contain more than one item. | ||
286 | .Pp | ||
287 | .Fn SSL_CTX_use_certificate_chain_file | ||
288 | adds the first certificate found in the file to the certificate store. | ||
289 | The other certificates are added to the store of chain certificates using | ||
290 | .Xr SSL_CTX_add_extra_chain_cert 3 . | ||
291 | There exists only one extra chain store, so that the same chain is appended | ||
292 | to both types of certificates, RSA and DSA! | ||
293 | If it is not intended to use both type of certificate at the same time, | ||
294 | it is recommended to use the | ||
295 | .Fn SSL_CTX_use_certificate_chain_file | ||
296 | instead of the | ||
297 | .Fn SSL_CTX_use_certificate_file | ||
298 | function in order to allow the use of complete certificate chains even when no | ||
299 | trusted CA storage is used or when the CA issuing the certificate shall not be | ||
300 | added to the trusted CA storage. | ||
301 | .Pp | ||
302 | If additional certificates are needed to complete the chain during the TLS | ||
303 | negotiation, CA certificates are additionally looked up in the locations of | ||
304 | trusted CA certificates (see | ||
305 | .Xr SSL_CTX_load_verify_locations 3 ) . | ||
306 | .Pp | ||
307 | The private keys loaded from file can be encrypted. | ||
308 | In order to successfully load encrypted keys, | ||
309 | a function returning the passphrase must have been supplied (see | ||
310 | .Xr SSL_CTX_set_default_passwd_cb 3 ) . | ||
311 | (Certificate files might be encrypted as well from the technical point of view, | ||
312 | it however does not make sense as the data in the certificate is considered | ||
313 | public anyway.) | ||
314 | .Sh RETURN VALUES | ||
315 | On success, the functions return 1. | ||
316 | Otherwise check out the error stack to find out the reason. | ||
317 | .Sh SEE ALSO | ||
318 | .Xr ssl 3 , | ||
319 | .Xr SSL_clear 3 , | ||
320 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
321 | .Xr SSL_CTX_load_verify_locations 3 , | ||
322 | .Xr SSL_CTX_set_cipher_list 3 , | ||
323 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
324 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
325 | .Xr SSL_new 3 | ||
326 | .Sh HISTORY | ||
327 | Support for DER encoded private keys | ||
328 | .Pq Dv SSL_FILETYPE_ASN1 | ||
329 | in | ||
330 | .Fn SSL_CTX_use_PrivateKey_file | ||
331 | and | ||
332 | .Fn SSL_use_PrivateKey_file | ||
333 | was added in 0.9.8. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod deleted file mode 100644 index 560e00937f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_certificate.pod +++ /dev/null | |||
@@ -1,180 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_CTX_use_certificate, SSL_CTX_use_certificate_ASN1, | ||
6 | SSL_CTX_use_certificate_file, SSL_use_certificate, | ||
7 | SSL_use_certificate_ASN1, SSL_use_certificate_file, | ||
8 | SSL_CTX_use_certificate_chain, SSL_CTX_use_certificate_chain_file, | ||
9 | SSL_CTX_use_PrivateKey, SSL_CTX_use_PrivateKey_ASN1, | ||
10 | SSL_CTX_use_PrivateKey_file, SSL_CTX_use_RSAPrivateKey, | ||
11 | SSL_CTX_use_RSAPrivateKey_ASN1, SSL_CTX_use_RSAPrivateKey_file, | ||
12 | SSL_use_PrivateKey_file, SSL_use_PrivateKey_ASN1, SSL_use_PrivateKey, | ||
13 | SSL_use_RSAPrivateKey, SSL_use_RSAPrivateKey_ASN1, SSL_use_RSAPrivateKey_file, | ||
14 | SSL_CTX_check_private_key, SSL_check_private_key - load certificate and key | ||
15 | data | ||
16 | |||
17 | =head1 SYNOPSIS | ||
18 | |||
19 | #include <openssl/ssl.h> | ||
20 | |||
21 | int SSL_CTX_use_certificate(SSL_CTX *ctx, X509 *x); | ||
22 | int SSL_CTX_use_certificate_ASN1(SSL_CTX *ctx, int len, unsigned char *d); | ||
23 | int SSL_CTX_use_certificate_file(SSL_CTX *ctx, const char *file, int type); | ||
24 | int SSL_use_certificate(SSL *ssl, X509 *x); | ||
25 | int SSL_use_certificate_ASN1(SSL *ssl, unsigned char *d, int len); | ||
26 | int SSL_use_certificate_file(SSL *ssl, const char *file, int type); | ||
27 | |||
28 | int SSL_CTX_use_certificate_chain(SSL_CTX *ctx, void *buf, int len); | ||
29 | int SSL_CTX_use_certificate_chain_file(SSL_CTX *ctx, const char *file); | ||
30 | |||
31 | int SSL_CTX_use_PrivateKey(SSL_CTX *ctx, EVP_PKEY *pkey); | ||
32 | int SSL_CTX_use_PrivateKey_ASN1(int pk, SSL_CTX *ctx, unsigned char *d, | ||
33 | long len); | ||
34 | int SSL_CTX_use_PrivateKey_file(SSL_CTX *ctx, const char *file, int type); | ||
35 | int SSL_CTX_use_RSAPrivateKey(SSL_CTX *ctx, RSA *rsa); | ||
36 | int SSL_CTX_use_RSAPrivateKey_ASN1(SSL_CTX *ctx, unsigned char *d, long len); | ||
37 | int SSL_CTX_use_RSAPrivateKey_file(SSL_CTX *ctx, const char *file, int type); | ||
38 | int SSL_use_PrivateKey(SSL *ssl, EVP_PKEY *pkey); | ||
39 | int SSL_use_PrivateKey_ASN1(int pk,SSL *ssl, unsigned char *d, long len); | ||
40 | int SSL_use_PrivateKey_file(SSL *ssl, const char *file, int type); | ||
41 | int SSL_use_RSAPrivateKey(SSL *ssl, RSA *rsa); | ||
42 | int SSL_use_RSAPrivateKey_ASN1(SSL *ssl, unsigned char *d, long len); | ||
43 | int SSL_use_RSAPrivateKey_file(SSL *ssl, const char *file, int type); | ||
44 | |||
45 | int SSL_CTX_check_private_key(const SSL_CTX *ctx); | ||
46 | int SSL_check_private_key(const SSL *ssl); | ||
47 | |||
48 | =head1 DESCRIPTION | ||
49 | |||
50 | These functions load the certificates and private keys into the SSL_CTX | ||
51 | or SSL object, respectively. | ||
52 | |||
53 | The SSL_CTX_* class of functions loads the certificates and keys into the | ||
54 | SSL_CTX object B<ctx>. The information is passed to SSL objects B<ssl> | ||
55 | created from B<ctx> with L<SSL_new(3)|SSL_new(3)> by copying, so that | ||
56 | changes applied to B<ctx> do not propagate to already existing SSL objects. | ||
57 | |||
58 | The SSL_* class of functions only loads certificates and keys into a | ||
59 | specific SSL object. The specific information is kept, when | ||
60 | L<SSL_clear(3)|SSL_clear(3)> is called for this SSL object. | ||
61 | |||
62 | SSL_CTX_use_certificate() loads the certificate B<x> into B<ctx>, | ||
63 | SSL_use_certificate() loads B<x> into B<ssl>. The rest of the | ||
64 | certificates needed to form the complete certificate chain can be | ||
65 | specified using the | ||
66 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | ||
67 | function. | ||
68 | |||
69 | SSL_CTX_use_certificate_ASN1() loads the ASN1 encoded certificate from | ||
70 | the memory location B<d> (with length B<len>) into B<ctx>, | ||
71 | SSL_use_certificate_ASN1() loads the ASN1 encoded certificate into B<ssl>. | ||
72 | |||
73 | SSL_CTX_use_certificate_file() loads the first certificate stored in B<file> | ||
74 | into B<ctx>. The formatting B<type> of the certificate must be specified | ||
75 | from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. | ||
76 | SSL_use_certificate_file() loads the certificate from B<file> into B<ssl>. | ||
77 | See the NOTES section on why SSL_CTX_use_certificate_chain_file() | ||
78 | should be preferred. | ||
79 | |||
80 | The SSL_CTX_use_certificate_chain*() functions load a certificate chain | ||
81 | into B<ctx>. The certificates must be in PEM format and must | ||
82 | be sorted starting with the subject's certificate (actual client or server | ||
83 | certificate), followed by intermediate CA certificates if applicable, and | ||
84 | ending at the highest level (root) CA. | ||
85 | There is no corresponding function working on a single SSL object. | ||
86 | |||
87 | SSL_CTX_use_PrivateKey() adds B<pkey> as private key to B<ctx>. | ||
88 | SSL_CTX_use_RSAPrivateKey() adds the private key B<rsa> of type RSA | ||
89 | to B<ctx>. SSL_use_PrivateKey() adds B<pkey> as private key to B<ssl>; | ||
90 | SSL_use_RSAPrivateKey() adds B<rsa> as private key of type RSA to B<ssl>. | ||
91 | If a certificate has already been set and the private does not belong | ||
92 | to the certificate an error is returned. To change a certificate, private | ||
93 | key pair the new certificate needs to be set with SSL_use_certificate() | ||
94 | or SSL_CTX_use_certificate() before setting the private key with | ||
95 | SSL_CTX_use_PrivateKey() or SSL_use_PrivateKey(). | ||
96 | |||
97 | |||
98 | SSL_CTX_use_PrivateKey_ASN1() adds the private key of type B<pk> | ||
99 | stored at memory location B<d> (length B<len>) to B<ctx>. | ||
100 | SSL_CTX_use_RSAPrivateKey_ASN1() adds the private key of type RSA | ||
101 | stored at memory location B<d> (length B<len>) to B<ctx>. | ||
102 | SSL_use_PrivateKey_ASN1() and SSL_use_RSAPrivateKey_ASN1() add the private | ||
103 | key to B<ssl>. | ||
104 | |||
105 | SSL_CTX_use_PrivateKey_file() adds the first private key found in | ||
106 | B<file> to B<ctx>. The formatting B<type> of the certificate must be specified | ||
107 | from the known types SSL_FILETYPE_PEM, SSL_FILETYPE_ASN1. | ||
108 | SSL_CTX_use_RSAPrivateKey_file() adds the first private RSA key found in | ||
109 | B<file> to B<ctx>. SSL_use_PrivateKey_file() adds the first private key found | ||
110 | in B<file> to B<ssl>; SSL_use_RSAPrivateKey_file() adds the first private | ||
111 | RSA key found to B<ssl>. | ||
112 | |||
113 | SSL_CTX_check_private_key() checks the consistency of a private key with | ||
114 | the corresponding certificate loaded into B<ctx>. If more than one | ||
115 | key/certificate pair (RSA/DSA) is installed, the last item installed will | ||
116 | be checked. If e.g. the last item was a RSA certificate or key, the RSA | ||
117 | key/certificate pair will be checked. SSL_check_private_key() performs | ||
118 | the same check for B<ssl>. If no key/certificate was explicitly added for | ||
119 | this B<ssl>, the last item added into B<ctx> will be checked. | ||
120 | |||
121 | =head1 NOTES | ||
122 | |||
123 | The internal certificate store of OpenSSL can hold two private key/certificate | ||
124 | pairs at a time: one key/certificate of type RSA and one key/certificate | ||
125 | of type DSA. The certificate used depends on the cipher select, see | ||
126 | also L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>. | ||
127 | |||
128 | When reading certificates and private keys from file, files of type | ||
129 | SSL_FILETYPE_ASN1 (also known as B<DER>, binary encoding) can only contain | ||
130 | one certificate or private key, consequently | ||
131 | SSL_CTX_use_certificate_chain_file() is only applicable to PEM formatting. | ||
132 | Files of type SSL_FILETYPE_PEM can contain more than one item. | ||
133 | |||
134 | SSL_CTX_use_certificate_chain_file() adds the first certificate found | ||
135 | in the file to the certificate store. The other certificates are added | ||
136 | to the store of chain certificates using | ||
137 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>. | ||
138 | There exists only one extra chain store, so that the same chain is appended | ||
139 | to both types of certificates, RSA and DSA! If it is not intended to use | ||
140 | both type of certificate at the same time, it is recommended to use the | ||
141 | SSL_CTX_use_certificate_chain_file() instead of the | ||
142 | SSL_CTX_use_certificate_file() function in order to allow the use of | ||
143 | complete certificate chains even when no trusted CA storage is used or | ||
144 | when the CA issuing the certificate shall not be added to the trusted | ||
145 | CA storage. | ||
146 | |||
147 | If additional certificates are needed to complete the chain during the | ||
148 | TLS negotiation, CA certificates are additionally looked up in the | ||
149 | locations of trusted CA certificates, see | ||
150 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>. | ||
151 | |||
152 | The private keys loaded from file can be encrypted. In order to successfully | ||
153 | load encrypted keys, a function returning the passphrase must have been | ||
154 | supplied, see | ||
155 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>. | ||
156 | (Certificate files might be encrypted as well from the technical point | ||
157 | of view, it however does not make sense as the data in the certificate | ||
158 | is considered public anyway.) | ||
159 | |||
160 | =head1 RETURN VALUES | ||
161 | |||
162 | On success, the functions return 1. | ||
163 | Otherwise check out the error stack to find out the reason. | ||
164 | |||
165 | =head1 SEE ALSO | ||
166 | |||
167 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
168 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)>, | ||
169 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, | ||
170 | L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
171 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
172 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)> | ||
173 | |||
174 | =head1 HISTORY | ||
175 | |||
176 | Support for DER encoded private keys (SSL_FILETYPE_ASN1) in | ||
177 | SSL_CTX_use_PrivateKey_file() and SSL_use_PrivateKey_file() was added | ||
178 | in 0.9.8 . | ||
179 | |||
180 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.3 b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.3 new file mode 100644 index 0000000000..4d4e8a6173 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.3 | |||
@@ -0,0 +1,107 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CTX_USE_PSK_IDENTITY_HINT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_CTX_use_psk_identity_hint , | ||
6 | .Nm SSL_use_psk_identity_hint , | ||
7 | .Nm SSL_CTX_set_psk_server_callback , | ||
8 | .Nm SSL_set_psk_server_callback | ||
9 | .Nd set PSK identity hint to use | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft int | ||
13 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
14 | .Ft int | ||
15 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
16 | .Ft void | ||
17 | .Fo SSL_CTX_set_psk_server_callback | ||
18 | .Fa "SSL_CTX *ctx" | ||
19 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
20 | .Fc | ||
21 | .Ft void | ||
22 | .Fo SSL_set_psk_server_callback | ||
23 | .Fa "SSL *ssl" | ||
24 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
25 | .Fc | ||
26 | .Sh DESCRIPTION | ||
27 | .Fn SSL_CTX_use_psk_identity_hint | ||
28 | sets the given | ||
29 | .Dv NULL Ns | ||
30 | -terminated PSK identity hint | ||
31 | .Fa hint | ||
32 | to SSL context object | ||
33 | .Fa ctx . | ||
34 | .Fn SSL_use_psk_identity_hint | ||
35 | sets the given | ||
36 | .Dv NULL Ns | ||
37 | -terminated | ||
38 | PSK identity hint | ||
39 | .Fa hint | ||
40 | to SSL connection object | ||
41 | .Fa ssl . | ||
42 | If | ||
43 | .Fa hint | ||
44 | is | ||
45 | .Dv NULL | ||
46 | the current hint from | ||
47 | .Fa ctx | ||
48 | or | ||
49 | .Fa ssl | ||
50 | is deleted. | ||
51 | .Pp | ||
52 | In the case where PSK identity hint is | ||
53 | .Dv NULL , | ||
54 | the server does not send the | ||
55 | .Em ServerKeyExchange | ||
56 | message to the client. | ||
57 | .Pp | ||
58 | A server application must provide a callback function which is called when the | ||
59 | server receives the | ||
60 | .Em ClientKeyExchange | ||
61 | message from the client. | ||
62 | The purpose of the callback function is to validate the received PSK identity | ||
63 | and to fetch the pre-shared key used during the connection setup phase. | ||
64 | The callback is set using functions | ||
65 | .Fn SSL_CTX_set_psk_server_callback | ||
66 | or | ||
67 | .Fn SSL_set_psk_server_callback . | ||
68 | The callback function is given the connection in parameter | ||
69 | .Fa ssl , | ||
70 | .Dv NULL Ns | ||
71 | -terminated PSK identity sent by the client in parameter | ||
72 | .Fa identity , | ||
73 | and a buffer | ||
74 | .Fa psk | ||
75 | of length | ||
76 | .Fa max_psk_len | ||
77 | bytes where the pre-shared key is to be stored. | ||
78 | .Sh RETURN VALUES | ||
79 | .Fn SSL_CTX_use_psk_identity_hint | ||
80 | and | ||
81 | .Fn SSL_use_psk_identity_hint | ||
82 | return 1 on success, 0 otherwise. | ||
83 | .Pp | ||
84 | Return values from the server callback are interpreted as follows: | ||
85 | .Bl -tag -width Ds | ||
86 | .It >0 | ||
87 | PSK identity was found and the server callback has provided the PSK | ||
88 | successfully in parameter | ||
89 | .Fa psk . | ||
90 | Return value is the length of | ||
91 | .Fa psk | ||
92 | in bytes. | ||
93 | It is an error to return a value greater than | ||
94 | .Fa max_psk_len . | ||
95 | .Pp | ||
96 | If the PSK identity was not found but the callback instructs the protocol to | ||
97 | continue anyway, the callback must provide some random data to | ||
98 | .Fa psk | ||
99 | and return the length of the random data, so the connection will fail with | ||
100 | .Dq decryption_error | ||
101 | before it will be finished completely. | ||
102 | .It 0 | ||
103 | PSK identity was not found. | ||
104 | An | ||
105 | .Dq unknown_psk_identity | ||
106 | alert message will be sent and the connection setup fails. | ||
107 | .El | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod b/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod deleted file mode 100644 index 9f88d284d2..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_CTX_use_psk_identity_hint.pod +++ /dev/null | |||
@@ -1,106 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =begin comment | ||
4 | |||
5 | Copyright 2005 Nokia. All rights reserved. | ||
6 | |||
7 | The portions of the attached software ("Contribution") is developed by | ||
8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
9 | license. | ||
10 | |||
11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
13 | support (see RFC 4279) to OpenSSL. | ||
14 | |||
15 | No patent licenses or other rights except those expressly stated in | ||
16 | the OpenSSL open source license shall be deemed granted or received | ||
17 | expressly, by implication, estoppel, or otherwise. | ||
18 | |||
19 | No assurances are provided by Nokia that the Contribution does not | ||
20 | infringe the patent or other intellectual property rights of any third | ||
21 | party or that the license provides you with all the necessary rights | ||
22 | to make use of the Contribution. | ||
23 | |||
24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
28 | OTHERWISE. | ||
29 | |||
30 | =end comment | ||
31 | |||
32 | =head1 NAME | ||
33 | |||
34 | SSL_CTX_use_psk_identity_hint, SSL_use_psk_identity_hint, | ||
35 | SSL_CTX_set_psk_server_callback, SSL_set_psk_server_callback - set PSK | ||
36 | identity hint to use | ||
37 | |||
38 | |||
39 | =head1 SYNOPSIS | ||
40 | |||
41 | #include <openssl/ssl.h> | ||
42 | |||
43 | int SSL_CTX_use_psk_identity_hint(SSL_CTX *ctx, const char *hint); | ||
44 | int SSL_use_psk_identity_hint(SSL *ssl, const char *hint); | ||
45 | |||
46 | void SSL_CTX_set_psk_server_callback(SSL_CTX *ctx, | ||
47 | unsigned int (*callback)(SSL *ssl, const char *identity, | ||
48 | unsigned char *psk, int max_psk_len)); | ||
49 | void SSL_set_psk_server_callback(SSL *ssl, | ||
50 | unsigned int (*callback)(SSL *ssl, const char *identity, | ||
51 | unsigned char *psk, int max_psk_len)); | ||
52 | |||
53 | |||
54 | =head1 DESCRIPTION | ||
55 | |||
56 | SSL_CTX_use_psk_identity_hint() sets the given B<NULL>-terminated PSK | ||
57 | identity hint B<hint> to SSL context object | ||
58 | B<ctx>. SSL_use_psk_identity_hint() sets the given B<NULL>-terminated | ||
59 | PSK identity hint B<hint> to SSL connection object B<ssl>. If B<hint> | ||
60 | is B<NULL> the current hint from B<ctx> or B<ssl> is deleted. | ||
61 | |||
62 | In the case where PSK identity hint is B<NULL>, the server | ||
63 | does not send the ServerKeyExchange message to the client. | ||
64 | |||
65 | A server application must provide a callback function which is called | ||
66 | when the server receives the ClientKeyExchange message from the | ||
67 | client. The purpose of the callback function is to validate the | ||
68 | received PSK identity and to fetch the pre-shared key used during the | ||
69 | connection setup phase. The callback is set using functions | ||
70 | SSL_CTX_set_psk_server_callback() or | ||
71 | SSL_set_psk_server_callback(). The callback function is given the | ||
72 | connection in parameter B<ssl>, B<NULL>-terminated PSK identity sent | ||
73 | by the client in parameter B<identity>, and a buffer B<psk> of length | ||
74 | B<max_psk_len> bytes where the pre-shared key is to be stored. | ||
75 | |||
76 | |||
77 | =head1 RETURN VALUES | ||
78 | |||
79 | SSL_CTX_use_psk_identity_hint() and SSL_use_psk_identity_hint() return | ||
80 | 1 on success, 0 otherwise. | ||
81 | |||
82 | Return values from the server callback are interpreted as follows: | ||
83 | |||
84 | =over 4 | ||
85 | |||
86 | =item C<E<gt> 0> | ||
87 | |||
88 | PSK identity was found and the server callback has provided the PSK | ||
89 | successfully in parameter B<psk>. Return value is the length of | ||
90 | B<psk> in bytes. It is an error to return a value greater than | ||
91 | B<max_psk_len>. | ||
92 | |||
93 | If the PSK identity was not found but the callback instructs the | ||
94 | protocol to continue anyway, the callback must provide some random | ||
95 | data to B<psk> and return the length of the random data, so the | ||
96 | connection will fail with decryption_error before it will be finished | ||
97 | completely. | ||
98 | |||
99 | =item C<0> | ||
100 | |||
101 | PSK identity was not found. An "unknown_psk_identity" alert message | ||
102 | will be sent and the connection setup fails. | ||
103 | |||
104 | =back | ||
105 | |||
106 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.3 b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.3 new file mode 100644 index 0000000000..f7d2350b55 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.3 | |||
@@ -0,0 +1,76 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_free | ||
6 | .Nd free an allocated SSL_SESSION structure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_SESSION_free "SSL_SESSION *session" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_SESSION_free | ||
13 | decrements the reference count of | ||
14 | .Fa session | ||
15 | and removes the | ||
16 | .Vt SSL_SESSION | ||
17 | structure pointed to by | ||
18 | .Fa session | ||
19 | and frees up the allocated memory, if the reference count has reached 0. | ||
20 | .Sh NOTES | ||
21 | .Vt SSL_SESSION | ||
22 | objects are allocated when a TLS/SSL handshake operation is successfully | ||
23 | completed. | ||
24 | Depending on the settings, see | ||
25 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
26 | the | ||
27 | .Vt SSL_SESSION | ||
28 | objects are internally referenced by the | ||
29 | .Vt SSL_CTX | ||
30 | and linked into its session cache. | ||
31 | .Vt SSL | ||
32 | objects may be using the | ||
33 | .Vt SSL_SESSION | ||
34 | object; as a session may be reused, several | ||
35 | .Vt SSL | ||
36 | objects may be using one | ||
37 | .Vt SSL_SESSION | ||
38 | object at the same time. | ||
39 | It is therefore crucial to keep the reference count (usage information) correct | ||
40 | and not delete a | ||
41 | .Vt SSL_SESSION | ||
42 | object that is still used, as this may lead to program failures due to dangling | ||
43 | pointers. | ||
44 | These failures may also appear delayed, e.g., when an | ||
45 | .Vt SSL_SESSION | ||
46 | object is completely freed as the reference count incorrectly becomes 0, but it | ||
47 | is still referenced in the internal session cache and the cache list is | ||
48 | processed during a | ||
49 | .Xr SSL_CTX_flush_sessions 3 | ||
50 | operation. | ||
51 | .Pp | ||
52 | .Fn SSL_SESSION_free | ||
53 | must only be called for | ||
54 | .Vt SSL_SESSION | ||
55 | objects, for which the reference count was explicitly incremented (e.g., by | ||
56 | calling | ||
57 | .Xr SSL_get1_session 3 ; | ||
58 | see | ||
59 | .Xr SSL_get_session 3 ) | ||
60 | or when the | ||
61 | .Vt SSL_SESSION | ||
62 | object was generated outside a TLS handshake operation, e.g., by using | ||
63 | .Xr d2i_SSL_SESSION 3 . | ||
64 | It must not be called on other | ||
65 | .Vt SSL_SESSION | ||
66 | objects, as this would cause incorrect reference counts and therefore program | ||
67 | failures. | ||
68 | .Sh RETURN VALUES | ||
69 | .Fn SSL_SESSION_free | ||
70 | does not provide diagnostic information. | ||
71 | .Sh SEE ALSO | ||
72 | .Xr d2i_SSL_SESSION 3 , | ||
73 | .Xr ssl 3 , | ||
74 | .Xr SSL_CTX_flush_sessions 3 , | ||
75 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
76 | .Xr SSL_get_session 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod deleted file mode 100644 index 110ec73ab6..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_free.pod +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_SESSION_free - free an allocated SSL_SESSION structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_SESSION_free(SSL_SESSION *session); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_SESSION_free() decrements the reference count of B<session> and removes | ||
16 | the B<SSL_SESSION> structure pointed to by B<session> and frees up the allocated | ||
17 | memory, if the reference count has reached 0. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | SSL_SESSION objects are allocated, when a TLS/SSL handshake operation | ||
22 | is successfully completed. Depending on the settings, see | ||
23 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
24 | the SSL_SESSION objects are internally referenced by the SSL_CTX and | ||
25 | linked into its session cache. SSL objects may be using the SSL_SESSION object; | ||
26 | as a session may be reused, several SSL objects may be using one SSL_SESSION | ||
27 | object at the same time. It is therefore crucial to keep the reference | ||
28 | count (usage information) correct and not delete a SSL_SESSION object | ||
29 | that is still used, as this may lead to program failures due to | ||
30 | dangling pointers. These failures may also appear delayed, e.g. | ||
31 | when an SSL_SESSION object was completely freed as the reference count | ||
32 | incorrectly became 0, but it is still referenced in the internal | ||
33 | session cache and the cache list is processed during a | ||
34 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)> operation. | ||
35 | |||
36 | SSL_SESSION_free() must only be called for SSL_SESSION objects, for | ||
37 | which the reference count was explicitly incremented (e.g. | ||
38 | by calling SSL_get1_session(), see L<SSL_get_session(3)|SSL_get_session(3)>) | ||
39 | or when the SSL_SESSION object was generated outside a TLS handshake | ||
40 | operation, e.g. by using L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>. | ||
41 | It must not be called on other SSL_SESSION objects, as this would cause | ||
42 | incorrect reference counts and therefore program failures. | ||
43 | |||
44 | =head1 RETURN VALUES | ||
45 | |||
46 | SSL_SESSION_free() does not provide diagnostic information. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_get_session(3)|SSL_get_session(3)>, | ||
51 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
52 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
53 | L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)> | ||
54 | |||
55 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.3 b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.3 new file mode 100644 index 0000000000..d6a94cb0b7 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.3 | |||
@@ -0,0 +1,77 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_get_ex_new_index , | ||
6 | .Nm SSL_SESSION_set_ex_data , | ||
7 | .Nm SSL_SESSION_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_SESSION_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *session" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *session" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate | ||
34 | application-specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_SESSION_get_ex_new_index | ||
37 | is used to register a new index for application-specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_SESSION_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa session | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_SESSION_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa session . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality | ||
57 | can be found in | ||
58 | .Xr RSA_get_ex_new_index 3 . | ||
59 | The | ||
60 | .Fn *_get_ex_data | ||
61 | and | ||
62 | .Fn *_set_ex_data | ||
63 | functionality is described in | ||
64 | .Xr CRYPTO_set_ex_data 3 . | ||
65 | .Sh WARNINGS | ||
66 | The application data is only maintained for sessions held in memory. | ||
67 | The application data is not included when dumping the session with | ||
68 | .Xr i2d_SSL_SESSION 3 | ||
69 | (and all functions indirectly calling the dump functions like | ||
70 | .Xr PEM_write_SSL_SESSION 3 | ||
71 | and | ||
72 | .Xr PEM_write_bio_SSL_SESSION 3 ) | ||
73 | and can therefore not be restored. | ||
74 | .Sh SEE ALSO | ||
75 | .Xr CRYPTO_set_ex_data 3 , | ||
76 | .Xr RSA_get_ex_new_index 3 , | ||
77 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod deleted file mode 100644 index 1e6bec2314..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_ex_new_index.pod +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_SESSION_get_ex_new_index, SSL_SESSION_set_ex_data, SSL_SESSION_get_ex_data | ||
6 | - internal application specific data functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_SESSION_get_ex_new_index(long argl, void *argp, | ||
13 | CRYPTO_EX_new *new_func, | ||
14 | CRYPTO_EX_dup *dup_func, | ||
15 | CRYPTO_EX_free *free_func); | ||
16 | |||
17 | int SSL_SESSION_set_ex_data(SSL_SESSION *session, int idx, void *arg); | ||
18 | |||
19 | void *SSL_SESSION_get_ex_data(const SSL_SESSION *session, int idx); | ||
20 | |||
21 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
22 | int idx, long argl, void *argp); | ||
23 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
24 | int idx, long argl, void *argp); | ||
25 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
26 | int idx, long argl, void *argp); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | Several OpenSSL structures can have application specific data attached to them. | ||
31 | These functions are used internally by OpenSSL to manipulate application | ||
32 | specific data attached to a specific structure. | ||
33 | |||
34 | SSL_SESSION_get_ex_new_index() is used to register a new index for application | ||
35 | specific data. | ||
36 | |||
37 | SSL_SESSION_set_ex_data() is used to store application data at B<arg> for B<idx> | ||
38 | into the B<session> object. | ||
39 | |||
40 | SSL_SESSION_get_ex_data() is used to retrieve the information for B<idx> from | ||
41 | B<session>. | ||
42 | |||
43 | A detailed description for the B<*_get_ex_new_index()> functionality | ||
44 | can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. | ||
45 | The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in | ||
46 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. | ||
47 | |||
48 | =head1 WARNINGS | ||
49 | |||
50 | The application data is only maintained for sessions held in memory. The | ||
51 | application data is not included when dumping the session with | ||
52 | i2d_SSL_SESSION() (and all functions indirectly calling the dump functions | ||
53 | like PEM_write_SSL_SESSION() and PEM_write_bio_SSL_SESSION()) and can | ||
54 | therefore not be restored. | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<ssl(3)|ssl(3)>, | ||
59 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | ||
60 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.3 b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.3 new file mode 100644 index 0000000000..d094adb50a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.3 | |||
@@ -0,0 +1,91 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_GET_TIME 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_SESSION_get_time , | ||
6 | .Nm SSL_SESSION_set_time , | ||
7 | .Nm SSL_SESSION_get_timeout , | ||
8 | .Nm SSL_SESSION_set_timeout | ||
9 | .Nd retrieve and manipulate session time and timeout settings | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft long | ||
13 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
14 | .Ft long | ||
15 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long tm" | ||
16 | .Ft long | ||
17 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
18 | .Ft long | ||
19 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long tm" | ||
20 | .Ft long | ||
21 | .Fn SSL_get_time "const SSL_SESSION *s" | ||
22 | .Ft long | ||
23 | .Fn SSL_set_time "SSL_SESSION *s" "long tm" | ||
24 | .Ft long | ||
25 | .Fn SSL_get_timeout "const SSL_SESSION *s" | ||
26 | .Ft long | ||
27 | .Fn SSL_set_timeout "SSL_SESSION *s" "long tm" | ||
28 | .Sh DESCRIPTION | ||
29 | .Fn SSL_SESSION_get_time | ||
30 | returns the time at which the session | ||
31 | .Fa s | ||
32 | was established. | ||
33 | The time is given in seconds since the Epoch and therefore compatible to the | ||
34 | time delivered by the | ||
35 | .Xr time 3 | ||
36 | call. | ||
37 | .Pp | ||
38 | .Fn SSL_SESSION_set_time | ||
39 | replaces the creation time of the session | ||
40 | .Fa s | ||
41 | with | ||
42 | the chosen value | ||
43 | .Fa tm . | ||
44 | .Pp | ||
45 | .Fn SSL_SESSION_get_timeout | ||
46 | returns the timeout value set for session | ||
47 | .Fa s | ||
48 | in seconds. | ||
49 | .Pp | ||
50 | .Fn SSL_SESSION_set_timeout | ||
51 | sets the timeout value for session | ||
52 | .Fa s | ||
53 | in seconds to | ||
54 | .Fa tm . | ||
55 | .Pp | ||
56 | The | ||
57 | .Fn SSL_get_time , | ||
58 | .Fn SSL_set_time , | ||
59 | .Fn SSL_get_timeout , | ||
60 | and | ||
61 | .Fn SSL_set_timeout | ||
62 | functions are synonyms for the | ||
63 | .Fn SSL_SESSION_* | ||
64 | counterparts. | ||
65 | .Sh NOTES | ||
66 | Sessions are expired by examining the creation time and the timeout value. | ||
67 | Both are set at creation time of the session to the actual time and the default | ||
68 | timeout value at creation, respectively, as set by | ||
69 | .Xr SSL_CTX_set_timeout 3 . | ||
70 | Using these functions it is possible to extend or shorten the lifetime of the | ||
71 | session. | ||
72 | .Sh RETURN VALUES | ||
73 | .Fn SSL_SESSION_get_time | ||
74 | and | ||
75 | .Fn SSL_SESSION_get_timeout | ||
76 | return the currently valid values. | ||
77 | .Pp | ||
78 | .Fn SSL_SESSION_set_time | ||
79 | and | ||
80 | .Fn SSL_SESSION_set_timeout | ||
81 | return 1 on success. | ||
82 | .Pp | ||
83 | If any of the function is passed the | ||
84 | .Dv NULL | ||
85 | pointer for the session | ||
86 | .Fa s , | ||
87 | 0 is returned. | ||
88 | .Sh SEE ALSO | ||
89 | .Xr ssl 3 , | ||
90 | .Xr SSL_CTX_set_timeout 3 , | ||
91 | .Xr SSL_get_default_timeout 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod b/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod deleted file mode 100644 index a9b44b3a5c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_SESSION_get_time.pod +++ /dev/null | |||
@@ -1,66 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_SESSION_get_time, SSL_SESSION_set_time, SSL_SESSION_get_timeout, | ||
6 | SSL_SESSION_set_timeout - retrieve and manipulate session time and timeout | ||
7 | settings | ||
8 | |||
9 | =head1 SYNOPSIS | ||
10 | |||
11 | #include <openssl/ssl.h> | ||
12 | |||
13 | long SSL_SESSION_get_time(const SSL_SESSION *s); | ||
14 | long SSL_SESSION_set_time(SSL_SESSION *s, long tm); | ||
15 | long SSL_SESSION_get_timeout(const SSL_SESSION *s); | ||
16 | long SSL_SESSION_set_timeout(SSL_SESSION *s, long tm); | ||
17 | |||
18 | long SSL_get_time(const SSL_SESSION *s); | ||
19 | long SSL_set_time(SSL_SESSION *s, long tm); | ||
20 | long SSL_get_timeout(const SSL_SESSION *s); | ||
21 | long SSL_set_timeout(SSL_SESSION *s, long tm); | ||
22 | |||
23 | =head1 DESCRIPTION | ||
24 | |||
25 | SSL_SESSION_get_time() returns the time at which the session B<s> was | ||
26 | established. The time is given in seconds since the Epoch and therefore | ||
27 | compatible to the time delivered by the time() call. | ||
28 | |||
29 | SSL_SESSION_set_time() replaces the creation time of the session B<s> with | ||
30 | the chosen value B<tm>. | ||
31 | |||
32 | SSL_SESSION_get_timeout() returns the timeout value set for session B<s> | ||
33 | in seconds. | ||
34 | |||
35 | SSL_SESSION_set_timeout() sets the timeout value for session B<s> in seconds | ||
36 | to B<tm>. | ||
37 | |||
38 | The SSL_get_time(), SSL_set_time(), SSL_get_timeout(), and SSL_set_timeout() | ||
39 | functions are synonyms for the SSL_SESSION_*() counterparts. | ||
40 | |||
41 | =head1 NOTES | ||
42 | |||
43 | Sessions are expired by examining the creation time and the timeout value. | ||
44 | Both are set at creation time of the session to the actual time and the | ||
45 | default timeout value at creation, respectively, as set by | ||
46 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>. | ||
47 | Using these functions it is possible to extend or shorten the lifetime | ||
48 | of the session. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | SSL_SESSION_get_time() and SSL_SESSION_get_timeout() return the currently | ||
53 | valid values. | ||
54 | |||
55 | SSL_SESSION_set_time() and SSL_SESSION_set_timeout() return 1 on success. | ||
56 | |||
57 | If any of the function is passed the NULL pointer for the session B<s>, | ||
58 | 0 is returned. | ||
59 | |||
60 | =head1 SEE ALSO | ||
61 | |||
62 | L<ssl(3)|ssl(3)>, | ||
63 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, | ||
64 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
65 | |||
66 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.3 b/src/lib/libssl/src/doc/ssl/SSL_accept.3 new file mode 100644 index 0000000000..88bea1fde7 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_accept.3 | |||
@@ -0,0 +1,110 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_ACCEPT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_accept | ||
6 | .Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_accept "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_accept | ||
13 | waits for a TLS/SSL client to initiate the TLS/SSL handshake. | ||
14 | The communication channel must already have been set and assigned to the | ||
15 | .Fa ssl | ||
16 | object by setting an underlying | ||
17 | .Vt BIO . | ||
18 | .Sh NOTES | ||
19 | The behaviour of | ||
20 | .Fn SSL_accept | ||
21 | depends on the underlying | ||
22 | .Vt BIO . | ||
23 | .Pp | ||
24 | If the underlying | ||
25 | .Vt BIO | ||
26 | is | ||
27 | .Em blocking , | ||
28 | .Fn SSL_accept | ||
29 | will only return once the handshake has been finished or an error occurred, | ||
30 | except for SGC (Server Gated Cryptography). | ||
31 | For SGC, | ||
32 | .Fn SSL_accept | ||
33 | may return with \(mi1, but | ||
34 | .Fn SSL_get_error | ||
35 | will yield | ||
36 | .Dv SSL_ERROR_WANT_READ/WRITE | ||
37 | and | ||
38 | .Fn SSL_accept | ||
39 | should be called again. | ||
40 | .Pp | ||
41 | If the underlying | ||
42 | .Vt BIO | ||
43 | is | ||
44 | .Em non-blocking , | ||
45 | .Fn SSL_accept | ||
46 | will also return when the underlying | ||
47 | .Vt BIO | ||
48 | could not satisfy the needs of | ||
49 | .Fn SSL_accept | ||
50 | to continue the handshake, indicating the problem by the return value \(mi1. | ||
51 | In this case a call to | ||
52 | .Xr SSL_get_error 3 | ||
53 | with the | ||
54 | return value of | ||
55 | .Fn SSL_accept | ||
56 | will yield | ||
57 | .Dv SSL_ERROR_WANT_READ | ||
58 | or | ||
59 | .Dv SSL_ERROR_WANT_WRITE . | ||
60 | The calling process then must repeat the call after taking appropriate action | ||
61 | to satisfy the needs of | ||
62 | .Fn SSL_accept . | ||
63 | The action depends on the underlying | ||
64 | .Dv BIO . | ||
65 | When using a non-blocking socket, nothing is to be done, but | ||
66 | .Xr select 2 | ||
67 | can be used to check for the required condition. | ||
68 | When using a buffering | ||
69 | .Vt BIO , | ||
70 | like a | ||
71 | .Vt BIO | ||
72 | pair, data must be written into or retrieved out of the | ||
73 | .Vt BIO | ||
74 | before being able to continue. | ||
75 | .Sh RETURN VALUES | ||
76 | The following return values can occur: | ||
77 | .Bl -tag -width Ds | ||
78 | .It 0 | ||
79 | The TLS/SSL handshake was not successful but was shut down controlled and by | ||
80 | the specifications of the TLS/SSL protocol. | ||
81 | Call | ||
82 | .Xr SSL_get_error 3 | ||
83 | with the return value | ||
84 | .Fa ret | ||
85 | to find out the reason. | ||
86 | .It 1 | ||
87 | The TLS/SSL handshake was successfully completed, | ||
88 | and a TLS/SSL connection has been established. | ||
89 | .It <0 | ||
90 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
91 | at the protocol level or a connection failure occurred. | ||
92 | The shutdown was not clean. | ||
93 | It can also occur of action is need to continue the operation for non-blocking | ||
94 | .Vt BIO Ns | ||
95 | s. | ||
96 | Call | ||
97 | .Xr SSL_get_error 3 | ||
98 | with the return value | ||
99 | .Fa ret | ||
100 | to find out the reason. | ||
101 | .El | ||
102 | .Sh SEE ALSO | ||
103 | .Xr bio 3 , | ||
104 | .Xr ssl 3 , | ||
105 | .Xr SSL_connect 3 , | ||
106 | .Xr SSL_CTX_new 3 , | ||
107 | .Xr SSL_do_handshake 3 , | ||
108 | .Xr SSL_get_error 3 , | ||
109 | .Xr SSL_set_connect_state 3 , | ||
110 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_accept.pod b/src/lib/libssl/src/doc/ssl/SSL_accept.pod deleted file mode 100644 index 42a539d354..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_accept.pod +++ /dev/null | |||
@@ -1,76 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_accept - wait for a TLS/SSL client to initiate a TLS/SSL handshake | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_accept(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_accept() waits for a TLS/SSL client to initiate the TLS/SSL handshake. | ||
16 | The communication channel must already have been set and assigned to the | ||
17 | B<ssl> by setting an underlying B<BIO>. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | The behaviour of SSL_accept() depends on the underlying BIO. | ||
22 | |||
23 | If the underlying BIO is B<blocking>, SSL_accept() will only return once the | ||
24 | handshake has been finished or an error occurred, except for SGC (Server | ||
25 | Gated Cryptography). For SGC, SSL_accept() may return with -1, but | ||
26 | SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and SSL_accept() | ||
27 | should be called again. | ||
28 | |||
29 | If the underlying BIO is B<non-blocking>, SSL_accept() will also return | ||
30 | when the underlying BIO could not satisfy the needs of SSL_accept() | ||
31 | to continue the handshake, indicating the problem by the return value -1. | ||
32 | In this case a call to SSL_get_error() with the | ||
33 | return value of SSL_accept() will yield B<SSL_ERROR_WANT_READ> or | ||
34 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
35 | taking appropriate action to satisfy the needs of SSL_accept(). | ||
36 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
37 | nothing is to be done, but select() can be used to check for the required | ||
38 | condition. When using a buffering BIO, like a BIO pair, data must be written | ||
39 | into or retrieved out of the BIO before being able to continue. | ||
40 | |||
41 | =head1 RETURN VALUES | ||
42 | |||
43 | The following return values can occur: | ||
44 | |||
45 | =over 4 | ||
46 | |||
47 | =item C<0> | ||
48 | |||
49 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
50 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | ||
51 | return value B<ret> to find out the reason. | ||
52 | |||
53 | =item C<1> | ||
54 | |||
55 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
56 | established. | ||
57 | |||
58 | =item E<lt>0 | ||
59 | |||
60 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
61 | at the protocol level or a connection failure occurred. The shutdown was | ||
62 | not clean. It can also occur of action is need to continue the operation | ||
63 | for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> | ||
64 | to find out the reason. | ||
65 | |||
66 | =back | ||
67 | |||
68 | =head1 SEE ALSO | ||
69 | |||
70 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | ||
71 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, | ||
72 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | ||
73 | L<SSL_do_handshake(3)|SSL_do_handshake(3)>, | ||
74 | L<SSL_CTX_new(3)|SSL_CTX_new(3)> | ||
75 | |||
76 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.3 b/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.3 new file mode 100644 index 0000000000..f4b652bc1a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.3 | |||
@@ -0,0 +1,190 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_ALERT_TYPE_STRING.POD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_alert_type_string , | ||
6 | .Nm SSL_alert_type_string_long , | ||
7 | .Nm SSL_alert_desc_string , | ||
8 | .Nm SSL_alert_desc_string_long | ||
9 | .Nd get textual description of alert information | ||
10 | .Sh SYNOPSIS | ||
11 | .In openssl/ssl.h | ||
12 | .Ft const char * Ns | ||
13 | .Fn SSL_alert_type_string "int value" | ||
14 | .Ft const char * Ns | ||
15 | .Fn SSL_alert_type_string_long "int value" | ||
16 | .Ft const char * Ns | ||
17 | .Fn SSL_alert_desc_string "int value" | ||
18 | .Ft const char * Ns | ||
19 | .Fn SSL_alert_desc_string_long "int value" | ||
20 | .Sh DESCRIPTION | ||
21 | .Fn SSL_alert_type_string | ||
22 | returns a one letter string indicating the type of the alert specified by | ||
23 | .Fa value . | ||
24 | .Pp | ||
25 | .Fn SSL_alert_type_string_long | ||
26 | returns a string indicating the type of the alert specified by | ||
27 | .Fa value . | ||
28 | .Pp | ||
29 | .Fn SSL_alert_desc_string | ||
30 | returns a two letter string as a short form describing the reason of the alert | ||
31 | specified by | ||
32 | .Fa value . | ||
33 | .Pp | ||
34 | .Fn SSL_alert_desc_string_long | ||
35 | returns a string describing the reason of the alert specified by | ||
36 | .Fa value . | ||
37 | .Sh NOTES | ||
38 | When one side of an SSL/TLS communication wants to inform the peer about | ||
39 | a special situation, it sends an alert. | ||
40 | The alert is sent as a special message and does not influence the normal data | ||
41 | stream (unless its contents results in the communication being canceled). | ||
42 | .Pp | ||
43 | A warning alert is sent, when a non-fatal error condition occurs. | ||
44 | The | ||
45 | .Dq close notify | ||
46 | alert is sent as a warning alert. | ||
47 | Other examples for non-fatal errors are certificate errors | ||
48 | .Po | ||
49 | .Dq certificate expired , | ||
50 | .Dq unsupported certificate | ||
51 | .Pc , | ||
52 | for which a warning alert may be sent. | ||
53 | (The sending party may, however, decide to send a fatal error.) | ||
54 | The receiving side may cancel the connection on reception of a warning alert at | ||
55 | its discretion. | ||
56 | .Pp | ||
57 | Several alert messages must be sent as fatal alert messages as specified | ||
58 | by the TLS RFC. | ||
59 | A fatal alert always leads to a connection abort. | ||
60 | .Sh RETURN VALUES | ||
61 | The following strings can occur for | ||
62 | .Fn SSL_alert_type_string | ||
63 | or | ||
64 | .Fn SSL_alert_type_string_long : | ||
65 | .Bl -tag -width Ds | ||
66 | .It \(dqW\(dq/\(dqwarning\(dq | ||
67 | .It \(dqF\(dq/\(dqfatal\(dq | ||
68 | .It \(dqU\(dq/\(dqunknown\(dq | ||
69 | This indicates that no support is available for this alert type. | ||
70 | Probably | ||
71 | .Fa value | ||
72 | does not contain a correct alert message. | ||
73 | .El | ||
74 | .Pp | ||
75 | The following strings can occur for | ||
76 | .Fn SSL_alert_desc_string | ||
77 | or | ||
78 | .Fn SSL_alert_desc_string_long : | ||
79 | .Bl -tag -width Ds | ||
80 | .It \(dqCN\(dq/\(dqclose notify\(dq | ||
81 | The connection shall be closed. | ||
82 | This is a warning alert. | ||
83 | .It \(dqUM\(dq/\(dqunexpected message\(dq | ||
84 | An inappropriate message was received. | ||
85 | This alert is always fatal and should never be observed in communication | ||
86 | between proper implementations. | ||
87 | .It \(dqBM\(dq/\(dqbad record mac\(dq | ||
88 | This alert is returned if a record is received with an incorrect MAC. | ||
89 | This message is always fatal. | ||
90 | .It \(dqDF\(dq/\(dqdecompression failure\(dq | ||
91 | The decompression function received improper input | ||
92 | (e.g., data that would expand to excessive length). | ||
93 | This message is always fatal. | ||
94 | .It \(dqHF\(dq/\(dqhandshake failure\(dq | ||
95 | Reception of a handshake_failure alert message indicates that the sender was | ||
96 | unable to negotiate an acceptable set of security parameters given the options | ||
97 | available. | ||
98 | This is a fatal error. | ||
99 | .It \(dqNC\(dq/\(dqno certificate\(dq | ||
100 | A client, that was asked to send a certificate, does not send a certificate | ||
101 | (SSLv3 only). | ||
102 | .It \(dqBC\(dq/\(dqbad certificate\(dq | ||
103 | A certificate was corrupt, contained signatures that did not verify correctly, | ||
104 | etc. | ||
105 | .It \(dqUC\(dq/\(dqunsupported certificate\(dq | ||
106 | A certificate was of an unsupported type. | ||
107 | .It \(dqCR\(dq/\(dqcertificate revoked\(dq | ||
108 | A certificate was revoked by its signer. | ||
109 | .It \(dqCE\(dq/\(dqcertificate expired\(dq | ||
110 | A certificate has expired or is not currently valid. | ||
111 | .It \(dqCU\(dq/\(dqcertificate unknown\(dq | ||
112 | Some other (unspecified) issue arose in processing the certificate, | ||
113 | rendering it unacceptable. | ||
114 | .It \(dqIP\(dq/\(dqillegal parameter\(dq | ||
115 | A field in the handshake was out of range or inconsistent with other fields. | ||
116 | This is always fatal. | ||
117 | .It \(dqDC\(dq/\(dqdecryption failed\(dq | ||
118 | A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple | ||
119 | of the block length or its padding values, when checked, weren't correct. | ||
120 | This message is always fatal. | ||
121 | .It \(dqRO\(dq/\(dqrecord overflow\(dq | ||
122 | A TLSCiphertext record was received which had a length more than | ||
123 | 2^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than | ||
124 | 2^14+1024 bytes. | ||
125 | This message is always fatal. | ||
126 | .It \(dqCA\(dq/\(dqunknown CA\(dq | ||
127 | A valid certificate chain or partial chain was received, | ||
128 | but the certificate was not accepted because the CA certificate could not be | ||
129 | located or couldn't be matched with a known, trusted CA. | ||
130 | This message is always fatal. | ||
131 | .It \(dqAD\(dq/\(dqaccess denied\(dq | ||
132 | A valid certificate was received, but when access control was applied, | ||
133 | the sender decided not to proceed with negotiation. | ||
134 | This message is always fatal. | ||
135 | .It \(dqDE\(dq/\(dqdecode error\(dq | ||
136 | A message could not be decoded because some field was out of the specified | ||
137 | range or the length of the message was incorrect. | ||
138 | This message is always fatal. | ||
139 | .It \(dqCY\(dq/\(dqdecrypt error\(dq | ||
140 | A handshake cryptographic operation failed, including being unable to correctly | ||
141 | verify a signature, decrypt a key exchange, or validate a finished message. | ||
142 | .It \(dqER\(dq/\(dqexport restriction\(dq | ||
143 | A negotiation not in compliance with export restrictions was detected; | ||
144 | for example, attempting to transfer a 1024 bit ephemeral RSA key for the | ||
145 | RSA_EXPORT handshake method. | ||
146 | This message is always fatal. | ||
147 | .It \(dqPV\(dq/\(dqprotocol version\(dq | ||
148 | The protocol version the client has attempted to negotiate is recognized, | ||
149 | but not supported. | ||
150 | (For example, old protocol versions might be avoided for security reasons.) | ||
151 | This message is always fatal. | ||
152 | .It \(dqIS\(dq/\(dqinsufficient security\(dq | ||
153 | Returned instead of handshake_failure when a negotiation has failed | ||
154 | specifically because the server requires ciphers more secure than those | ||
155 | supported by the client. | ||
156 | This message is always fatal. | ||
157 | .It \(dqIE\(dq/\(dqinternal error\(dq | ||
158 | An internal error unrelated to the peer or the correctness of the protocol | ||
159 | makes it impossible to continue (such as a memory allocation failure). | ||
160 | This message is always fatal. | ||
161 | .It \(dqUS\(dq/\(dquser canceled\(dq | ||
162 | This handshake is being canceled for some reason unrelated to a protocol | ||
163 | failure. | ||
164 | If the user cancels an operation after the handshake is complete, | ||
165 | just closing the connection by sending a close_notify is more appropriate. | ||
166 | This alert should be followed by a close_notify. | ||
167 | This message is generally a warning. | ||
168 | .It \(dqNR\(dq/\(dqno renegotiation\(dq | ||
169 | Sent by the client in response to a hello request or by the server in response | ||
170 | to a client hello after initial handshaking. | ||
171 | Either of these would normally lead to renegotiation; when that is not | ||
172 | appropriate, the recipient should respond with this alert; at that point, | ||
173 | the original requester can decide whether to proceed with the connection. | ||
174 | One case where this would be appropriate would be where a server has spawned a | ||
175 | process to satisfy a request; the process might receive security parameters | ||
176 | (key length, authentication, etc.) at startup and it might be difficult to | ||
177 | communicate changes to these parameters after that point. | ||
178 | This message is always a warning. | ||
179 | .It \(dqUP\(dq/\(dqunknown PSK identity\(dq | ||
180 | Sent by the server to indicate that it does not recognize a PSK identity or an | ||
181 | SRP identity. | ||
182 | .It \(dqUK\(dq/\(dqunknown\(dq | ||
183 | This indicates that no description is available for this alert type. | ||
184 | Probably | ||
185 | .Fa value | ||
186 | does not contain a correct alert message. | ||
187 | .El | ||
188 | .Sh SEE ALSO | ||
189 | .Xr ssl 3 , | ||
190 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod b/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod deleted file mode 100644 index 0a70a46890..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_alert_type_string.pod +++ /dev/null | |||
@@ -1,234 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_alert_type_string, SSL_alert_type_string_long, SSL_alert_desc_string, | ||
6 | SSL_alert_desc_string_long - get textual description of alert information | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | const char *SSL_alert_type_string(int value); | ||
13 | const char *SSL_alert_type_string_long(int value); | ||
14 | |||
15 | const char *SSL_alert_desc_string(int value); | ||
16 | const char *SSL_alert_desc_string_long(int value); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_alert_type_string() returns a one letter string indicating the | ||
21 | type of the alert specified by B<value>. | ||
22 | |||
23 | SSL_alert_type_string_long() returns a string indicating the type of the alert | ||
24 | specified by B<value>. | ||
25 | |||
26 | SSL_alert_desc_string() returns a two letter string as a short form | ||
27 | describing the reason of the alert specified by B<value>. | ||
28 | |||
29 | SSL_alert_desc_string_long() returns a string describing the reason | ||
30 | of the alert specified by B<value>. | ||
31 | |||
32 | =head1 NOTES | ||
33 | |||
34 | When one side of an SSL/TLS communication wants to inform the peer about | ||
35 | a special situation, it sends an alert. The alert is sent as a special message | ||
36 | and does not influence the normal data stream (unless its contents results | ||
37 | in the communication being canceled). | ||
38 | |||
39 | A warning alert is sent, when a non-fatal error condition occurs. The | ||
40 | "close notify" alert is sent as a warning alert. Other examples for | ||
41 | non-fatal errors are certificate errors ("certificate expired", | ||
42 | "unsupported certificate"), for which a warning alert may be sent. | ||
43 | (The sending party may however decide to send a fatal error.) The | ||
44 | receiving side may cancel the connection on reception of a warning | ||
45 | alert on it discretion. | ||
46 | |||
47 | Several alert messages must be sent as fatal alert messages as specified | ||
48 | by the TLS RFC. A fatal alert always leads to a connection abort. | ||
49 | |||
50 | =head1 RETURN VALUES | ||
51 | |||
52 | The following strings can occur for SSL_alert_type_string() or | ||
53 | SSL_alert_type_string_long(): | ||
54 | |||
55 | =over 4 | ||
56 | |||
57 | =item "W"/"warning" | ||
58 | |||
59 | =item "F"/"fatal" | ||
60 | |||
61 | =item "U"/"unknown" | ||
62 | |||
63 | This indicates that no support is available for this alert type. | ||
64 | Probably B<value> does not contain a correct alert message. | ||
65 | |||
66 | =back | ||
67 | |||
68 | The following strings can occur for SSL_alert_desc_string() or | ||
69 | SSL_alert_desc_string_long(): | ||
70 | |||
71 | =over 4 | ||
72 | |||
73 | =item "CN"/"close notify" | ||
74 | |||
75 | The connection shall be closed. This is a warning alert. | ||
76 | |||
77 | =item "UM"/"unexpected message" | ||
78 | |||
79 | An inappropriate message was received. This alert is always fatal | ||
80 | and should never be observed in communication between proper | ||
81 | implementations. | ||
82 | |||
83 | =item "BM"/"bad record mac" | ||
84 | |||
85 | This alert is returned if a record is received with an incorrect | ||
86 | MAC. This message is always fatal. | ||
87 | |||
88 | =item "DF"/"decompression failure" | ||
89 | |||
90 | The decompression function received improper input (e.g. data | ||
91 | that would expand to excessive length). This message is always | ||
92 | fatal. | ||
93 | |||
94 | =item "HF"/"handshake failure" | ||
95 | |||
96 | Reception of a handshake_failure alert message indicates that the | ||
97 | sender was unable to negotiate an acceptable set of security | ||
98 | parameters given the options available. This is a fatal error. | ||
99 | |||
100 | =item "NC"/"no certificate" | ||
101 | |||
102 | A client, that was asked to send a certificate, does not send a certificate | ||
103 | (SSLv3 only). | ||
104 | |||
105 | =item "BC"/"bad certificate" | ||
106 | |||
107 | A certificate was corrupt, contained signatures that did not | ||
108 | verify correctly, etc | ||
109 | |||
110 | =item "UC"/"unsupported certificate" | ||
111 | |||
112 | A certificate was of an unsupported type. | ||
113 | |||
114 | =item "CR"/"certificate revoked" | ||
115 | |||
116 | A certificate was revoked by its signer. | ||
117 | |||
118 | =item "CE"/"certificate expired" | ||
119 | |||
120 | A certificate has expired or is not currently valid. | ||
121 | |||
122 | =item "CU"/"certificate unknown" | ||
123 | |||
124 | Some other (unspecified) issue arose in processing the | ||
125 | certificate, rendering it unacceptable. | ||
126 | |||
127 | =item "IP"/"illegal parameter" | ||
128 | |||
129 | A field in the handshake was out of range or inconsistent with | ||
130 | other fields. This is always fatal. | ||
131 | |||
132 | =item "DC"/"decryption failed" | ||
133 | |||
134 | A TLSCiphertext decrypted in an invalid way: either it wasn't an | ||
135 | even multiple of the block length or its padding values, when | ||
136 | checked, weren't correct. This message is always fatal. | ||
137 | |||
138 | =item "RO"/"record overflow" | ||
139 | |||
140 | A TLSCiphertext record was received which had a length more than | ||
141 | 2^14+2048 bytes, or a record decrypted to a TLSCompressed record | ||
142 | with more than 2^14+1024 bytes. This message is always fatal. | ||
143 | |||
144 | =item "CA"/"unknown CA" | ||
145 | |||
146 | A valid certificate chain or partial chain was received, but the | ||
147 | certificate was not accepted because the CA certificate could not | ||
148 | be located or couldn't be matched with a known, trusted CA. This | ||
149 | message is always fatal. | ||
150 | |||
151 | =item "AD"/"access denied" | ||
152 | |||
153 | A valid certificate was received, but when access control was | ||
154 | applied, the sender decided not to proceed with negotiation. | ||
155 | This message is always fatal. | ||
156 | |||
157 | =item "DE"/"decode error" | ||
158 | |||
159 | A message could not be decoded because some field was out of the | ||
160 | specified range or the length of the message was incorrect. This | ||
161 | message is always fatal. | ||
162 | |||
163 | =item "CY"/"decrypt error" | ||
164 | |||
165 | A handshake cryptographic operation failed, including being | ||
166 | unable to correctly verify a signature, decrypt a key exchange, | ||
167 | or validate a finished message. | ||
168 | |||
169 | =item "ER"/"export restriction" | ||
170 | |||
171 | A negotiation not in compliance with export restrictions was | ||
172 | detected; for example, attempting to transfer a 1024 bit | ||
173 | ephemeral RSA key for the RSA_EXPORT handshake method. This | ||
174 | message is always fatal. | ||
175 | |||
176 | =item "PV"/"protocol version" | ||
177 | |||
178 | The protocol version the client has attempted to negotiate is | ||
179 | recognized, but not supported. (For example, old protocol | ||
180 | versions might be avoided for security reasons). This message is | ||
181 | always fatal. | ||
182 | |||
183 | =item "IS"/"insufficient security" | ||
184 | |||
185 | Returned instead of handshake_failure when a negotiation has | ||
186 | failed specifically because the server requires ciphers more | ||
187 | secure than those supported by the client. This message is always | ||
188 | fatal. | ||
189 | |||
190 | =item "IE"/"internal error" | ||
191 | |||
192 | An internal error unrelated to the peer or the correctness of the | ||
193 | protocol makes it impossible to continue (such as a memory | ||
194 | allocation failure). This message is always fatal. | ||
195 | |||
196 | =item "US"/"user canceled" | ||
197 | |||
198 | This handshake is being canceled for some reason unrelated to a | ||
199 | protocol failure. If the user cancels an operation after the | ||
200 | handshake is complete, just closing the connection by sending a | ||
201 | close_notify is more appropriate. This alert should be followed | ||
202 | by a close_notify. This message is generally a warning. | ||
203 | |||
204 | =item "NR"/"no renegotiation" | ||
205 | |||
206 | Sent by the client in response to a hello request or by the | ||
207 | server in response to a client hello after initial handshaking. | ||
208 | Either of these would normally lead to renegotiation; when that | ||
209 | is not appropriate, the recipient should respond with this alert; | ||
210 | at that point, the original requester can decide whether to | ||
211 | proceed with the connection. One case where this would be | ||
212 | appropriate would be where a server has spawned a process to | ||
213 | satisfy a request; the process might receive security parameters | ||
214 | (key length, authentication, etc.) at startup and it might be | ||
215 | difficult to communicate changes to these parameters after that | ||
216 | point. This message is always a warning. | ||
217 | |||
218 | =item "UP"/"unknown PSK identity" | ||
219 | |||
220 | Sent by the server to indicate that it does not recognize a PSK | ||
221 | identity or an SRP identity. | ||
222 | |||
223 | =item "UK"/"unknown" | ||
224 | |||
225 | This indicates that no description is available for this alert type. | ||
226 | Probably B<value> does not contain a correct alert message. | ||
227 | |||
228 | =back | ||
229 | |||
230 | =head1 SEE ALSO | ||
231 | |||
232 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> | ||
233 | |||
234 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_clear.3 b/src/lib/libssl/src/doc/ssl/SSL_clear.3 new file mode 100644 index 0000000000..dc596ce12a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_clear.3 | |||
@@ -0,0 +1,89 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CLEAR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_clear | ||
6 | .Nd reset SSL object to allow another connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_clear "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | Reset | ||
13 | .Fa ssl | ||
14 | to allow another connection. | ||
15 | All settings (method, ciphers, BIOs) are kept. | ||
16 | .Sh NOTES | ||
17 | .Fn SSL_clear | ||
18 | is used to prepare an | ||
19 | .Vt SSL | ||
20 | object for a new connection. | ||
21 | While all settings are kept, | ||
22 | a side effect is the handling of the current SSL session. | ||
23 | If a session is still | ||
24 | .Em open , | ||
25 | it is considered bad and will be removed from the session cache, | ||
26 | as required by RFC2246. | ||
27 | A session is considered open if | ||
28 | .Xr SSL_shutdown 3 | ||
29 | was not called for the connection or at least | ||
30 | .Xr SSL_set_shutdown 3 | ||
31 | was used to | ||
32 | set the | ||
33 | .Dv SSL_SENT_SHUTDOWN | ||
34 | state. | ||
35 | .Pp | ||
36 | If a session was closed cleanly, | ||
37 | the session object will be kept and all settings corresponding. | ||
38 | This explicitly means that for example the special method used during the | ||
39 | session will be kept for the next handshake. | ||
40 | So if the session was a TLSv1 session, a | ||
41 | .Vt SSL | ||
42 | client object will use a TLSv1 client method for the next handshake and a | ||
43 | .Vt SSL | ||
44 | server object will use a TLSv1 server method, even if | ||
45 | .Fn SSLv23_*_method Ns s | ||
46 | were chosen on startup. | ||
47 | This might lead to connection failures (see | ||
48 | .Xr SSL_new 3 ) | ||
49 | for a description of the method's properties. | ||
50 | .Sh WARNINGS | ||
51 | .Fn SSL_clear | ||
52 | resets the | ||
53 | .Vt SSL | ||
54 | object to allow for another connection. | ||
55 | The reset operation however keeps several settings of the last sessions | ||
56 | (some of these settings were made automatically during the last handshake). | ||
57 | It only makes sense for a new connection with the exact same peer that shares | ||
58 | these settings, | ||
59 | and may fail if that peer changes its settings between connections. | ||
60 | Use the sequence | ||
61 | .Xr SSL_get_session 3 ; | ||
62 | .Xr SSL_new 3 ; | ||
63 | .Xr SSL_set_session 3 ; | ||
64 | .Xr SSL_free 3 | ||
65 | instead to avoid such failures (or simply | ||
66 | .Xr SSL_free 3 ; | ||
67 | .Xr SSL_new 3 | ||
68 | if session reuse is not desired). | ||
69 | .Sh RETURN VALUES | ||
70 | The following return values can occur: | ||
71 | .Bl -tag -width Ds | ||
72 | .It 0 | ||
73 | The | ||
74 | .Fn SSL_clear | ||
75 | operation could not be performed. | ||
76 | Check the error stack to find out the reason. | ||
77 | .It 1 | ||
78 | The | ||
79 | .Fn SSL_clear | ||
80 | operation was successful. | ||
81 | .El | ||
82 | .Sh SEE ALSO | ||
83 | .Xr ssl 3 , | ||
84 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
85 | .Xr SSL_CTX_set_options 3 , | ||
86 | .Xr SSL_free 3 , | ||
87 | .Xr SSL_new 3 , | ||
88 | .Xr SSL_set_shutdown 3 , | ||
89 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_clear.pod b/src/lib/libssl/src/doc/ssl/SSL_clear.pod deleted file mode 100644 index e115a07db6..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_clear.pod +++ /dev/null | |||
@@ -1,77 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_clear - reset SSL object to allow another connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_clear(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | Reset B<ssl> to allow another connection. All settings (method, ciphers, | ||
16 | BIOs) are kept. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | SSL_clear is used to prepare an SSL object for a new connection. While all | ||
21 | settings are kept, a side effect is the handling of the current SSL session. | ||
22 | If a session is still B<open>, it is considered bad and will be removed | ||
23 | from the session cache, as required by RFC2246. A session is considered open, | ||
24 | if L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection | ||
25 | or at least L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was used to | ||
26 | set the SSL_SENT_SHUTDOWN state. | ||
27 | |||
28 | If a session was closed cleanly, the session object will be kept and all | ||
29 | settings corresponding. This explicitly means, that e.g. the special method | ||
30 | used during the session will be kept for the next handshake. So if the | ||
31 | session was a TLSv1 session, a SSL client object will use a TLSv1 client | ||
32 | method for the next handshake and a SSL server object will use a TLSv1 | ||
33 | server method, even if SSLv23_*_methods were chosen on startup. This | ||
34 | will might lead to connection failures (see L<SSL_new(3)|SSL_new(3)>) | ||
35 | for a description of the method's properties. | ||
36 | |||
37 | =head1 WARNINGS | ||
38 | |||
39 | SSL_clear() resets the SSL object to allow for another connection. The | ||
40 | reset operation however keeps several settings of the last sessions | ||
41 | (some of these settings were made automatically during the last | ||
42 | handshake). It only makes sense for a new connection with the exact | ||
43 | same peer that shares these settings, and may fail if that peer | ||
44 | changes its settings between connections. Use the sequence | ||
45 | L<SSL_get_session(3)|SSL_get_session(3)>; | ||
46 | L<SSL_new(3)|SSL_new(3)>; | ||
47 | L<SSL_set_session(3)|SSL_set_session(3)>; | ||
48 | L<SSL_free(3)|SSL_free(3)> | ||
49 | instead to avoid such failures | ||
50 | (or simply L<SSL_free(3)|SSL_free(3)>; L<SSL_new(3)|SSL_new(3)> | ||
51 | if session reuse is not desired). | ||
52 | |||
53 | =head1 RETURN VALUES | ||
54 | |||
55 | The following return values can occur: | ||
56 | |||
57 | =over 4 | ||
58 | |||
59 | =item C<0> | ||
60 | |||
61 | The SSL_clear() operation could not be performed. Check the error stack to | ||
62 | find out the reason. | ||
63 | |||
64 | =item C<1> | ||
65 | |||
66 | The SSL_clear() operation was successful. | ||
67 | |||
68 | =back | ||
69 | |||
70 | =head1 SEE ALSO | ||
71 | |||
72 | L<SSL_new(3)|SSL_new(3)>, L<SSL_free(3)|SSL_free(3)>, | ||
73 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
74 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, L<ssl(3)|ssl(3)>, | ||
75 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> | ||
76 | |||
77 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_connect.3 b/src/lib/libssl/src/doc/ssl/SSL_connect.3 new file mode 100644 index 0000000000..4f8428c3c9 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_connect.3 | |||
@@ -0,0 +1,99 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_CONNECT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_connect | ||
6 | .Nd initiate the TLS/SSL handshake with an TLS/SSL server | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_connect "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_connect | ||
13 | initiates the TLS/SSL handshake with a server. | ||
14 | The communication channel must already have been set and assigned to the | ||
15 | .Fa ssl | ||
16 | by setting an underlying | ||
17 | .Vt BIO . | ||
18 | .Sh NOTES | ||
19 | The behaviour of | ||
20 | .Fn SSL_connect | ||
21 | depends on the underlying | ||
22 | .Vt BIO. | ||
23 | .Pp | ||
24 | If the underlying | ||
25 | .Vt BIO | ||
26 | is | ||
27 | .Em blocking , | ||
28 | .Fn SSL_connect | ||
29 | will only return once the handshake has been finished or an error occurred. | ||
30 | .Pp | ||
31 | If the underlying | ||
32 | .Vt BIO | ||
33 | is | ||
34 | .Em non-blocking , | ||
35 | .Fn SSL_connect | ||
36 | will also return when the underlying | ||
37 | .Vt BIO | ||
38 | could not satisfy the needs of | ||
39 | .Fn SSL_connect | ||
40 | to continue the handshake, indicating the problem with the return value \(mi1. | ||
41 | In this case a call to | ||
42 | .Xr SSL_get_error 3 | ||
43 | with the return value of | ||
44 | .Fn SSL_connect | ||
45 | will yield | ||
46 | .Dv SSL_ERROR_WANT_READ | ||
47 | or | ||
48 | .Dv SSL_ERROR_WANT_WRITE . | ||
49 | The calling process then must repeat the call after taking appropriate action | ||
50 | to satisfy the needs of | ||
51 | .Fn SSL_connect . | ||
52 | The action depends on the underlying | ||
53 | .Vt BIO . | ||
54 | When using a non-blocking socket, nothing is to be done, but | ||
55 | .Xr select 2 | ||
56 | can be used to check for the required condition. | ||
57 | When using a buffering | ||
58 | .Vt BIO , | ||
59 | like a | ||
60 | .Vt BIO | ||
61 | pair, data must be written into or retrieved out of the | ||
62 | .Vt BIO | ||
63 | before being able to continue. | ||
64 | .Sh RETURN VALUES | ||
65 | The following return values can occur: | ||
66 | .Bl -tag -width Ds | ||
67 | .It 0 | ||
68 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
69 | by the specifications of the TLS/SSL protocol. | ||
70 | Call | ||
71 | .Xr SSL_get_error 3 | ||
72 | with the return value | ||
73 | .Fa ret | ||
74 | to find out the reason. | ||
75 | .It 1 | ||
76 | The TLS/SSL handshake was successfully completed, | ||
77 | and a TLS/SSL connection has been established. | ||
78 | .It <0 | ||
79 | The TLS/SSL handshake was not successful, because either a fatal error occurred | ||
80 | at the protocol level or a connection failure occurred. | ||
81 | The shutdown was not clean. | ||
82 | It can also occur if action is needed to continue the operation for | ||
83 | non-blocking | ||
84 | .Vt BIO Ns s. | ||
85 | Call | ||
86 | .Xr SSL_get_error 3 | ||
87 | with the return value | ||
88 | .Fa ret | ||
89 | to find out the reason. | ||
90 | .El | ||
91 | .Sh SEE ALSO | ||
92 | .Xr bio 3 , | ||
93 | .Xr ssl 3 , | ||
94 | .Xr SSL_accept 3 , | ||
95 | .Xr SSL_CTX_new 3 , | ||
96 | .Xr SSL_do_handshake 3 , | ||
97 | .Xr SSL_get_error 3 , | ||
98 | .Xr SSL_set_connect_state 3 , | ||
99 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_connect.pod b/src/lib/libssl/src/doc/ssl/SSL_connect.pod deleted file mode 100644 index 5b21119a91..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_connect.pod +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_connect - initiate the TLS/SSL handshake with an TLS/SSL server | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_connect(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_connect() initiates the TLS/SSL handshake with a server. The communication | ||
16 | channel must already have been set and assigned to the B<ssl> by setting an | ||
17 | underlying B<BIO>. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | The behaviour of SSL_connect() depends on the underlying BIO. | ||
22 | |||
23 | If the underlying BIO is B<blocking>, SSL_connect() will only return once the | ||
24 | handshake has been finished or an error occurred. | ||
25 | |||
26 | If the underlying BIO is B<non-blocking>, SSL_connect() will also return | ||
27 | when the underlying BIO could not satisfy the needs of SSL_connect() | ||
28 | to continue the handshake, indicating the problem by the return value -1. | ||
29 | In this case a call to SSL_get_error() with the | ||
30 | return value of SSL_connect() will yield B<SSL_ERROR_WANT_READ> or | ||
31 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
32 | taking appropriate action to satisfy the needs of SSL_connect(). | ||
33 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
34 | nothing is to be done, but select() can be used to check for the required | ||
35 | condition. When using a buffering BIO, like a BIO pair, data must be written | ||
36 | into or retrieved out of the BIO before being able to continue. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | The following return values can occur: | ||
41 | |||
42 | =over 4 | ||
43 | |||
44 | =item C<0> | ||
45 | |||
46 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
47 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | ||
48 | return value B<ret> to find out the reason. | ||
49 | |||
50 | =item C<1> | ||
51 | |||
52 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
53 | established. | ||
54 | |||
55 | =item C<E<lt>0> | ||
56 | |||
57 | The TLS/SSL handshake was not successful, because a fatal error occurred either | ||
58 | at the protocol level or a connection failure occurred. The shutdown was | ||
59 | not clean. It can also occur of action is need to continue the operation | ||
60 | for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> | ||
61 | to find out the reason. | ||
62 | |||
63 | =back | ||
64 | |||
65 | =head1 SEE ALSO | ||
66 | |||
67 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
68 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, | ||
69 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | ||
70 | L<SSL_do_handshake(3)|SSL_do_handshake(3)>, | ||
71 | L<SSL_CTX_new(3)|SSL_CTX_new(3)> | ||
72 | |||
73 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 new file mode 100644 index 0000000000..8e6e0a820b --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.3 | |||
@@ -0,0 +1,110 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_DO_HANDSHAKE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_do_handshake | ||
6 | .Nd perform a TLS/SSL handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_do_handshake "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_do_handshake | ||
13 | will wait for a SSL/TLS handshake to take place. | ||
14 | If the connection is in client mode, the handshake will be started. | ||
15 | The handshake routines may have to be explicitly set in advance using either | ||
16 | .Xr SSL_set_connect_state 3 | ||
17 | or | ||
18 | .Xr SSL_set_accept_state 3 . | ||
19 | .Sh NOTES | ||
20 | The behaviour of | ||
21 | .Fn SSL_do_handshake | ||
22 | depends on the underlying | ||
23 | .Vt BIO . | ||
24 | .Pp | ||
25 | If the underlying | ||
26 | .Vt BIO | ||
27 | is | ||
28 | .Em blocking , | ||
29 | .Fn SSL_do_handshake | ||
30 | will only return once the handshake has been finished or an error occurred, | ||
31 | except for SGC (Server Gated Cryptography). | ||
32 | For SGC, | ||
33 | .Fn SSL_do_handshake | ||
34 | may return with \(mi1, but | ||
35 | .Xr SSL_get_error 3 | ||
36 | will yield | ||
37 | .Dv SSL_ERROR_WANT_READ | ||
38 | or | ||
39 | .Dv SSL_ERROR_WANT_WRITE | ||
40 | and | ||
41 | .Fn SSL_do_handshake | ||
42 | should be called again. | ||
43 | .Pp | ||
44 | If the underlying | ||
45 | .Vt BIO | ||
46 | is | ||
47 | .Em non-blocking , | ||
48 | .Fn SSL_do_handshake | ||
49 | will also return when the underlying | ||
50 | .Vt BIO | ||
51 | could not satisfy the needs of | ||
52 | .Fn SSL_do_handshake | ||
53 | to continue the handshake. | ||
54 | In this case a call to | ||
55 | .Xr SSL_get_error 3 | ||
56 | with the return value of | ||
57 | .Fn SSL_do_handshake | ||
58 | will yield | ||
59 | .Dv SSL_ERROR_WANT_READ | ||
60 | or | ||
61 | .Dv SSL_ERROR_WANT_WRITE . | ||
62 | The calling process then must repeat the call after taking appropriate action | ||
63 | to satisfy the needs of | ||
64 | .Fn SSL_do_handshake . | ||
65 | The action depends on the underlying | ||
66 | .Vt BIO . | ||
67 | When using a non-blocking socket, nothing is to be done, but | ||
68 | .Xr select 2 | ||
69 | can be used to check for the required condition. | ||
70 | When using a buffering | ||
71 | .Vt BIO , | ||
72 | like a | ||
73 | .Vt BIO | ||
74 | pair, data must be written into or retrieved out of the | ||
75 | .Vt BIO | ||
76 | before being able to continue. | ||
77 | .Sh RETURN VALUES | ||
78 | The following return values can occur: | ||
79 | .Bl -tag -width Ds | ||
80 | .It 0 | ||
81 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
82 | by the specifications of the TLS/SSL protocol. | ||
83 | Call | ||
84 | .Xr SSL_get_error 3 | ||
85 | with the return value | ||
86 | .Fa ret | ||
87 | to find out the reason. | ||
88 | .It 1 | ||
89 | The TLS/SSL handshake was successfully completed, | ||
90 | and a TLS/SSL connection has been established. | ||
91 | .It <0 | ||
92 | The TLS/SSL handshake was not successful because either a fatal error occurred | ||
93 | at the protocol level or a connection failure occurred. | ||
94 | The shutdown was not clean. | ||
95 | It can also occur if action is needed to continue the operation for | ||
96 | non-blocking | ||
97 | .Vt BIO Ns s. | ||
98 | Call | ||
99 | .Xr SSL_get_error 3 | ||
100 | with the return value | ||
101 | .Fa ret | ||
102 | to find out the reason. | ||
103 | .El | ||
104 | .Sh SEE ALSO | ||
105 | .Xr bio 3 , | ||
106 | .Xr ssl 3 , | ||
107 | .Xr SSL_accept 3 , | ||
108 | .Xr SSL_connect 3 , | ||
109 | .Xr SSL_get_error 3 , | ||
110 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod b/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod deleted file mode 100644 index 1ca18d4723..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_do_handshake.pod +++ /dev/null | |||
@@ -1,75 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_do_handshake - perform a TLS/SSL handshake | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_do_handshake(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_do_handshake() will wait for a SSL/TLS handshake to take place. If the | ||
16 | connection is in client mode, the handshake will be started. The handshake | ||
17 | routines may have to be explicitly set in advance using either | ||
18 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or | ||
19 | L<SSL_set_accept_state(3)|SSL_set_accept_state(3)>. | ||
20 | |||
21 | =head1 NOTES | ||
22 | |||
23 | The behaviour of SSL_do_handshake() depends on the underlying BIO. | ||
24 | |||
25 | If the underlying BIO is B<blocking>, SSL_do_handshake() will only return | ||
26 | once the handshake has been finished or an error occurred, except for SGC | ||
27 | (Server Gated Cryptography). For SGC, SSL_do_handshake() may return with -1, | ||
28 | but SSL_get_error() will yield B<SSL_ERROR_WANT_READ/WRITE> and | ||
29 | SSL_do_handshake() should be called again. | ||
30 | |||
31 | If the underlying BIO is B<non-blocking>, SSL_do_handshake() will also return | ||
32 | when the underlying BIO could not satisfy the needs of SSL_do_handshake() | ||
33 | to continue the handshake. In this case a call to SSL_get_error() with the | ||
34 | return value of SSL_do_handshake() will yield B<SSL_ERROR_WANT_READ> or | ||
35 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
36 | taking appropriate action to satisfy the needs of SSL_do_handshake(). | ||
37 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
38 | nothing is to be done, but select() can be used to check for the required | ||
39 | condition. When using a buffering BIO, like a BIO pair, data must be written | ||
40 | into or retrieved out of the BIO before being able to continue. | ||
41 | |||
42 | =head1 RETURN VALUES | ||
43 | |||
44 | The following return values can occur: | ||
45 | |||
46 | =over 4 | ||
47 | |||
48 | =item C<0> | ||
49 | |||
50 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
51 | by the specifications of the TLS/SSL protocol. Call SSL_get_error() with the | ||
52 | return value B<ret> to find out the reason. | ||
53 | |||
54 | =item C<1> | ||
55 | |||
56 | The TLS/SSL handshake was successfully completed, a TLS/SSL connection has been | ||
57 | established. | ||
58 | |||
59 | =item C<E<lt>0> | ||
60 | |||
61 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
62 | at the protocol level or a connection failure occurred. The shutdown was | ||
63 | not clean. It can also occur of action is need to continue the operation | ||
64 | for non-blocking BIOs. Call SSL_get_error() with the return value B<ret> | ||
65 | to find out the reason. | ||
66 | |||
67 | =back | ||
68 | |||
69 | =head1 SEE ALSO | ||
70 | |||
71 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | ||
72 | L<SSL_accept(3)|SSL_accept(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)>, | ||
73 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> | ||
74 | |||
75 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_free.3 b/src/lib/libssl/src/doc/ssl/SSL_free.3 new file mode 100644 index 0000000000..453cd7d424 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_free.3 | |||
@@ -0,0 +1,59 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_FREE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_free | ||
6 | .Nd free an allocated SSL structure | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_free "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_free | ||
13 | decrements the reference count of | ||
14 | .Fa ssl , | ||
15 | and removes the | ||
16 | .Vt SSL | ||
17 | structure pointed to by | ||
18 | .Fa ssl | ||
19 | and frees up the allocated memory if the reference count has reached 0. | ||
20 | .Sh NOTES | ||
21 | .Fn SSL_free | ||
22 | also calls the | ||
23 | .Xr free 3 Ns | ||
24 | ing procedures for indirectly affected items, if applicable: the buffering | ||
25 | .Vt BIO , | ||
26 | the read and write | ||
27 | .Vt BIOs , | ||
28 | cipher lists specially created for this | ||
29 | .Fa ssl , | ||
30 | the | ||
31 | .Sy SSL_SESSION . | ||
32 | Do not explicitly free these indirectly freed up items before or after calling | ||
33 | .Fn SSL_free , | ||
34 | as trying to free things twice may lead to program failure. | ||
35 | .Pp | ||
36 | The | ||
37 | .Fa ssl | ||
38 | session has reference counts from two users: the | ||
39 | .Vt SSL | ||
40 | object, for which the reference count is removed by | ||
41 | .Fn SSL_free | ||
42 | and the internal session cache. | ||
43 | If the session is considered bad, because | ||
44 | .Xr SSL_shutdown 3 | ||
45 | was not called for the connection and | ||
46 | .Xr SSL_set_shutdown 3 | ||
47 | was not used to set the | ||
48 | .Vt SSL_SENT_SHUTDOWN | ||
49 | state, the session will also be removed from the session cache as required by | ||
50 | RFC2246. | ||
51 | .Sh RETURN VALUES | ||
52 | .Fn SSL_free | ||
53 | does not provide diagnostic information. | ||
54 | .Sh SEE ALSO | ||
55 | .Xr ssl 3 , | ||
56 | .Xr SSL_clear 3 , | ||
57 | .Xr SSL_new 3 , | ||
58 | .Xr SSL_set_shutdown 3 , | ||
59 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_free.pod b/src/lib/libssl/src/doc/ssl/SSL_free.pod deleted file mode 100644 index 61603d833b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_free.pod +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_free - free an allocated SSL structure | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_free(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_free() decrements the reference count of B<ssl>, and removes the SSL | ||
16 | structure pointed to by B<ssl> and frees up the allocated memory if the | ||
17 | reference count has reached 0. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | SSL_free() also calls the free()ing procedures for indirectly affected items, if | ||
22 | applicable: the buffering BIO, the read and write BIOs, | ||
23 | cipher lists specially created for this B<ssl>, the B<SSL_SESSION>. | ||
24 | Do not explicitly free these indirectly freed up items before or after | ||
25 | calling SSL_free(), as trying to free things twice may lead to program | ||
26 | failure. | ||
27 | |||
28 | The ssl session has reference counts from two users: the SSL object, for | ||
29 | which the reference count is removed by SSL_free() and the internal | ||
30 | session cache. If the session is considered bad, because | ||
31 | L<SSL_shutdown(3)|SSL_shutdown(3)> was not called for the connection | ||
32 | and L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> was not used to set the | ||
33 | SSL_SENT_SHUTDOWN state, the session will also be removed | ||
34 | from the session cache as required by RFC2246. | ||
35 | |||
36 | =head1 RETURN VALUES | ||
37 | |||
38 | SSL_free() does not provide diagnostic information. | ||
39 | |||
40 | =head1 SEE ALSO | ||
41 | |||
42 | L<SSL_new(3)|SSL_new(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
43 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
44 | L<ssl(3)|ssl(3)> | ||
45 | |||
46 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.3 b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.3 new file mode 100644 index 0000000000..40effb512f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.3 | |||
@@ -0,0 +1,25 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_SSL_CTX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_SSL_CTX | ||
6 | .Nd get the SSL_CTX from which an SSL is created | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft SSL_CTX * | ||
10 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_SSL_CTX | ||
13 | returns a pointer to the | ||
14 | .Vt SSL_CTX | ||
15 | object from which | ||
16 | .Fa ssl | ||
17 | was created with | ||
18 | .Xr SSL_new 3 . | ||
19 | .Sh RETURN VALUES | ||
20 | The pointer to the | ||
21 | .Vt SSL_CTX | ||
22 | object is returned. | ||
23 | .Sh SEE ALSO | ||
24 | .Xr ssl 3 , | ||
25 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod b/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod deleted file mode 100644 index 659c482c79..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_SSL_CTX.pod +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_SSL_CTX - get the SSL_CTX from which an SSL is created | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_SSL_CTX() returns a pointer to the SSL_CTX object, from which | ||
16 | B<ssl> was created with L<SSL_new(3)|SSL_new(3)>. | ||
17 | |||
18 | =head1 RETURN VALUES | ||
19 | |||
20 | The pointer to the SSL_CTX object is returned. | ||
21 | |||
22 | =head1 SEE ALSO | ||
23 | |||
24 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)> | ||
25 | |||
26 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.3 b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.3 new file mode 100644 index 0000000000..f836988f39 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CIPHERS 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ciphers , | ||
6 | .Nm SSL_get_cipher_list | ||
7 | .Nd get list of available SSL_CIPHERs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft STACK_OF(SSL_CIPHER) * | ||
11 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_get_cipher_list "const SSL *ssl" "int priority" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_ciphers | ||
16 | returns the stack of available | ||
17 | .Vt SSL_CIPHER Ns s | ||
18 | for | ||
19 | .Fa ssl , | ||
20 | sorted by preference. | ||
21 | If | ||
22 | .Fa ssl | ||
23 | is | ||
24 | .Dv NULL | ||
25 | or no ciphers are available, | ||
26 | .Dv NULL | ||
27 | is returned. | ||
28 | .Pp | ||
29 | .Fn SSL_get_cipher_list | ||
30 | returns a pointer to the name of the | ||
31 | .Vt SSL_CIPHER | ||
32 | listed for | ||
33 | .Fa ssl | ||
34 | with | ||
35 | .Fa priority . | ||
36 | If | ||
37 | .Fa ssl | ||
38 | is | ||
39 | .Dv NULL , | ||
40 | no ciphers are available, or there are fewer ciphers than | ||
41 | .Fa priority | ||
42 | available, | ||
43 | .Dv NULL | ||
44 | is returned. | ||
45 | .Sh NOTES | ||
46 | The details of the ciphers obtained by | ||
47 | .Fn SSL_get_ciphers | ||
48 | can be obtained using the | ||
49 | .Xr SSL_CIPHER_get_name 3 | ||
50 | family of functions. | ||
51 | .Pp | ||
52 | Call | ||
53 | .Fn SSL_get_cipher_list | ||
54 | with | ||
55 | .Fa priority | ||
56 | starting from 0 to obtain the sorted list of available ciphers, until | ||
57 | .Dv NULL | ||
58 | is returned. | ||
59 | .Sh RETURN VALUES | ||
60 | See | ||
61 | .Sx DESCRIPTION . | ||
62 | .Sh SEE ALSO | ||
63 | .Xr ssl 3 , | ||
64 | .Xr SSL_CIPHER_get_name 3 , | ||
65 | .Xr SSL_CTX_set_cipher_list 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod deleted file mode 100644 index aecadd9138..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_ciphers.pod +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_ciphers, SSL_get_cipher_list - get list of available SSL_CIPHERs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *ssl); | ||
12 | const char *SSL_get_cipher_list(const SSL *ssl, int priority); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_get_ciphers() returns the stack of available SSL_CIPHERs for B<ssl>, | ||
17 | sorted by preference. If B<ssl> is NULL or no ciphers are available, NULL | ||
18 | is returned. | ||
19 | |||
20 | SSL_get_cipher_list() returns a pointer to the name of the SSL_CIPHER | ||
21 | listed for B<ssl> with B<priority>. If B<ssl> is NULL, no ciphers are | ||
22 | available, or there are less ciphers than B<priority> available, NULL | ||
23 | is returned. | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | The details of the ciphers obtained by SSL_get_ciphers() can be obtained using | ||
28 | the L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> family of functions. | ||
29 | |||
30 | Call SSL_get_cipher_list() with B<priority> starting from 0 to obtain the | ||
31 | sorted list of available ciphers, until NULL is returned. | ||
32 | |||
33 | =head1 RETURN VALUES | ||
34 | |||
35 | See DESCRIPTION | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
40 | L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> | ||
41 | |||
42 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.3 b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.3 new file mode 100644 index 0000000000..9c08a8e17d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.3 | |||
@@ -0,0 +1,58 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CLIENT_CA_LIST 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_client_CA_list , | ||
6 | .Nm SSL_CTX_get_client_CA_list | ||
7 | .Nd get list of client CAs | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft STACK_OF(X509_NAME) * | ||
11 | .Fn SSL_get_client_CA_list "const SSL *s" | ||
12 | .Ft STACK_OF(X509_NAME) * | ||
13 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_CTX_get_client_CA_list | ||
16 | returns the list of client CAs explicitly set for | ||
17 | .Fa ctx | ||
18 | using | ||
19 | .Xr SSL_CTX_set_client_CA_list 3 . | ||
20 | .Pp | ||
21 | .Fn SSL_get_client_CA_list | ||
22 | returns the list of client CAs explicitly set for | ||
23 | .Fa ssl | ||
24 | using | ||
25 | .Fn SSL_set_client_CA_list | ||
26 | or | ||
27 | .Fa ssl Ns 's | ||
28 | .Vt SSL_CTX | ||
29 | object with | ||
30 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
31 | when in server mode. | ||
32 | In client mode, | ||
33 | .Fn SSL_get_client_CA_list | ||
34 | returns the list of client CAs sent from the server, if any. | ||
35 | .Sh RETURN VALUES | ||
36 | .Fn SSL_CTX_set_client_CA_list | ||
37 | and | ||
38 | .Fn SSL_set_client_CA_list | ||
39 | do not return diagnostic information. | ||
40 | .Pp | ||
41 | .Fn SSL_CTX_add_client_CA | ||
42 | and | ||
43 | .Fn SSL_add_client_CA | ||
44 | have the following return values: | ||
45 | .Bl -tag -width Ds | ||
46 | .It Dv STACK_OF Ns Po Vt X509_NAMES Pc | ||
47 | List of CA names explicitly set (for | ||
48 | .Fa ctx | ||
49 | or in server mode) or sent by the server (client mode). | ||
50 | .It Dv NULL | ||
51 | No client CA list was explicitly set (for | ||
52 | .Fa ctx | ||
53 | or in server mode) or the server did not send a list of CAs (client mode). | ||
54 | .El | ||
55 | .Sh SEE ALSO | ||
56 | .Xr ssl 3 , | ||
57 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
58 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod b/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod deleted file mode 100644 index 8b5ac0df2c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_client_CA_list.pod +++ /dev/null | |||
@@ -1,53 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_client_CA_list, SSL_CTX_get_client_CA_list - get list of client CAs | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACK_OF(X509_NAME) *SSL_get_client_CA_list(const SSL *s); | ||
12 | STACK_OF(X509_NAME) *SSL_CTX_get_client_CA_list(const SSL_CTX *ctx); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_CTX_get_client_CA_list() returns the list of client CAs explicitly set for | ||
17 | B<ctx> using L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>. | ||
18 | |||
19 | SSL_get_client_CA_list() returns the list of client CAs explicitly | ||
20 | set for B<ssl> using SSL_set_client_CA_list() or B<ssl>'s SSL_CTX object with | ||
21 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, when in | ||
22 | server mode. In client mode, SSL_get_client_CA_list returns the list of | ||
23 | client CAs sent from the server, if any. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | SSL_CTX_set_client_CA_list() and SSL_set_client_CA_list() do not return | ||
28 | diagnostic information. | ||
29 | |||
30 | SSL_CTX_add_client_CA() and SSL_add_client_CA() have the following return | ||
31 | values: | ||
32 | |||
33 | =over 4 | ||
34 | |||
35 | =item STACK_OF(X509_NAMES) | ||
36 | |||
37 | List of CA names explicitly set (for B<ctx> or in server mode) or send | ||
38 | by the server (client mode). | ||
39 | |||
40 | =item NULL | ||
41 | |||
42 | No client CA list was explicitly set (for B<ctx> or in server mode) or | ||
43 | the server did not send a list of CAs (client mode). | ||
44 | |||
45 | =back | ||
46 | |||
47 | =head1 SEE ALSO | ||
48 | |||
49 | L<ssl(3)|ssl(3)>, | ||
50 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | ||
51 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)> | ||
52 | |||
53 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.3 b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.3 new file mode 100644 index 0000000000..ec1f2bb7df --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.3 | |||
@@ -0,0 +1,49 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_CURRENT_CIPHER 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_current_cipher , | ||
6 | .Nm SSL_get_cipher , | ||
7 | .Nm SSL_get_cipher_name , | ||
8 | .Nm SSL_get_cipher_bits , | ||
9 | .Nm SSL_get_cipher_version | ||
10 | .Nd get SSL_CIPHER of a connection | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/ssl.h | ||
13 | .Ft SSL_CIPHER * | ||
14 | .Fn SSL_get_current_cipher "const SSL *ssl" | ||
15 | .Fd #define SSL_get_cipher(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
16 | .Fd #define SSL_get_cipher_name(s) \ | ||
17 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
18 | .Fd #define SSL_get_cipher_bits(s,np) \ | ||
19 | SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) | ||
20 | .Fd #define SSL_get_cipher_version(s) \ | ||
21 | SSL_CIPHER_get_version(SSL_get_current_cipher(s)) | ||
22 | .Sh DESCRIPTION | ||
23 | .Fn SSL_get_current_cipher | ||
24 | returns a pointer to an | ||
25 | .Vt SSL_CIPHER | ||
26 | object containing the description of the actually used cipher of a connection | ||
27 | established with the | ||
28 | .Fa ssl | ||
29 | object. | ||
30 | .Pp | ||
31 | .Fn SSL_get_cipher | ||
32 | and | ||
33 | .Fn SSL_get_cipher_name | ||
34 | are identical macros to obtain the name of the currently used cipher. | ||
35 | .Fn SSL_get_cipher_bits | ||
36 | is a macro to obtain the number of secret/algorithm bits used and | ||
37 | .Fn SSL_get_cipher_version | ||
38 | returns the protocol name. | ||
39 | See | ||
40 | .Xr SSL_CIPHER_get_name 3 | ||
41 | for more details. | ||
42 | .Sh RETURN VALUES | ||
43 | .Fn SSL_get_current_cipher | ||
44 | returns the cipher actually used or | ||
45 | .Dv NULL , | ||
46 | when no session has been established. | ||
47 | .Sh SEE ALSO | ||
48 | .Xr ssl 3 , | ||
49 | .Xr SSL_CIPHER_get_name 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod b/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod deleted file mode 100644 index 2f69109a7a..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_current_cipher.pod +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_current_cipher, SSL_get_cipher, SSL_get_cipher_name, | ||
6 | SSL_get_cipher_bits, SSL_get_cipher_version - get SSL_CIPHER of a connection | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | SSL_CIPHER *SSL_get_current_cipher(const SSL *ssl); | ||
13 | #define SSL_get_cipher(s) \ | ||
14 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
15 | #define SSL_get_cipher_name(s) \ | ||
16 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
17 | #define SSL_get_cipher_bits(s,np) \ | ||
18 | SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) | ||
19 | #define SSL_get_cipher_version(s) \ | ||
20 | SSL_CIPHER_get_version(SSL_get_current_cipher(s)) | ||
21 | |||
22 | =head1 DESCRIPTION | ||
23 | |||
24 | SSL_get_current_cipher() returns a pointer to an SSL_CIPHER object containing | ||
25 | the description of the actually used cipher of a connection established with | ||
26 | the B<ssl> object. | ||
27 | |||
28 | SSL_get_cipher() and SSL_get_cipher_name() are identical macros to obtain the | ||
29 | name of the currently used cipher. SSL_get_cipher_bits() is a | ||
30 | macro to obtain the number of secret/algorithm bits used and | ||
31 | SSL_get_cipher_version() returns the protocol name. | ||
32 | See L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> for more details. | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | SSL_get_current_cipher() returns the cipher actually used or NULL, when | ||
37 | no session has been established. | ||
38 | |||
39 | =head1 SEE ALSO | ||
40 | |||
41 | L<ssl(3)|ssl(3)>, L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)> | ||
42 | |||
43 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.3 b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.3 new file mode 100644 index 0000000000..28ab34d5e8 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.3 | |||
@@ -0,0 +1,33 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_DEFAULT_TIMEOUT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_default_timeout | ||
6 | .Nd get default session timeout value | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_default_timeout | ||
13 | returns the default timeout value assigned to | ||
14 | .Vt SSL_SESSION | ||
15 | objects negotiated for the protocol valid for | ||
16 | .Fa ssl . | ||
17 | .Sh NOTES | ||
18 | Whenever a new session is negotiated, it is assigned a timeout value, | ||
19 | after which it will not be accepted for session reuse. | ||
20 | If the timeout value was not explicitly set using | ||
21 | .Xr SSL_CTX_set_timeout 3 , | ||
22 | the hardcoded default timeout for the protocol will be used. | ||
23 | .Pp | ||
24 | .Fn SSL_get_default_timeout | ||
25 | return this hardcoded value, which is 300 seconds for all currently supported | ||
26 | protocols (SSLv2, SSLv3, and TLSv1). | ||
27 | .Sh RETURN VALUES | ||
28 | See description. | ||
29 | .Sh SEE ALSO | ||
30 | .Xr ssl 3 , | ||
31 | .Xr SSL_CTX_flush_sessions 3 , | ||
32 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
33 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod b/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod deleted file mode 100644 index a648a9b82d..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_default_timeout.pod +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_default_timeout - get default session timeout value | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_get_default_timeout(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_default_timeout() returns the default timeout value assigned to | ||
16 | SSL_SESSION objects negotiated for the protocol valid for B<ssl>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | Whenever a new session is negotiated, it is assigned a timeout value, | ||
21 | after which it will not be accepted for session reuse. If the timeout | ||
22 | value was not explicitly set using | ||
23 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, the hardcoded default | ||
24 | timeout for the protocol will be used. | ||
25 | |||
26 | SSL_get_default_timeout() return this hardcoded value, which is 300 seconds | ||
27 | for all currently supported protocols (SSLv2, SSLv3, and TLSv1). | ||
28 | |||
29 | =head1 RETURN VALUES | ||
30 | |||
31 | See description. | ||
32 | |||
33 | =head1 SEE ALSO | ||
34 | |||
35 | L<ssl(3)|ssl(3)>, | ||
36 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
37 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | ||
38 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
39 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)> | ||
40 | |||
41 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_error.3 b/src/lib/libssl/src/doc/ssl/SSL_get_error.3 new file mode 100644 index 0000000000..ad533f68c5 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_error.3 | |||
@@ -0,0 +1,166 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_ERROR 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_error | ||
6 | .Nd obtain result code for TLS/SSL I/O operation | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_get_error "const SSL *ssl" "int ret" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_error | ||
13 | returns a result code (suitable for the C | ||
14 | .Dq switch | ||
15 | statement) for a preceding call to | ||
16 | .Xr SSL_connect 3 , | ||
17 | .Xr SSL_accept 3 , | ||
18 | .Xr SSL_do_handshake 3 , | ||
19 | .Xr SSL_read 3 , | ||
20 | .Xr SSL_peek 3 , | ||
21 | or | ||
22 | .Xr SSL_write 3 | ||
23 | on | ||
24 | .Fa ssl . | ||
25 | The value returned by that TLS/SSL I/O function must be passed to | ||
26 | .Fn SSL_get_error | ||
27 | in parameter | ||
28 | .Fa ret . | ||
29 | .Pp | ||
30 | In addition to | ||
31 | .Fa ssl | ||
32 | and | ||
33 | .Fa ret , | ||
34 | .Fn SSL_get_error | ||
35 | inspects the current thread's OpenSSL error queue. | ||
36 | Thus, | ||
37 | .Fn SSL_get_error | ||
38 | must be used in the same thread that performed the TLS/SSL I/O operation, | ||
39 | and no other OpenSSL function calls should appear in between. | ||
40 | The current thread's error queue must be empty before the TLS/SSL I/O operation | ||
41 | is attempted, or | ||
42 | .Fn SSL_get_error | ||
43 | will not work reliably. | ||
44 | .Sh RETURN VALUES | ||
45 | The following return values can currently occur: | ||
46 | .Bl -tag -width Ds | ||
47 | .It Dv SSL_ERROR_NONE | ||
48 | The TLS/SSL I/O operation completed. | ||
49 | This result code is returned if and only if | ||
50 | .Fa ret | ||
51 | < 0. | ||
52 | .It Dv SSL_ERROR_ZERO_RETURN | ||
53 | The TLS/SSL connection has been closed. | ||
54 | If the protocol version is SSL 3.0 or TLS 1.0, this result code is returned | ||
55 | only if a closure alert has occurred in the protocol, i.e., if the connection | ||
56 | has been closed cleanly. | ||
57 | Note that in this case | ||
58 | .Dv SSL_ERROR_ZERO_RETURN | ||
59 | does not necessarily indicate that the underlying transport has been closed. | ||
60 | .It Dv SSL_ERROR_WANT_READ , Dv SSL_ERROR_WANT_WRITE | ||
61 | The operation did not complete; | ||
62 | the same TLS/SSL I/O function should be called again later. | ||
63 | If, by then, the underlying | ||
64 | .Vt BIO | ||
65 | has data available for reading (if the result code is | ||
66 | .Dv SSL_ERROR_WANT_READ ) | ||
67 | or allows writing data | ||
68 | .Pq Dv SSL_ERROR_WANT_WRITE , | ||
69 | then some TLS/SSL protocol progress will take place, | ||
70 | i.e., at least part of an TLS/SSL record will be read or written. | ||
71 | Note that the retry may again lead to a | ||
72 | .Dv SSL_ERROR_WANT_READ | ||
73 | or | ||
74 | .Dv SSL_ERROR_WANT_WRITE | ||
75 | condition. | ||
76 | There is no fixed upper limit for the number of iterations that may be | ||
77 | necessary until progress becomes visible at application protocol level. | ||
78 | .Pp | ||
79 | For socket | ||
80 | .Fa BIO Ns | ||
81 | s (e.g., when | ||
82 | .Fn SSL_set_fd | ||
83 | was used), | ||
84 | .Xr select 2 | ||
85 | or | ||
86 | .Xr poll 2 | ||
87 | on the underlying socket can be used to find out when the TLS/SSL I/O function | ||
88 | should be retried. | ||
89 | .Pp | ||
90 | Caveat: Any TLS/SSL I/O function can lead to either of | ||
91 | .Dv SSL_ERROR_WANT_READ | ||
92 | and | ||
93 | .Dv SSL_ERROR_WANT_WRITE . | ||
94 | In particular, | ||
95 | .Xr SSL_read 3 | ||
96 | or | ||
97 | .Xr SSL_peek 3 | ||
98 | may want to write data and | ||
99 | .Xr SSL_write 3 | ||
100 | may want | ||
101 | to read data. | ||
102 | This is mainly because TLS/SSL handshakes may occur at any time during the | ||
103 | protocol (initiated by either the client or the server); | ||
104 | .Xr SSL_read 3 , | ||
105 | .Xr SSL_peek 3 , | ||
106 | and | ||
107 | .Xr SSL_write 3 | ||
108 | will handle any pending handshakes. | ||
109 | .It Dv SSL_ERROR_WANT_CONNECT , Dv SSL_ERROR_WANT_ACCEPT | ||
110 | The operation did not complete; the same TLS/SSL I/O function should be | ||
111 | called again later. | ||
112 | The underlying BIO was not connected yet to the peer and the call would block | ||
113 | in | ||
114 | .Xr connect 2 Ns / Ns | ||
115 | .Xr accept 2 . | ||
116 | The SSL function should be | ||
117 | called again when the connection is established. | ||
118 | These messages can only appear with a | ||
119 | .Xr BIO_s_connect 3 | ||
120 | or | ||
121 | .Xr BIO_s_accept 3 | ||
122 | .Vt BIO , | ||
123 | respectively. | ||
124 | In order to find out when the connection has been successfully established, | ||
125 | on many platforms | ||
126 | .Xr select 2 | ||
127 | or | ||
128 | .Xr poll 2 | ||
129 | for writing on the socket file descriptor can be used. | ||
130 | .It Dv SSL_ERROR_WANT_X509_LOOKUP | ||
131 | The operation did not complete because an application callback set by | ||
132 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
133 | has asked to be called again. | ||
134 | The TLS/SSL I/O function should be called again later. | ||
135 | Details depend on the application. | ||
136 | .It Dv SSL_ERROR_SYSCALL | ||
137 | Some I/O error occurred. | ||
138 | The OpenSSL error queue may contain more information on the error. | ||
139 | If the error queue is empty (i.e., | ||
140 | .Fn ERR_get_error | ||
141 | returns 0), | ||
142 | .Fa ret | ||
143 | can be used to find out more about the error: | ||
144 | If | ||
145 | .Fa ret | ||
146 | == 0, an | ||
147 | .Dv EOF | ||
148 | was observed that violates the protocol. | ||
149 | If | ||
150 | .Fa ret | ||
151 | == \(mi1, the underlying | ||
152 | .Vt BIO | ||
153 | reported an | ||
154 | I/O error (for socket I/O on Unix systems, consult | ||
155 | .Dv errno | ||
156 | for details). | ||
157 | .It Dv SSL_ERROR_SSL | ||
158 | A failure in the SSL library occurred, usually a protocol error. | ||
159 | The OpenSSL error queue contains more information on the error. | ||
160 | .El | ||
161 | .Sh SEE ALSO | ||
162 | .Xr err 3 , | ||
163 | .Xr ssl 3 | ||
164 | .Sh HISTORY | ||
165 | .Fn SSL_get_error | ||
166 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod b/src/lib/libssl/src/doc/ssl/SSL_get_error.pod deleted file mode 100644 index ba430bd18d..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_error.pod +++ /dev/null | |||
@@ -1,113 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_error - obtain result code for TLS/SSL I/O operation | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_get_error(const SSL *ssl, int ret); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_error() returns a result code (suitable for the C "switch" statement) | ||
16 | for a preceding call to SSL_connect(), SSL_accept(), SSL_do_handshake(), | ||
17 | SSL_read(), SSL_peek(), or SSL_write() on B<ssl>. The value returned by that | ||
18 | TLS/SSL I/O function must be passed to SSL_get_error() in parameter B<ret>. | ||
19 | |||
20 | In addition to B<ssl> and B<ret>, SSL_get_error() inspects the | ||
21 | current thread's OpenSSL error queue. Thus, SSL_get_error() must be | ||
22 | used in the same thread that performed the TLS/SSL I/O operation, and no | ||
23 | other OpenSSL function calls should appear in between. The current | ||
24 | thread's error queue must be empty before the TLS/SSL I/O operation is | ||
25 | attempted, or SSL_get_error() will not work reliably. | ||
26 | |||
27 | =head1 RETURN VALUES | ||
28 | |||
29 | The following return values can currently occur: | ||
30 | |||
31 | =over 4 | ||
32 | |||
33 | =item SSL_ERROR_NONE | ||
34 | |||
35 | The TLS/SSL I/O operation completed. This result code is returned | ||
36 | if and only if B<ret E<gt> 0>. | ||
37 | |||
38 | =item SSL_ERROR_ZERO_RETURN | ||
39 | |||
40 | The TLS/SSL connection has been closed. If the protocol version is SSL 3.0 | ||
41 | or TLS 1.0, this result code is returned only if a closure | ||
42 | alert has occurred in the protocol, i.e. if the connection has been | ||
43 | closed cleanly. Note that in this case B<SSL_ERROR_ZERO_RETURN> | ||
44 | does not necessarily indicate that the underlying transport | ||
45 | has been closed. | ||
46 | |||
47 | =item SSL_ERROR_WANT_READ, SSL_ERROR_WANT_WRITE | ||
48 | |||
49 | The operation did not complete; the same TLS/SSL I/O function should be | ||
50 | called again later. If, by then, the underlying B<BIO> has data | ||
51 | available for reading (if the result code is B<SSL_ERROR_WANT_READ>) | ||
52 | or allows writing data (B<SSL_ERROR_WANT_WRITE>), then some TLS/SSL | ||
53 | protocol progress will take place, i.e. at least part of an TLS/SSL | ||
54 | record will be read or written. Note that the retry may again lead to | ||
55 | a B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE> condition. | ||
56 | There is no fixed upper limit for the number of iterations that | ||
57 | may be necessary until progress becomes visible at application | ||
58 | protocol level. | ||
59 | |||
60 | For socket B<BIO>s (e.g. when SSL_set_fd() was used), select() or | ||
61 | poll() on the underlying socket can be used to find out when the | ||
62 | TLS/SSL I/O function should be retried. | ||
63 | |||
64 | Caveat: Any TLS/SSL I/O function can lead to either of | ||
65 | B<SSL_ERROR_WANT_READ> and B<SSL_ERROR_WANT_WRITE>. In particular, | ||
66 | SSL_read() or SSL_peek() may want to write data and SSL_write() may want | ||
67 | to read data. This is mainly because TLS/SSL handshakes may occur at any | ||
68 | time during the protocol (initiated by either the client or the server); | ||
69 | SSL_read(), SSL_peek(), and SSL_write() will handle any pending handshakes. | ||
70 | |||
71 | =item SSL_ERROR_WANT_CONNECT, SSL_ERROR_WANT_ACCEPT | ||
72 | |||
73 | The operation did not complete; the same TLS/SSL I/O function should be | ||
74 | called again later. The underlying BIO was not connected yet to the peer | ||
75 | and the call would block in connect()/accept(). The SSL function should be | ||
76 | called again when the connection is established. These messages can only | ||
77 | appear with a BIO_s_connect() or BIO_s_accept() BIO, respectively. | ||
78 | In order to find out, when the connection has been successfully established, | ||
79 | on many platforms select() or poll() for writing on the socket file descriptor | ||
80 | can be used. | ||
81 | |||
82 | =item SSL_ERROR_WANT_X509_LOOKUP | ||
83 | |||
84 | The operation did not complete because an application callback set by | ||
85 | SSL_CTX_set_client_cert_cb() has asked to be called again. | ||
86 | The TLS/SSL I/O function should be called again later. | ||
87 | Details depend on the application. | ||
88 | |||
89 | =item SSL_ERROR_SYSCALL | ||
90 | |||
91 | Some I/O error occurred. The OpenSSL error queue may contain more | ||
92 | information on the error. If the error queue is empty | ||
93 | (i.e. ERR_get_error() returns 0), B<ret> can be used to find out more | ||
94 | about the error: If B<ret == 0>, an EOF was observed that violates | ||
95 | the protocol. If B<ret == -1>, the underlying B<BIO> reported an | ||
96 | I/O error (for socket I/O on Unix systems, consult B<errno> for details). | ||
97 | |||
98 | =item SSL_ERROR_SSL | ||
99 | |||
100 | A failure in the SSL library occurred, usually a protocol error. The | ||
101 | OpenSSL error queue contains more information on the error. | ||
102 | |||
103 | =back | ||
104 | |||
105 | =head1 SEE ALSO | ||
106 | |||
107 | L<ssl(3)|ssl(3)>, L<err(3)|err(3)> | ||
108 | |||
109 | =head1 HISTORY | ||
110 | |||
111 | SSL_get_error() was added in SSLeay 0.8. | ||
112 | |||
113 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.3 new file mode 100644 index 0000000000..9151f1d989 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.3 | |||
@@ -0,0 +1,62 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ex_data_X509_STORE_CTX_idx | ||
6 | .Nd get ex_data index to access SSL structure from X509_STORE_CTX | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
13 | returns the index number under which the pointer to the | ||
14 | .Vt SSL | ||
15 | object is stored into the | ||
16 | .Vt X509_STORE_CTX | ||
17 | object. | ||
18 | .Sh NOTES | ||
19 | Whenever a | ||
20 | .Vt X509_STORE_CTX | ||
21 | object is created for the verification of the peer's certificate during a | ||
22 | handshake, a pointer to the | ||
23 | .Vt SSL | ||
24 | object is stored into the | ||
25 | .Vt X509_STORE_CTX | ||
26 | object to identify the connection affected. | ||
27 | To retrieve this pointer the | ||
28 | .Xr X509_STORE_CTX_get_ex_data 3 | ||
29 | function can be used with the correct index. | ||
30 | This index is globally the same for all | ||
31 | .Vt X509_STORE_CTX | ||
32 | objects and can be retrieved using | ||
33 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx . | ||
34 | The index value is set when | ||
35 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
36 | is first called either by the application program directly or indirectly during | ||
37 | other SSL setup functions or during the handshake. | ||
38 | .Pp | ||
39 | The value depends on other index values defined for | ||
40 | .Vt X509_STORE_CTX | ||
41 | objects before the SSL index is created. | ||
42 | .Sh RETURN VALUES | ||
43 | .Bl -tag -width Ds | ||
44 | .It \(>=0 | ||
45 | The index value to access the pointer. | ||
46 | .It \(la0 | ||
47 | An error occurred, check the error stack for a detailed error message. | ||
48 | .El | ||
49 | .Sh EXAMPLES | ||
50 | The index returned from | ||
51 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
52 | provides access to | ||
53 | .Vt SSL | ||
54 | object for the connection during the | ||
55 | .Fn verify_callback | ||
56 | when checking the peer's certificate. | ||
57 | Please check the example in | ||
58 | .Xr SSL_CTX_set_verify 3 . | ||
59 | .Sh SEE ALSO | ||
60 | .Xr CRYPTO_set_ex_data 3 , | ||
61 | .Xr ssl 3 , | ||
62 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod deleted file mode 100644 index 165c6a5b2c..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_ex_data_X509_STORE_CTX_idx.pod +++ /dev/null | |||
@@ -1,61 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_ex_data_X509_STORE_CTX_idx - get ex_data index to access SSL structure | ||
6 | from X509_STORE_CTX | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_get_ex_data_X509_STORE_CTX_idx(void); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_get_ex_data_X509_STORE_CTX_idx() returns the index number under which | ||
17 | the pointer to the SSL object is stored into the X509_STORE_CTX object. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | Whenever a X509_STORE_CTX object is created for the verification of the | ||
22 | peers certificate during a handshake, a pointer to the SSL object is | ||
23 | stored into the X509_STORE_CTX object to identify the connection affected. | ||
24 | To retrieve this pointer the X509_STORE_CTX_get_ex_data() function can | ||
25 | be used with the correct index. This index is globally the same for all | ||
26 | X509_STORE_CTX objects and can be retrieved using | ||
27 | SSL_get_ex_data_X509_STORE_CTX_idx(). The index value is set when | ||
28 | SSL_get_ex_data_X509_STORE_CTX_idx() is first called either by the application | ||
29 | program directly or indirectly during other SSL setup functions or during | ||
30 | the handshake. | ||
31 | |||
32 | The value depends on other index values defined for X509_STORE_CTX objects | ||
33 | before the SSL index is created. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | =over 4 | ||
38 | |||
39 | =item E<gt>=0 | ||
40 | |||
41 | The index value to access the pointer. | ||
42 | |||
43 | =item E<lt>0 | ||
44 | |||
45 | An error occurred, check the error stack for a detailed error message. | ||
46 | |||
47 | =back | ||
48 | |||
49 | =head1 EXAMPLES | ||
50 | |||
51 | The index returned from SSL_get_ex_data_X509_STORE_CTX_idx() allows to | ||
52 | access the SSL object for the connection to be accessed during the | ||
53 | verify_callback() when checking the peers certificate. Please check | ||
54 | the example in L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | ||
59 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)> | ||
60 | |||
61 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.3 b/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.3 new file mode 100644 index 0000000000..5b1ff19c54 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.3 | |||
@@ -0,0 +1,73 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_EX_NEW_INDEX 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_ex_new_index , | ||
6 | .Nm SSL_set_ex_data , | ||
7 | .Nm SSL_get_ex_data | ||
8 | .Nd internal application specific data functions | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fo SSL_get_ex_new_index | ||
13 | .Fa "long argl" | ||
14 | .Fa "void *argp" | ||
15 | .Fa "CRYPTO_EX_new *new_func" | ||
16 | .Fa "CRYPTO_EX_dup *dup_func" | ||
17 | .Fa "CRYPTO_EX_free *free_func" | ||
18 | .Fc | ||
19 | .Ft int | ||
20 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "void *arg" | ||
21 | .Ft void * | ||
22 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
23 | .Bd -literal | ||
24 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
25 | int idx, long argl, void *argp); | ||
26 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
27 | int idx, long argl, void *argp); | ||
28 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
29 | int idx, long argl, void *argp); | ||
30 | .Ed | ||
31 | .Sh DESCRIPTION | ||
32 | Several OpenSSL structures can have application specific data attached to them. | ||
33 | These functions are used internally by OpenSSL to manipulate application | ||
34 | specific data attached to a specific structure. | ||
35 | .Pp | ||
36 | .Fn SSL_get_ex_new_index | ||
37 | is used to register a new index for application specific data. | ||
38 | .Pp | ||
39 | .Fn SSL_set_ex_data | ||
40 | is used to store application data at | ||
41 | .Fa arg | ||
42 | for | ||
43 | .Fa idx | ||
44 | into the | ||
45 | .Fa ssl | ||
46 | object. | ||
47 | .Pp | ||
48 | .Fn SSL_get_ex_data | ||
49 | is used to retrieve the information for | ||
50 | .Fa idx | ||
51 | from | ||
52 | .Fa ssl . | ||
53 | .Pp | ||
54 | A detailed description for the | ||
55 | .Fn *_get_ex_new_index | ||
56 | functionality can be found in | ||
57 | .Xr RSA_get_ex_new_index 3 . | ||
58 | The | ||
59 | .Fn *_get_ex_data | ||
60 | and | ||
61 | .Fn *_set_ex_data | ||
62 | functionality is described in | ||
63 | .Xr CRYPTO_set_ex_data 3 . | ||
64 | .Sh EXAMPLES | ||
65 | An example of how to use the functionality is included in the example | ||
66 | .Fn verify_callback | ||
67 | in | ||
68 | .Xr SSL_CTX_set_verify 3 . | ||
69 | .Sh SEE ALSO | ||
70 | .Xr CRYPTO_set_ex_data 3 , | ||
71 | .Xr RSA_get_ex_new_index 3 , | ||
72 | .Xr ssl 3 , | ||
73 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod b/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod deleted file mode 100644 index 394ae1a406..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_ex_new_index.pod +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_ex_new_index, SSL_set_ex_data, SSL_get_ex_data - internal application | ||
6 | specific data functions | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_get_ex_new_index(long argl, void *argp, | ||
13 | CRYPTO_EX_new *new_func, | ||
14 | CRYPTO_EX_dup *dup_func, | ||
15 | CRYPTO_EX_free *free_func); | ||
16 | |||
17 | int SSL_set_ex_data(SSL *ssl, int idx, void *arg); | ||
18 | |||
19 | void *SSL_get_ex_data(const SSL *ssl, int idx); | ||
20 | |||
21 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
22 | int idx, long argl, void *argp); | ||
23 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
24 | int idx, long argl, void *argp); | ||
25 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
26 | int idx, long argl, void *argp); | ||
27 | |||
28 | =head1 DESCRIPTION | ||
29 | |||
30 | Several OpenSSL structures can have application specific data attached to them. | ||
31 | These functions are used internally by OpenSSL to manipulate application | ||
32 | specific data attached to a specific structure. | ||
33 | |||
34 | SSL_get_ex_new_index() is used to register a new index for application | ||
35 | specific data. | ||
36 | |||
37 | SSL_set_ex_data() is used to store application data at B<arg> for B<idx> into | ||
38 | the B<ssl> object. | ||
39 | |||
40 | SSL_get_ex_data() is used to retrieve the information for B<idx> from | ||
41 | B<ssl>. | ||
42 | |||
43 | A detailed description for the B<*_get_ex_new_index()> functionality | ||
44 | can be found in L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>. | ||
45 | The B<*_get_ex_data()> and B<*_set_ex_data()> functionality is described in | ||
46 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>. | ||
47 | |||
48 | =head1 EXAMPLES | ||
49 | |||
50 | An example on how to use the functionality is included in the example | ||
51 | verify_callback() in L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>. | ||
52 | |||
53 | =head1 SEE ALSO | ||
54 | |||
55 | L<ssl(3)|ssl(3)>, | ||
56 | L<RSA_get_ex_new_index(3)|RSA_get_ex_new_index(3)>, | ||
57 | L<CRYPTO_set_ex_data(3)|CRYPTO_set_ex_data(3)>, | ||
58 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
59 | |||
60 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_fd.3 b/src/lib/libssl/src/doc/ssl/SSL_get_fd.3 new file mode 100644 index 0000000000..458e73dacc --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_fd.3 | |||
@@ -0,0 +1,43 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_FD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_fd , | ||
6 | .Nm SSL_get_rfd , | ||
7 | .Nm SSL_get_wfd | ||
8 | .Nd get file descriptor linked to an SSL object | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_get_fd "const SSL *ssl" | ||
13 | .Ft int | ||
14 | .Fn SSL_get_rfd "const SSL *ssl" | ||
15 | .Ft int | ||
16 | .Fn SSL_get_wfd "const SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_get_fd | ||
19 | returns the file descriptor which is linked to | ||
20 | .Fa ssl . | ||
21 | .Fn SSL_get_rfd | ||
22 | and | ||
23 | .Fn SSL_get_wfd | ||
24 | return the file descriptors for the read or the write channel, | ||
25 | which can be different. | ||
26 | If the read and the write channel are different, | ||
27 | .Fn SSL_get_fd | ||
28 | will return the file descriptor of the read channel. | ||
29 | .Sh RETURN VALUES | ||
30 | The following return values can occur: | ||
31 | .Bl -tag -width Ds | ||
32 | .It \(mi1 | ||
33 | The operation failed, because the underlying | ||
34 | .Vt BIO | ||
35 | is not of the correct type (suitable for file descriptors). | ||
36 | .It \(>=0 | ||
37 | The file descriptor linked to | ||
38 | .Fa ssl . | ||
39 | .El | ||
40 | .Sh SEE ALSO | ||
41 | .Xr bio 3 , | ||
42 | .Xr ssl 3 , | ||
43 | .Xr SSL_set_fd 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod b/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod deleted file mode 100644 index 19e52d68d0..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_fd.pod +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_fd, SSL_get_rfd, SSL_get_wfd - get file descriptor linked to an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_get_fd(const SSL *ssl); | ||
12 | int SSL_get_rfd(const SSL *ssl); | ||
13 | int SSL_get_wfd(const SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_get_fd() returns the file descriptor which is linked to B<ssl>. | ||
18 | SSL_get_rfd() and SSL_get_wfd() return the file descriptors for the | ||
19 | read or the write channel, which can be different. If the read and the | ||
20 | write channel are different, SSL_get_fd() will return the file descriptor | ||
21 | of the read channel. | ||
22 | |||
23 | =head1 RETURN VALUES | ||
24 | |||
25 | The following return values can occur: | ||
26 | |||
27 | =over 4 | ||
28 | |||
29 | =item -1 | ||
30 | |||
31 | The operation failed, because the underlying BIO is not of the correct type | ||
32 | (suitable for file descriptors). | ||
33 | |||
34 | =item E<gt>=0 | ||
35 | |||
36 | The file descriptor linked to B<ssl>. | ||
37 | |||
38 | =back | ||
39 | |||
40 | =head1 SEE ALSO | ||
41 | |||
42 | L<SSL_set_fd(3)|SSL_set_fd(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
43 | |||
44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.3 b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.3 new file mode 100644 index 0000000000..850e8cf913 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.3 | |||
@@ -0,0 +1,44 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PEER_CERT_CHAIN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_peer_cert_chain | ||
6 | .Nd get the X509 certificate chain of the peer | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft STACK_OF(X509) * | ||
10 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_peer_cert_chain | ||
13 | returns a pointer to | ||
14 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
15 | certificates forming the certificate chain of the peer. | ||
16 | If called on the client side, the stack also contains the peer's certificate; | ||
17 | if called on the server side, the peer's certificate must be obtained | ||
18 | separately using | ||
19 | .Xr SSL_get_peer_certificate 3 . | ||
20 | If the peer did not present a certificate, | ||
21 | .Dv NULL | ||
22 | is returned. | ||
23 | .Sh NOTES | ||
24 | The peer certificate chain is not necessarily available after reusing a | ||
25 | session, in which case a | ||
26 | .Dv NULL | ||
27 | pointer is returned. | ||
28 | .Pp | ||
29 | The reference count of the | ||
30 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
31 | object is not incremented. | ||
32 | If the corresponding session is freed, the pointer must not be used any longer. | ||
33 | .Sh RETURN VALUES | ||
34 | The following return values can occur: | ||
35 | .Bl -tag -width Ds | ||
36 | .It Dv NULL | ||
37 | No certificate was presented by the peer or no connection was established or | ||
38 | the certificate chain is no longer available when a session is reused. | ||
39 | .It Pointer to a Dv STACK_OF Ns Po X509 Pc | ||
40 | The return value points to the certificate chain presented by the peer. | ||
41 | .El | ||
42 | .Sh SEE ALSO | ||
43 | .Xr ssl 3 , | ||
44 | .Xr SSL_get_peer_certificate 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod deleted file mode 100644 index 059376c76b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_peer_cert_chain.pod +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_peer_cert_chain - get the X509 certificate chain of the peer | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACK_OF(X509) *SSL_get_peer_cert_chain(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_peer_cert_chain() returns a pointer to STACK_OF(X509) certificates | ||
16 | forming the certificate chain of the peer. If called on the client side, | ||
17 | the stack also contains the peer's certificate; if called on the server | ||
18 | side, the peer's certificate must be obtained separately using | ||
19 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. | ||
20 | If the peer did not present a certificate, NULL is returned. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The peer certificate chain is not necessarily available after reusing | ||
25 | a session, in which case a NULL pointer is returned. | ||
26 | |||
27 | The reference count of the STACK_OF(X509) object is not incremented. | ||
28 | If the corresponding session is freed, the pointer must not be used | ||
29 | any longer. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | The following return values can occur: | ||
34 | |||
35 | =over 4 | ||
36 | |||
37 | =item NULL | ||
38 | |||
39 | No certificate was presented by the peer or no connection was established | ||
40 | or the certificate chain is no longer available when a session is reused. | ||
41 | |||
42 | =item Pointer to a STACK_OF(X509) | ||
43 | |||
44 | The return value points to the certificate chain presented by the peer. | ||
45 | |||
46 | =back | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)> | ||
51 | |||
52 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.3 b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.3 new file mode 100644 index 0000000000..7e4ab3fccf --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.3 | |||
@@ -0,0 +1,50 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PEER_CERTIFICATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_peer_certificate | ||
6 | .Nd get the X509 certificate of the peer | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft X509 * | ||
10 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_peer_certificate | ||
13 | returns a pointer to the X509 certificate the peer presented. | ||
14 | If the peer did not present a certificate, | ||
15 | .Dv NULL | ||
16 | is returned. | ||
17 | .Sh NOTES | ||
18 | Due to the protocol definition, a TLS/SSL server will always send a | ||
19 | certificate, if present. | ||
20 | A client will only send a certificate when explicitly requested to do so by the | ||
21 | server (see | ||
22 | .Xr SSL_CTX_set_verify 3 ) . | ||
23 | If an anonymous cipher is used, no certificates are sent. | ||
24 | .Pp | ||
25 | That a certificate is returned does not indicate information about the | ||
26 | verification state. | ||
27 | Use | ||
28 | .Xr SSL_get_verify_result 3 | ||
29 | to check the verification state. | ||
30 | .Pp | ||
31 | The reference count of the | ||
32 | .Vt X509 | ||
33 | object is incremented by one, so that it will not be destroyed when the session | ||
34 | containing the peer certificate is freed. | ||
35 | The | ||
36 | .Vt X509 | ||
37 | object must be explicitly freed using | ||
38 | .Xr X509_free 3 . | ||
39 | .Sh RETURN VALUES | ||
40 | The following return values can occur: | ||
41 | .Bl -tag -width Ds | ||
42 | .It Dv NULL | ||
43 | No certificate was presented by the peer or no connection was established. | ||
44 | .It Pointer to an X509 certificate | ||
45 | The return value points to the certificate presented by the peer. | ||
46 | .El | ||
47 | .Sh SEE ALSO | ||
48 | .Xr ssl 3 , | ||
49 | .Xr SSL_CTX_set_verify 3 , | ||
50 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod b/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod deleted file mode 100644 index ef7c8be180..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_peer_certificate.pod +++ /dev/null | |||
@@ -1,55 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_peer_certificate - get the X509 certificate of the peer | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | X509 *SSL_get_peer_certificate(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_peer_certificate() returns a pointer to the X509 certificate the | ||
16 | peer presented. If the peer did not present a certificate, NULL is returned. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | Due to the protocol definition, a TLS/SSL server will always send a | ||
21 | certificate, if present. A client will only send a certificate when | ||
22 | explicitly requested to do so by the server (see | ||
23 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>). If an anonymous cipher | ||
24 | is used, no certificates are sent. | ||
25 | |||
26 | That a certificate is returned does not indicate information about the | ||
27 | verification state, use L<SSL_get_verify_result(3)|SSL_get_verify_result(3)> | ||
28 | to check the verification state. | ||
29 | |||
30 | The reference count of the X509 object is incremented by one, so that it | ||
31 | will not be destroyed when the session containing the peer certificate is | ||
32 | freed. The X509 object must be explicitly freed using X509_free(). | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | The following return values can occur: | ||
37 | |||
38 | =over 4 | ||
39 | |||
40 | =item NULL | ||
41 | |||
42 | No certificate was presented by the peer or no connection was established. | ||
43 | |||
44 | =item Pointer to an X509 certificate | ||
45 | |||
46 | The return value points to the certificate presented by the peer. | ||
47 | |||
48 | =back | ||
49 | |||
50 | =head1 SEE ALSO | ||
51 | |||
52 | L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
53 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)> | ||
54 | |||
55 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.3 b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.3 new file mode 100644 index 0000000000..b3a72cca29 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.3 | |||
@@ -0,0 +1,41 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_PSK_IDENTITY 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_psk_identity , | ||
6 | .Nm SSL_get_psk_identity_hint | ||
7 | .Nd get PSK client identity and hint | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_get_psk_identity_hint "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_get_psk_identity "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_psk_identity_hint | ||
16 | is used to retrieve the PSK identity hint used during the connection setup | ||
17 | related to | ||
18 | .Vt SSL | ||
19 | object | ||
20 | .Fa ssl . | ||
21 | Similarly, | ||
22 | .Fn SSL_get_psk_identity | ||
23 | is used to retrieve the PSK identity used during the connection setup. | ||
24 | .Sh RETURN VALUES | ||
25 | If | ||
26 | .Pf non- Dv NULL , | ||
27 | .Fn SSL_get_psk_identity_hint | ||
28 | returns the PSK identity hint and | ||
29 | .Fn SSL_get_psk_identity | ||
30 | returns the PSK identity. | ||
31 | Both are | ||
32 | .Dv NULL Ns -terminated. | ||
33 | .Fn SSL_get_psk_identity_hint | ||
34 | may return | ||
35 | .Dv NULL | ||
36 | if no PSK identity hint was used during the connection setup. | ||
37 | .Pp | ||
38 | Note that the return value is valid only during the lifetime of the | ||
39 | .Vt SSL | ||
40 | object | ||
41 | .Fa ssl . | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod b/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod deleted file mode 100644 index 6fc72b31b4..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_psk_identity.pod +++ /dev/null | |||
@@ -1,64 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =begin comment | ||
4 | |||
5 | Copyright 2005 Nokia. All rights reserved. | ||
6 | |||
7 | The portions of the attached software ("Contribution") is developed by | ||
8 | Nokia Corporation and is licensed pursuant to the OpenSSL open source | ||
9 | license. | ||
10 | |||
11 | The Contribution, originally written by Mika Kousa and Pasi Eronen of | ||
12 | Nokia Corporation, consists of the "PSK" (Pre-Shared Key) ciphersuites | ||
13 | support (see RFC 4279) to OpenSSL. | ||
14 | |||
15 | No patent licenses or other rights except those expressly stated in | ||
16 | the OpenSSL open source license shall be deemed granted or received | ||
17 | expressly, by implication, estoppel, or otherwise. | ||
18 | |||
19 | No assurances are provided by Nokia that the Contribution does not | ||
20 | infringe the patent or other intellectual property rights of any third | ||
21 | party or that the license provides you with all the necessary rights | ||
22 | to make use of the Contribution. | ||
23 | |||
24 | THE SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. IN | ||
25 | ADDITION TO THE DISCLAIMERS INCLUDED IN THE LICENSE, NOKIA | ||
26 | SPECIFICALLY DISCLAIMS ANY LIABILITY FOR CLAIMS BROUGHT BY YOU OR ANY | ||
27 | OTHER ENTITY BASED ON INFRINGEMENT OF INTELLECTUAL PROPERTY RIGHTS OR | ||
28 | OTHERWISE. | ||
29 | |||
30 | =end comment | ||
31 | |||
32 | =head1 NAME | ||
33 | |||
34 | SSL_get_psk_identity, SSL_get_psk_identity_hint - get PSK client identity and | ||
35 | hint | ||
36 | |||
37 | |||
38 | =head1 SYNOPSIS | ||
39 | |||
40 | #include <openssl/ssl.h> | ||
41 | |||
42 | const char *SSL_get_psk_identity_hint(const SSL *ssl); | ||
43 | const char *SSL_get_psk_identity(const SSL *ssl); | ||
44 | |||
45 | |||
46 | =head1 DESCRIPTION | ||
47 | |||
48 | SSL_get_psk_identity_hint() is used to retrieve the PSK identity hint | ||
49 | used during the connection setup related to SSL object | ||
50 | B<ssl>. Similarly, SSL_get_psk_identity() is used to retrieve the PSK | ||
51 | identity used during the connection setup. | ||
52 | |||
53 | |||
54 | =head1 RETURN VALUES | ||
55 | |||
56 | If non-B<NULL>, SSL_get_psk_identity_hint() returns the PSK identity | ||
57 | hint and SSL_get_psk_identity() returns the PSK identity. Both are | ||
58 | B<NULL>-terminated. SSL_get_psk_identity_hint() may return B<NULL> if | ||
59 | no PSK identity hint was used during the connection setup. | ||
60 | |||
61 | Note that the return value is valid only during the lifetime of the | ||
62 | SSL object B<ssl>. | ||
63 | |||
64 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_rbio.3 b/src/lib/libssl/src/doc/ssl/SSL_get_rbio.3 new file mode 100644 index 0000000000..a8370d5ef2 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_rbio.3 | |||
@@ -0,0 +1,42 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_RBIO 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_rbio , | ||
6 | .Nm SSL_get_wbio | ||
7 | .Nd get BIO linked to an SSL object | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft BIO * | ||
11 | .Fn SSL_get_rbio "SSL *ssl" | ||
12 | .Ft BIO * | ||
13 | .Fn SSL_get_wbio "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_get_rbio | ||
16 | and | ||
17 | .Fn SSL_get_wbio | ||
18 | return pointers to the | ||
19 | .Vt BIO Ns s | ||
20 | for the read or the write channel, which can be different. | ||
21 | The reference count of the | ||
22 | .Vt BIO | ||
23 | is not incremented. | ||
24 | .Sh RETURN VALUES | ||
25 | The following return values can occur: | ||
26 | .Bl -tag -width Ds | ||
27 | .It Dv NULL | ||
28 | No | ||
29 | .Vt BIO | ||
30 | was connected to the | ||
31 | .Vt SSL | ||
32 | object. | ||
33 | .It Any other pointer | ||
34 | The | ||
35 | .Vt BIO | ||
36 | linked to | ||
37 | .Fa ssl . | ||
38 | .El | ||
39 | .Sh SEE ALSO | ||
40 | .Xr bio 3 , | ||
41 | .Xr ssl 3 , | ||
42 | .Xr SSL_set_bio 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod b/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod deleted file mode 100644 index 08dea6a6cd..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_rbio.pod +++ /dev/null | |||
@@ -1,40 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_rbio, SSL_get_wbio - get BIO linked to an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | BIO *SSL_get_rbio(SSL *ssl); | ||
12 | BIO *SSL_get_wbio(SSL *ssl); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | SSL_get_rbio() and SSL_get_wbio() return pointers to the BIOs for the | ||
17 | read or the write channel, which can be different. The reference count | ||
18 | of the BIO is not incremented. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | The following return values can occur: | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item NULL | ||
27 | |||
28 | No BIO was connected to the SSL object | ||
29 | |||
30 | =item Any other pointer | ||
31 | |||
32 | The BIO linked to B<ssl>. | ||
33 | |||
34 | =back | ||
35 | |||
36 | =head1 SEE ALSO | ||
37 | |||
38 | L<SSL_set_bio(3)|SSL_set_bio(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
39 | |||
40 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_session.3 b/src/lib/libssl/src/doc/ssl/SSL_get_session.3 new file mode 100644 index 0000000000..fe9a6d48ef --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_session.3 | |||
@@ -0,0 +1,94 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_session , | ||
6 | .Nm SSL_get0_session , | ||
7 | .Nm SSL_get1_session | ||
8 | .Nd retrieve TLS/SSL session data | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft SSL_SESSION * | ||
12 | SSL_get_session "const SSL *ssl" | ||
13 | .Ft SSL_SESSION * | ||
14 | SSL_get0_session "const SSL *ssl" | ||
15 | .Ft SSL_SESSION * | ||
16 | SSL_get1_session "SSL *ssl" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_get_session | ||
19 | returns a pointer to the | ||
20 | .Vt SSL_SESSION | ||
21 | actually used in | ||
22 | .Fa ssl . | ||
23 | The reference count of the | ||
24 | .Vt SSL_SESSION | ||
25 | is not incremented, so that the pointer can become invalid by other operations. | ||
26 | .Pp | ||
27 | .Fn SSL_get0_session | ||
28 | is the same as | ||
29 | .Fn SSL_get_session . | ||
30 | .Pp | ||
31 | .Fn SSL_get1_session | ||
32 | is the same as | ||
33 | .Fn SSL_get_session , | ||
34 | but the reference count of the | ||
35 | .Vt SSL_SESSION | ||
36 | is incremented by one. | ||
37 | .Sh NOTES | ||
38 | The | ||
39 | Fa ssl | ||
40 | session contains all information required to re-establish the connection | ||
41 | without a new handshake. | ||
42 | .Pp | ||
43 | .Fn SSL_get0_session | ||
44 | returns a pointer to the actual session. | ||
45 | As the reference counter is not incremented, | ||
46 | the pointer is only valid while the connection is in use. | ||
47 | If | ||
48 | .Xr SSL_clear 3 | ||
49 | or | ||
50 | .Xr SSL_free 3 | ||
51 | is called, the session may be removed completely (if considered bad), | ||
52 | and the pointer obtained will become invalid. | ||
53 | Even if the session is valid, | ||
54 | it can be removed at any time due to timeout during | ||
55 | .Xr SSL_CTX_flush_sessions 3 . | ||
56 | .Pp | ||
57 | If the data is to be kept, | ||
58 | .Fn SSL_get1_session | ||
59 | will increment the reference count, so that the session will not be implicitly | ||
60 | removed by other operations but stays in memory. | ||
61 | In order to remove the session | ||
62 | .Xr SSL_SESSION_free 3 | ||
63 | must be explicitly called once to decrement the reference count again. | ||
64 | .Pp | ||
65 | .Vt SSL_SESSION | ||
66 | objects keep internal link information about the session cache list when being | ||
67 | inserted into one | ||
68 | .Vt SSL_CTX | ||
69 | object's session cache. | ||
70 | One | ||
71 | .Vt SSL_SESSION | ||
72 | object, regardless of its reference count, must therefore only be used with one | ||
73 | .Vt SSL_CTX | ||
74 | object (and the | ||
75 | .Vt SSL | ||
76 | objects created from this | ||
77 | .Vt SSL_CTX | ||
78 | object). | ||
79 | .Sh RETURN VALUES | ||
80 | The following return values can occur: | ||
81 | .Bl -tag -width Ds | ||
82 | .It Dv NULL | ||
83 | There is no session available in | ||
84 | .Fa ssl . | ||
85 | .It Pointer to an Vt SSL | ||
86 | The return value points to the data of an | ||
87 | .Vt SSL | ||
88 | session. | ||
89 | .El | ||
90 | .Sh SEE ALSO | ||
91 | .Xr ssl 3 , | ||
92 | .Xr SSL_clear 3 , | ||
93 | .Xr SSL_free 3 , | ||
94 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod b/src/lib/libssl/src/doc/ssl/SSL_get_session.pod deleted file mode 100644 index 1a30f7bb5f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_session.pod +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_session, SSL_get0_session, SSL_get1_session - retrieve TLS/SSL session data | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL_SESSION *SSL_get_session(const SSL *ssl); | ||
12 | SSL_SESSION *SSL_get0_session(const SSL *ssl); | ||
13 | SSL_SESSION *SSL_get1_session(SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_get_session() returns a pointer to the B<SSL_SESSION> actually used in | ||
18 | B<ssl>. The reference count of the B<SSL_SESSION> is not incremented, so | ||
19 | that the pointer can become invalid by other operations. | ||
20 | |||
21 | SSL_get0_session() is the same as SSL_get_session(). | ||
22 | |||
23 | SSL_get1_session() is the same as SSL_get_session(), but the reference | ||
24 | count of the B<SSL_SESSION> is incremented by one. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | The ssl session contains all information required to re-establish the | ||
29 | connection without a new handshake. | ||
30 | |||
31 | SSL_get0_session() returns a pointer to the actual session. As the | ||
32 | reference counter is not incremented, the pointer is only valid while | ||
33 | the connection is in use. If L<SSL_clear(3)|SSL_clear(3)> or | ||
34 | L<SSL_free(3)|SSL_free(3)> is called, the session may be removed completely | ||
35 | (if considered bad), and the pointer obtained will become invalid. Even | ||
36 | if the session is valid, it can be removed at any time due to timeout | ||
37 | during L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>. | ||
38 | |||
39 | If the data is to be kept, SSL_get1_session() will increment the reference | ||
40 | count, so that the session will not be implicitly removed by other operations | ||
41 | but stays in memory. In order to remove the session | ||
42 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> must be explicitly called once | ||
43 | to decrement the reference count again. | ||
44 | |||
45 | SSL_SESSION objects keep internal link information about the session cache | ||
46 | list, when being inserted into one SSL_CTX object's session cache. | ||
47 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
48 | only be used with one SSL_CTX object (and the SSL objects created | ||
49 | from this SSL_CTX object). | ||
50 | |||
51 | =head1 RETURN VALUES | ||
52 | |||
53 | The following return values can occur: | ||
54 | |||
55 | =over 4 | ||
56 | |||
57 | =item NULL | ||
58 | |||
59 | There is no session available in B<ssl>. | ||
60 | |||
61 | =item Pointer to an SSL | ||
62 | |||
63 | The return value points to the data of an SSL session. | ||
64 | |||
65 | =back | ||
66 | |||
67 | =head1 SEE ALSO | ||
68 | |||
69 | L<ssl(3)|ssl(3)>, L<SSL_free(3)|SSL_free(3)>, | ||
70 | L<SSL_clear(3)|SSL_clear(3)>, | ||
71 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)> | ||
72 | |||
73 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.3 b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.3 new file mode 100644 index 0000000000..3409dc0698 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.3 | |||
@@ -0,0 +1,46 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_VERIFY_RESULT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_verify_result | ||
6 | .Nd get result of peer certificate verification | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft long | ||
10 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_verify_result | ||
13 | returns the result of the verification of the X509 certificate presented by the | ||
14 | peer, if any. | ||
15 | .Sh NOTES | ||
16 | .Fn SSL_get_verify_result | ||
17 | can only return one error code while the verification of a certificate can fail | ||
18 | because of many reasons at the same time. | ||
19 | Only the last verification error that occurred during the processing is | ||
20 | available from | ||
21 | .Fn SSL_get_verify_result . | ||
22 | .Pp | ||
23 | The verification result is part of the established session and is restored when | ||
24 | a session is reused. | ||
25 | .Sh RETURN VALUES | ||
26 | The following return values can currently occur: | ||
27 | .Bl -tag -width Ds | ||
28 | .It Dv X509_V_OK | ||
29 | The verification succeeded or no peer certificate was presented. | ||
30 | .It Any other value | ||
31 | Documented in | ||
32 | .Xr verify 1 . | ||
33 | .El | ||
34 | .Sh SEE ALSO | ||
35 | .Xr verify 1 , | ||
36 | .Xr ssl 3 , | ||
37 | .Xr SSL_get_peer_certificate 3 , | ||
38 | .Xr SSL_set_verify_result 3 | ||
39 | .Sh BUGS | ||
40 | If no peer certificate was presented, the returned result code is | ||
41 | .Dv X509_V_OK . | ||
42 | This is because no verification error occurred; | ||
43 | however, it does not indicate success. | ||
44 | .Fn SSL_get_verify_result | ||
45 | is only useful in connection with | ||
46 | .Xr SSL_get_peer_certificate 3 . | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod b/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod deleted file mode 100644 index 55b56a53f9..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_verify_result.pod +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_verify_result - get result of peer certificate verification | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | long SSL_get_verify_result(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_verify_result() returns the result of the verification of the | ||
16 | X509 certificate presented by the peer, if any. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | SSL_get_verify_result() can only return one error code while the verification | ||
21 | of a certificate can fail because of many reasons at the same time. Only | ||
22 | the last verification error that occurred during the processing is available | ||
23 | from SSL_get_verify_result(). | ||
24 | |||
25 | The verification result is part of the established session and is restored | ||
26 | when a session is reused. | ||
27 | |||
28 | =head1 BUGS | ||
29 | |||
30 | If no peer certificate was presented, the returned result code is | ||
31 | X509_V_OK. This is because no verification error occurred, it does however | ||
32 | not indicate success. SSL_get_verify_result() is only useful in connection | ||
33 | with L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>. | ||
34 | |||
35 | =head1 RETURN VALUES | ||
36 | |||
37 | The following return values can currently occur: | ||
38 | |||
39 | =over 4 | ||
40 | |||
41 | =item X509_V_OK | ||
42 | |||
43 | The verification succeeded or no peer certificate was presented. | ||
44 | |||
45 | =item Any other value | ||
46 | |||
47 | Documented in L<verify(1)|verify(1)>. | ||
48 | |||
49 | =back | ||
50 | |||
51 | =head1 SEE ALSO | ||
52 | |||
53 | L<ssl(3)|ssl(3)>, L<SSL_set_verify_result(3)|SSL_set_verify_result(3)>, | ||
54 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | ||
55 | L<verify(1)|verify(1)> | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_version.3 b/src/lib/libssl/src/doc/ssl/SSL_get_version.3 new file mode 100644 index 0000000000..f8fe406d44 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_get_version.3 | |||
@@ -0,0 +1,32 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_GET_VERSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_get_version | ||
6 | .Nd get the protocol version of a connection. | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft const char * | ||
10 | .Fn SSL_get_version "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_get_version | ||
13 | returns the name of the protocol used for the connection | ||
14 | .Fa ssl . | ||
15 | .Sh RETURN VALUES | ||
16 | The following strings can be returned: | ||
17 | .Bl -tag -width Ds | ||
18 | .It Qq SSLv2 | ||
19 | The connection uses the SSLv2 protocol. | ||
20 | .It Qq SSLv3 | ||
21 | The connection uses the SSLv3 protocol. | ||
22 | .It Qq TLSv1 | ||
23 | The connection uses the TLSv1.0 protocol. | ||
24 | .It Qq TLSv1.1 | ||
25 | The connection uses the TLSv1.1 protocol. | ||
26 | .It Qq TLSv1.2 | ||
27 | The connection uses the TLSv1.2 protocol. | ||
28 | .It Qq unknown | ||
29 | This indicates that no version has been set (no connection established). | ||
30 | .El | ||
31 | .Sh SEE ALSO | ||
32 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_get_version.pod b/src/lib/libssl/src/doc/ssl/SSL_get_version.pod deleted file mode 100644 index 9ae6f25508..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_get_version.pod +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_get_version - get the protocol version of a connection. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | const char *SSL_get_version(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_get_version() returns the name of the protocol used for the | ||
16 | connection B<ssl>. | ||
17 | |||
18 | =head1 RETURN VALUES | ||
19 | |||
20 | The following strings can be returned: | ||
21 | |||
22 | =over 4 | ||
23 | |||
24 | =item SSLv2 | ||
25 | |||
26 | The connection uses the SSLv2 protocol. | ||
27 | |||
28 | =item SSLv3 | ||
29 | |||
30 | The connection uses the SSLv3 protocol. | ||
31 | |||
32 | =item TLSv1 | ||
33 | |||
34 | The connection uses the TLSv1.0 protocol. | ||
35 | |||
36 | =item TLSv1.1 | ||
37 | |||
38 | The connection uses the TLSv1.1 protocol. | ||
39 | |||
40 | =item TLSv1.2 | ||
41 | |||
42 | The connection uses the TLSv1.2 protocol. | ||
43 | |||
44 | =item unknown | ||
45 | |||
46 | This indicates that no version has been set (no connection established). | ||
47 | |||
48 | =back | ||
49 | |||
50 | =head1 SEE ALSO | ||
51 | |||
52 | L<ssl(3)|ssl(3)> | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_library_init.3 b/src/lib/libssl/src/doc/ssl/SSL_library_init.3 new file mode 100644 index 0000000000..0644ebd987 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_library_init.3 | |||
@@ -0,0 +1,51 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_LIBRARY_INIT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_library_init , | ||
6 | .Nm OpenSSL_add_ssl_algorithms , | ||
7 | .Nm SSLeay_add_ssl_algorithms | ||
8 | .Nd initialize SSL library by registering algorithms | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_library_init void | ||
13 | .Fd #define OpenSSL_add_ssl_algorithms() SSL_library_init() | ||
14 | .Fd #define SSLeay_add_ssl_algorithms() SSL_library_init() | ||
15 | .Sh DESCRIPTION | ||
16 | .Fn SSL_library_init | ||
17 | registers the available SSL/TLS ciphers and digests. | ||
18 | .Pp | ||
19 | .Fn OpenSSL_add_ssl_algorithms | ||
20 | and | ||
21 | .Fn SSLeay_add_ssl_algorithms | ||
22 | are synonyms for | ||
23 | .Fn SSL_library_init . | ||
24 | .Sh NOTES | ||
25 | .Fn SSL_library_init | ||
26 | must be called before any other action takes place. | ||
27 | .Fn SSL_library_init | ||
28 | is not reentrant. | ||
29 | .Sh WARNING | ||
30 | .Fn SSL_library_init | ||
31 | adds ciphers and digests used directly and indirectly by SSL/TLS. | ||
32 | .Sh RETURN VALUES | ||
33 | .Fn SSL_library_init | ||
34 | always returns 1, so it is safe to discard the return value. | ||
35 | .Sh EXAMPLES | ||
36 | A typical TLS/SSL application will start with the library initialization, and | ||
37 | provide readable error messages. | ||
38 | .Bd -literal | ||
39 | SSL_load_error_strings(); /* readable error messages */ | ||
40 | SSL_library_init(); /* initialize library */ | ||
41 | .Ed | ||
42 | .Sh NOTES | ||
43 | OpenSSL 0.9.8o and 1.0.0a and later added SHA2 algorithms to | ||
44 | .Fn SSL_library_init . | ||
45 | Applications which need to use SHA2 in earlier versions of OpenSSL should call | ||
46 | .Fn OpenSSL_add_all_algorithms | ||
47 | as well. | ||
48 | .Sh SEE ALSO | ||
49 | .Xr RAND_add 3 , | ||
50 | .Xr ssl 3 , | ||
51 | .Xr SSL_load_error_strings 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_library_init.pod b/src/lib/libssl/src/doc/ssl/SSL_library_init.pod deleted file mode 100644 index 4767c0ba8b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_library_init.pod +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_library_init, OpenSSL_add_ssl_algorithms, SSLeay_add_ssl_algorithms | ||
6 | - initialize SSL library by registering algorithms | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_library_init(void); | ||
13 | #define OpenSSL_add_ssl_algorithms() SSL_library_init() | ||
14 | #define SSLeay_add_ssl_algorithms() SSL_library_init() | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_library_init() registers the available SSL/TLS ciphers and digests. | ||
19 | |||
20 | OpenSSL_add_ssl_algorithms() and SSLeay_add_ssl_algorithms() are synonyms | ||
21 | for SSL_library_init(). | ||
22 | |||
23 | =head1 NOTES | ||
24 | |||
25 | SSL_library_init() must be called before any other action takes place. | ||
26 | SSL_library_init() is not reentrant. | ||
27 | |||
28 | =head1 WARNING | ||
29 | |||
30 | SSL_library_init() adds ciphers and digests used directly and indirectly by | ||
31 | SSL/TLS. | ||
32 | |||
33 | =head1 EXAMPLES | ||
34 | |||
35 | A typical TLS/SSL application will start with the library initialization, | ||
36 | and provide readable error messages. | ||
37 | |||
38 | SSL_load_error_strings(); /* readable error messages */ | ||
39 | SSL_library_init(); /* initialize library */ | ||
40 | |||
41 | =head1 RETURN VALUES | ||
42 | |||
43 | SSL_library_init() always returns "1", so it is safe to discard the return | ||
44 | value. | ||
45 | |||
46 | =head1 NOTES | ||
47 | |||
48 | OpenSSL 0.9.8o and 1.0.0a and later added SHA2 algorithms to SSL_library_init(). | ||
49 | Applications which need to use SHA2 in earlier versions of OpenSSL should call | ||
50 | OpenSSL_add_all_algorithms() as well. | ||
51 | |||
52 | =head1 SEE ALSO | ||
53 | |||
54 | L<ssl(3)|ssl(3)>, L<SSL_load_error_strings(3)|SSL_load_error_strings(3)>, | ||
55 | L<RAND_add(3)|RAND_add(3)> | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.3 b/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.3 new file mode 100644 index 0000000000..52d21e8e31 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.3 | |||
@@ -0,0 +1,50 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_LOAD_CLIENT_CA_FILE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_load_client_CA_file | ||
6 | .Nd load certificate names from file | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft STACK_OF(X509_NAME) * | ||
10 | .Fn SSL_load_client_CA_file "const char *file" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_load_client_CA_file | ||
13 | reads certificates from | ||
14 | .Fa file | ||
15 | and returns a | ||
16 | .Dv STACK_OF Ns | ||
17 | .Pq Vt X509_NAME | ||
18 | with the subject names found. | ||
19 | .Sh NOTES | ||
20 | .Fn SSL_load_client_CA_file | ||
21 | reads a file of PEM formatted certificates and extracts the | ||
22 | .Vt X509_NAME Ns s | ||
23 | of the certificates found. | ||
24 | While the name suggests the specific usage as support function for | ||
25 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
26 | it is not limited to CA certificates. | ||
27 | .Sh RETURN VALUES | ||
28 | The following return values can occur: | ||
29 | .Bl -tag -width Ds | ||
30 | .It Dv NULL | ||
31 | The operation failed, check out the error stack for the reason. | ||
32 | .It Pointer to Dv STACK_OF Ns Po Vt X509_NAME Pc | ||
33 | Pointer to the subject names of the successfully read certificates. | ||
34 | .El | ||
35 | .Sh EXAMPLES | ||
36 | Load names of CAs from file and use it as a client CA list: | ||
37 | .Bd -literal | ||
38 | SSL_CTX *ctx; | ||
39 | STACK_OF(X509_NAME) *cert_names; | ||
40 | \&... | ||
41 | cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem"); | ||
42 | if (cert_names != NULL) | ||
43 | SSL_CTX_set_client_CA_list(ctx, cert_names); | ||
44 | else | ||
45 | error_handling(); | ||
46 | \&... | ||
47 | .Ed | ||
48 | .Sh SEE ALSO | ||
49 | .Xr ssl 3 , | ||
50 | .Xr SSL_CTX_set_client_CA_list 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.pod b/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.pod deleted file mode 100644 index 5aa2b73447..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_load_client_CA_file.pod +++ /dev/null | |||
@@ -1,62 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_load_client_CA_file - load certificate names from file | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | STACK_OF(X509_NAME) *SSL_load_client_CA_file(const char *file); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_load_client_CA_file() reads certificates from B<file> and returns | ||
16 | a STACK_OF(X509_NAME) with the subject names found. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | SSL_load_client_CA_file() reads a file of PEM formatted certificates and | ||
21 | extracts the X509_NAMES of the certificates found. While the name suggests | ||
22 | the specific usage as support function for | ||
23 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | ||
24 | it is not limited to CA certificates. | ||
25 | |||
26 | =head1 EXAMPLES | ||
27 | |||
28 | Load names of CAs from file and use it as a client CA list: | ||
29 | |||
30 | SSL_CTX *ctx; | ||
31 | STACK_OF(X509_NAME) *cert_names; | ||
32 | |||
33 | ... | ||
34 | cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem"); | ||
35 | if (cert_names != NULL) | ||
36 | SSL_CTX_set_client_CA_list(ctx, cert_names); | ||
37 | else | ||
38 | error_handling(); | ||
39 | ... | ||
40 | |||
41 | =head1 RETURN VALUES | ||
42 | |||
43 | The following return values can occur: | ||
44 | |||
45 | =over 4 | ||
46 | |||
47 | =item NULL | ||
48 | |||
49 | The operation failed, check out the error stack for the reason. | ||
50 | |||
51 | =item Pointer to STACK_OF(X509_NAME) | ||
52 | |||
53 | Pointer to the subject names of the successfully read certificates. | ||
54 | |||
55 | =back | ||
56 | |||
57 | =head1 SEE ALSO | ||
58 | |||
59 | L<ssl(3)|ssl(3)>, | ||
60 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)> | ||
61 | |||
62 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_new.3 b/src/lib/libssl/src/doc/ssl/SSL_new.3 new file mode 100644 index 0000000000..3c5b303bbb --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_new.3 | |||
@@ -0,0 +1,38 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_NEW 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_new | ||
6 | .Nd create a new SSL structure for a connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft SSL * | ||
10 | .Fn SSL_new "SSL_CTX *ctx" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_new | ||
13 | creates a new | ||
14 | .Vt SSL | ||
15 | structure which is needed to hold the data for a TLS/SSL connection. | ||
16 | The new structure inherits the settings of the underlying context | ||
17 | .Fa ctx : | ||
18 | connection method (SSLv2/v3/TLSv1), options, verification settings, | ||
19 | timeout settings. | ||
20 | .Sh RETURN VALUES | ||
21 | The following return values can occur: | ||
22 | .Bl -tag -width Ds | ||
23 | .It Dv NULL | ||
24 | The creation of a new | ||
25 | .Vt SSL | ||
26 | structure failed. | ||
27 | Check the error stack to find out the reason. | ||
28 | .It Pointer to an Vt SSL No structure | ||
29 | The return value points to an allocated | ||
30 | .Vt SSL | ||
31 | structure. | ||
32 | .El | ||
33 | .Sh SEE ALSO | ||
34 | .Xr ssl 3 , | ||
35 | .Xr SSL_clear 3 , | ||
36 | .Xr SSL_CTX_set_options 3 , | ||
37 | .Xr SSL_free 3 , | ||
38 | .Xr SSL_get_SSL_CTX 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_new.pod b/src/lib/libssl/src/doc/ssl/SSL_new.pod deleted file mode 100644 index 25300e978f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_new.pod +++ /dev/null | |||
@@ -1,44 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_new - create a new SSL structure for a connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | SSL *SSL_new(SSL_CTX *ctx); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_new() creates a new B<SSL> structure which is needed to hold the | ||
16 | data for a TLS/SSL connection. The new structure inherits the settings | ||
17 | of the underlying context B<ctx>: connection method (SSLv2/v3/TLSv1), | ||
18 | options, verification settings, timeout settings. | ||
19 | |||
20 | =head1 RETURN VALUES | ||
21 | |||
22 | The following return values can occur: | ||
23 | |||
24 | =over 4 | ||
25 | |||
26 | =item NULL | ||
27 | |||
28 | The creation of a new SSL structure failed. Check the error stack to | ||
29 | find out the reason. | ||
30 | |||
31 | =item Pointer to an SSL structure | ||
32 | |||
33 | The return value points to an allocated SSL structure. | ||
34 | |||
35 | =back | ||
36 | |||
37 | =head1 SEE ALSO | ||
38 | |||
39 | L<SSL_free(3)|SSL_free(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
40 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
41 | L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, | ||
42 | L<ssl(3)|ssl(3)> | ||
43 | |||
44 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_pending.3 b/src/lib/libssl/src/doc/ssl/SSL_pending.3 new file mode 100644 index 0000000000..e07ba48283 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_pending.3 | |||
@@ -0,0 +1,41 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_PENDING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_pending | ||
6 | .Nd obtain number of readable bytes buffered in an SSL object | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_pending "const SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_pending | ||
13 | returns the number of bytes which are available inside | ||
14 | .Fa ssl | ||
15 | for immediate read. | ||
16 | .Sh NOTES | ||
17 | Data are received in blocks from the peer. | ||
18 | Therefore data can be buffered inside | ||
19 | .Fa ssl | ||
20 | and are ready for immediate retrieval with | ||
21 | .Xr SSL_read 3 . | ||
22 | .Sh RETURN VALUES | ||
23 | The number of bytes pending is returned. | ||
24 | .Sh SEE ALSO | ||
25 | .Xr ssl 3 , | ||
26 | .Xr SSL_read 3 | ||
27 | .Sh BUGS | ||
28 | .Fn SSL_pending | ||
29 | takes into account only bytes from the TLS/SSL record that is currently being | ||
30 | processed (if any). | ||
31 | If the | ||
32 | .Vt SSL | ||
33 | object's | ||
34 | .Em read_ahead | ||
35 | flag is set, additional protocol bytes may have been read containing more | ||
36 | TLS/SSL records; these are ignored by | ||
37 | .Fn SSL_pending . | ||
38 | .Pp | ||
39 | Up to OpenSSL 0.9.6, | ||
40 | .Fn SSL_pending | ||
41 | does not check if the record type of pending data is application data. | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_pending.pod b/src/lib/libssl/src/doc/ssl/SSL_pending.pod deleted file mode 100644 index 43f2874e8b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_pending.pod +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_pending - obtain number of readable bytes buffered in an SSL object | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_pending(const SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_pending() returns the number of bytes which are available inside | ||
16 | B<ssl> for immediate read. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | Data are received in blocks from the peer. Therefore data can be buffered | ||
21 | inside B<ssl> and are ready for immediate retrieval with | ||
22 | L<SSL_read(3)|SSL_read(3)>. | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | The number of bytes pending is returned. | ||
27 | |||
28 | =head1 BUGS | ||
29 | |||
30 | SSL_pending() takes into account only bytes from the TLS/SSL record | ||
31 | that is currently being processed (if any). If the B<SSL> object's | ||
32 | I<read_ahead> flag is set, additional protocol bytes may have been | ||
33 | read containing more TLS/SSL records; these are ignored by | ||
34 | SSL_pending(). | ||
35 | |||
36 | Up to OpenSSL 0.9.6, SSL_pending() does not check if the record type | ||
37 | of pending data is application data. | ||
38 | |||
39 | =head1 SEE ALSO | ||
40 | |||
41 | L<SSL_read(3)|SSL_read(3)>, L<ssl(3)|ssl(3)> | ||
42 | |||
43 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_read.3 b/src/lib/libssl/src/doc/ssl/SSL_read.3 new file mode 100644 index 0000000000..aed39c300f --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_read.3 | |||
@@ -0,0 +1,190 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_READ 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_read | ||
6 | .Nd read bytes from a TLS/SSL connection. | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_read | ||
13 | tries to read | ||
14 | .Fa num | ||
15 | bytes from the specified | ||
16 | .Fa ssl | ||
17 | into the buffer | ||
18 | .Fa buf . | ||
19 | .Sh NOTES | ||
20 | If necessary, | ||
21 | .Fn SSL_read | ||
22 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
23 | .Xr SSL_connect 3 | ||
24 | or | ||
25 | .Xr SSL_accept 3 . | ||
26 | If the peer requests a re-negotiation, | ||
27 | it will be performed transparently during the | ||
28 | .Fn SSL_read | ||
29 | operation. | ||
30 | The behaviour of | ||
31 | .Fn SSL_read | ||
32 | depends on the underlying | ||
33 | .Vt BIO . | ||
34 | .Pp | ||
35 | For the transparent negotiation to succeed, the | ||
36 | .Fa ssl | ||
37 | must have been initialized to client or server mode. | ||
38 | This is being done by calling | ||
39 | .Xr SSL_set_connect_state 3 | ||
40 | or | ||
41 | .Xr SSL_set_accept_state 3 | ||
42 | before the first call to | ||
43 | .Fn SSL_read | ||
44 | or | ||
45 | .Xr SSL_write 3 . | ||
46 | .Pp | ||
47 | .Fn SSL_read | ||
48 | works based on the SSL/TLS records. | ||
49 | The data are received in records (with a maximum record size of 16kB for | ||
50 | SSLv3/TLSv1). | ||
51 | Only after a record has been completely received can it be processed | ||
52 | (decrypted and checked for integrity). | ||
53 | Therefore data not retrieved at the last call of | ||
54 | .Fn SSL_read | ||
55 | can still be buffered inside the SSL layer and will be retrieved on the next | ||
56 | call to | ||
57 | .Fn SSL_read . | ||
58 | If | ||
59 | .Fa num | ||
60 | is higher than the number of bytes buffered, | ||
61 | .Fn SSL_read | ||
62 | will return with the bytes buffered. | ||
63 | If no more bytes are in the buffer, | ||
64 | .Fn SSL_read | ||
65 | will trigger the processing of the next record. | ||
66 | Only when the record has been received and processed completely will | ||
67 | .Fn SSL_read | ||
68 | return reporting success. | ||
69 | At most the contents of the record will be returned. | ||
70 | As the size of an SSL/TLS record may exceed the maximum packet size of the | ||
71 | underlying transport (e.g., TCP), it may be necessary to read several packets | ||
72 | from the transport layer before the record is complete and | ||
73 | .Fn SSL_read | ||
74 | can succeed. | ||
75 | .Pp | ||
76 | If the underlying | ||
77 | .Vt BIO | ||
78 | is | ||
79 | .Em blocking , | ||
80 | .Fn SSL_read | ||
81 | will only return once the read operation has been finished or an error | ||
82 | has occurred, except when a renegotiation take place, in which case a | ||
83 | .Dv SSL_ERROR_WANT_READ | ||
84 | may occur. | ||
85 | This behavior can be controlled with the | ||
86 | .Dv SSL_MODE_AUTO_RETRY | ||
87 | flag of the | ||
88 | .Xr SSL_CTX_set_mode 3 | ||
89 | call. | ||
90 | .Pp | ||
91 | If the underlying | ||
92 | .Vt BIO | ||
93 | is | ||
94 | .Em non-blocking , | ||
95 | .Fn SSL_read | ||
96 | will also return when the underlying | ||
97 | .Vt BIO | ||
98 | could not satisfy the needs of | ||
99 | .Fn SSL_read | ||
100 | to continue the operation. | ||
101 | In this case a call to | ||
102 | .Xr SSL_get_error 3 | ||
103 | with the return value of | ||
104 | .Fn SSL_read | ||
105 | will yield | ||
106 | .Dv SSL_ERROR_WANT_READ | ||
107 | or | ||
108 | .Dv SSL_ERROR_WANT_WRITE . | ||
109 | As at any time a re-negotiation is possible, a call to | ||
110 | .Fn SSL_read | ||
111 | can also cause write operations! | ||
112 | The calling process then must repeat the call after taking appropriate action | ||
113 | to satisfy the needs of | ||
114 | .Fn SSL_read . | ||
115 | The action depends on the underlying | ||
116 | .Vt BIO . | ||
117 | When using a non-blocking socket, nothing is to be done, but | ||
118 | .Xr select 2 | ||
119 | can be used to check for the required condition. | ||
120 | When using a buffering | ||
121 | .Vt BIO , | ||
122 | like a | ||
123 | .Vt BIO | ||
124 | pair, data must be written into or retrieved out of the | ||
125 | .Vt BIO | ||
126 | before being able to continue. | ||
127 | .Pp | ||
128 | .Xr SSL_pending 3 | ||
129 | can be used to find out whether there are buffered bytes available for | ||
130 | immediate retrieval. | ||
131 | In this case | ||
132 | .Fn SSL_read | ||
133 | can be called without blocking or actually receiving new data from the | ||
134 | underlying socket. | ||
135 | .Sh WARNING | ||
136 | When an | ||
137 | .Fn SSL_read | ||
138 | operation has to be repeated because of | ||
139 | .Dv SSL_ERROR_WANT_READ | ||
140 | or | ||
141 | .Dv SSL_ERROR_WANT_WRITE , | ||
142 | it must be repeated with the same arguments. | ||
143 | .Sh RETURN VALUES | ||
144 | The following return values can occur: | ||
145 | .Bl -tag -width Ds | ||
146 | .It >0 | ||
147 | The read operation was successful; the return value is the number of bytes | ||
148 | actually read from the TLS/SSL connection. | ||
149 | .It 0 | ||
150 | The read operation was not successful. | ||
151 | The reason may either be a clean shutdown due to a | ||
152 | .Dq close notify | ||
153 | alert sent by the peer (in which case the | ||
154 | .Dv SSL_RECEIVED_SHUTDOWN | ||
155 | flag in the ssl shutdown state is set (see | ||
156 | .Xr SSL_shutdown 3 | ||
157 | and | ||
158 | .Xr SSL_set_shutdown 3 ) . | ||
159 | It is also possible that the peer simply shut down the underlying transport and | ||
160 | the shutdown is incomplete. | ||
161 | Call | ||
162 | .Fn SSL_get_error | ||
163 | with the return value to find out whether an error occurred or the connection | ||
164 | was shut down cleanly | ||
165 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
166 | .Pp | ||
167 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
168 | be detected whether the underlying connection was closed. | ||
169 | It cannot be checked whether the closure was initiated by the peer or by | ||
170 | something else. | ||
171 | .It <0 | ||
172 | The read operation was not successful, because either an error occurred or | ||
173 | action must be taken by the calling process. | ||
174 | Call | ||
175 | .Fn SSL_get_error | ||
176 | with the return value to find out the reason. | ||
177 | .El | ||
178 | .Sh SEE ALSO | ||
179 | .Xr bio 3 , | ||
180 | .Xr ssl 3 , | ||
181 | .Xr SSL_accept 3 , | ||
182 | .Xr SSL_connect 3 , | ||
183 | .Xr SSL_CTX_new 3 , | ||
184 | .Xr SSL_CTX_set_mode 3 , | ||
185 | .Xr SSL_get_error 3 , | ||
186 | .Xr SSL_pending 3 , | ||
187 | .Xr SSL_set_connect_state 3 , | ||
188 | .Xr SSL_set_shutdown 3 , | ||
189 | .Xr SSL_shutdown 3 , | ||
190 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_read.pod b/src/lib/libssl/src/doc/ssl/SSL_read.pod deleted file mode 100644 index 57dfbdfc28..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_read.pod +++ /dev/null | |||
@@ -1,124 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_read - read bytes from a TLS/SSL connection. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_read(SSL *ssl, void *buf, int num); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_read() tries to read B<num> bytes from the specified B<ssl> into the | ||
16 | buffer B<buf>. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | If necessary, SSL_read() will negotiate a TLS/SSL session, if | ||
21 | not already explicitly performed by L<SSL_connect(3)|SSL_connect(3)> or | ||
22 | L<SSL_accept(3)|SSL_accept(3)>. If the | ||
23 | peer requests a re-negotiation, it will be performed transparently during | ||
24 | the SSL_read() operation. The behaviour of SSL_read() depends on the | ||
25 | underlying BIO. | ||
26 | |||
27 | For the transparent negotiation to succeed, the B<ssl> must have been | ||
28 | initialized to client or server mode. This is being done by calling | ||
29 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() | ||
30 | before the first call to an SSL_read() or L<SSL_write(3)|SSL_write(3)> | ||
31 | function. | ||
32 | |||
33 | SSL_read() works based on the SSL/TLS records. The data are received in | ||
34 | records (with a maximum record size of 16kB for SSLv3/TLSv1). Only when a | ||
35 | record has been completely received, it can be processed (decryption and | ||
36 | check of integrity). Therefore data that was not retrieved at the last | ||
37 | call of SSL_read() can still be buffered inside the SSL layer and will be | ||
38 | retrieved on the next call to SSL_read(). If B<num> is higher than the | ||
39 | number of bytes buffered, SSL_read() will return with the bytes buffered. | ||
40 | If no more bytes are in the buffer, SSL_read() will trigger the processing | ||
41 | of the next record. Only when the record has been received and processed | ||
42 | completely, SSL_read() will return reporting success. At most the contents | ||
43 | of the record will be returned. As the size of an SSL/TLS record may exceed | ||
44 | the maximum packet size of the underlying transport (e.g. TCP), it may | ||
45 | be necessary to read several packets from the transport layer before the | ||
46 | record is complete and SSL_read() can succeed. | ||
47 | |||
48 | If the underlying BIO is B<blocking>, SSL_read() will only return, once the | ||
49 | read operation has been finished or an error occurred, except when a | ||
50 | renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. | ||
51 | This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the | ||
52 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call. | ||
53 | |||
54 | If the underlying BIO is B<non-blocking>, SSL_read() will also return | ||
55 | when the underlying BIO could not satisfy the needs of SSL_read() | ||
56 | to continue the operation. In this case a call to | ||
57 | L<SSL_get_error(3)|SSL_get_error(3)> with the | ||
58 | return value of SSL_read() will yield B<SSL_ERROR_WANT_READ> or | ||
59 | B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a | ||
60 | call to SSL_read() can also cause write operations! The calling process | ||
61 | then must repeat the call after taking appropriate action to satisfy the | ||
62 | needs of SSL_read(). The action depends on the underlying BIO. When using a | ||
63 | non-blocking socket, nothing is to be done, but select() can be used to check | ||
64 | for the required condition. When using a buffering BIO, like a BIO pair, data | ||
65 | must be written into or retrieved out of the BIO before being able to continue. | ||
66 | |||
67 | L<SSL_pending(3)|SSL_pending(3)> can be used to find out whether there | ||
68 | are buffered bytes available for immediate retrieval. In this case | ||
69 | SSL_read() can be called without blocking or actually receiving new | ||
70 | data from the underlying socket. | ||
71 | |||
72 | =head1 WARNING | ||
73 | |||
74 | When an SSL_read() operation has to be repeated because of | ||
75 | B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated | ||
76 | with the same arguments. | ||
77 | |||
78 | =head1 RETURN VALUES | ||
79 | |||
80 | The following return values can occur: | ||
81 | |||
82 | =over 4 | ||
83 | |||
84 | =item C<E<gt>0> | ||
85 | |||
86 | The read operation was successful; the return value is the number of | ||
87 | bytes actually read from the TLS/SSL connection. | ||
88 | |||
89 | =item C<0> | ||
90 | |||
91 | The read operation was not successful. The reason may either be a clean | ||
92 | shutdown due to a "close notify" alert sent by the peer (in which case | ||
93 | the SSL_RECEIVED_SHUTDOWN flag in the ssl shutdown state is set | ||
94 | (see L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
95 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>). It is also possible, that | ||
96 | the peer simply shut down the underlying transport and the shutdown is | ||
97 | incomplete. Call SSL_get_error() with the return value B<ret> to find out, | ||
98 | whether an error occurred or the connection was shut down cleanly | ||
99 | (SSL_ERROR_ZERO_RETURN). | ||
100 | |||
101 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can | ||
102 | only be detected, whether the underlying connection was closed. It cannot | ||
103 | be checked, whether the closure was initiated by the peer or by something | ||
104 | else. | ||
105 | |||
106 | =item C<E<lt>0> | ||
107 | |||
108 | The read operation was not successful, because either an error occurred | ||
109 | or action must be taken by the calling process. Call SSL_get_error() with the | ||
110 | return value B<ret> to find out the reason. | ||
111 | |||
112 | =back | ||
113 | |||
114 | =head1 SEE ALSO | ||
115 | |||
116 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_write(3)|SSL_write(3)>, | ||
117 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
118 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> | ||
119 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | ||
120 | L<SSL_pending(3)|SSL_pending(3)>, | ||
121 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
122 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
123 | |||
124 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_rstate_string.3 b/src/lib/libssl/src/doc/ssl/SSL_rstate_string.3 new file mode 100644 index 0000000000..77fcd06eac --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_rstate_string.3 | |||
@@ -0,0 +1,52 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_RSTATE_STRING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_rstate_string , | ||
6 | .Nm SSL_rstate_string_long | ||
7 | .Nd get textual description of state of an SSL object during read operation | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_rstate_string "SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_rstate_string | ||
16 | returns a 2-letter string indicating the current read state of the | ||
17 | .Vt SSL | ||
18 | object | ||
19 | .Fa ssl . | ||
20 | .Pp | ||
21 | .Fn SSL_rstate_string_long | ||
22 | returns a string indicating the current read state of the | ||
23 | .Vt SSL | ||
24 | object | ||
25 | .Fa ssl . | ||
26 | .Sh NOTES | ||
27 | When performing a read operation, the SSL/TLS engine must parse the record, | ||
28 | consisting of header and body. | ||
29 | When working in a blocking environment, | ||
30 | .Fn SSL_rstate_string[_long] | ||
31 | should always return | ||
32 | .Qo RD Qc Ns / Ns Qo read done Qc . | ||
33 | .Pp | ||
34 | This function should only seldom be needed in applications. | ||
35 | .Sh RETURN VALUES | ||
36 | .Fn SSL_rstate_string | ||
37 | and | ||
38 | .Fn SSL_rstate_string_long | ||
39 | can return the following values: | ||
40 | .Bl -tag -width Ds | ||
41 | .It Qo RH Qc Ns / Ns Qo read header Qc | ||
42 | The header of the record is being evaluated. | ||
43 | .It Qo RB Qc Ns / Ns Qo read body Qc | ||
44 | The body of the record is being evaluated. | ||
45 | .It Qo RD Qc Ns / Ns Qo read done Qc | ||
46 | The record has been completely processed. | ||
47 | .It Qo unknown Qc Ns / Ns Qo unknown Qc | ||
48 | The read state is unknown. | ||
49 | This should never happen. | ||
50 | .El | ||
51 | .Sh SEE ALSO | ||
52 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod b/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod deleted file mode 100644 index af72642210..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_rstate_string.pod +++ /dev/null | |||
@@ -1,60 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_rstate_string, SSL_rstate_string_long - get textual description of state of | ||
6 | an SSL object during read operation | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | const char *SSL_rstate_string(SSL *ssl); | ||
13 | const char *SSL_rstate_string_long(SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_rstate_string() returns a 2 letter string indicating the current read state | ||
18 | of the SSL object B<ssl>. | ||
19 | |||
20 | SSL_rstate_string_long() returns a string indicating the current read state of | ||
21 | the SSL object B<ssl>. | ||
22 | |||
23 | =head1 NOTES | ||
24 | |||
25 | When performing a read operation, the SSL/TLS engine must parse the record, | ||
26 | consisting of header and body. When working in a blocking environment, | ||
27 | SSL_rstate_string[_long]() should always return "RD"/"read done". | ||
28 | |||
29 | This function should only seldom be needed in applications. | ||
30 | |||
31 | =head1 RETURN VALUES | ||
32 | |||
33 | SSL_rstate_string() and SSL_rstate_string_long() can return the following | ||
34 | values: | ||
35 | |||
36 | =over 4 | ||
37 | |||
38 | =item "RH"/"read header" | ||
39 | |||
40 | The header of the record is being evaluated. | ||
41 | |||
42 | =item "RB"/"read body" | ||
43 | |||
44 | The body of the record is being evaluated. | ||
45 | |||
46 | =item "RD"/"read done" | ||
47 | |||
48 | The record has been completely processed. | ||
49 | |||
50 | =item "unknown"/"unknown" | ||
51 | |||
52 | The read state is unknown. This should never happen. | ||
53 | |||
54 | =back | ||
55 | |||
56 | =head1 SEE ALSO | ||
57 | |||
58 | L<ssl(3)|ssl(3)> | ||
59 | |||
60 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_session_reused.3 b/src/lib/libssl/src/doc/ssl/SSL_session_reused.3 new file mode 100644 index 0000000000..40a88cd881 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_session_reused.3 | |||
@@ -0,0 +1,29 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SESSION_REUSED 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_session_reused | ||
6 | .Nd query whether a reused session was negotiated during handshake | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_session_reused "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | Query whether a reused session was negotiated during the handshake. | ||
13 | .Sh NOTES | ||
14 | During the negotiation, a client can propose to reuse a session. | ||
15 | The server then looks up the session in its cache. | ||
16 | If both client and server agree on the session, | ||
17 | it will be reused and a flag is set that can be queried by the application. | ||
18 | .Sh RETURN VALUES | ||
19 | The following return values can occur: | ||
20 | .Bl -tag -width Ds | ||
21 | .It 0 | ||
22 | A new session was negotiated. | ||
23 | .It 1 | ||
24 | A session was reused. | ||
25 | .El | ||
26 | .Sh SEE ALSO | ||
27 | .Xr ssl 3 , | ||
28 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
29 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod b/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod deleted file mode 100644 index ef30d82e3d..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_session_reused.pod +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_session_reused - query whether a reused session was negotiated during | ||
6 | handshake | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_session_reused(SSL *ssl); | ||
13 | |||
14 | =head1 DESCRIPTION | ||
15 | |||
16 | Query, whether a reused session was negotiated during the handshake. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | During the negotiation, a client can propose to reuse a session. The server | ||
21 | then looks up the session in its cache. If both client and server agree | ||
22 | on the session, it will be reused and a flag is being set that can be | ||
23 | queried by the application. | ||
24 | |||
25 | =head1 RETURN VALUES | ||
26 | |||
27 | The following return values can occur: | ||
28 | |||
29 | =over 4 | ||
30 | |||
31 | =item C<0> | ||
32 | |||
33 | A new session was negotiated. | ||
34 | |||
35 | =item C<1> | ||
36 | |||
37 | A session was reused. | ||
38 | |||
39 | =back | ||
40 | |||
41 | =head1 SEE ALSO | ||
42 | |||
43 | L<ssl(3)|ssl(3)>, L<SSL_set_session(3)|SSL_set_session(3)>, | ||
44 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | ||
45 | |||
46 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_bio.3 b/src/lib/libssl/src/doc/ssl/SSL_set_bio.3 new file mode 100644 index 0000000000..62bc22370d --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_bio.3 | |||
@@ -0,0 +1,48 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_BIO 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_bio | ||
6 | .Nd connect the SSL object with a BIO | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_bio | ||
13 | connects the | ||
14 | .Vt BIO Ns | ||
15 | s | ||
16 | .Fa rbio | ||
17 | and | ||
18 | .Fa wbio | ||
19 | for the read and write operations of the TLS/SSL (encrypted) side of | ||
20 | .Fa ssl . | ||
21 | .Pp | ||
22 | The SSL engine inherits the behaviour of | ||
23 | .Fa rbio | ||
24 | and | ||
25 | .Fa wbio , | ||
26 | respectively. | ||
27 | If a | ||
28 | .Vt BIO | ||
29 | is non-blocking, the | ||
30 | .Fa ssl | ||
31 | will also have non-blocking behaviour. | ||
32 | .Pp | ||
33 | If there was already a | ||
34 | .Vt BIO | ||
35 | connected to | ||
36 | .Fa ssl , | ||
37 | .Xr BIO_free 3 | ||
38 | will be called (for both the reading and writing side, if different). | ||
39 | .Sh RETURN VALUES | ||
40 | .Fn SSL_set_bio | ||
41 | cannot fail. | ||
42 | .Sh SEE ALSO | ||
43 | .Xr bio 3 , | ||
44 | .Xr ssl 3 , | ||
45 | .Xr SSL_accept 3 , | ||
46 | .Xr SSL_connect 3 , | ||
47 | .Xr SSL_get_rbio 3 , | ||
48 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod b/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod deleted file mode 100644 index 67c9756d3f..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_bio.pod +++ /dev/null | |||
@@ -1,34 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_bio - connect the SSL object with a BIO | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_set_bio(SSL *ssl, BIO *rbio, BIO *wbio); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_set_bio() connects the BIOs B<rbio> and B<wbio> for the read and write | ||
16 | operations of the TLS/SSL (encrypted) side of B<ssl>. | ||
17 | |||
18 | The SSL engine inherits the behaviour of B<rbio> and B<wbio>, respectively. | ||
19 | If a BIO is non-blocking, the B<ssl> will also have non-blocking behaviour. | ||
20 | |||
21 | If there was already a BIO connected to B<ssl>, BIO_free() will be called | ||
22 | (for both the reading and writing side, if different). | ||
23 | |||
24 | =head1 RETURN VALUES | ||
25 | |||
26 | SSL_set_bio() cannot fail. | ||
27 | |||
28 | =head1 SEE ALSO | ||
29 | |||
30 | L<SSL_get_rbio(3)|SSL_get_rbio(3)>, | ||
31 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
32 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
33 | |||
34 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.3 b/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.3 new file mode 100644 index 0000000000..37e52788a4 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.3 | |||
@@ -0,0 +1,68 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_CONNECT_STATE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_connect_state , | ||
6 | .Nm SSL_get_accept_state | ||
7 | .Nd prepare SSL object to work in client or server mode | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_set_connect_state "SSL *ssl" | ||
12 | .Ft void | ||
13 | .Fn SSL_set_accept_state "SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_set_connect_state | ||
16 | sets | ||
17 | .Fa ssl | ||
18 | to work in client mode. | ||
19 | .Pp | ||
20 | .Fn SSL_set_accept_state | ||
21 | sets | ||
22 | .Fa ssl | ||
23 | to work in server mode. | ||
24 | .Sh NOTES | ||
25 | When the | ||
26 | .Vt SSL_CTX | ||
27 | object was created with | ||
28 | .Xr SSL_CTX_new 3 , | ||
29 | it was either assigned a dedicated client method, a dedicated server method, or | ||
30 | a generic method, that can be used for both client and server connections. | ||
31 | (The method might have been changed with | ||
32 | .Xr SSL_CTX_set_ssl_version 3 | ||
33 | or | ||
34 | .Xr SSL_set_ssl_method 3 . ) | ||
35 | .Pp | ||
36 | When beginning a new handshake, the SSL engine must know whether it must call | ||
37 | the connect (client) or accept (server) routines. | ||
38 | Even though it may be clear from the method chosen whether client or server | ||
39 | mode was requested, the handshake routines must be explicitly set. | ||
40 | .Pp | ||
41 | When using the | ||
42 | .Xr SSL_connect 3 | ||
43 | or | ||
44 | .Xr SSL_accept 3 | ||
45 | routines, the correct handshake routines are automatically set. | ||
46 | When performing a transparent negotiation using | ||
47 | .Xr SSL_write 3 | ||
48 | or | ||
49 | .Xr SSL_read 3 , | ||
50 | the handshake routines must be explicitly set in advance using either | ||
51 | .Fn SSL_set_connect_state | ||
52 | or | ||
53 | .Fn SSL_set_accept_state . | ||
54 | .Sh RETURN VALUES | ||
55 | .Fn SSL_set_connect_state | ||
56 | and | ||
57 | .Fn SSL_set_accept_state | ||
58 | do not return diagnostic information. | ||
59 | .Sh SEE ALSO | ||
60 | .Xr ssl 3 , | ||
61 | .Xr SSL_accept 3 , | ||
62 | .Xr SSL_connect 3 , | ||
63 | .Xr SSL_CTX_new 3 , | ||
64 | .Xr SSL_CTX_set_ssl_version 3 , | ||
65 | .Xr SSL_do_handshake 3 , | ||
66 | .Xr SSL_new 3 , | ||
67 | .Xr SSL_read 3 , | ||
68 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod b/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod deleted file mode 100644 index 1b19067b47..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_connect_state.pod +++ /dev/null | |||
@@ -1,56 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_connect_state, SSL_get_accept_state - prepare SSL object to work in | ||
6 | client or server mode | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_set_connect_state(SSL *ssl); | ||
13 | |||
14 | void SSL_set_accept_state(SSL *ssl); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_set_connect_state() sets B<ssl> to work in client mode. | ||
19 | |||
20 | SSL_set_accept_state() sets B<ssl> to work in server mode. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | When the SSL_CTX object was created with L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
25 | it was either assigned a dedicated client method, a dedicated server | ||
26 | method, or a generic method, that can be used for both client and | ||
27 | server connections. (The method might have been changed with | ||
28 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> or | ||
29 | SSL_set_ssl_method().) | ||
30 | |||
31 | When beginning a new handshake, the SSL engine must know whether it must | ||
32 | call the connect (client) or accept (server) routines. Even though it may | ||
33 | be clear from the method chosen, whether client or server mode was | ||
34 | requested, the handshake routines must be explicitly set. | ||
35 | |||
36 | When using the L<SSL_connect(3)|SSL_connect(3)> or | ||
37 | L<SSL_accept(3)|SSL_accept(3)> routines, the correct handshake | ||
38 | routines are automatically set. When performing a transparent negotiation | ||
39 | using L<SSL_write(3)|SSL_write(3)> or L<SSL_read(3)|SSL_read(3)>, the | ||
40 | handshake routines must be explicitly set in advance using either | ||
41 | SSL_set_connect_state() or SSL_set_accept_state(). | ||
42 | |||
43 | =head1 RETURN VALUES | ||
44 | |||
45 | SSL_set_connect_state() and SSL_set_accept_state() do not return diagnostic | ||
46 | information. | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<ssl(3)|ssl(3)>, L<SSL_new(3)|SSL_new(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
51 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
52 | L<SSL_write(3)|SSL_write(3)>, L<SSL_read(3)|SSL_read(3)>, | ||
53 | L<SSL_do_handshake(3)|SSL_do_handshake(3)>, | ||
54 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)> | ||
55 | |||
56 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_fd.3 b/src/lib/libssl/src/doc/ssl/SSL_set_fd.3 new file mode 100644 index 0000000000..94345ae236 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_fd.3 | |||
@@ -0,0 +1,70 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_FD 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_fd , | ||
6 | .Nm SSL_set_rfd , | ||
7 | .Nm SSL_set_wfd | ||
8 | .Nd connect the SSL object with a file descriptor | ||
9 | .Sh SYNOPSIS | ||
10 | .In openssl/ssl.h | ||
11 | .Ft int | ||
12 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
13 | .Ft int | ||
14 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
15 | .Ft int | ||
16 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
17 | .Sh DESCRIPTION | ||
18 | .Fn SSL_set_fd | ||
19 | sets the file descriptor | ||
20 | .Fa fd | ||
21 | as the input/output facility for the TLS/SSL (encrypted) side of | ||
22 | .Fa ssl . | ||
23 | .Fa fd | ||
24 | will typically be the socket file descriptor of a network connection. | ||
25 | .Pp | ||
26 | When performing the operation, a socket | ||
27 | .Vt BIO | ||
28 | is automatically created to interface between the | ||
29 | .Fa ssl | ||
30 | and | ||
31 | .Fa fd . | ||
32 | The | ||
33 | .Vt BIO | ||
34 | and hence the SSL engine inherit the behaviour of | ||
35 | .Fa fd . | ||
36 | If | ||
37 | .Fa fd | ||
38 | is non-blocking, the | ||
39 | .Fa ssl | ||
40 | will also have non-blocking behaviour. | ||
41 | .Pp | ||
42 | If there was already a | ||
43 | .Vt BIO | ||
44 | connected to | ||
45 | .Fa ssl , | ||
46 | .Xr BIO_free 3 | ||
47 | will be called (for both the reading and writing side, if different). | ||
48 | .Pp | ||
49 | .Fn SSL_set_rfd | ||
50 | and | ||
51 | .Fn SSL_set_wfd | ||
52 | perform the respective action, but only for the read channel or the write | ||
53 | channel, which can be set independently. | ||
54 | .Sh RETURN VALUES | ||
55 | The following return values can occur: | ||
56 | .Bl -tag -width Ds | ||
57 | .It 0 | ||
58 | The operation failed. | ||
59 | Check the error stack to find out why. | ||
60 | .It 1 | ||
61 | The operation succeeded. | ||
62 | .El | ||
63 | .Sh SEE ALSO | ||
64 | .Xr bio 3 , | ||
65 | .Xr ssl 3 , | ||
66 | .Xr SSL_accept 3 , | ||
67 | .Xr SSL_connect 3 , | ||
68 | .Xr SSL_get_fd 3 , | ||
69 | .Xr SSL_set_bio 3 , | ||
70 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod b/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod deleted file mode 100644 index 7f270c9fbc..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_fd.pod +++ /dev/null | |||
@@ -1,54 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_fd, SSL_set_rfd, SSL_set_wfd - connect the SSL object with a file descriptor | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_set_fd(SSL *ssl, int fd); | ||
12 | int SSL_set_rfd(SSL *ssl, int fd); | ||
13 | int SSL_set_wfd(SSL *ssl, int fd); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_set_fd() sets the file descriptor B<fd> as the input/output facility | ||
18 | for the TLS/SSL (encrypted) side of B<ssl>. B<fd> will typically be the | ||
19 | socket file descriptor of a network connection. | ||
20 | |||
21 | When performing the operation, a B<socket BIO> is automatically created to | ||
22 | interface between the B<ssl> and B<fd>. The BIO and hence the SSL engine | ||
23 | inherit the behaviour of B<fd>. If B<fd> is non-blocking, the B<ssl> will | ||
24 | also have non-blocking behaviour. | ||
25 | |||
26 | If there was already a BIO connected to B<ssl>, BIO_free() will be called | ||
27 | (for both the reading and writing side, if different). | ||
28 | |||
29 | SSL_set_rfd() and SSL_set_wfd() perform the respective action, but only | ||
30 | for the read channel or the write channel, which can be set independently. | ||
31 | |||
32 | =head1 RETURN VALUES | ||
33 | |||
34 | The following return values can occur: | ||
35 | |||
36 | =over 4 | ||
37 | |||
38 | =item C<0> | ||
39 | |||
40 | The operation failed. Check the error stack to find out why. | ||
41 | |||
42 | =item C<1> | ||
43 | |||
44 | The operation succeeded. | ||
45 | |||
46 | =back | ||
47 | |||
48 | =head1 SEE ALSO | ||
49 | |||
50 | L<SSL_get_fd(3)|SSL_get_fd(3)>, L<SSL_set_bio(3)|SSL_set_bio(3)>, | ||
51 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)>, | ||
52 | L<SSL_shutdown(3)|SSL_shutdown(3)>, L<ssl(3)|ssl(3)> , L<bio(3)|bio(3)> | ||
53 | |||
54 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_session.3 b/src/lib/libssl/src/doc/ssl/SSL_set_session.3 new file mode 100644 index 0000000000..3721b0e0e6 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_session.3 | |||
@@ -0,0 +1,65 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_session | ||
6 | .Nd set a TLS/SSL session to be used during TLS/SSL connect | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_session | ||
13 | sets | ||
14 | .Fa session | ||
15 | to be used when the TLS/SSL connection is to be established. | ||
16 | .Fn SSL_set_session | ||
17 | is only useful for TLS/SSL clients. | ||
18 | When the session is set, the reference count of | ||
19 | .Fa session | ||
20 | is incremented | ||
21 | by 1. | ||
22 | If the session is not reused, the reference count is decremented again during | ||
23 | .Fn SSL_connect . | ||
24 | Whether the session was reused can be queried with the | ||
25 | .Xr SSL_session_reused 3 | ||
26 | call. | ||
27 | .Pp | ||
28 | If there is already a session set inside | ||
29 | .Fa ssl | ||
30 | (because it was set with | ||
31 | .Fn SSL_set_session | ||
32 | before or because the same | ||
33 | .Fa ssl | ||
34 | was already used for a connection), | ||
35 | .Xr SSL_SESSION_free 3 | ||
36 | will be called for that session. | ||
37 | .Sh NOTES | ||
38 | .Vt SSL_SESSION | ||
39 | objects keep internal link information about the session cache list when being | ||
40 | inserted into one | ||
41 | .Vt SSL_CTX | ||
42 | object's session cache. | ||
43 | One | ||
44 | .Vt SSL_SESSION | ||
45 | object, regardless of its reference count, must therefore only be used with one | ||
46 | .Vt SSL_CTX | ||
47 | object (and the | ||
48 | .Vt SSL | ||
49 | objects created from this | ||
50 | .Vt SSL_CTX | ||
51 | object). | ||
52 | .Sh RETURN VALUES | ||
53 | The following return values can occur: | ||
54 | .Bl -tag -width Ds | ||
55 | .It 0 | ||
56 | The operation failed; check the error stack to find out the reason. | ||
57 | .It 1 | ||
58 | The operation succeeded. | ||
59 | .El | ||
60 | .Sh SEE ALSO | ||
61 | .Xr ssl 3 , | ||
62 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
63 | .Xr SSL_get_session 3 , | ||
64 | .Xr SSL_SESSION_free 3 , | ||
65 | .Xr SSL_session_reused 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_session.pod b/src/lib/libssl/src/doc/ssl/SSL_set_session.pod deleted file mode 100644 index d35e6d3b7b..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_session.pod +++ /dev/null | |||
@@ -1,57 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_session - set a TLS/SSL session to be used during TLS/SSL connect | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_set_session(SSL *ssl, SSL_SESSION *session); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_set_session() sets B<session> to be used when the TLS/SSL connection | ||
16 | is to be established. SSL_set_session() is only useful for TLS/SSL clients. | ||
17 | When the session is set, the reference count of B<session> is incremented | ||
18 | by 1. If the session is not reused, the reference count is decremented | ||
19 | again during SSL_connect(). Whether the session was reused can be queried | ||
20 | with the L<SSL_session_reused(3)|SSL_session_reused(3)> call. | ||
21 | |||
22 | If there is already a session set inside B<ssl> (because it was set with | ||
23 | SSL_set_session() before or because the same B<ssl> was already used for | ||
24 | a connection), SSL_SESSION_free() will be called for that session. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | SSL_SESSION objects keep internal link information about the session cache | ||
29 | list, when being inserted into one SSL_CTX object's session cache. | ||
30 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
31 | only be used with one SSL_CTX object (and the SSL objects created | ||
32 | from this SSL_CTX object). | ||
33 | |||
34 | =head1 RETURN VALUES | ||
35 | |||
36 | The following return values can occur: | ||
37 | |||
38 | =over 4 | ||
39 | |||
40 | =item C<0> | ||
41 | |||
42 | The operation failed; check the error stack to find out the reason. | ||
43 | |||
44 | =item C<1> | ||
45 | |||
46 | The operation succeeded. | ||
47 | |||
48 | =back | ||
49 | |||
50 | =head1 SEE ALSO | ||
51 | |||
52 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
53 | L<SSL_get_session(3)|SSL_get_session(3)>, | ||
54 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
55 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)> | ||
56 | |||
57 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.3 b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.3 new file mode 100644 index 0000000000..239bbd6801 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.3 | |||
@@ -0,0 +1,85 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_shutdown , | ||
6 | .Nm SSL_get_shutdown | ||
7 | .Nd manipulate shutdown state of an SSL connection | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft void | ||
11 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
12 | .Ft int | ||
13 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_set_shutdown | ||
16 | sets the shutdown state of | ||
17 | .Fa ssl | ||
18 | to | ||
19 | .Fa mode . | ||
20 | .Pp | ||
21 | .Fn SSL_get_shutdown | ||
22 | returns the shutdown mode of | ||
23 | .Fa ssl . | ||
24 | .Sh NOTES | ||
25 | The shutdown state of an ssl connection is a bitmask of: | ||
26 | .Bl -tag -width Ds | ||
27 | .It 0 | ||
28 | No shutdown setting, yet. | ||
29 | .It Dv SSL_SENT_SHUTDOWN | ||
30 | A | ||
31 | .Dq close notify | ||
32 | shutdown alert was sent to the peer; the connection is being considered closed | ||
33 | and the session is closed and correct. | ||
34 | .It Dv SSL_RECEIVED_SHUTDOWN | ||
35 | A shutdown alert was received form the peer, either a normal | ||
36 | .Dq close notify | ||
37 | or a fatal error. | ||
38 | .El | ||
39 | .Pp | ||
40 | .Dv SSL_SENT_SHUTDOWN | ||
41 | and | ||
42 | .Dv SSL_RECEIVED_SHUTDOWN | ||
43 | can be set at the same time. | ||
44 | .Pp | ||
45 | The shutdown state of the connection is used to determine the state of the | ||
46 | .Fa ssl | ||
47 | session. | ||
48 | If the session is still open when | ||
49 | .Xr SSL_clear 3 | ||
50 | or | ||
51 | .Xr SSL_free 3 | ||
52 | is called, it is considered bad and removed according to RFC2246. | ||
53 | The actual condition for a correctly closed session is | ||
54 | .Dv SSL_SENT_SHUTDOWN | ||
55 | (according to the TLS RFC, it is acceptable to only send the | ||
56 | .Dq close notify | ||
57 | alert but to not wait for the peer's answer when the underlying connection is | ||
58 | closed). | ||
59 | .Fn SSL_set_shutdown | ||
60 | can be used to set this state without sending a close alert to the peer (see | ||
61 | .Xr SSL_shutdown 3 ) . | ||
62 | .Pp | ||
63 | If a | ||
64 | .Dq close notify | ||
65 | was received, | ||
66 | .Dv SSL_RECEIVED_SHUTDOWN | ||
67 | will be set, but to set | ||
68 | .Dv SSL_SENT_SHUTDOWN | ||
69 | the application must still call | ||
70 | .Xr SSL_shutdown 3 | ||
71 | or | ||
72 | .Fn SSL_set_shutdown | ||
73 | itself. | ||
74 | .Sh RETURN VALUES | ||
75 | .Fn SSL_set_shutdown | ||
76 | does not return diagnostic information. | ||
77 | .Pp | ||
78 | .Fn SSL_get_shutdown | ||
79 | returns the current setting. | ||
80 | .Sh SEE ALSO | ||
81 | .Xr ssl 3 , | ||
82 | .Xr SSL_clear 3 , | ||
83 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
84 | .Xr SSL_free 3 , | ||
85 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod deleted file mode 100644 index f84da386a1..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_shutdown.pod +++ /dev/null | |||
@@ -1,73 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_shutdown, SSL_get_shutdown - manipulate shutdown state of an SSL | ||
6 | connection | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | void SSL_set_shutdown(SSL *ssl, int mode); | ||
13 | |||
14 | int SSL_get_shutdown(const SSL *ssl); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | SSL_set_shutdown() sets the shutdown state of B<ssl> to B<mode>. | ||
19 | |||
20 | SSL_get_shutdown() returns the shutdown mode of B<ssl>. | ||
21 | |||
22 | =head1 NOTES | ||
23 | |||
24 | The shutdown state of an ssl connection is a bitmask of: | ||
25 | |||
26 | =over 4 | ||
27 | |||
28 | =item Z<>0 | ||
29 | |||
30 | No shutdown setting, yet. | ||
31 | |||
32 | =item SSL_SENT_SHUTDOWN | ||
33 | |||
34 | A "close notify" shutdown alert was sent to the peer, the connection is being | ||
35 | considered closed and the session is closed and correct. | ||
36 | |||
37 | =item SSL_RECEIVED_SHUTDOWN | ||
38 | |||
39 | A shutdown alert was received form the peer, either a normal "close notify" | ||
40 | or a fatal error. | ||
41 | |||
42 | =back | ||
43 | |||
44 | SSL_SENT_SHUTDOWN and SSL_RECEIVED_SHUTDOWN can be set at the same time. | ||
45 | |||
46 | The shutdown state of the connection is used to determine the state of | ||
47 | the ssl session. If the session is still open, when | ||
48 | L<SSL_clear(3)|SSL_clear(3)> or L<SSL_free(3)|SSL_free(3)> is called, | ||
49 | it is considered bad and removed according to RFC2246. | ||
50 | The actual condition for a correctly closed session is SSL_SENT_SHUTDOWN | ||
51 | (according to the TLS RFC, it is acceptable to only send the "close notify" | ||
52 | alert but to not wait for the peer's answer, when the underlying connection | ||
53 | is closed). | ||
54 | SSL_set_shutdown() can be used to set this state without sending a | ||
55 | close alert to the peer (see L<SSL_shutdown(3)|SSL_shutdown(3)>). | ||
56 | |||
57 | If a "close notify" was received, SSL_RECEIVED_SHUTDOWN will be set, | ||
58 | for setting SSL_SENT_SHUTDOWN the application must however still call | ||
59 | L<SSL_shutdown(3)|SSL_shutdown(3)> or SSL_set_shutdown() itself. | ||
60 | |||
61 | =head1 RETURN VALUES | ||
62 | |||
63 | SSL_set_shutdown() does not return diagnostic information. | ||
64 | |||
65 | SSL_get_shutdown() returns the current setting. | ||
66 | |||
67 | =head1 SEE ALSO | ||
68 | |||
69 | L<ssl(3)|ssl(3)>, L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
70 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
71 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)> | ||
72 | |||
73 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.3 b/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.3 new file mode 100644 index 0000000000..3c7f0540fb --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.3 | |||
@@ -0,0 +1,39 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SET_VERIFY_RESULT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_set_verify_result | ||
6 | .Nd override result of peer certificate verification | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft void | ||
10 | .Fn SSL_set_verify_result "SSL *ssl" "long verify_result" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_set_verify_result | ||
13 | sets | ||
14 | .Fa verify_result | ||
15 | of the object | ||
16 | .Fa ssl | ||
17 | to be the result of the verification of the X509 certificate presented by the | ||
18 | peer, if any. | ||
19 | .Sh NOTES | ||
20 | .Fn SSL_set_verify_result | ||
21 | overrides the verification result. | ||
22 | It only changes the verification result of the | ||
23 | .Fa ssl | ||
24 | object. | ||
25 | It does not become part of the established session, so if the session is to be | ||
26 | reused later, the original value will reappear. | ||
27 | .Pp | ||
28 | The valid codes for | ||
29 | .Fa verify_result | ||
30 | are documented in | ||
31 | .Xr verify 1 . | ||
32 | .Sh RETURN VALUES | ||
33 | .Fn SSL_set_verify_result | ||
34 | does not provide a return value. | ||
35 | .Sh SEE ALSO | ||
36 | .Xr verify 1 , | ||
37 | .Xr ssl 3 , | ||
38 | .Xr SSL_get_peer_certificate 3 , | ||
39 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod b/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod deleted file mode 100644 index 04ab101aad..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_set_verify_result.pod +++ /dev/null | |||
@@ -1,38 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_set_verify_result - override result of peer certificate verification | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | void SSL_set_verify_result(SSL *ssl, long verify_result); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_set_verify_result() sets B<verify_result> of the object B<ssl> to be the | ||
16 | result of the verification of the X509 certificate presented by the peer, | ||
17 | if any. | ||
18 | |||
19 | =head1 NOTES | ||
20 | |||
21 | SSL_set_verify_result() overrides the verification result. It only changes | ||
22 | the verification result of the B<ssl> object. It does not become part of the | ||
23 | established session, so if the session is to be reused later, the original | ||
24 | value will reappear. | ||
25 | |||
26 | The valid codes for B<verify_result> are documented in L<verify(1)|verify(1)>. | ||
27 | |||
28 | =head1 RETURN VALUES | ||
29 | |||
30 | SSL_set_verify_result() does not provide a return value. | ||
31 | |||
32 | =head1 SEE ALSO | ||
33 | |||
34 | L<ssl(3)|ssl(3)>, L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
35 | L<SSL_get_peer_certificate(3)|SSL_get_peer_certificate(3)>, | ||
36 | L<verify(1)|verify(1)> | ||
37 | |||
38 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.3 b/src/lib/libssl/src/doc/ssl/SSL_shutdown.3 new file mode 100644 index 0000000000..aa8d483b24 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_shutdown.3 | |||
@@ -0,0 +1,201 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_SHUTDOWN 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_shutdown | ||
6 | .Nd shut down a TLS/SSL connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_shutdown "SSL *ssl" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_shutdown | ||
13 | shuts down an active TLS/SSL connection. | ||
14 | It sends the | ||
15 | .Dq close notify | ||
16 | shutdown alert to the peer. | ||
17 | .Sh NOTES | ||
18 | .Fn SSL_shutdown | ||
19 | tries to send the | ||
20 | .Dq close notify | ||
21 | shutdown alert to the peer. | ||
22 | Whether the operation succeeds or not, the | ||
23 | .Dv SSL_SENT_SHUTDOWN | ||
24 | flag is set and a currently open session is considered closed and good and will | ||
25 | be kept in the session cache for further reuse. | ||
26 | .Pp | ||
27 | The shutdown procedure consists of 2 steps: the sending of the | ||
28 | .Dq close notify | ||
29 | shutdown alert and the reception of the peer's | ||
30 | .Dq close notify | ||
31 | shutdown alert. | ||
32 | According to the TLS standard, it is acceptable for an application to only send | ||
33 | its shutdown alert and then close the underlying connection without waiting for | ||
34 | the peer's response (this way resources can be saved, as the process can | ||
35 | already terminate or serve another connection). | ||
36 | When the underlying connection shall be used for more communications, | ||
37 | the complete shutdown procedure (bidirectional | ||
38 | .Dq close notify | ||
39 | alerts) must be performed, so that the peers stay synchronized. | ||
40 | .Pp | ||
41 | .Fn SSL_shutdown | ||
42 | supports both uni- and bidirectional shutdown by its 2 step behavior. | ||
43 | .Pp | ||
44 | When the application is the first party to send the | ||
45 | .Dq close notify | ||
46 | alert, | ||
47 | .Fn SSL_shutdown | ||
48 | will only send the alert and then set the | ||
49 | .Dv SSL_SENT_SHUTDOWN | ||
50 | flag (so that the session is considered good and will be kept in cache). | ||
51 | .Fn SSL_shutdown | ||
52 | will then return 0. | ||
53 | If a unidirectional shutdown is enough | ||
54 | (the underlying connection shall be closed anyway), this first call to | ||
55 | .Fn SSL_shutdown | ||
56 | is sufficient. | ||
57 | In order to complete the bidirectional shutdown handshake, | ||
58 | .Fn SSL_shutdown | ||
59 | must be called again. | ||
60 | The second call will make | ||
61 | .Fn SSL_shutdown | ||
62 | wait for the peer's | ||
63 | .Dq close notify | ||
64 | shutdown alert. | ||
65 | On success, the second call to | ||
66 | .Fn SSL_shutdown | ||
67 | will return 1. | ||
68 | .Pp | ||
69 | If the peer already sent the | ||
70 | .Dq close notify | ||
71 | alert and it was already processed implicitly inside another function | ||
72 | .Pq Xr SSL_read 3 , | ||
73 | the | ||
74 | .Dv SSL_RECEIVED_SHUTDOWN | ||
75 | flag is set. | ||
76 | .Fn SSL_shutdown | ||
77 | will send the | ||
78 | .Dq close notify | ||
79 | alert, set the | ||
80 | .Dv SSL_SENT_SHUTDOWN | ||
81 | flag and will immediately return with 1. | ||
82 | Whether | ||
83 | .Dv SSL_RECEIVED_SHUTDOWN | ||
84 | is already set can be checked using the | ||
85 | .Fn SSL_get_shutdown | ||
86 | (see also the | ||
87 | .Xr SSL_set_shutdown 3 | ||
88 | call). | ||
89 | .Pp | ||
90 | It is therefore recommended to check the return value of | ||
91 | .Fn SSL_shutdown | ||
92 | and call | ||
93 | .Fn SSL_shutdown | ||
94 | again, if the bidirectional shutdown is not yet complete (return value of the | ||
95 | first call is 0). | ||
96 | As the shutdown is not specially handled in the SSLv2 protocol, | ||
97 | .Fn SSL_shutdown | ||
98 | will succeed on the first call. | ||
99 | .Pp | ||
100 | The behaviour of | ||
101 | .Fn SSL_shutdown | ||
102 | additionally depends on the underlying | ||
103 | .Vt BIO . | ||
104 | .Pp | ||
105 | If the underlying | ||
106 | .Vt BIO | ||
107 | is | ||
108 | .Em blocking , | ||
109 | .Fn SSL_shutdown | ||
110 | will only return once the | ||
111 | handshake step has been finished or an error occurred. | ||
112 | .Pp | ||
113 | If the underlying | ||
114 | .Vt BIO | ||
115 | is | ||
116 | .Em non-blocking , | ||
117 | .Fn SSL_shutdown | ||
118 | will also return when the underlying | ||
119 | .Vt BIO | ||
120 | could not satisfy the needs of | ||
121 | .Fn SSL_shutdown | ||
122 | to continue the handshake. | ||
123 | In this case a call to | ||
124 | .Xr SSL_get_error 3 | ||
125 | with the | ||
126 | return value of | ||
127 | .Fn SSL_shutdown | ||
128 | will yield | ||
129 | .Dv SSL_ERROR_WANT_READ | ||
130 | or | ||
131 | .Dv SSL_ERROR_WANT_WRITE . | ||
132 | The calling process then must repeat the call after taking appropriate action | ||
133 | to satisfy the needs of | ||
134 | .Fn SSL_shutdown . | ||
135 | The action depends on the underlying | ||
136 | .Vt BIO . | ||
137 | When using a non-blocking socket, nothing is to be done, but | ||
138 | .Xr select 2 | ||
139 | can be used to check for the required condition. | ||
140 | When using a buffering | ||
141 | .Vt BIO , | ||
142 | like a | ||
143 | .Vt BIO | ||
144 | pair, data must be written into or retrieved out of the | ||
145 | .Vt BIO | ||
146 | before being able to continue. | ||
147 | .Pp | ||
148 | .Fn SSL_shutdown | ||
149 | can be modified to only set the connection to | ||
150 | .Dq shutdown | ||
151 | state but not actually send the | ||
152 | .Dq close notify | ||
153 | alert messages; see | ||
154 | .Xr SSL_CTX_set_quiet_shutdown 3 . | ||
155 | When | ||
156 | .Dq quiet shutdown | ||
157 | is enabled, | ||
158 | .Fn SSL_shutdown | ||
159 | will always succeed and return 1. | ||
160 | .Sh RETURN VALUES | ||
161 | The following return values can occur: | ||
162 | .Bl -tag -width Ds | ||
163 | .It 0 | ||
164 | The shutdown is not yet finished. | ||
165 | Call | ||
166 | .Fn SSL_shutdown | ||
167 | for a second time, if a bidirectional shutdown shall be performed. | ||
168 | The output of | ||
169 | .Xr SSL_get_error 3 | ||
170 | may be misleading, as an erroneous | ||
171 | .Dv SSL_ERROR_SYSCALL | ||
172 | may be flagged even though no error occurred. | ||
173 | .It 1 | ||
174 | The shutdown was successfully completed. | ||
175 | The | ||
176 | .Dq close notify | ||
177 | alert was sent and the peer's | ||
178 | .Dq close notify | ||
179 | alert was received. | ||
180 | .It \(mi1 | ||
181 | The shutdown was not successful because a fatal error occurred either | ||
182 | at the protocol level or a connection failure occurred. | ||
183 | It can also occur if action is need to continue the operation for non-blocking | ||
184 | .Vt BIO Ns | ||
185 | s. | ||
186 | Call | ||
187 | .Xr SSL_get_error 3 | ||
188 | with the return value | ||
189 | .Fa ret | ||
190 | to find out the reason. | ||
191 | .El | ||
192 | .Sh SEE ALSO | ||
193 | .Xr bio 3 , | ||
194 | .Xr ssl 3 , | ||
195 | .Xr SSL_accept 3 , | ||
196 | .Xr SSL_clear 3 , | ||
197 | .Xr SSL_connect 3 , | ||
198 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
199 | .Xr SSL_free 3 , | ||
200 | .Xr SSL_get_error 3 , | ||
201 | .Xr SSL_set_shutdown 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod b/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod deleted file mode 100644 index 50f47c20d7..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_shutdown.pod +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_shutdown - shut down a TLS/SSL connection | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_shutdown(SSL *ssl); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_shutdown() shuts down an active TLS/SSL connection. It sends the | ||
16 | "close notify" shutdown alert to the peer. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | SSL_shutdown() tries to send the "close notify" shutdown alert to the peer. | ||
21 | Whether the operation succeeds or not, the SSL_SENT_SHUTDOWN flag is set and | ||
22 | a currently open session is considered closed and good and will be kept in the | ||
23 | session cache for further reuse. | ||
24 | |||
25 | The shutdown procedure consists of 2 steps: the sending of the "close notify" | ||
26 | shutdown alert and the reception of the peer's "close notify" shutdown | ||
27 | alert. According to the TLS standard, it is acceptable for an application | ||
28 | to only send its shutdown alert and then close the underlying connection | ||
29 | without waiting for the peer's response (this way resources can be saved, | ||
30 | as the process can already terminate or serve another connection). | ||
31 | When the underlying connection shall be used for more communications, the | ||
32 | complete shutdown procedure (bidirectional "close notify" alerts) must be | ||
33 | performed, so that the peers stay synchronized. | ||
34 | |||
35 | SSL_shutdown() supports both uni- and bidirectional shutdown by its 2 step | ||
36 | behaviour. | ||
37 | |||
38 | =over 4 | ||
39 | |||
40 | =item When the application is the first party to send the "close notify" | ||
41 | alert, SSL_shutdown() will only send the alert and then set the | ||
42 | SSL_SENT_SHUTDOWN flag (so that the session is considered good and will | ||
43 | be kept in cache). SSL_shutdown() will then return with 0. If a unidirectional | ||
44 | shutdown is enough (the underlying connection shall be closed anyway), this | ||
45 | first call to SSL_shutdown() is sufficient. In order to complete the | ||
46 | bidirectional shutdown handshake, SSL_shutdown() must be called again. | ||
47 | The second call will make SSL_shutdown() wait for the peer's "close notify" | ||
48 | shutdown alert. On success, the second call to SSL_shutdown() will return | ||
49 | with 1. | ||
50 | |||
51 | =item If the peer already sent the "close notify" alert B<and> it was | ||
52 | already processed implicitly inside another function | ||
53 | (L<SSL_read(3)|SSL_read(3)>), the SSL_RECEIVED_SHUTDOWN flag is set. | ||
54 | SSL_shutdown() will send the "close notify" alert, set the SSL_SENT_SHUTDOWN | ||
55 | flag and will immediately return with 1. | ||
56 | Whether SSL_RECEIVED_SHUTDOWN is already set can be checked using the | ||
57 | SSL_get_shutdown() (see also L<SSL_set_shutdown(3)|SSL_set_shutdown(3)> call. | ||
58 | |||
59 | =back | ||
60 | |||
61 | It is therefore recommended, to check the return value of SSL_shutdown() | ||
62 | and call SSL_shutdown() again, if the bidirectional shutdown is not yet | ||
63 | complete (return value of the first call is 0). As the shutdown is not | ||
64 | specially handled in the SSLv2 protocol, SSL_shutdown() will succeed on | ||
65 | the first call. | ||
66 | |||
67 | The behaviour of SSL_shutdown() additionally depends on the underlying BIO. | ||
68 | |||
69 | If the underlying BIO is B<blocking>, SSL_shutdown() will only return once the | ||
70 | handshake step has been finished or an error occurred. | ||
71 | |||
72 | If the underlying BIO is B<non-blocking>, SSL_shutdown() will also return | ||
73 | when the underlying BIO could not satisfy the needs of SSL_shutdown() | ||
74 | to continue the handshake. In this case a call to SSL_get_error() with the | ||
75 | return value of SSL_shutdown() will yield B<SSL_ERROR_WANT_READ> or | ||
76 | B<SSL_ERROR_WANT_WRITE>. The calling process then must repeat the call after | ||
77 | taking appropriate action to satisfy the needs of SSL_shutdown(). | ||
78 | The action depends on the underlying BIO. When using a non-blocking socket, | ||
79 | nothing is to be done, but select() can be used to check for the required | ||
80 | condition. When using a buffering BIO, like a BIO pair, data must be written | ||
81 | into or retrieved out of the BIO before being able to continue. | ||
82 | |||
83 | SSL_shutdown() can be modified to only set the connection to "shutdown" | ||
84 | state but not actually send the "close notify" alert messages, | ||
85 | see L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>. | ||
86 | When "quiet shutdown" is enabled, SSL_shutdown() will always succeed | ||
87 | and return 1. | ||
88 | |||
89 | =head1 RETURN VALUES | ||
90 | |||
91 | The following return values can occur: | ||
92 | |||
93 | =over 4 | ||
94 | |||
95 | =item C<0> | ||
96 | |||
97 | The shutdown is not yet finished. Call SSL_shutdown() for a second time, | ||
98 | if a bidirectional shutdown shall be performed. | ||
99 | The output of L<SSL_get_error(3)|SSL_get_error(3)> may be misleading, as an | ||
100 | erroneous SSL_ERROR_SYSCALL may be flagged even though no error occurred. | ||
101 | |||
102 | =item C<1> | ||
103 | |||
104 | The shutdown was successfully completed. The "close notify" alert was sent | ||
105 | and the peer's "close notify" alert was received. | ||
106 | |||
107 | =item C<-1> | ||
108 | |||
109 | The shutdown was not successful because a fatal error occurred either | ||
110 | at the protocol level or a connection failure occurred. It can also occur if | ||
111 | action is need to continue the operation for non-blocking BIOs. | ||
112 | Call L<SSL_get_error(3)|SSL_get_error(3)> with the return value B<ret> | ||
113 | to find out the reason. | ||
114 | |||
115 | =back | ||
116 | |||
117 | =head1 SEE ALSO | ||
118 | |||
119 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_connect(3)|SSL_connect(3)>, | ||
120 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
121 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
122 | L<SSL_clear(3)|SSL_clear(3)>, L<SSL_free(3)|SSL_free(3)>, | ||
123 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
124 | |||
125 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_state_string.3 b/src/lib/libssl/src/doc/ssl/SSL_state_string.3 new file mode 100644 index 0000000000..828b8f351a --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_state_string.3 | |||
@@ -0,0 +1,54 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_STATE_STRING 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_state_string , | ||
6 | .Nm SSL_state_string_long | ||
7 | .Nd get textual description of state of an SSL object | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft const char * | ||
11 | .Fn SSL_state_string "const SSL *ssl" | ||
12 | .Ft const char * | ||
13 | .Fn SSL_state_string_long "const SSL *ssl" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn SSL_state_string | ||
16 | returns a 6 letter string indicating the current state of the | ||
17 | .Vt SSL | ||
18 | object | ||
19 | .Fa ssl . | ||
20 | .Pp | ||
21 | .Fn SSL_state_string_long | ||
22 | returns a string indicating the current state of the | ||
23 | .Vt SSL | ||
24 | object | ||
25 | .Fa ssl . | ||
26 | .Sh NOTES | ||
27 | During its use, an | ||
28 | .Vt SSL | ||
29 | object passes several states. | ||
30 | The state is internally maintained. | ||
31 | Querying the state information is not very informative before or when a | ||
32 | connection has been established. | ||
33 | It however can be of significant interest during the handshake. | ||
34 | .Pp | ||
35 | When using non-blocking sockets, | ||
36 | the function call performing the handshake may return with | ||
37 | .Dv SSL_ERROR_WANT_READ | ||
38 | or | ||
39 | .Dv SSL_ERROR_WANT_WRITE | ||
40 | condition, so that | ||
41 | .Fn SSL_state_string[_long] | ||
42 | may be called. | ||
43 | .Pp | ||
44 | For both blocking or non-blocking sockets, | ||
45 | the details state information can be used within the | ||
46 | .Fn info_callback | ||
47 | function set with the | ||
48 | .Xr SSL_set_info_callback 3 | ||
49 | call. | ||
50 | .Sh RETURN VALUES | ||
51 | Detailed description of possible states to be included later. | ||
52 | .Sh SEE ALSO | ||
53 | .Xr ssl 3 , | ||
54 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_state_string.pod b/src/lib/libssl/src/doc/ssl/SSL_state_string.pod deleted file mode 100644 index e7611f1aff..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_state_string.pod +++ /dev/null | |||
@@ -1,46 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_state_string, SSL_state_string_long - get textual description of state of | ||
6 | an SSL object | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | const char *SSL_state_string(const SSL *ssl); | ||
13 | const char *SSL_state_string_long(const SSL *ssl); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | SSL_state_string() returns a 6 letter string indicating the current state | ||
18 | of the SSL object B<ssl>. | ||
19 | |||
20 | SSL_state_string_long() returns a string indicating the current state of | ||
21 | the SSL object B<ssl>. | ||
22 | |||
23 | =head1 NOTES | ||
24 | |||
25 | During its use, an SSL objects passes several states. The state is internally | ||
26 | maintained. Querying the state information is not very informative before | ||
27 | or when a connection has been established. It however can be of significant | ||
28 | interest during the handshake. | ||
29 | |||
30 | When using non-blocking sockets, the function call performing the handshake | ||
31 | may return with SSL_ERROR_WANT_READ or SSL_ERROR_WANT_WRITE condition, | ||
32 | so that SSL_state_string[_long]() may be called. | ||
33 | |||
34 | For both blocking or non-blocking sockets, the details state information | ||
35 | can be used within the info_callback function set with the | ||
36 | SSL_set_info_callback() call. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | Detailed description of possible states to be included later. | ||
41 | |||
42 | =head1 SEE ALSO | ||
43 | |||
44 | L<ssl(3)|ssl(3)>, L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)> | ||
45 | |||
46 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_want.3 b/src/lib/libssl/src/doc/ssl/SSL_want.3 new file mode 100644 index 0000000000..5f9d89ea92 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_want.3 | |||
@@ -0,0 +1,100 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_WANT 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_want , | ||
6 | .Nm SSL_want_nothing , | ||
7 | .Nm SSL_want_read , | ||
8 | .Nm SSL_want_write , | ||
9 | .Nm SSL_want_x509_lookup | ||
10 | .Nd obtain state information TLS/SSL I/O operation | ||
11 | .Sh SYNOPSIS | ||
12 | .In openssl/ssl.h | ||
13 | .Ft int | ||
14 | .Fn SSL_want "const SSL *ssl" | ||
15 | .Ft int | ||
16 | .Fn SSL_want_nothing "const SSL *ssl" | ||
17 | .Ft int | ||
18 | .Fn SSL_want_read "const SSL *ssl" | ||
19 | .Ft int | ||
20 | .Fn SSL_want_write "const SSL *ssl" | ||
21 | .Ft int | ||
22 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
23 | .Sh DESCRIPTION | ||
24 | .Fn SSL_want | ||
25 | returns state information for the | ||
26 | .Vt SSL | ||
27 | object | ||
28 | .Fa ssl . | ||
29 | .Pp | ||
30 | The other | ||
31 | .Fn SSL_want_* | ||
32 | calls are shortcuts for the possible states returned by | ||
33 | .Fn SSL_want . | ||
34 | .Sh NOTES | ||
35 | .Fn SSL_want | ||
36 | examines the internal state information of the | ||
37 | .Vt SSL | ||
38 | object. | ||
39 | Its return values are similar to those of | ||
40 | .Xr SSL_get_error 3 . | ||
41 | Unlike | ||
42 | .Xr SSL_get_error 3 , | ||
43 | which also evaluates the error queue, | ||
44 | the results are obtained by examining an internal state flag only. | ||
45 | The information must therefore only be used for normal operation under | ||
46 | non-blocking I/O. | ||
47 | Error conditions are not handled and must be treated using | ||
48 | .Xr SSL_get_error 3 . | ||
49 | .Pp | ||
50 | The result returned by | ||
51 | .Fn SSL_want | ||
52 | should always be consistent with the result of | ||
53 | .Xr SSL_get_error 3 . | ||
54 | .Sh RETURN VALUES | ||
55 | The following return values can currently occur for | ||
56 | .Fn SSL_want : | ||
57 | .Bl -tag -width Ds | ||
58 | .It .Dv SSL_NOTHING | ||
59 | There is no data to be written or to be read. | ||
60 | .It .Dv SSL_WRITING | ||
61 | There are data in the SSL buffer that must be written to the underlying | ||
62 | .Vt BIO | ||
63 | layer in order to complete the actual | ||
64 | .Fn SSL_* | ||
65 | operation. | ||
66 | A call to | ||
67 | .Xr SSL_get_error 3 | ||
68 | should return | ||
69 | .Dv SSL_ERROR_WANT_WRITE . | ||
70 | .It Dv SSL_READING | ||
71 | More data must be read from the underlying | ||
72 | .Vt BIO | ||
73 | layer in order to | ||
74 | complete the actual | ||
75 | .Fn SSL_* | ||
76 | operation. | ||
77 | A call to | ||
78 | .Xr SSL_get_error 3 | ||
79 | should return | ||
80 | .Dv SSL_ERROR_WANT_READ. | ||
81 | .It Dv SSL_X509_LOOKUP | ||
82 | The operation did not complete because an application callback set by | ||
83 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
84 | has asked to be called again. | ||
85 | A call to | ||
86 | .Xr SSL_get_error 3 | ||
87 | should return | ||
88 | .Dv SSL_ERROR_WANT_X509_LOOKUP . | ||
89 | .El | ||
90 | .Pp | ||
91 | .Fn SSL_want_nothing , | ||
92 | .Fn SSL_want_read , | ||
93 | .Fn SSL_want_write , | ||
94 | and | ||
95 | .Fn SSL_want_x509_lookup | ||
96 | return 1 when the corresponding condition is true or 0 otherwise. | ||
97 | .Sh SEE ALSO | ||
98 | .Xr err 3 , | ||
99 | .Xr ssl 3 , | ||
100 | .Xr SSL_get_error 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_want.pod b/src/lib/libssl/src/doc/ssl/SSL_want.pod deleted file mode 100644 index 7ef6cf6ffa..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_want.pod +++ /dev/null | |||
@@ -1,78 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_want, SSL_want_nothing, SSL_want_read, SSL_want_write, SSL_want_x509_lookup | ||
6 | - obtain state information TLS/SSL I/O operation | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | int SSL_want(const SSL *ssl); | ||
13 | int SSL_want_nothing(const SSL *ssl); | ||
14 | int SSL_want_read(const SSL *ssl); | ||
15 | int SSL_want_write(const SSL *ssl); | ||
16 | int SSL_want_x509_lookup(const SSL *ssl); | ||
17 | |||
18 | =head1 DESCRIPTION | ||
19 | |||
20 | SSL_want() returns state information for the SSL object B<ssl>. | ||
21 | |||
22 | The other SSL_want_*() calls are shortcuts for the possible states returned | ||
23 | by SSL_want(). | ||
24 | |||
25 | =head1 NOTES | ||
26 | |||
27 | SSL_want() examines the internal state information of the SSL object. Its | ||
28 | return values are similar to that of L<SSL_get_error(3)|SSL_get_error(3)>. | ||
29 | Unlike L<SSL_get_error(3)|SSL_get_error(3)>, which also evaluates the | ||
30 | error queue, the results are obtained by examining an internal state flag | ||
31 | only. The information must therefore only be used for normal operation under | ||
32 | non-blocking I/O. Error conditions are not handled and must be treated | ||
33 | using L<SSL_get_error(3)|SSL_get_error(3)>. | ||
34 | |||
35 | The result returned by SSL_want() should always be consistent with | ||
36 | the result of L<SSL_get_error(3)|SSL_get_error(3)>. | ||
37 | |||
38 | =head1 RETURN VALUES | ||
39 | |||
40 | The following return values can currently occur for SSL_want(): | ||
41 | |||
42 | =over 4 | ||
43 | |||
44 | =item SSL_NOTHING | ||
45 | |||
46 | There is no data to be written or to be read. | ||
47 | |||
48 | =item SSL_WRITING | ||
49 | |||
50 | There are data in the SSL buffer that must be written to the underlying | ||
51 | B<BIO> layer in order to complete the actual SSL_*() operation. | ||
52 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
53 | SSL_ERROR_WANT_WRITE. | ||
54 | |||
55 | =item SSL_READING | ||
56 | |||
57 | More data must be read from the underlying B<BIO> layer in order to | ||
58 | complete the actual SSL_*() operation. | ||
59 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
60 | SSL_ERROR_WANT_READ. | ||
61 | |||
62 | =item SSL_X509_LOOKUP | ||
63 | |||
64 | The operation did not complete because an application callback set by | ||
65 | SSL_CTX_set_client_cert_cb() has asked to be called again. | ||
66 | A call to L<SSL_get_error(3)|SSL_get_error(3)> should return | ||
67 | SSL_ERROR_WANT_X509_LOOKUP. | ||
68 | |||
69 | =back | ||
70 | |||
71 | SSL_want_nothing(), SSL_want_read(), SSL_want_write(), SSL_want_x509_lookup() | ||
72 | return 1, when the corresponding condition is true or 0 otherwise. | ||
73 | |||
74 | =head1 SEE ALSO | ||
75 | |||
76 | L<ssl(3)|ssl(3)>, L<err(3)|err(3)>, L<SSL_get_error(3)|SSL_get_error(3)> | ||
77 | |||
78 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_write.3 b/src/lib/libssl/src/doc/ssl/SSL_write.3 new file mode 100644 index 0000000000..19dfffae1b --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/SSL_write.3 | |||
@@ -0,0 +1,172 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL_WRITE 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL_write | ||
6 | .Nd write bytes to a TLS/SSL connection | ||
7 | .Sh SYNOPSIS | ||
8 | .In openssl/ssl.h | ||
9 | .Ft int | ||
10 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
11 | .Sh DESCRIPTION | ||
12 | .Fn SSL_write | ||
13 | writes | ||
14 | .Fa num | ||
15 | bytes from the buffer | ||
16 | .Fa buf | ||
17 | into the specified | ||
18 | .Fa ssl | ||
19 | connection. | ||
20 | .Sh NOTES | ||
21 | If necessary, | ||
22 | .Fn SSL_write | ||
23 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
24 | .Xr SSL_connect 3 | ||
25 | or | ||
26 | .Xr SSL_accept 3 . | ||
27 | If the peer requests a re-negotiation, | ||
28 | it will be performed transparently during the | ||
29 | .Fn SSL_write | ||
30 | operation. | ||
31 | The behaviour of | ||
32 | .Fn SSL_write | ||
33 | depends on the underlying | ||
34 | .Vt BIO . | ||
35 | .Pp | ||
36 | For the transparent negotiation to succeed, the | ||
37 | .Fa ssl | ||
38 | must have been initialized to client or server mode. | ||
39 | This is being done by calling | ||
40 | .Xr SSL_set_connect_state 3 | ||
41 | or | ||
42 | .Xr SSL_set_accept_state 3 | ||
43 | before the first call to an | ||
44 | .Xr SSL_read 3 | ||
45 | or | ||
46 | .Fn SSL_write | ||
47 | function. | ||
48 | .Pp | ||
49 | If the underlying | ||
50 | .Vt BIO | ||
51 | is | ||
52 | .Em blocking , | ||
53 | .Fn SSL_write | ||
54 | will only return once the write operation has been finished or an error | ||
55 | occurred, except when a renegotiation take place, in which case a | ||
56 | .Dv SSL_ERROR_WANT_READ | ||
57 | may occur. | ||
58 | This behaviour can be controlled with the | ||
59 | .Dv SSL_MODE_AUTO_RETRY | ||
60 | flag of the | ||
61 | .Xr SSL_CTX_set_mode 3 | ||
62 | call. | ||
63 | .Pp | ||
64 | If the underlying | ||
65 | .Vt BIO | ||
66 | is | ||
67 | .Em non-blocking , | ||
68 | .Fn SSL_write | ||
69 | will also return when the underlying | ||
70 | .Vt BIO | ||
71 | could not satisfy the needs of | ||
72 | .Fn SSL_write | ||
73 | to continue the operation. | ||
74 | In this case a call to | ||
75 | .Xr SSL_get_error 3 | ||
76 | with the return value of | ||
77 | .Fn SSL_write | ||
78 | will yield | ||
79 | .Dv SSL_ERROR_WANT_READ | ||
80 | or | ||
81 | .Dv SSL_ERROR_WANT_WRITE . | ||
82 | As at any time a re-negotiation is possible, a call to | ||
83 | .Fn SSL_write | ||
84 | can also cause read operations! | ||
85 | The calling process then must repeat the call after taking appropriate action | ||
86 | to satisfy the needs of | ||
87 | .Fn SSL_write . | ||
88 | The action depends on the underlying | ||
89 | .Vt BIO . | ||
90 | When using a non-blocking socket, nothing is to be done, but | ||
91 | .Xr select 2 | ||
92 | can be used to check for the required condition. | ||
93 | When using a buffering | ||
94 | .Vt BIO , | ||
95 | like a | ||
96 | .Vt BIO | ||
97 | pair, data must be written into or retrieved out of the BIO before being able | ||
98 | to continue. | ||
99 | .Pp | ||
100 | .Fn SSL_write | ||
101 | will only return with success, when the complete contents of | ||
102 | .Fa buf | ||
103 | of length | ||
104 | .Fa num | ||
105 | have been written. | ||
106 | This default behaviour can be changed with the | ||
107 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
108 | option of | ||
109 | .Xr SSL_CTX_set_mode 3 . | ||
110 | When this flag is set, | ||
111 | .Fn SSL_write | ||
112 | will also return with success when a partial write has been successfully | ||
113 | completed. | ||
114 | In this case the | ||
115 | .Fn SSL_write | ||
116 | operation is considered completed. | ||
117 | The bytes are sent and a new | ||
118 | .Fn SSL_write | ||
119 | operation with a new buffer (with the already sent bytes removed) must be | ||
120 | started. | ||
121 | A partial write is performed with the size of a message block, which is 16kB | ||
122 | for SSLv3/TLSv1. | ||
123 | .Sh WARNING | ||
124 | When an | ||
125 | .Fn SSL_write | ||
126 | operation has to be repeated because of | ||
127 | .Dv SSL_ERROR_WANT_READ | ||
128 | or | ||
129 | .Dv SSL_ERROR_WANT_WRITE , | ||
130 | it must be repeated with the same arguments. | ||
131 | .Pp | ||
132 | When calling | ||
133 | .Fn SSL_write | ||
134 | with | ||
135 | .Fa num Ns | ||
136 | =0 bytes to be sent the behaviour is undefined. | ||
137 | .Sh RETURN VALUES | ||
138 | The following return values can occur: | ||
139 | .Bl -tag -width Ds | ||
140 | .It >0 | ||
141 | The write operation was successful. | ||
142 | The return value is the number of bytes actually written to the TLS/SSL | ||
143 | connection. | ||
144 | .It 0 | ||
145 | The write operation was not successful. | ||
146 | Probably the underlying connection was closed. | ||
147 | Call | ||
148 | .Xr SSL_get_error 3 | ||
149 | with the return value to find out whether an error occurred or the connection | ||
150 | was shut down cleanly | ||
151 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
152 | .Pp | ||
153 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
154 | be detected whether the underlying connection was closed. | ||
155 | It cannot be checked why the closure happened. | ||
156 | .It <0 | ||
157 | The write operation was not successful, because either an error occurred or | ||
158 | action must be taken by the calling process. | ||
159 | Call | ||
160 | .Xr SSL_get_error 3 | ||
161 | with the return value to find out the reason. | ||
162 | .El | ||
163 | .Sh SEE ALSO | ||
164 | .Xr bio 3 , | ||
165 | .Xr ssl 3 , | ||
166 | .Xr SSL_accept 3 , | ||
167 | .Xr SSL_connect 3 , | ||
168 | .Xr SSL_CTX_new 3 , | ||
169 | .Xr SSL_CTX_set_mode 3 , | ||
170 | .Xr SSL_get_error 3 , | ||
171 | .Xr SSL_read 3 , | ||
172 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/SSL_write.pod b/src/lib/libssl/src/doc/ssl/SSL_write.pod deleted file mode 100644 index f248f7d740..0000000000 --- a/src/lib/libssl/src/doc/ssl/SSL_write.pod +++ /dev/null | |||
@@ -1,109 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | SSL_write - write bytes to a TLS/SSL connection. | ||
6 | |||
7 | =head1 SYNOPSIS | ||
8 | |||
9 | #include <openssl/ssl.h> | ||
10 | |||
11 | int SSL_write(SSL *ssl, const void *buf, int num); | ||
12 | |||
13 | =head1 DESCRIPTION | ||
14 | |||
15 | SSL_write() writes B<num> bytes from the buffer B<buf> into the specified | ||
16 | B<ssl> connection. | ||
17 | |||
18 | =head1 NOTES | ||
19 | |||
20 | If necessary, SSL_write() will negotiate a TLS/SSL session, if | ||
21 | not already explicitly performed by L<SSL_connect(3)|SSL_connect(3)> or | ||
22 | L<SSL_accept(3)|SSL_accept(3)>. If the | ||
23 | peer requests a re-negotiation, it will be performed transparently during | ||
24 | the SSL_write() operation. The behaviour of SSL_write() depends on the | ||
25 | underlying BIO. | ||
26 | |||
27 | For the transparent negotiation to succeed, the B<ssl> must have been | ||
28 | initialized to client or server mode. This is being done by calling | ||
29 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)> or SSL_set_accept_state() | ||
30 | before the first call to an L<SSL_read(3)|SSL_read(3)> or SSL_write() function. | ||
31 | |||
32 | If the underlying BIO is B<blocking>, SSL_write() will only return, once the | ||
33 | write operation has been finished or an error occurred, except when a | ||
34 | renegotiation take place, in which case a SSL_ERROR_WANT_READ may occur. | ||
35 | This behaviour can be controlled with the SSL_MODE_AUTO_RETRY flag of the | ||
36 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)> call. | ||
37 | |||
38 | If the underlying BIO is B<non-blocking>, SSL_write() will also return, | ||
39 | when the underlying BIO could not satisfy the needs of SSL_write() | ||
40 | to continue the operation. In this case a call to | ||
41 | L<SSL_get_error(3)|SSL_get_error(3)> with the | ||
42 | return value of SSL_write() will yield B<SSL_ERROR_WANT_READ> or | ||
43 | B<SSL_ERROR_WANT_WRITE>. As at any time a re-negotiation is possible, a | ||
44 | call to SSL_write() can also cause read operations! The calling process | ||
45 | then must repeat the call after taking appropriate action to satisfy the | ||
46 | needs of SSL_write(). The action depends on the underlying BIO. When using a | ||
47 | non-blocking socket, nothing is to be done, but select() can be used to check | ||
48 | for the required condition. When using a buffering BIO, like a BIO pair, data | ||
49 | must be written into or retrieved out of the BIO before being able to continue. | ||
50 | |||
51 | SSL_write() will only return with success, when the complete contents | ||
52 | of B<buf> of length B<num> has been written. This default behaviour | ||
53 | can be changed with the SSL_MODE_ENABLE_PARTIAL_WRITE option of | ||
54 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>. When this flag is set, | ||
55 | SSL_write() will also return with success, when a partial write has been | ||
56 | successfully completed. In this case the SSL_write() operation is considered | ||
57 | completed. The bytes are sent and a new SSL_write() operation with a new | ||
58 | buffer (with the already sent bytes removed) must be started. | ||
59 | A partial write is performed with the size of a message block, which is | ||
60 | 16kB for SSLv3/TLSv1. | ||
61 | |||
62 | =head1 WARNING | ||
63 | |||
64 | When an SSL_write() operation has to be repeated because of | ||
65 | B<SSL_ERROR_WANT_READ> or B<SSL_ERROR_WANT_WRITE>, it must be repeated | ||
66 | with the same arguments. | ||
67 | |||
68 | When calling SSL_write() with num=0 bytes to be sent the behaviour is | ||
69 | undefined. | ||
70 | |||
71 | =head1 RETURN VALUES | ||
72 | |||
73 | The following return values can occur: | ||
74 | |||
75 | =over 4 | ||
76 | |||
77 | =item C<E<gt>0> | ||
78 | |||
79 | The write operation was successful, the return value is the number of | ||
80 | bytes actually written to the TLS/SSL connection. | ||
81 | |||
82 | =item C<0> | ||
83 | |||
84 | The write operation was not successful. Probably the underlying connection | ||
85 | was closed. Call SSL_get_error() with the return value B<ret> to find out, | ||
86 | whether an error occurred or the connection was shut down cleanly | ||
87 | (SSL_ERROR_ZERO_RETURN). | ||
88 | |||
89 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can | ||
90 | only be detected, whether the underlying connection was closed. It cannot | ||
91 | be checked, why the closure happened. | ||
92 | |||
93 | =item C<E<lt>0> | ||
94 | |||
95 | The write operation was not successful, because either an error occurred | ||
96 | or action must be taken by the calling process. Call SSL_get_error() with the | ||
97 | return value B<ret> to find out the reason. | ||
98 | |||
99 | =back | ||
100 | |||
101 | =head1 SEE ALSO | ||
102 | |||
103 | L<SSL_get_error(3)|SSL_get_error(3)>, L<SSL_read(3)|SSL_read(3)>, | ||
104 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
105 | L<SSL_connect(3)|SSL_connect(3)>, L<SSL_accept(3)|SSL_accept(3)> | ||
106 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | ||
107 | L<ssl(3)|ssl(3)>, L<bio(3)|bio(3)> | ||
108 | |||
109 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.3 b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.3 new file mode 100644 index 0000000000..3a40c32e69 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.3 | |||
@@ -0,0 +1,126 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt D2I_SSL_SESSION 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm d2i_SSL_SESSION , | ||
6 | .Nm i2d_SSL_SESSION | ||
7 | .Nd convert SSL_SESSION object from/to ASN1 representation | ||
8 | .Sh SYNOPSIS | ||
9 | .In openssl/ssl.h | ||
10 | .Ft SSL_SESSION * | ||
11 | .Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" | ||
12 | .Ft int | ||
13 | .Fn i2d_SSL_SESSION "SSL_SESSION *in" "unsigned char **pp" | ||
14 | .Sh DESCRIPTION | ||
15 | .Fn d2i_SSL_SESSION | ||
16 | transforms the external ASN1 representation of an SSL/TLS session, | ||
17 | stored as binary data at location | ||
18 | .Fa pp | ||
19 | with length | ||
20 | .Fa length , | ||
21 | into | ||
22 | an | ||
23 | .Vt SSL_SESSION | ||
24 | object. | ||
25 | .Pp | ||
26 | .Fn i2d_SSL_SESSION | ||
27 | transforms the | ||
28 | .Vt SSL_SESSION | ||
29 | object | ||
30 | .Fa in | ||
31 | into the ASN1 representation and stores it into the memory location pointed to | ||
32 | by | ||
33 | .Fa pp . | ||
34 | The length of the resulting ASN1 representation is returned. | ||
35 | If | ||
36 | .Fa pp | ||
37 | is the | ||
38 | .Dv NULL | ||
39 | pointer, only the length is calculated and returned. | ||
40 | .Sh NOTES | ||
41 | The | ||
42 | .Vt SSL_SESSION | ||
43 | object is built from several | ||
44 | .Xr malloc 3 Ns | ||
45 | -ed parts; it can therefore not be moved, copied or stored directly. | ||
46 | In order to store session data on disk or into a database, | ||
47 | it must be transformed into a binary ASN1 representation. | ||
48 | .Pp | ||
49 | When using | ||
50 | .Fn d2i_SSL_SESSION , | ||
51 | the | ||
52 | .Vt SSL_SESSION | ||
53 | object is automatically allocated. | ||
54 | The reference count is 1, so that the session must be explicitly removed using | ||
55 | .Xr SSL_SESSION_free 3 , | ||
56 | unless the | ||
57 | .Vt SSL_SESSION | ||
58 | object is completely taken over, when being called inside the | ||
59 | .Xr get_session_cb 3 | ||
60 | (see | ||
61 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
62 | .Pp | ||
63 | .Vt SSL_SESSION | ||
64 | objects keep internal link information about the session cache list when being | ||
65 | inserted into one | ||
66 | .Vt SSL_CTX | ||
67 | object's session cache. | ||
68 | One | ||
69 | .Vt SSL_SESSION | ||
70 | object, regardless of its reference count, must therefore only be used with one | ||
71 | .Vt SSL_CTX | ||
72 | object (and the | ||
73 | .Vt SSL | ||
74 | objects created from this | ||
75 | .Vt SSL_CTX | ||
76 | object). | ||
77 | .Pp | ||
78 | When using | ||
79 | .Fn i2d_SSL_SESSION , | ||
80 | the memory location pointed to by | ||
81 | .Fa pp | ||
82 | must be large enough to hold the binary representation of the session. | ||
83 | There is no known limit on the size of the created ASN1 representation, | ||
84 | so the necessary amount of space should be obtained by first calling | ||
85 | .Fn i2d_SSL_SESSION | ||
86 | with | ||
87 | .Fa pp Ns | ||
88 | = Ns | ||
89 | .Dv NULL , | ||
90 | and obtain the size needed, then allocate the memory and call | ||
91 | .Fn i2d_SSL_SESSION | ||
92 | again. | ||
93 | Note that this will advance the value contained in | ||
94 | .Fa *pp | ||
95 | so it is necessary to save a copy of the original allocation. | ||
96 | For example: | ||
97 | .Bd -literal | ||
98 | int i, j; | ||
99 | |||
100 | char *p, *temp; | ||
101 | |||
102 | i = i2d_SSL_SESSION(sess, NULL); | ||
103 | p = temp = malloc(i); | ||
104 | if (temp != NULL) { | ||
105 | j = i2d_SSL_SESSION(sess, &temp); | ||
106 | assert(i == j); | ||
107 | assert(p + i == temp); | ||
108 | } | ||
109 | .Ed | ||
110 | .Sh RETURN VALUES | ||
111 | .Fn d2i_SSL_SESSION | ||
112 | returns a pointer to the newly allocated | ||
113 | .Vt SSL_SESSION | ||
114 | object. | ||
115 | In case of failure a | ||
116 | .Dv NULL | ||
117 | pointer is returned and the error message can be retrieved from the error | ||
118 | stack. | ||
119 | .Pp | ||
120 | .Fn i2d_SSL_SESSION | ||
121 | returns the size of the ASN1 representation in bytes. | ||
122 | When the session is not valid, 0 is returned and no operation is performed. | ||
123 | .Sh SEE ALSO | ||
124 | .Xr ssl 3 , | ||
125 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
126 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod b/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod deleted file mode 100644 index d817f72b54..0000000000 --- a/src/lib/libssl/src/doc/ssl/d2i_SSL_SESSION.pod +++ /dev/null | |||
@@ -1,80 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | d2i_SSL_SESSION, i2d_SSL_SESSION - convert SSL_SESSION object from/to ASN1 | ||
6 | representation | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/ssl.h> | ||
11 | |||
12 | SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, const unsigned char **pp, long length); | ||
13 | int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp); | ||
14 | |||
15 | =head1 DESCRIPTION | ||
16 | |||
17 | d2i_SSL_SESSION() transforms the external ASN1 representation of an SSL/TLS | ||
18 | session, stored as binary data at location B<pp> with length B<length>, into | ||
19 | an SSL_SESSION object. | ||
20 | |||
21 | i2d_SSL_SESSION() transforms the SSL_SESSION object B<in> into the ASN1 | ||
22 | representation and stores it into the memory location pointed to by B<pp>. | ||
23 | The length of the resulting ASN1 representation is returned. If B<pp> is | ||
24 | the NULL pointer, only the length is calculated and returned. | ||
25 | |||
26 | =head1 NOTES | ||
27 | |||
28 | The SSL_SESSION object is built from several malloc()ed parts, it can | ||
29 | therefore not be moved, copied or stored directly. In order to store | ||
30 | session data on disk or into a database, it must be transformed into | ||
31 | a binary ASN1 representation. | ||
32 | |||
33 | When using d2i_SSL_SESSION(), the SSL_SESSION object is automatically | ||
34 | allocated. The reference count is 1, so that the session must be | ||
35 | explicitly removed using L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
36 | unless the SSL_SESSION object is completely taken over, when being called | ||
37 | inside the get_session_cb() (see | ||
38 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>). | ||
39 | |||
40 | SSL_SESSION objects keep internal link information about the session cache | ||
41 | list, when being inserted into one SSL_CTX object's session cache. | ||
42 | One SSL_SESSION object, regardless of its reference count, must therefore | ||
43 | only be used with one SSL_CTX object (and the SSL objects created | ||
44 | from this SSL_CTX object). | ||
45 | |||
46 | When using i2d_SSL_SESSION(), the memory location pointed to by B<pp> must be | ||
47 | large enough to hold the binary representation of the session. There is no | ||
48 | known limit on the size of the created ASN1 representation, so the necessary | ||
49 | amount of space should be obtained by first calling i2d_SSL_SESSION() with | ||
50 | B<pp=NULL>, and obtain the size needed, then allocate the memory and | ||
51 | call i2d_SSL_SESSION() again. | ||
52 | Note that this will advance the value contained in B<*pp> so it is necessary | ||
53 | to save a copy of the original allocation. | ||
54 | For example: | ||
55 | int i, j; | ||
56 | char *p, *temp; | ||
57 | |||
58 | i = i2d_SSL_SESSION(sess, NULL); | ||
59 | p = temp = malloc(i); | ||
60 | if (temp != NULL) { | ||
61 | j = i2d_SSL_SESSION(sess, &temp); | ||
62 | assert(i == j); | ||
63 | assert(p + i == temp); | ||
64 | } | ||
65 | |||
66 | =head1 RETURN VALUES | ||
67 | |||
68 | d2i_SSL_SESSION() returns a pointer to the newly allocated SSL_SESSION | ||
69 | object. In case of failure the NULL-pointer is returned and the error message | ||
70 | can be retrieved from the error stack. | ||
71 | |||
72 | i2d_SSL_SESSION() returns the size of the ASN1 representation in bytes. | ||
73 | When the session is not valid, B<0> is returned and no operation is performed. | ||
74 | |||
75 | =head1 SEE ALSO | ||
76 | |||
77 | L<ssl(3)|ssl(3)>, L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
78 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)> | ||
79 | |||
80 | =cut | ||
diff --git a/src/lib/libssl/src/doc/ssl/ssl.3 b/src/lib/libssl/src/doc/ssl/ssl.3 new file mode 100644 index 0000000000..901e1fdfc1 --- /dev/null +++ b/src/lib/libssl/src/doc/ssl/ssl.3 | |||
@@ -0,0 +1,1317 @@ | |||
1 | .Dd $Mdocdate: October 12 2014 $ | ||
2 | .Dt SSL 3 | ||
3 | .Os | ||
4 | .Sh NAME | ||
5 | .Nm SSL | ||
6 | .Nd OpenSSL SSL/TLS library | ||
7 | .Sh SYNOPSIS | ||
8 | .Sh DESCRIPTION | ||
9 | The OpenSSL | ||
10 | .Nm ssl | ||
11 | library implements the Secure Sockets Layer (SSL v2/v3) and | ||
12 | Transport Layer Security (TLS v1) protocols. | ||
13 | It provides a rich API which is documented here. | ||
14 | .Pp | ||
15 | At first the library must be initialized; see | ||
16 | .Xr SSL_library_init 3 . | ||
17 | .Pp | ||
18 | Then an | ||
19 | .Vt SSL_CTX | ||
20 | object is created as a framework to establish TLS/SSL enabled connections (see | ||
21 | .Xr SSL_CTX_new 3 ) . | ||
22 | Various options regarding certificates, algorithms, etc., can be set in this | ||
23 | object. | ||
24 | .Pp | ||
25 | When a network connection has been created, it can be assigned to an | ||
26 | .Vt SSL | ||
27 | object. | ||
28 | After the | ||
29 | .Vt SSL | ||
30 | object has been created using | ||
31 | .Xr SSL_new 3 , | ||
32 | .Xr SSL_set_fd 3 | ||
33 | or | ||
34 | .Xr SSL_set_bio 3 | ||
35 | can be used to associate the network connection with the object. | ||
36 | .Pp | ||
37 | Then the TLS/SSL handshake is performed using | ||
38 | .Xr SSL_accept 3 | ||
39 | or | ||
40 | .Xr SSL_connect 3 | ||
41 | respectively. | ||
42 | .Xr SSL_read 3 | ||
43 | and | ||
44 | .Xr SSL_write 3 | ||
45 | are used to read and write data on the TLS/SSL connection. | ||
46 | .Xr SSL_shutdown 3 | ||
47 | can be used to shut down the TLS/SSL connection. | ||
48 | .Sh DATA STRUCTURES | ||
49 | Currently the OpenSSL | ||
50 | .Nm ssl | ||
51 | library functions deals with the following data structures: | ||
52 | .Bl -tag -width Ds | ||
53 | .It Vt SSL_METHOD No (SSL Method) | ||
54 | That's a dispatch structure describing the internal | ||
55 | .Nm ssl | ||
56 | library methods/functions which implement the various protocol versions | ||
57 | (SSLv1, SSLv2 and TLSv1). | ||
58 | It's needed to create an | ||
59 | .Vt SSL_CTX . | ||
60 | .It Vt SSL_CIPHER No (SSL Cipher) | ||
61 | This structure holds the algorithm information for a particular cipher which | ||
62 | is a core part of the SSL/TLS protocol. | ||
63 | The available ciphers are configured on an | ||
64 | .Vt SSL_CTX | ||
65 | basis and the actually used ones are then part of the | ||
66 | .Vt SSL_SESSION . | ||
67 | .It Vt SSL_CTX No (SSL Context) | ||
68 | That's the global context structure which is created by a server or client | ||
69 | once per program lifetime and which holds mainly default values for the | ||
70 | .Vt SSL | ||
71 | structures which are later created for the connections. | ||
72 | .It Vt SSL_SESSION No (SSL Session) | ||
73 | This is a structure containing the current TLS/SSL session details for a | ||
74 | connection: | ||
75 | .Vt SSL_CIPHER Ns s, client and server certificates, keys, etc. | ||
76 | .It Vt SSL No (SSL Connection) | ||
77 | That's the main SSL/TLS structure which is created by a server or client per | ||
78 | established connection. | ||
79 | This actually is the core structure in the SSL API. | ||
80 | Under run-time the application usually deals with this structure which has | ||
81 | links to mostly all other structures. | ||
82 | .El | ||
83 | .Sh HEADER FILES | ||
84 | Currently the OpenSSL | ||
85 | .Nm ssl | ||
86 | library provides the following C header files containing the prototypes for the | ||
87 | data structures and functions: | ||
88 | .Bl -tag -width Ds | ||
89 | .It Pa ssl.h | ||
90 | That's the common header file for the SSL/TLS API. | ||
91 | Include it into your program to make the API of the | ||
92 | .Nm ssl | ||
93 | library available. | ||
94 | It internally includes both more private SSL headers and headers from the | ||
95 | .Em crypto | ||
96 | library. | ||
97 | Whenever you need hardcore details on the internals of the SSL API, look inside | ||
98 | this header file. | ||
99 | .It Pa ssl2.h | ||
100 | That's the sub header file dealing with the SSLv2 protocol only. | ||
101 | .Bf Em | ||
102 | Usually you don't have to include it explicitly because it's already included | ||
103 | by | ||
104 | .Pa ssl.h . | ||
105 | .Ef | ||
106 | .It Pa ssl3.h | ||
107 | That's the sub header file dealing with the SSLv3 protocol only. | ||
108 | .Bf Em | ||
109 | Usually you don't have to include it explicitly because it's already included | ||
110 | by | ||
111 | .Pa ssl.h . | ||
112 | .Ef | ||
113 | .It Pa ssl23.h | ||
114 | That's the sub header file dealing with the combined use of the SSLv2 and SSLv3 | ||
115 | protocols. | ||
116 | .Bf Em | ||
117 | Usually you don't have to include it explicitly because it's already included | ||
118 | by | ||
119 | .Pa ssl.h . | ||
120 | .Ef | ||
121 | .It Pa tls1.h | ||
122 | That's the sub header file dealing with the TLSv1 protocol only. | ||
123 | .Bf Em | ||
124 | Usually you don't have to include it explicitly because it's already included | ||
125 | by | ||
126 | .Pa ssl.h . | ||
127 | .Ef | ||
128 | .El | ||
129 | .Sh API FUNCTIONS | ||
130 | The functions that the OpenSSL | ||
131 | .Nm ssl | ||
132 | library exports are documented below: | ||
133 | .Ss DEALING WITH PROTOCOL METHODS | ||
134 | Here we document the various API functions which deal with the SSL/TLS protocol | ||
135 | methods defined in | ||
136 | .Vt SSL_METHOD | ||
137 | structures. | ||
138 | .Bl -tag -width Ds | ||
139 | .It Xo | ||
140 | .Ft const SSL_METHOD * | ||
141 | .Fn SSLv2_client_method void | ||
142 | .Xc | ||
143 | Constructor for the SSLv2 | ||
144 | .Vt SSL_METHOD | ||
145 | structure for a dedicated client. | ||
146 | .It Xo | ||
147 | .Ft const SSL_METHOD * | ||
148 | .Fn SSLv2_server_method void | ||
149 | .Xc | ||
150 | Constructor for the SSLv2 | ||
151 | .Vt SSL_METHOD | ||
152 | structure for a dedicated server. | ||
153 | .It Xo | ||
154 | .Ft const SSL_METHOD * | ||
155 | .Fn SSLv2_method void | ||
156 | .Xc | ||
157 | Constructor for the SSLv2 | ||
158 | .Vt SSL_METHOD | ||
159 | structure for combined client and server. | ||
160 | .It Xo | ||
161 | .Ft const SSL_METHOD * | ||
162 | .Fn SSLv3_client_method void | ||
163 | .Xc | ||
164 | Constructor for the SSLv3 | ||
165 | .Vt SSL_METHOD | ||
166 | structure for a dedicated client. | ||
167 | .It Xo | ||
168 | .Ft const SSL_METHOD * | ||
169 | .Fn SSLv3_server_method void | ||
170 | .Xc | ||
171 | Constructor for the SSLv3 | ||
172 | .Vt SSL_METHOD | ||
173 | structure for a dedicated server. | ||
174 | .It Xo | ||
175 | .Ft const SSL_METHOD * | ||
176 | .Fn SSLv3_method void | ||
177 | .Xc | ||
178 | Constructor for the SSLv3 | ||
179 | .Vt SSL_METHOD | ||
180 | structure for combined client and server. | ||
181 | .It Xo | ||
182 | .Ft const SSL_METHOD * | ||
183 | .Fn TLSv1_client_method void | ||
184 | .Xc | ||
185 | Constructor for the TLSv1 | ||
186 | .Vt SSL_METHOD | ||
187 | structure for a dedicated client. | ||
188 | .It Xo | ||
189 | .Ft const SSL_METHOD * | ||
190 | .Fn TLSv1_server_method void | ||
191 | .Xc | ||
192 | Constructor for the TLSv1 | ||
193 | .Vt SSL_METHOD | ||
194 | structure for a dedicated server. | ||
195 | .It Xo | ||
196 | .Ft const SSL_METHOD * | ||
197 | .Fn TLSv1_method void | ||
198 | .Xc | ||
199 | Constructor for the TLSv1 | ||
200 | .Vt SSL_METHOD | ||
201 | structure for combined client and server. | ||
202 | .El | ||
203 | .Ss DEALING WITH CIPHERS | ||
204 | Here we document the various API functions which deal with the SSL/TLS ciphers | ||
205 | defined in | ||
206 | .Vt SSL_CIPHER | ||
207 | structures. | ||
208 | .Bl -tag -width Ds | ||
209 | .It Xo | ||
210 | .Ft char * | ||
211 | .Fn SSL_CIPHER_description "SSL_CIPHER *cipher" "char *buf" "int len" | ||
212 | .Xc | ||
213 | Write a string to | ||
214 | .Fa buf | ||
215 | (with a maximum size of | ||
216 | .Fa len ) | ||
217 | containing a human readable description of | ||
218 | .Fa cipher . | ||
219 | Returns | ||
220 | .Fa buf . | ||
221 | .It Xo | ||
222 | .Ft int | ||
223 | .Fn SSL_CIPHER_get_bits "SSL_CIPHER *cipher" "int *alg_bits" | ||
224 | .Xc | ||
225 | Determine the number of bits in | ||
226 | .Fa cipher . | ||
227 | Because of export crippled ciphers there are two bits: | ||
228 | the bits the algorithm supports in general (stored to | ||
229 | .Fa alg_bits ) | ||
230 | and the bits which are actually used (the return value). | ||
231 | .It Xo | ||
232 | .Ft const char * | ||
233 | .Fn SSL_CIPHER_get_name "SSL_CIPHER *cipher" | ||
234 | .Xc | ||
235 | Return the internal name of | ||
236 | .Fa cipher | ||
237 | as a string. | ||
238 | These are the various strings defined by the | ||
239 | .Dv SSL2_TXT_xxx , | ||
240 | .Dv SSL3_TXT_xxx | ||
241 | and | ||
242 | .Dv TLS1_TXT_xxx | ||
243 | definitions in the header files. | ||
244 | .It Xo | ||
245 | .Ft char * | ||
246 | .Fn SSL_CIPHER_get_version "SSL_CIPHER *cipher" | ||
247 | .Xc | ||
248 | Returns a string like | ||
249 | Qq TLSv1/SSLv3 | ||
250 | or | ||
251 | Qq SSLv2 | ||
252 | which indicates the SSL/TLS protocol version to which | ||
253 | .Fa cipher | ||
254 | belongs (i.e., where it was defined in the specification the first time). | ||
255 | .El | ||
256 | .Ss DEALING WITH PROTOCOL CONTEXTS | ||
257 | Here we document the various API functions which deal with the SSL/TLS | ||
258 | protocol context defined in the | ||
259 | .Vt SSL_CTX | ||
260 | structure. | ||
261 | .Bl -tag -width Ds | ||
262 | .It Xo | ||
263 | .Ft int | ||
264 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *x" | ||
265 | .Xc | ||
266 | .It Xo | ||
267 | .Ft long | ||
268 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" | ||
269 | .Xc | ||
270 | .It Xo | ||
271 | .Ft int | ||
272 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
273 | .Xc | ||
274 | .It Xo | ||
275 | .Ft int | ||
276 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
277 | .Xc | ||
278 | .It Xo | ||
279 | .Ft long | ||
280 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "char *parg" | ||
281 | .Xc | ||
282 | .It Xo | ||
283 | .Ft void | ||
284 | .Fn SSL_CTX_flush_sessions "SSL_CTX *s" "long t" | ||
285 | .Xc | ||
286 | .It Xo | ||
287 | .Ft void | ||
288 | .Fn SSL_CTX_free "SSL_CTX *a" | ||
289 | .Xc | ||
290 | .It Xo | ||
291 | .Ft char * | ||
292 | .Fn SSL_CTX_get_app_data "SSL_CTX *ctx" | ||
293 | .Xc | ||
294 | .It Xo | ||
295 | .Ft X509_STORE * | ||
296 | .Fn SSL_CTX_get_cert_store "SSL_CTX *ctx" | ||
297 | .Xc | ||
298 | .It Xo | ||
299 | .Ft STACK * | ||
300 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
301 | .Xc | ||
302 | .It Xo | ||
303 | .Ft int | ||
304 | .Fn "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
305 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
306 | .Xc | ||
307 | .It Xo | ||
308 | .Ft char * | ||
309 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *s" "int idx" | ||
310 | .Xc | ||
311 | .It Xo | ||
312 | .Ft int | ||
313 | .Fo SSL_CTX_get_ex_new_index | ||
314 | .Fa "long argl" | ||
315 | .Fa "void *argp" | ||
316 | .Fa "CRYPTO_EX_new *new_func" | ||
317 | .Fa "CRYPTO_EX_dup *dup_func" | ||
318 | .Fa "CRYPTO_EX_free *free_func" | ||
319 | .Fc | ||
320 | .Xc | ||
321 | .It Xo | ||
322 | .Ft void | ||
323 | .Fo "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
324 | .Fa "SSL *ssl" | ||
325 | .Fa "int cb" | ||
326 | .Fa "int ret" | ||
327 | .Fc | ||
328 | .Xc | ||
329 | .It Xo | ||
330 | .Ft int | ||
331 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
332 | .Xc | ||
333 | .It Xo | ||
334 | .Ft int | ||
335 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX *ctx" | ||
336 | .Xc | ||
337 | .It Xo | ||
338 | .Ft long | ||
339 | .Fn SSL_CTX_get_timeout "const SSL_CTX *ctx" | ||
340 | .Xc | ||
341 | .It Xo | ||
342 | .Ft int | ||
343 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
344 | .Fa "int ok" | ||
345 | .Fa "X509_STORE_CTX *ctx" | ||
346 | .Fc | ||
347 | .Xc | ||
348 | .It Xo | ||
349 | .Ft int | ||
350 | .Fn SSL_CTX_get_verify_mode "SSL_CTX *ctx" | ||
351 | .Xc | ||
352 | .It Xo | ||
353 | .Ft int | ||
354 | .Fn SSL_CTX_load_verify_locations "SSL_CTX *ctx" "char *CAfile" "char *CApath" | ||
355 | .Xc | ||
356 | .It Xo | ||
357 | .Ft long | ||
358 | .Fn SSL_CTX_need_tmp_RSA "SSL_CTX *ctx" | ||
359 | .Xc | ||
360 | .It Xo | ||
361 | .Ft SSL_CTX * | ||
362 | .Fn SSL_CTX_new "const SSL_METHOD *meth" | ||
363 | .Xc | ||
364 | .It Xo | ||
365 | .Ft int | ||
366 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
367 | .Xc | ||
368 | .It Xo | ||
369 | .Ft int | ||
370 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
371 | .Xc | ||
372 | .It Xo | ||
373 | .Ft int | ||
374 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
375 | .Xc | ||
376 | .It Xo | ||
377 | .Ft int | ||
378 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
379 | .Xc | ||
380 | .It Xo | ||
381 | .Ft int | ||
382 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
383 | .Xc | ||
384 | .It Xo | ||
385 | .Ft int | ||
386 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
387 | .Xc | ||
388 | .It Xo | ||
389 | .Ft int | ||
390 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
391 | .Xc | ||
392 | .It Xo | ||
393 | .Ft int | ||
394 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
395 | .Xc | ||
396 | .It Xo | ||
397 | .Ft int | ||
398 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
399 | .Xc | ||
400 | .It Xo | ||
401 | .Ft int | ||
402 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
403 | .Xc | ||
404 | .It Xo | ||
405 | .Ft SSL_SESSION * | ||
406 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
407 | .Fa "SSL *ssl" | ||
408 | .Fa "unsigned char *data" | ||
409 | .Fa "int len" | ||
410 | .Fa "int *copy" | ||
411 | .Fc | ||
412 | .Xc | ||
413 | .It Xo | ||
414 | .Ft int | ||
415 | .Fn "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" "SSL *ssl" "SSL_SESSION *sess" | ||
416 | .Xc | ||
417 | .It Xo | ||
418 | .Ft void | ||
419 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
420 | .Fa "SSL_CTX *ctx" | ||
421 | .Fa "SSL_SESSION *sess" | ||
422 | .Fc | ||
423 | .Xc | ||
424 | .It Xo | ||
425 | .Ft int | ||
426 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
427 | .Xc | ||
428 | .It Xo | ||
429 | .Ft int | ||
430 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
431 | .Xc | ||
432 | .It Xo | ||
433 | .Ft int | ||
434 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
435 | .Xc | ||
436 | .It Xo | ||
437 | .Ft void | ||
438 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
439 | .Xc | ||
440 | .It Xo | ||
441 | .Ft void | ||
442 | .Fo SSL_CTX_sess_set_get_cb | ||
443 | .Fa "SSL_CTX *ctx" | ||
444 | .Fa "SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)" | ||
445 | .Fc | ||
446 | .Xc | ||
447 | .It Xo | ||
448 | .Ft void | ||
449 | .Fo SSL_CTX_sess_set_new_cb | ||
450 | .Fa "SSL_CTX *ctx" | ||
451 | .Fa "int (*cb)(SSL *ssl, SSL_SESSION *sess)" | ||
452 | .Fc | ||
453 | .Xc | ||
454 | .It Xo | ||
455 | .Ft void | ||
456 | .Fo SSL_CTX_sess_set_remove_cb | ||
457 | .Fa "SSL_CTX *ctx" | ||
458 | .Fa "void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)" | ||
459 | .Fc | ||
460 | .Xc | ||
461 | .It Xo | ||
462 | .Ft int | ||
463 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
464 | .Xc | ||
465 | .It Xo | ||
466 | .Ft LHASH * | ||
467 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
468 | .Xc | ||
469 | .It Xo | ||
470 | .Ft void | ||
471 | .Fn SSL_CTX_set_app_data "SSL_CTX *ctx" "void *arg" | ||
472 | .Xc | ||
473 | .It Xo | ||
474 | .Ft void | ||
475 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *cs" | ||
476 | .Xc | ||
477 | .It Xo | ||
478 | .Ft void | ||
479 | .Fn SSL_CTX_set_cert_verify_cb "SSL_CTX *ctx" "int (*cb)()" "char *arg" | ||
480 | .Xc | ||
481 | .It Xo | ||
482 | .Ft int | ||
483 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "char *str" | ||
484 | .Xc | ||
485 | .It Xo | ||
486 | .Ft void | ||
487 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK *list" | ||
488 | .Xc | ||
489 | .It Xo | ||
490 | .Ft void | ||
491 | .Fo SSL_CTX_set_client_cert_cb | ||
492 | .Fa "SSL_CTX *ctx" | ||
493 | .Fa "int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
494 | .Fc | ||
495 | .Xc | ||
496 | .It Xo | ||
497 | .Ft void | ||
498 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
499 | .Xc | ||
500 | .It Xo | ||
501 | .Ft void | ||
502 | .Fn SSL_CTX_set_default_read_ahead "SSL_CTX *ctx" "int m" | ||
503 | .Xc | ||
504 | .It Xo | ||
505 | .Ft int | ||
506 | .Fn SSL_CTX_set_default_verify_paths "SSL_CTX *ctx" | ||
507 | .Xc | ||
508 | .It Xo | ||
509 | .Ft int | ||
510 | .Fn SSL_CTX_set_ex_data "SSL_CTX *s" "int idx" "char *arg" | ||
511 | .Xc | ||
512 | .It Xo | ||
513 | .Ft void | ||
514 | .Fo SSL_CTX_set_info_callback | ||
515 | .Fa "SSL_CTX *ctx" | ||
516 | .Fa "void (*cb)(SSL *ssl, int cb, int ret)" | ||
517 | .Fc | ||
518 | .Xc | ||
519 | .It Xo | ||
520 | .Ft void | ||
521 | .Fo SSL_CTX_set_msg_callback | ||
522 | .Fa "SSL_CTX *ctx" | ||
523 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
524 | size_t len, SSL *ssl, void *arg)" | ||
525 | .Fc | ||
526 | .Xc | ||
527 | .It Xo | ||
528 | .Ft void | ||
529 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
530 | .Xc | ||
531 | .It Xo | ||
532 | .Ft void | ||
533 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "unsigned long op" | ||
534 | .Xc | ||
535 | .It Xo | ||
536 | .Ft void | ||
537 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
538 | .Xc | ||
539 | .It Xo | ||
540 | .Ft void | ||
541 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX *ctx" "int mode" | ||
542 | .Xc | ||
543 | .It Xo | ||
544 | .Ft int | ||
545 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *meth" | ||
546 | .Xc | ||
547 | .It Xo | ||
548 | .Ft void | ||
549 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
550 | .Xc | ||
551 | .It Xo | ||
552 | .Ft long | ||
553 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX* ctx" "DH *dh" | ||
554 | .Xc | ||
555 | .It Xo | ||
556 | .Ft long | ||
557 | .Fn SSL_CTX_set_tmp_dh_callback "SSL_CTX *ctx" "DH *(*cb)(void)" | ||
558 | .Xc | ||
559 | .It Xo | ||
560 | .Ft long | ||
561 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
562 | .Xc | ||
563 | .It Xo | ||
564 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
565 | .Xc | ||
566 | .Ft long | ||
567 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
568 | .Fa "SSL_CTX *ctx" | ||
569 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
570 | .Fc | ||
571 | .Pp | ||
572 | Sets the callback which will be called when a temporary private key is | ||
573 | required. | ||
574 | The | ||
575 | .Fa export | ||
576 | flag will be set if the reason for needing a temp key is that an export | ||
577 | ciphersuite is in use, in which case, | ||
578 | .Fa keylength | ||
579 | will contain the required keylength in bits. | ||
580 | .\" XXX using what? | ||
581 | Generate a key of appropriate size (using ???) and return it. | ||
582 | .It Xo | ||
583 | .Fn SSL_set_tmp_rsa_callback | ||
584 | .Xc | ||
585 | .Ft long | ||
586 | .Fo SSL_set_tmp_rsa_callback | ||
587 | .Fa "SSL *ssl" | ||
588 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
589 | .Fc | ||
590 | .Pp | ||
591 | The same as | ||
592 | .Fn SSL_CTX_set_tmp_rsa_callback , | ||
593 | except it operates on an | ||
594 | .Vt SSL | ||
595 | session instead of a context. | ||
596 | .It Xo | ||
597 | .Ft void | ||
598 | .Fn SSL_CTX_set_verify "SSL_CTX *ctx" "int mode" "int (*cb)(void)" | ||
599 | .Xc | ||
600 | .It Xo | ||
601 | .Ft int | ||
602 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
603 | .Xc | ||
604 | .It Xo | ||
605 | .Ft int | ||
606 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
607 | .Fa "int type" | ||
608 | .Fa "SSL_CTX *ctx" | ||
609 | .Fa "unsigned char *d" | ||
610 | .Fa "long len" | ||
611 | .Fc | ||
612 | .Xc | ||
613 | .It Xo | ||
614 | .Ft int | ||
615 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
616 | .Xc | ||
617 | .It Xo | ||
618 | .Ft int | ||
619 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
620 | .Xc | ||
621 | .It Xo | ||
622 | .Ft int | ||
623 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
624 | .Xc | ||
625 | .It Xo | ||
626 | .Ft int | ||
627 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
628 | .Xc | ||
629 | .It Xo | ||
630 | .Ft int | ||
631 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
632 | .Xc | ||
633 | .It Xo | ||
634 | .Ft int | ||
635 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
636 | .Xc | ||
637 | .It Xo | ||
638 | .Ft int | ||
639 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "char *file" "int type" | ||
640 | .Xc | ||
641 | .It Xo | ||
642 | .Ft void | ||
643 | .Fo SSL_CTX_set_psk_client_callback | ||
644 | .Fa "SSL_CTX *ctx" | ||
645 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
646 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
647 | .Fc | ||
648 | .Xc | ||
649 | .It Xo | ||
650 | .Ft int | ||
651 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
652 | .Xc | ||
653 | .It Xo | ||
654 | .Ft void | ||
655 | .Fo SSL_CTX_set_psk_server_callback | ||
656 | .Fa "SSL_CTX *ctx" | ||
657 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
658 | unsigned char *psk, int max_psk_len)" | ||
659 | .Fc | ||
660 | .Xc | ||
661 | .El | ||
662 | .Ss DEALING WITH SESSIONS | ||
663 | Here we document the various API functions which deal with the SSL/TLS sessions | ||
664 | defined in the | ||
665 | .Vt SSL_SESSION | ||
666 | structures. | ||
667 | .Bl -tag -width Ds | ||
668 | .It Xo | ||
669 | .Ft int | ||
670 | .Fn SSL_SESSION_cmp "const SSL_SESSION *a" "const SSL_SESSION *b" | ||
671 | .Xc | ||
672 | .It Xo | ||
673 | .Ft void | ||
674 | .Fn SSL_SESSION_free "SSL_SESSION *ss" | ||
675 | .Xc | ||
676 | .It Xo | ||
677 | .Ft char * | ||
678 | .Fn SSL_SESSION_get_app_data "SSL_SESSION *s" | ||
679 | .Xc | ||
680 | .It Xo | ||
681 | .Ft char * | ||
682 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *s" "int idx" | ||
683 | .Xc | ||
684 | .It Xo | ||
685 | .Ft int | ||
686 | .Fo SSL_SESSION_get_ex_new_index | ||
687 | .Fa "long argl" | ||
688 | .Fa "char *argp" | ||
689 | .Fa "int (*new_func)(void)" | ||
690 | .Fa "int (*dup_func)(void), void (*free_func)(void)" | ||
691 | .Fc | ||
692 | .Xc | ||
693 | .It Xo | ||
694 | .Ft long | ||
695 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
696 | .Xc | ||
697 | .It Xo | ||
698 | .Ft long | ||
699 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
700 | .Xc | ||
701 | .It Xo | ||
702 | .Ft unsigned long | ||
703 | .Fn SSL_SESSION_hash "const SSL_SESSION *a" | ||
704 | .Xc | ||
705 | .It Xo | ||
706 | .Ft SSL_SESSION * | ||
707 | .Fn SSL_SESSION_new void | ||
708 | .Xc | ||
709 | .It Xo | ||
710 | .Ft int | ||
711 | .Fn SSL_SESSION_print "BIO *bp" "const SSL_SESSION *x" | ||
712 | .Xc | ||
713 | .It Xo | ||
714 | .Ft int | ||
715 | .Fn SSL_SESSION_print_fp "FILE *fp" "const SSL_SESSION *x" | ||
716 | .Xc | ||
717 | .It Xo | ||
718 | .Ft void | ||
719 | .Fn SSL_SESSION_set_app_data "SSL_SESSION *s" "char *a" | ||
720 | .Xc | ||
721 | .It Xo | ||
722 | .Ft int | ||
723 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *s" "int idx" "char *arg" | ||
724 | .Xc | ||
725 | .It Xo | ||
726 | .Ft long | ||
727 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long t" | ||
728 | .Xc | ||
729 | .It Xo | ||
730 | .Ft long | ||
731 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long t" | ||
732 | .Xc | ||
733 | .El | ||
734 | .Ss DEALING WITH CONNECTIONS | ||
735 | Here we document the various API functions which deal with the SSL/TLS | ||
736 | connection defined in the | ||
737 | .Vt SSL | ||
738 | structure. | ||
739 | .Bl -tag -width Ds | ||
740 | .It Xo | ||
741 | .Ft int | ||
742 | .Fn SSL_accept "SSL *ssl" | ||
743 | .Xc | ||
744 | .It Xo | ||
745 | .Ft int | ||
746 | .Fn SSL_add_dir_cert_subjects_to_stack "STACK *stack" "const char *dir" | ||
747 | .Xc | ||
748 | .It Xo | ||
749 | .Ft int | ||
750 | .Fn SSL_add_file_cert_subjects_to_stack "STACK *stack" "const char *file" | ||
751 | .Xc | ||
752 | .It Xo | ||
753 | .Ft int | ||
754 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *x" | ||
755 | .Xc | ||
756 | .It Xo | ||
757 | .Ft char * | ||
758 | .Fn SSL_alert_desc_string "int value" | ||
759 | .Xc | ||
760 | .It Xo | ||
761 | .Ft char * | ||
762 | .Fn SSL_alert_desc_string_long "int value" | ||
763 | .Xc | ||
764 | .It Xo | ||
765 | .Ft char * | ||
766 | .Fn SSL_alert_type_string "int value" | ||
767 | .Xc | ||
768 | .It Xo | ||
769 | .Ft char * | ||
770 | .Fn SSL_alert_type_string_long "int value" | ||
771 | .Xc | ||
772 | .It Xo | ||
773 | .Ft int | ||
774 | .Fn SSL_check_private_key "const SSL *ssl" | ||
775 | .Xc | ||
776 | .It Xo | ||
777 | .Ft void | ||
778 | .Fn SSL_clear "SSL *ssl" | ||
779 | .Xc | ||
780 | .It Xo | ||
781 | .Ft long | ||
782 | .Fn SSL_clear_num_renegotiations "SSL *ssl" | ||
783 | .Xc | ||
784 | .It Xo | ||
785 | .Ft int | ||
786 | .Fn SSL_connect "SSL *ssl" | ||
787 | .Xc | ||
788 | .It Xo | ||
789 | .Ft void | ||
790 | .Fn SSL_copy_session_id "SSL *t" "const SSL *f" | ||
791 | .Xc | ||
792 | .It Xo | ||
793 | .Ft long | ||
794 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "char *parg" | ||
795 | .Xc | ||
796 | .It Xo | ||
797 | .Ft int | ||
798 | .Fn SSL_do_handshake "SSL *ssl" | ||
799 | .Xc | ||
800 | .It Xo | ||
801 | .Ft SSL * | ||
802 | .Fn SSL_dup "SSL *ssl" | ||
803 | .Xc | ||
804 | .It Xo | ||
805 | .Ft STACK * | ||
806 | .Fn SSL_dup_CA_list "STACK *sk" | ||
807 | .Xc | ||
808 | .It Xo | ||
809 | .Ft void | ||
810 | .Fn SSL_free "SSL *ssl" | ||
811 | .Xc | ||
812 | .It Xo | ||
813 | .Ft SSL_CTX * | ||
814 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
815 | .Xc | ||
816 | .It Xo | ||
817 | .Ft char * | ||
818 | .Fn SSL_get_app_data "SSL *ssl" | ||
819 | .Xc | ||
820 | .It Xo | ||
821 | .Ft X509 * | ||
822 | .Fn SSL_get_certificate "const SSL *ssl" | ||
823 | .Xc | ||
824 | .It Xo | ||
825 | .Ft const char * | ||
826 | .Fn SSL_get_cipher "const SSL *ssl" | ||
827 | .Xc | ||
828 | .It Xo | ||
829 | .Ft int | ||
830 | .Fn SSL_get_cipher_bits "const SSL *ssl" "int *alg_bits" | ||
831 | .Xc | ||
832 | .It Xo | ||
833 | .Ft char * | ||
834 | .Fn SSL_get_cipher_list "const SSL *ssl" "int n" | ||
835 | .Xc | ||
836 | .It Xo | ||
837 | .Ft char * | ||
838 | .Fn SSL_get_cipher_name "const SSL *ssl" | ||
839 | .Xc | ||
840 | .It Xo | ||
841 | .Ft char * | ||
842 | .Fn SSL_get_cipher_version "const SSL *ssl" | ||
843 | .Xc | ||
844 | .It Xo | ||
845 | .Ft STACK * | ||
846 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
847 | .Xc | ||
848 | .It Xo | ||
849 | .Ft STACK * | ||
850 | .Fn SSL_get_client_CA_list "const SSL *ssl" | ||
851 | .Xc | ||
852 | .It Xo | ||
853 | .Ft SSL_CIPHER * | ||
854 | .Fn SSL_get_current_cipher "SSL *ssl" | ||
855 | .Xc | ||
856 | .It Xo | ||
857 | .Ft long | ||
858 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
859 | .Xc | ||
860 | .It Xo | ||
861 | .Ft int | ||
862 | .Fn SSL_get_error "const SSL *ssl" "int i" | ||
863 | .Xc | ||
864 | .It Xo | ||
865 | .Ft char * | ||
866 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
867 | .Xc | ||
868 | .It Xo | ||
869 | .Ft int | ||
870 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
871 | .Xc | ||
872 | .It Xo | ||
873 | .Ft int | ||
874 | .Fo SSL_get_ex_new_index | ||
875 | .Fa "long argl" | ||
876 | .Fa "char *argp" | ||
877 | .Fa "int (*new_func)(void)" | ||
878 | .Fa "int (*dup_func)(void)" | ||
879 | .Fa "void (*free_func)(void)" | ||
880 | .Fc | ||
881 | .Xc | ||
882 | .It Xo | ||
883 | .Ft int | ||
884 | .Fn SSL_get_fd "const SSL *ssl" | ||
885 | .Xc | ||
886 | .It Xo | ||
887 | .Ft void | ||
888 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
889 | .Xc | ||
890 | .It Xo | ||
891 | .Ft STACK * | ||
892 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
893 | .Xc | ||
894 | .It Xo | ||
895 | .Ft X509 * | ||
896 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
897 | .Xc | ||
898 | .It Xo | ||
899 | .Ft EVP_PKEY * | ||
900 | .Fn SSL_get_privatekey "SSL *ssl" | ||
901 | .Xc | ||
902 | .It Xo | ||
903 | .Ft int | ||
904 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
905 | .Xc | ||
906 | .It Xo | ||
907 | .Ft BIO * | ||
908 | .Fn SSL_get_rbio "const SSL *ssl" | ||
909 | .Xc | ||
910 | .It Xo | ||
911 | .Ft int | ||
912 | .Fn SSL_get_read_ahead "const SSL *ssl" | ||
913 | .Xc | ||
914 | .It Xo | ||
915 | .Ft SSL_SESSION * | ||
916 | .Fn SSL_get_session "const SSL *ssl" | ||
917 | .Xc | ||
918 | .It Xo | ||
919 | .Ft char * | ||
920 | .Fn SSL_get_shared_ciphers "const SSL *ssl" "char *buf" "int len" | ||
921 | .Xc | ||
922 | .It Xo | ||
923 | .Ft int | ||
924 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
925 | .Xc | ||
926 | .It Xo | ||
927 | .Ft const SSL_METHOD * | ||
928 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
929 | .Xc | ||
930 | .It Xo | ||
931 | .Ft int | ||
932 | .Fn SSL_get_state "const SSL *ssl" | ||
933 | .Xc | ||
934 | .It Xo | ||
935 | .Ft long | ||
936 | .Fn SSL_get_time "const SSL *ssl" | ||
937 | .Xc | ||
938 | .It Xo | ||
939 | .Ft long | ||
940 | .Fn SSL_get_timeout "const SSL *ssl" | ||
941 | .Xc | ||
942 | .It Xo | ||
943 | .Ft int | ||
944 | .Fn "(*SSL_get_verify_callback(const SSL *ssl))" int "X509_STORE_CTX *" | ||
945 | .Xc | ||
946 | .It Xo | ||
947 | .Ft int | ||
948 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
949 | .Xc | ||
950 | .It Xo | ||
951 | .Ft long | ||
952 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
953 | .Xc | ||
954 | .It Xo | ||
955 | .Ft char * | ||
956 | .Fn SSL_get_version "const SSL *ssl" | ||
957 | .Xc | ||
958 | .It Xo | ||
959 | .Ft BIO * | ||
960 | .Fn SSL_get_wbio "const SSL *ssl" | ||
961 | .Xc | ||
962 | .It Xo | ||
963 | .Ft int | ||
964 | .Fn SSL_in_accept_init "SSL *ssl" | ||
965 | .Xc | ||
966 | .It Xo | ||
967 | .Ft int | ||
968 | .Fn SSL_in_before "SSL *ssl" | ||
969 | .Xc | ||
970 | .It Xo | ||
971 | .Ft int | ||
972 | .Fn SSL_in_connect_init "SSL *ssl" | ||
973 | .Xc | ||
974 | .It Xo | ||
975 | .Ft int | ||
976 | .Fn SSL_in_init "SSL *ssl" | ||
977 | .Xc | ||
978 | .It Xo | ||
979 | .Ft int | ||
980 | .Fn SSL_is_init_finished "SSL *ssl" | ||
981 | .Xc | ||
982 | .It Xo | ||
983 | .Ft STACK * | ||
984 | .Fn SSL_load_client_CA_file "char *file" | ||
985 | .Xc | ||
986 | .It Xo | ||
987 | .Ft void | ||
988 | .Fn SSL_load_error_strings "void" | ||
989 | .Xc | ||
990 | .It Xo | ||
991 | .Ft SSL * | ||
992 | .Fn SSL_new "SSL_CTX *ctx" | ||
993 | .Xc | ||
994 | .It Xo | ||
995 | .Ft long | ||
996 | .Fn SSL_num_renegotiations "SSL *ssl" | ||
997 | .Xc | ||
998 | .It Xo | ||
999 | .Ft int | ||
1000 | .Fn SSL_peek "SSL *ssl" "void *buf" "int num" | ||
1001 | .Xc | ||
1002 | .It Xo | ||
1003 | .Ft int | ||
1004 | .Fn SSL_pending "const SSL *ssl" | ||
1005 | .Xc | ||
1006 | .It Xo | ||
1007 | .Ft int | ||
1008 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
1009 | .Xc | ||
1010 | .It Xo | ||
1011 | .Ft int | ||
1012 | .Fn SSL_renegotiate "SSL *ssl" | ||
1013 | .Xc | ||
1014 | .It Xo | ||
1015 | .Ft char * | ||
1016 | .Fn SSL_rstate_string "SSL *ssl" | ||
1017 | .Xc | ||
1018 | .It Xo | ||
1019 | .Ft char * | ||
1020 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
1021 | .Xc | ||
1022 | .It Xo | ||
1023 | .Ft long | ||
1024 | .Fn SSL_session_reused "SSL *ssl" | ||
1025 | .Xc | ||
1026 | .It Xo | ||
1027 | .Ft void | ||
1028 | .Fn SSL_set_accept_state "SSL *ssl" | ||
1029 | .Xc | ||
1030 | .It Xo | ||
1031 | .Ft void | ||
1032 | .Fn SSL_set_app_data "SSL *ssl" "char *arg" | ||
1033 | .Xc | ||
1034 | .It Xo | ||
1035 | .Ft void | ||
1036 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
1037 | .Xc | ||
1038 | .It Xo | ||
1039 | .Ft int | ||
1040 | .Fn SSL_set_cipher_list "SSL *ssl" "char *str" | ||
1041 | .Xc | ||
1042 | .It Xo | ||
1043 | .Ft void | ||
1044 | .Fn SSL_set_client_CA_list "SSL *ssl" "STACK *list" | ||
1045 | .Xc | ||
1046 | .It Xo | ||
1047 | .Ft void | ||
1048 | .Fn SSL_set_connect_state "SSL *ssl" | ||
1049 | .Xc | ||
1050 | .It Xo | ||
1051 | .Ft int | ||
1052 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "char *arg" | ||
1053 | .Xc | ||
1054 | .It Xo | ||
1055 | .Ft int | ||
1056 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
1057 | .Xc | ||
1058 | .It Xo | ||
1059 | .Ft void | ||
1060 | .Fn SSL_set_info_callback "SSL *ssl" "void (*cb)(void)" | ||
1061 | .Xc | ||
1062 | .It Xo | ||
1063 | .Ft void | ||
1064 | .Fo SSL_set_msg_callback | ||
1065 | .Fa "SSL *ctx" | ||
1066 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
1067 | size_t len, SSL *ssl, void *arg)" | ||
1068 | .Fc | ||
1069 | .Xc | ||
1070 | .It Xo | ||
1071 | .Ft void | ||
1072 | .Fn SSL_set_msg_callback_arg "SSL *ctx" "void *arg" | ||
1073 | .Xc | ||
1074 | .It Xo | ||
1075 | .Ft void | ||
1076 | .Fn SSL_set_options "SSL *ssl" "unsigned long op" | ||
1077 | .Xc | ||
1078 | .It Xo | ||
1079 | .Ft void | ||
1080 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
1081 | .Xc | ||
1082 | .It Xo | ||
1083 | .Ft void | ||
1084 | .Fn SSL_set_read_ahead "SSL *ssl" "int yes" | ||
1085 | .Xc | ||
1086 | .It Xo | ||
1087 | .Ft int | ||
1088 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
1089 | .Xc | ||
1090 | .It Xo | ||
1091 | .Ft int | ||
1092 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
1093 | .Xc | ||
1094 | .It Xo | ||
1095 | .Ft void | ||
1096 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
1097 | .Xc | ||
1098 | .It Xo | ||
1099 | .Ft int | ||
1100 | .Fn SSL_set_ssl_method "SSL *ssl" "const SSL_METHOD *meth" | ||
1101 | .Xc | ||
1102 | .It Xo | ||
1103 | .Ft void | ||
1104 | .Fn SSL_set_time "SSL *ssl" "long t" | ||
1105 | .Xc | ||
1106 | .It Xo | ||
1107 | .Ft void | ||
1108 | .Fn SSL_set_timeout "SSL *ssl" "long t" | ||
1109 | .Xc | ||
1110 | .It Xo | ||
1111 | .Ft void | ||
1112 | .Fn SSL_set_verify "SSL *ssl" "int mode" "int (*callback)(void)" | ||
1113 | .Xc | ||
1114 | .It Xo | ||
1115 | .Ft void | ||
1116 | .Fn SSL_set_verify_result "SSL *ssl" "long arg" | ||
1117 | .Xc | ||
1118 | .It Xo | ||
1119 | .Ft int | ||
1120 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
1121 | .Xc | ||
1122 | .It Xo | ||
1123 | .Ft int | ||
1124 | .Fn SSL_shutdown "SSL *ssl" | ||
1125 | .Xc | ||
1126 | .It Xo | ||
1127 | .Ft int | ||
1128 | .Fn SSL_state "const SSL *ssl" | ||
1129 | .Xc | ||
1130 | .It Xo | ||
1131 | .Ft char * | ||
1132 | .Fn SSL_state_string "const SSL *ssl" | ||
1133 | .Xc | ||
1134 | .It Xo | ||
1135 | .Ft char * | ||
1136 | .Fn SSL_state_string_long "const SSL *ssl" | ||
1137 | .Xc | ||
1138 | .It Xo | ||
1139 | .Ft long | ||
1140 | .Fn SSL_total_renegotiations "SSL *ssl" | ||
1141 | .Xc | ||
1142 | .It Xo | ||
1143 | .Ft int | ||
1144 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
1145 | .Xc | ||
1146 | .It Xo | ||
1147 | .Ft int | ||
1148 | .Fn SSL_use_PrivateKey_ASN1 "int type" "SSL *ssl" "unsigned char *d" "long len" | ||
1149 | .Xc | ||
1150 | .It Xo | ||
1151 | .Ft int | ||
1152 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "char *file" "int type" | ||
1153 | .Xc | ||
1154 | .It Xo | ||
1155 | .Ft int | ||
1156 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
1157 | .Xc | ||
1158 | .It Xo | ||
1159 | .Ft int | ||
1160 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
1161 | .Xc | ||
1162 | .It Xo | ||
1163 | .Ft int | ||
1164 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "char *file" "int type" | ||
1165 | .Xc | ||
1166 | .It Xo | ||
1167 | .Ft int | ||
1168 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
1169 | .Xc | ||
1170 | .It Xo | ||
1171 | .Ft int | ||
1172 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "int len" "unsigned char *d" | ||
1173 | .Xc | ||
1174 | .It Xo | ||
1175 | .Ft int | ||
1176 | .Fn SSL_use_certificate_file "SSL *ssl" "char *file" "int type" | ||
1177 | .Xc | ||
1178 | .It Xo | ||
1179 | .Ft int | ||
1180 | .Fn SSL_version "const SSL *ssl" | ||
1181 | .Xc | ||
1182 | .It Xo | ||
1183 | .Ft int | ||
1184 | .Fn SSL_want "const SSL *ssl" | ||
1185 | .Xc | ||
1186 | .It Xo | ||
1187 | .Ft int | ||
1188 | .Fn SSL_want_nothing "const SSL *ssl" | ||
1189 | .Xc | ||
1190 | .It Xo | ||
1191 | .Ft int | ||
1192 | .Fn SSL_want_read "const SSL *ssl" | ||
1193 | .Xc | ||
1194 | .It Xo | ||
1195 | .Ft int | ||
1196 | .Fn SSL_want_write "const SSL *ssl" | ||
1197 | .Xc | ||
1198 | .It Xo | ||
1199 | .Ft int | ||
1200 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
1201 | .Xc | ||
1202 | .It Xo | ||
1203 | .Ft int | ||
1204 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
1205 | .Xc | ||
1206 | .It Xo | ||
1207 | .Ft void | ||
1208 | .Fo SSL_set_psk_client_callback | ||
1209 | .Fa "SSL *ssl" | ||
1210 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
1211 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
1212 | .Fc | ||
1213 | .Xc | ||
1214 | .It Xo | ||
1215 | .Ft int | ||
1216 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
1217 | .Xc | ||
1218 | .It Xo | ||
1219 | .Ft void | ||
1220 | .Fo SSL_set_psk_server_callback | ||
1221 | .Fa "SSL *ssl" | ||
1222 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
1223 | unsigned char *psk, int max_psk_len)" | ||
1224 | .Fc | ||
1225 | .Xc | ||
1226 | .It Xo | ||
1227 | .Ft const char * | ||
1228 | .Fn SSL_get_psk_identity_hint "SSL *ssl" | ||
1229 | .Xc | ||
1230 | .It Xo | ||
1231 | .Ft const char * | ||
1232 | .Fn SSL_get_psk_identity "SSL *ssl" | ||
1233 | .Xc | ||
1234 | .El | ||
1235 | .Sh SEE ALSO | ||
1236 | .Xr openssl 1 , | ||
1237 | .Xr crypto 3 , | ||
1238 | .Xr d2i_SSL_SESSION 3 , | ||
1239 | .Xr SSL_accept 3 , | ||
1240 | .Xr SSL_alert_type_string 3 , | ||
1241 | .Xr SSL_CIPHER_get_name 3 , | ||
1242 | .Xr SSL_clear 3 , | ||
1243 | .Xr SSL_COMP_add_compression_method 3 , | ||
1244 | .Xr SSL_connect 3 , | ||
1245 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
1246 | .Xr SSL_CTX_add_session 3 , | ||
1247 | .Xr SSL_CTX_ctrl 3 , | ||
1248 | .Xr SSL_CTX_flush_sessions 3 , | ||
1249 | .Xr SSL_CTX_get_ex_new_index 3 , | ||
1250 | .Xr SSL_CTX_get_verify_mode 3 , | ||
1251 | .Xr SSL_CTX_load_verify_locations 3 , | ||
1252 | .Xr SSL_CTX_new 3 , | ||
1253 | .Xr SSL_CTX_sess_number 3 , | ||
1254 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
1255 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
1256 | .Xr SSL_CTX_sessions 3 , | ||
1257 | .Xr SSL_CTX_set_cert_store 3 , | ||
1258 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
1259 | .Xr SSL_CTX_set_cipher_list 3 , | ||
1260 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
1261 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
1262 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
1263 | .Xr SSL_CTX_set_generate_session_id 3 , | ||
1264 | .Xr SSL_CTX_set_info_callback 3 , | ||
1265 | .Xr SSL_CTX_set_max_cert_list 3 , | ||
1266 | .Xr SSL_CTX_set_mode 3 , | ||
1267 | .Xr SSL_CTX_set_msg_callback 3 , | ||
1268 | .Xr SSL_CTX_set_options 3 , | ||
1269 | .Xr SSL_CTX_set_psk_client_callback 3 , | ||
1270 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
1271 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
1272 | .Xr SSL_CTX_set_session_id_context 3 , | ||
1273 | .Xr SSL_CTX_set_ssl_version 3 , | ||
1274 | .Xr SSL_CTX_set_timeout 3 , | ||
1275 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
1276 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
1277 | .Xr SSL_CTX_set_verify 3 , | ||
1278 | .Xr SSL_CTX_use_certificate 3 , | ||
1279 | .Xr SSL_CTX_use_psk_identity_hint 3 , | ||
1280 | .Xr SSL_do_handshake 3 , | ||
1281 | .Xr SSL_get_ciphers 3 , | ||
1282 | .Xr SSL_get_client_CA_list 3 , | ||
1283 | .Xr SSL_get_default_timeout 3 , | ||
1284 | .Xr SSL_get_error 3 , | ||
1285 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
1286 | .Xr SSL_get_ex_new_index 3 , | ||
1287 | .Xr SSL_get_fd 3 , | ||
1288 | .Xr SSL_get_peer_cert_chain 3 , | ||
1289 | .Xr SSL_get_psk_identity 3 , | ||
1290 | .Xr SSL_get_rbio 3 , | ||
1291 | .Xr SSL_get_session 3 , | ||
1292 | .Xr SSL_get_SSL_CTX 3 , | ||
1293 | .Xr SSL_get_verify_result 3 , | ||
1294 | .Xr SSL_get_version 3 , | ||
1295 | .Xr SSL_library_init 3 , | ||
1296 | .Xr SSL_load_client_CA_file 3 , | ||
1297 | .Xr SSL_new 3 , | ||
1298 | .Xr SSL_pending 3 , | ||
1299 | .Xr SSL_read 3 , | ||
1300 | .Xr SSL_rstate_string 3 , | ||
1301 | .Xr SSL_SESSION_free 3 , | ||
1302 | .Xr SSL_SESSION_get_ex_new_index 3 , | ||
1303 | .Xr SSL_SESSION_get_time 3 , | ||
1304 | .Xr SSL_session_reused 3 , | ||
1305 | .Xr SSL_set_bio 3 , | ||
1306 | .Xr SSL_set_connect_state 3 , | ||
1307 | .Xr SSL_set_fd 3 , | ||
1308 | .Xr SSL_set_session 3 , | ||
1309 | .Xr SSL_set_shutdown 3 , | ||
1310 | .Xr SSL_shutdown 3 , | ||
1311 | .Xr SSL_state_string 3 , | ||
1312 | .Xr SSL_want 3 , | ||
1313 | .Xr SSL_write 3 | ||
1314 | .Sh HISTORY | ||
1315 | The | ||
1316 | .Xr ssl 3 | ||
1317 | document appeared in OpenSSL 0.9.2. | ||
diff --git a/src/lib/libssl/src/doc/ssl/ssl.pod b/src/lib/libssl/src/doc/ssl/ssl.pod deleted file mode 100644 index 6d3ee24e4e..0000000000 --- a/src/lib/libssl/src/doc/ssl/ssl.pod +++ /dev/null | |||
@@ -1,758 +0,0 @@ | |||
1 | |||
2 | =pod | ||
3 | |||
4 | =head1 NAME | ||
5 | |||
6 | SSL - OpenSSL SSL/TLS library | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | =head1 DESCRIPTION | ||
11 | |||
12 | The OpenSSL B<ssl> library implements the Secure Sockets Layer (SSL v2/v3) and | ||
13 | Transport Layer Security (TLS v1) protocols. It provides a rich API which is | ||
14 | documented here. | ||
15 | |||
16 | At first the library must be initialized; see | ||
17 | L<SSL_library_init(3)|SSL_library_init(3)>. | ||
18 | |||
19 | Then an B<SSL_CTX> object is created as a framework to establish | ||
20 | TLS/SSL enabled connections (see L<SSL_CTX_new(3)|SSL_CTX_new(3)>). | ||
21 | Various options regarding certificates, algorithms etc. can be set | ||
22 | in this object. | ||
23 | |||
24 | When a network connection has been created, it can be assigned to an | ||
25 | B<SSL> object. After the B<SSL> object has been created using | ||
26 | L<SSL_new(3)|SSL_new(3)>, L<SSL_set_fd(3)|SSL_set_fd(3)> or | ||
27 | L<SSL_set_bio(3)|SSL_set_bio(3)> can be used to associate the network | ||
28 | connection with the object. | ||
29 | |||
30 | Then the TLS/SSL handshake is performed using | ||
31 | L<SSL_accept(3)|SSL_accept(3)> or L<SSL_connect(3)|SSL_connect(3)> | ||
32 | respectively. | ||
33 | L<SSL_read(3)|SSL_read(3)> and L<SSL_write(3)|SSL_write(3)> are used | ||
34 | to read and write data on the TLS/SSL connection. | ||
35 | L<SSL_shutdown(3)|SSL_shutdown(3)> can be used to shut down the | ||
36 | TLS/SSL connection. | ||
37 | |||
38 | =head1 DATA STRUCTURES | ||
39 | |||
40 | Currently the OpenSSL B<ssl> library functions deals with the following data | ||
41 | structures: | ||
42 | |||
43 | =over 4 | ||
44 | |||
45 | =item B<SSL_METHOD> (SSL Method) | ||
46 | |||
47 | That's a dispatch structure describing the internal B<ssl> library | ||
48 | methods/functions which implement the various protocol versions (SSLv1, SSLv2 | ||
49 | and TLSv1). It's needed to create an B<SSL_CTX>. | ||
50 | |||
51 | =item B<SSL_CIPHER> (SSL Cipher) | ||
52 | |||
53 | This structure holds the algorithm information for a particular cipher which | ||
54 | are a core part of the SSL/TLS protocol. The available ciphers are configured | ||
55 | on a B<SSL_CTX> basis and the actually used ones are then part of the | ||
56 | B<SSL_SESSION>. | ||
57 | |||
58 | =item B<SSL_CTX> (SSL Context) | ||
59 | |||
60 | That's the global context structure which is created by a server or client | ||
61 | once per program life-time and which holds mainly default values for the | ||
62 | B<SSL> structures which are later created for the connections. | ||
63 | |||
64 | =item B<SSL_SESSION> (SSL Session) | ||
65 | |||
66 | This is a structure containing the current TLS/SSL session details for a | ||
67 | connection: B<SSL_CIPHER>s, client and server certificates, keys, etc. | ||
68 | |||
69 | =item B<SSL> (SSL Connection) | ||
70 | |||
71 | That's the main SSL/TLS structure which is created by a server or client per | ||
72 | established connection. This actually is the core structure in the SSL API. | ||
73 | Under run-time the application usually deals with this structure which has | ||
74 | links to mostly all other structures. | ||
75 | |||
76 | =back | ||
77 | |||
78 | |||
79 | =head1 HEADER FILES | ||
80 | |||
81 | Currently the OpenSSL B<ssl> library provides the following C header files | ||
82 | containing the prototypes for the data structures and and functions: | ||
83 | |||
84 | =over 4 | ||
85 | |||
86 | =item B<ssl.h> | ||
87 | |||
88 | That's the common header file for the SSL/TLS API. Include it into your | ||
89 | program to make the API of the B<ssl> library available. It internally | ||
90 | includes both more private SSL headers and headers from the B<crypto> library. | ||
91 | Whenever you need hard-core details on the internals of the SSL API, look | ||
92 | inside this header file. | ||
93 | |||
94 | =item B<ssl2.h> | ||
95 | |||
96 | That's the sub header file dealing with the SSLv2 protocol only. | ||
97 | I<Usually you don't have to include it explicitly because | ||
98 | it's already included by ssl.h>. | ||
99 | |||
100 | =item B<ssl3.h> | ||
101 | |||
102 | That's the sub header file dealing with the SSLv3 protocol only. | ||
103 | I<Usually you don't have to include it explicitly because | ||
104 | it's already included by ssl.h>. | ||
105 | |||
106 | =item B<ssl23.h> | ||
107 | |||
108 | That's the sub header file dealing with the combined use of the SSLv2 and | ||
109 | SSLv3 protocols. | ||
110 | I<Usually you don't have to include it explicitly because | ||
111 | it's already included by ssl.h>. | ||
112 | |||
113 | =item B<tls1.h> | ||
114 | |||
115 | That's the sub header file dealing with the TLSv1 protocol only. | ||
116 | I<Usually you don't have to include it explicitly because | ||
117 | it's already included by ssl.h>. | ||
118 | |||
119 | =back | ||
120 | |||
121 | =head1 API FUNCTIONS | ||
122 | |||
123 | Currently the OpenSSL B<ssl> library exports 214 API functions. | ||
124 | They are documented in the following: | ||
125 | |||
126 | =head2 DEALING WITH PROTOCOL METHODS | ||
127 | |||
128 | Here we document the various API functions which deal with the SSL/TLS | ||
129 | protocol methods defined in B<SSL_METHOD> structures. | ||
130 | |||
131 | =over 4 | ||
132 | |||
133 | =item const SSL_METHOD *B<SSLv2_client_method>(void); | ||
134 | |||
135 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated client. | ||
136 | |||
137 | =item const SSL_METHOD *B<SSLv2_server_method>(void); | ||
138 | |||
139 | Constructor for the SSLv2 SSL_METHOD structure for a dedicated server. | ||
140 | |||
141 | =item const SSL_METHOD *B<SSLv2_method>(void); | ||
142 | |||
143 | Constructor for the SSLv2 SSL_METHOD structure for combined client and server. | ||
144 | |||
145 | =item const SSL_METHOD *B<SSLv3_client_method>(void); | ||
146 | |||
147 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated client. | ||
148 | |||
149 | =item const SSL_METHOD *B<SSLv3_server_method>(void); | ||
150 | |||
151 | Constructor for the SSLv3 SSL_METHOD structure for a dedicated server. | ||
152 | |||
153 | =item const SSL_METHOD *B<SSLv3_method>(void); | ||
154 | |||
155 | Constructor for the SSLv3 SSL_METHOD structure for combined client and server. | ||
156 | |||
157 | =item const SSL_METHOD *B<TLSv1_client_method>(void); | ||
158 | |||
159 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated client. | ||
160 | |||
161 | =item const SSL_METHOD *B<TLSv1_server_method>(void); | ||
162 | |||
163 | Constructor for the TLSv1 SSL_METHOD structure for a dedicated server. | ||
164 | |||
165 | =item const SSL_METHOD *B<TLSv1_method>(void); | ||
166 | |||
167 | Constructor for the TLSv1 SSL_METHOD structure for combined client and server. | ||
168 | |||
169 | =back | ||
170 | |||
171 | =head2 DEALING WITH CIPHERS | ||
172 | |||
173 | Here we document the various API functions which deal with the SSL/TLS | ||
174 | ciphers defined in B<SSL_CIPHER> structures. | ||
175 | |||
176 | =over 4 | ||
177 | |||
178 | =item char *B<SSL_CIPHER_description>(SSL_CIPHER *cipher, char *buf, int len); | ||
179 | |||
180 | Write a string to I<buf> (with a maximum size of I<len>) containing a human | ||
181 | readable description of I<cipher>. Returns I<buf>. | ||
182 | |||
183 | =item int B<SSL_CIPHER_get_bits>(SSL_CIPHER *cipher, int *alg_bits); | ||
184 | |||
185 | Determine the number of bits in I<cipher>. Because of export crippled ciphers | ||
186 | there are two bits: The bits the algorithm supports in general (stored to | ||
187 | I<alg_bits>) and the bits which are actually used (the return value). | ||
188 | |||
189 | =item const char *B<SSL_CIPHER_get_name>(SSL_CIPHER *cipher); | ||
190 | |||
191 | Return the internal name of I<cipher> as a string. These are the various | ||
192 | strings defined by the I<SSL2_TXT_xxx>, I<SSL3_TXT_xxx> and I<TLS1_TXT_xxx> | ||
193 | definitions in the header files. | ||
194 | |||
195 | =item char *B<SSL_CIPHER_get_version>(SSL_CIPHER *cipher); | ||
196 | |||
197 | Returns a string like "C<TLSv1/SSLv3>" or "C<SSLv2>" which indicates the | ||
198 | SSL/TLS protocol version to which I<cipher> belongs (i.e. where it was defined | ||
199 | in the specification the first time). | ||
200 | |||
201 | =back | ||
202 | |||
203 | =head2 DEALING WITH PROTOCOL CONTEXTS | ||
204 | |||
205 | Here we document the various API functions which deal with the SSL/TLS | ||
206 | protocol context defined in the B<SSL_CTX> structure. | ||
207 | |||
208 | =over 4 | ||
209 | |||
210 | =item int B<SSL_CTX_add_client_CA>(SSL_CTX *ctx, X509 *x); | ||
211 | |||
212 | =item long B<SSL_CTX_add_extra_chain_cert>(SSL_CTX *ctx, X509 *x509); | ||
213 | |||
214 | =item int B<SSL_CTX_add_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
215 | |||
216 | =item int B<SSL_CTX_check_private_key>(const SSL_CTX *ctx); | ||
217 | |||
218 | =item long B<SSL_CTX_ctrl>(SSL_CTX *ctx, int cmd, long larg, char *parg); | ||
219 | |||
220 | =item void B<SSL_CTX_flush_sessions>(SSL_CTX *s, long t); | ||
221 | |||
222 | =item void B<SSL_CTX_free>(SSL_CTX *a); | ||
223 | |||
224 | =item char *B<SSL_CTX_get_app_data>(SSL_CTX *ctx); | ||
225 | |||
226 | =item X509_STORE *B<SSL_CTX_get_cert_store>(SSL_CTX *ctx); | ||
227 | |||
228 | =item STACK *B<SSL_CTX_get_client_CA_list>(const SSL_CTX *ctx); | ||
229 | |||
230 | =item int (*B<SSL_CTX_get_client_cert_cb>(SSL_CTX *ctx))(SSL *ssl, X509 **x509, EVP_PKEY **pkey); | ||
231 | |||
232 | =item char *B<SSL_CTX_get_ex_data>(const SSL_CTX *s, int idx); | ||
233 | |||
234 | =item int B<SSL_CTX_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
235 | |||
236 | =item void (*B<SSL_CTX_get_info_callback>(SSL_CTX *ctx))(SSL *ssl, int cb, int ret); | ||
237 | |||
238 | =item int B<SSL_CTX_get_quiet_shutdown>(const SSL_CTX *ctx); | ||
239 | |||
240 | =item int B<SSL_CTX_get_session_cache_mode>(SSL_CTX *ctx); | ||
241 | |||
242 | =item long B<SSL_CTX_get_timeout>(const SSL_CTX *ctx); | ||
243 | |||
244 | =item int (*B<SSL_CTX_get_verify_callback>(const SSL_CTX *ctx))(int ok, X509_STORE_CTX *ctx); | ||
245 | |||
246 | =item int B<SSL_CTX_get_verify_mode>(SSL_CTX *ctx); | ||
247 | |||
248 | =item int B<SSL_CTX_load_verify_locations>(SSL_CTX *ctx, char *CAfile, char *CApath); | ||
249 | |||
250 | =item long B<SSL_CTX_need_tmp_RSA>(SSL_CTX *ctx); | ||
251 | |||
252 | =item SSL_CTX *B<SSL_CTX_new>(const SSL_METHOD *meth); | ||
253 | |||
254 | =item int B<SSL_CTX_remove_session>(SSL_CTX *ctx, SSL_SESSION *c); | ||
255 | |||
256 | =item int B<SSL_CTX_sess_accept>(SSL_CTX *ctx); | ||
257 | |||
258 | =item int B<SSL_CTX_sess_accept_good>(SSL_CTX *ctx); | ||
259 | |||
260 | =item int B<SSL_CTX_sess_accept_renegotiate>(SSL_CTX *ctx); | ||
261 | |||
262 | =item int B<SSL_CTX_sess_cache_full>(SSL_CTX *ctx); | ||
263 | |||
264 | =item int B<SSL_CTX_sess_cb_hits>(SSL_CTX *ctx); | ||
265 | |||
266 | =item int B<SSL_CTX_sess_connect>(SSL_CTX *ctx); | ||
267 | |||
268 | =item int B<SSL_CTX_sess_connect_good>(SSL_CTX *ctx); | ||
269 | |||
270 | =item int B<SSL_CTX_sess_connect_renegotiate>(SSL_CTX *ctx); | ||
271 | |||
272 | =item int B<SSL_CTX_sess_get_cache_size>(SSL_CTX *ctx); | ||
273 | |||
274 | =item SSL_SESSION *(*B<SSL_CTX_sess_get_get_cb>(SSL_CTX *ctx))(SSL *ssl, unsigned char *data, int len, int *copy); | ||
275 | |||
276 | =item int (*B<SSL_CTX_sess_get_new_cb>(SSL_CTX *ctx)(SSL *ssl, SSL_SESSION *sess); | ||
277 | |||
278 | =item void (*B<SSL_CTX_sess_get_remove_cb>(SSL_CTX *ctx)(SSL_CTX *ctx, SSL_SESSION *sess); | ||
279 | |||
280 | =item int B<SSL_CTX_sess_hits>(SSL_CTX *ctx); | ||
281 | |||
282 | =item int B<SSL_CTX_sess_misses>(SSL_CTX *ctx); | ||
283 | |||
284 | =item int B<SSL_CTX_sess_number>(SSL_CTX *ctx); | ||
285 | |||
286 | =item void B<SSL_CTX_sess_set_cache_size>(SSL_CTX *ctx,t); | ||
287 | |||
288 | =item void B<SSL_CTX_sess_set_get_cb>(SSL_CTX *ctx, SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)); | ||
289 | |||
290 | =item void B<SSL_CTX_sess_set_new_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, SSL_SESSION *sess)); | ||
291 | |||
292 | =item void B<SSL_CTX_sess_set_remove_cb>(SSL_CTX *ctx, void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)); | ||
293 | |||
294 | =item int B<SSL_CTX_sess_timeouts>(SSL_CTX *ctx); | ||
295 | |||
296 | =item LHASH *B<SSL_CTX_sessions>(SSL_CTX *ctx); | ||
297 | |||
298 | =item void B<SSL_CTX_set_app_data>(SSL_CTX *ctx, void *arg); | ||
299 | |||
300 | =item void B<SSL_CTX_set_cert_store>(SSL_CTX *ctx, X509_STORE *cs); | ||
301 | |||
302 | =item void B<SSL_CTX_set_cert_verify_cb>(SSL_CTX *ctx, int (*cb)(), char *arg) | ||
303 | |||
304 | =item int B<SSL_CTX_set_cipher_list>(SSL_CTX *ctx, char *str); | ||
305 | |||
306 | =item void B<SSL_CTX_set_client_CA_list>(SSL_CTX *ctx, STACK *list); | ||
307 | |||
308 | =item void B<SSL_CTX_set_client_cert_cb>(SSL_CTX *ctx, int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)); | ||
309 | |||
310 | =item void B<SSL_CTX_set_default_passwd_cb>(SSL_CTX *ctx, int (*cb);(void)) | ||
311 | |||
312 | =item void B<SSL_CTX_set_default_read_ahead>(SSL_CTX *ctx, int m); | ||
313 | |||
314 | =item int B<SSL_CTX_set_default_verify_paths>(SSL_CTX *ctx); | ||
315 | |||
316 | =item int B<SSL_CTX_set_ex_data>(SSL_CTX *s, int idx, char *arg); | ||
317 | |||
318 | =item void B<SSL_CTX_set_info_callback>(SSL_CTX *ctx, void (*cb)(SSL *ssl, int cb, int ret)); | ||
319 | |||
320 | =item void B<SSL_CTX_set_msg_callback>(SSL_CTX *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
321 | |||
322 | =item void B<SSL_CTX_set_msg_callback_arg>(SSL_CTX *ctx, void *arg); | ||
323 | |||
324 | =item void B<SSL_CTX_set_options>(SSL_CTX *ctx, unsigned long op); | ||
325 | |||
326 | =item void B<SSL_CTX_set_quiet_shutdown>(SSL_CTX *ctx, int mode); | ||
327 | |||
328 | =item void B<SSL_CTX_set_session_cache_mode>(SSL_CTX *ctx, int mode); | ||
329 | |||
330 | =item int B<SSL_CTX_set_ssl_version>(SSL_CTX *ctx, const SSL_METHOD *meth); | ||
331 | |||
332 | =item void B<SSL_CTX_set_timeout>(SSL_CTX *ctx, long t); | ||
333 | |||
334 | =item long B<SSL_CTX_set_tmp_dh>(SSL_CTX* ctx, DH *dh); | ||
335 | |||
336 | =item long B<SSL_CTX_set_tmp_dh_callback>(SSL_CTX *ctx, DH *(*cb)(void)); | ||
337 | |||
338 | =item long B<SSL_CTX_set_tmp_rsa>(SSL_CTX *ctx, RSA *rsa); | ||
339 | |||
340 | =item SSL_CTX_set_tmp_rsa_callback | ||
341 | |||
342 | C<long B<SSL_CTX_set_tmp_rsa_callback>(SSL_CTX *B<ctx>, RSA *(*B<cb>)(SSL *B<ssl>, int B<export>, int B<keylength>));> | ||
343 | |||
344 | Sets the callback which will be called when a temporary private key is | ||
345 | required. The B<C<export>> flag will be set if the reason for needing | ||
346 | a temp key is that an export ciphersuite is in use, in which case, | ||
347 | B<C<keylength>> will contain the required keylength in bits. Generate a key of | ||
348 | appropriate size (using ???) and return it. | ||
349 | |||
350 | =item SSL_set_tmp_rsa_callback | ||
351 | |||
352 | long B<SSL_set_tmp_rsa_callback>(SSL *ssl, RSA *(*cb)(SSL *ssl, int export, int keylength)); | ||
353 | |||
354 | The same as B<SSL_CTX_set_tmp_rsa_callback>, except it operates on an SSL | ||
355 | session instead of a context. | ||
356 | |||
357 | =item void B<SSL_CTX_set_verify>(SSL_CTX *ctx, int mode, int (*cb);(void)) | ||
358 | |||
359 | =item int B<SSL_CTX_use_PrivateKey>(SSL_CTX *ctx, EVP_PKEY *pkey); | ||
360 | |||
361 | =item int B<SSL_CTX_use_PrivateKey_ASN1>(int type, SSL_CTX *ctx, unsigned char *d, long len); | ||
362 | |||
363 | =item int B<SSL_CTX_use_PrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
364 | |||
365 | =item int B<SSL_CTX_use_RSAPrivateKey>(SSL_CTX *ctx, RSA *rsa); | ||
366 | |||
367 | =item int B<SSL_CTX_use_RSAPrivateKey_ASN1>(SSL_CTX *ctx, unsigned char *d, long len); | ||
368 | |||
369 | =item int B<SSL_CTX_use_RSAPrivateKey_file>(SSL_CTX *ctx, char *file, int type); | ||
370 | |||
371 | =item int B<SSL_CTX_use_certificate>(SSL_CTX *ctx, X509 *x); | ||
372 | |||
373 | =item int B<SSL_CTX_use_certificate_ASN1>(SSL_CTX *ctx, int len, unsigned char *d); | ||
374 | |||
375 | =item int B<SSL_CTX_use_certificate_file>(SSL_CTX *ctx, char *file, int type); | ||
376 | |||
377 | =item void B<SSL_CTX_set_psk_client_callback>(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); | ||
378 | |||
379 | =item int B<SSL_CTX_use_psk_identity_hint>(SSL_CTX *ctx, const char *hint); | ||
380 | |||
381 | =item void B<SSL_CTX_set_psk_server_callback>(SSL_CTX *ctx, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); | ||
382 | |||
383 | |||
384 | |||
385 | |||
386 | =back | ||
387 | |||
388 | =head2 DEALING WITH SESSIONS | ||
389 | |||
390 | Here we document the various API functions which deal with the SSL/TLS | ||
391 | sessions defined in the B<SSL_SESSION> structures. | ||
392 | |||
393 | =over 4 | ||
394 | |||
395 | =item int B<SSL_SESSION_cmp>(const SSL_SESSION *a, const SSL_SESSION *b); | ||
396 | |||
397 | =item void B<SSL_SESSION_free>(SSL_SESSION *ss); | ||
398 | |||
399 | =item char *B<SSL_SESSION_get_app_data>(SSL_SESSION *s); | ||
400 | |||
401 | =item char *B<SSL_SESSION_get_ex_data>(const SSL_SESSION *s, int idx); | ||
402 | |||
403 | =item int B<SSL_SESSION_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
404 | |||
405 | =item long B<SSL_SESSION_get_time>(const SSL_SESSION *s); | ||
406 | |||
407 | =item long B<SSL_SESSION_get_timeout>(const SSL_SESSION *s); | ||
408 | |||
409 | =item unsigned long B<SSL_SESSION_hash>(const SSL_SESSION *a); | ||
410 | |||
411 | =item SSL_SESSION *B<SSL_SESSION_new>(void); | ||
412 | |||
413 | =item int B<SSL_SESSION_print>(BIO *bp, const SSL_SESSION *x); | ||
414 | |||
415 | =item int B<SSL_SESSION_print_fp>(FILE *fp, const SSL_SESSION *x); | ||
416 | |||
417 | =item void B<SSL_SESSION_set_app_data>(SSL_SESSION *s, char *a); | ||
418 | |||
419 | =item int B<SSL_SESSION_set_ex_data>(SSL_SESSION *s, int idx, char *arg); | ||
420 | |||
421 | =item long B<SSL_SESSION_set_time>(SSL_SESSION *s, long t); | ||
422 | |||
423 | =item long B<SSL_SESSION_set_timeout>(SSL_SESSION *s, long t); | ||
424 | |||
425 | =back | ||
426 | |||
427 | =head2 DEALING WITH CONNECTIONS | ||
428 | |||
429 | Here we document the various API functions which deal with the SSL/TLS | ||
430 | connection defined in the B<SSL> structure. | ||
431 | |||
432 | =over 4 | ||
433 | |||
434 | =item int B<SSL_accept>(SSL *ssl); | ||
435 | |||
436 | =item int B<SSL_add_dir_cert_subjects_to_stack>(STACK *stack, const char *dir); | ||
437 | |||
438 | =item int B<SSL_add_file_cert_subjects_to_stack>(STACK *stack, const char *file); | ||
439 | |||
440 | =item int B<SSL_add_client_CA>(SSL *ssl, X509 *x); | ||
441 | |||
442 | =item char *B<SSL_alert_desc_string>(int value); | ||
443 | |||
444 | =item char *B<SSL_alert_desc_string_long>(int value); | ||
445 | |||
446 | =item char *B<SSL_alert_type_string>(int value); | ||
447 | |||
448 | =item char *B<SSL_alert_type_string_long>(int value); | ||
449 | |||
450 | =item int B<SSL_check_private_key>(const SSL *ssl); | ||
451 | |||
452 | =item void B<SSL_clear>(SSL *ssl); | ||
453 | |||
454 | =item long B<SSL_clear_num_renegotiations>(SSL *ssl); | ||
455 | |||
456 | =item int B<SSL_connect>(SSL *ssl); | ||
457 | |||
458 | =item void B<SSL_copy_session_id>(SSL *t, const SSL *f); | ||
459 | |||
460 | =item long B<SSL_ctrl>(SSL *ssl, int cmd, long larg, char *parg); | ||
461 | |||
462 | =item int B<SSL_do_handshake>(SSL *ssl); | ||
463 | |||
464 | =item SSL *B<SSL_dup>(SSL *ssl); | ||
465 | |||
466 | =item STACK *B<SSL_dup_CA_list>(STACK *sk); | ||
467 | |||
468 | =item void B<SSL_free>(SSL *ssl); | ||
469 | |||
470 | =item SSL_CTX *B<SSL_get_SSL_CTX>(const SSL *ssl); | ||
471 | |||
472 | =item char *B<SSL_get_app_data>(SSL *ssl); | ||
473 | |||
474 | =item X509 *B<SSL_get_certificate>(const SSL *ssl); | ||
475 | |||
476 | =item const char *B<SSL_get_cipher>(const SSL *ssl); | ||
477 | |||
478 | =item int B<SSL_get_cipher_bits>(const SSL *ssl, int *alg_bits); | ||
479 | |||
480 | =item char *B<SSL_get_cipher_list>(const SSL *ssl, int n); | ||
481 | |||
482 | =item char *B<SSL_get_cipher_name>(const SSL *ssl); | ||
483 | |||
484 | =item char *B<SSL_get_cipher_version>(const SSL *ssl); | ||
485 | |||
486 | =item STACK *B<SSL_get_ciphers>(const SSL *ssl); | ||
487 | |||
488 | =item STACK *B<SSL_get_client_CA_list>(const SSL *ssl); | ||
489 | |||
490 | =item SSL_CIPHER *B<SSL_get_current_cipher>(SSL *ssl); | ||
491 | |||
492 | =item long B<SSL_get_default_timeout>(const SSL *ssl); | ||
493 | |||
494 | =item int B<SSL_get_error>(const SSL *ssl, int i); | ||
495 | |||
496 | =item char *B<SSL_get_ex_data>(const SSL *ssl, int idx); | ||
497 | |||
498 | =item int B<SSL_get_ex_data_X509_STORE_CTX_idx>(void); | ||
499 | |||
500 | =item int B<SSL_get_ex_new_index>(long argl, char *argp, int (*new_func);(void), int (*dup_func)(void), void (*free_func)(void)) | ||
501 | |||
502 | =item int B<SSL_get_fd>(const SSL *ssl); | ||
503 | |||
504 | =item void (*B<SSL_get_info_callback>(const SSL *ssl);)() | ||
505 | |||
506 | =item STACK *B<SSL_get_peer_cert_chain>(const SSL *ssl); | ||
507 | |||
508 | =item X509 *B<SSL_get_peer_certificate>(const SSL *ssl); | ||
509 | |||
510 | =item EVP_PKEY *B<SSL_get_privatekey>(SSL *ssl); | ||
511 | |||
512 | =item int B<SSL_get_quiet_shutdown>(const SSL *ssl); | ||
513 | |||
514 | =item BIO *B<SSL_get_rbio>(const SSL *ssl); | ||
515 | |||
516 | =item int B<SSL_get_read_ahead>(const SSL *ssl); | ||
517 | |||
518 | =item SSL_SESSION *B<SSL_get_session>(const SSL *ssl); | ||
519 | |||
520 | =item char *B<SSL_get_shared_ciphers>(const SSL *ssl, char *buf, int len); | ||
521 | |||
522 | =item int B<SSL_get_shutdown>(const SSL *ssl); | ||
523 | |||
524 | =item const SSL_METHOD *B<SSL_get_ssl_method>(SSL *ssl); | ||
525 | |||
526 | =item int B<SSL_get_state>(const SSL *ssl); | ||
527 | |||
528 | =item long B<SSL_get_time>(const SSL *ssl); | ||
529 | |||
530 | =item long B<SSL_get_timeout>(const SSL *ssl); | ||
531 | |||
532 | =item int (*B<SSL_get_verify_callback>(const SSL *ssl))(int,X509_STORE_CTX *) | ||
533 | |||
534 | =item int B<SSL_get_verify_mode>(const SSL *ssl); | ||
535 | |||
536 | =item long B<SSL_get_verify_result>(const SSL *ssl); | ||
537 | |||
538 | =item char *B<SSL_get_version>(const SSL *ssl); | ||
539 | |||
540 | =item BIO *B<SSL_get_wbio>(const SSL *ssl); | ||
541 | |||
542 | =item int B<SSL_in_accept_init>(SSL *ssl); | ||
543 | |||
544 | =item int B<SSL_in_before>(SSL *ssl); | ||
545 | |||
546 | =item int B<SSL_in_connect_init>(SSL *ssl); | ||
547 | |||
548 | =item int B<SSL_in_init>(SSL *ssl); | ||
549 | |||
550 | =item int B<SSL_is_init_finished>(SSL *ssl); | ||
551 | |||
552 | =item STACK *B<SSL_load_client_CA_file>(char *file); | ||
553 | |||
554 | =item void B<SSL_load_error_strings>(void); | ||
555 | |||
556 | =item SSL *B<SSL_new>(SSL_CTX *ctx); | ||
557 | |||
558 | =item long B<SSL_num_renegotiations>(SSL *ssl); | ||
559 | |||
560 | =item int B<SSL_peek>(SSL *ssl, void *buf, int num); | ||
561 | |||
562 | =item int B<SSL_pending>(const SSL *ssl); | ||
563 | |||
564 | =item int B<SSL_read>(SSL *ssl, void *buf, int num); | ||
565 | |||
566 | =item int B<SSL_renegotiate>(SSL *ssl); | ||
567 | |||
568 | =item char *B<SSL_rstate_string>(SSL *ssl); | ||
569 | |||
570 | =item char *B<SSL_rstate_string_long>(SSL *ssl); | ||
571 | |||
572 | =item long B<SSL_session_reused>(SSL *ssl); | ||
573 | |||
574 | =item void B<SSL_set_accept_state>(SSL *ssl); | ||
575 | |||
576 | =item void B<SSL_set_app_data>(SSL *ssl, char *arg); | ||
577 | |||
578 | =item void B<SSL_set_bio>(SSL *ssl, BIO *rbio, BIO *wbio); | ||
579 | |||
580 | =item int B<SSL_set_cipher_list>(SSL *ssl, char *str); | ||
581 | |||
582 | =item void B<SSL_set_client_CA_list>(SSL *ssl, STACK *list); | ||
583 | |||
584 | =item void B<SSL_set_connect_state>(SSL *ssl); | ||
585 | |||
586 | =item int B<SSL_set_ex_data>(SSL *ssl, int idx, char *arg); | ||
587 | |||
588 | =item int B<SSL_set_fd>(SSL *ssl, int fd); | ||
589 | |||
590 | =item void B<SSL_set_info_callback>(SSL *ssl, void (*cb);(void)) | ||
591 | |||
592 | =item void B<SSL_set_msg_callback>(SSL *ctx, void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)); | ||
593 | |||
594 | =item void B<SSL_set_msg_callback_arg>(SSL *ctx, void *arg); | ||
595 | |||
596 | =item void B<SSL_set_options>(SSL *ssl, unsigned long op); | ||
597 | |||
598 | =item void B<SSL_set_quiet_shutdown>(SSL *ssl, int mode); | ||
599 | |||
600 | =item void B<SSL_set_read_ahead>(SSL *ssl, int yes); | ||
601 | |||
602 | =item int B<SSL_set_rfd>(SSL *ssl, int fd); | ||
603 | |||
604 | =item int B<SSL_set_session>(SSL *ssl, SSL_SESSION *session); | ||
605 | |||
606 | =item void B<SSL_set_shutdown>(SSL *ssl, int mode); | ||
607 | |||
608 | =item int B<SSL_set_ssl_method>(SSL *ssl, const SSL_METHOD *meth); | ||
609 | |||
610 | =item void B<SSL_set_time>(SSL *ssl, long t); | ||
611 | |||
612 | =item void B<SSL_set_timeout>(SSL *ssl, long t); | ||
613 | |||
614 | =item void B<SSL_set_verify>(SSL *ssl, int mode, int (*callback);(void)) | ||
615 | |||
616 | =item void B<SSL_set_verify_result>(SSL *ssl, long arg); | ||
617 | |||
618 | =item int B<SSL_set_wfd>(SSL *ssl, int fd); | ||
619 | |||
620 | =item int B<SSL_shutdown>(SSL *ssl); | ||
621 | |||
622 | =item int B<SSL_state>(const SSL *ssl); | ||
623 | |||
624 | =item char *B<SSL_state_string>(const SSL *ssl); | ||
625 | |||
626 | =item char *B<SSL_state_string_long>(const SSL *ssl); | ||
627 | |||
628 | =item long B<SSL_total_renegotiations>(SSL *ssl); | ||
629 | |||
630 | =item int B<SSL_use_PrivateKey>(SSL *ssl, EVP_PKEY *pkey); | ||
631 | |||
632 | =item int B<SSL_use_PrivateKey_ASN1>(int type, SSL *ssl, unsigned char *d, long len); | ||
633 | |||
634 | =item int B<SSL_use_PrivateKey_file>(SSL *ssl, char *file, int type); | ||
635 | |||
636 | =item int B<SSL_use_RSAPrivateKey>(SSL *ssl, RSA *rsa); | ||
637 | |||
638 | =item int B<SSL_use_RSAPrivateKey_ASN1>(SSL *ssl, unsigned char *d, long len); | ||
639 | |||
640 | =item int B<SSL_use_RSAPrivateKey_file>(SSL *ssl, char *file, int type); | ||
641 | |||
642 | =item int B<SSL_use_certificate>(SSL *ssl, X509 *x); | ||
643 | |||
644 | =item int B<SSL_use_certificate_ASN1>(SSL *ssl, int len, unsigned char *d); | ||
645 | |||
646 | =item int B<SSL_use_certificate_file>(SSL *ssl, char *file, int type); | ||
647 | |||
648 | =item int B<SSL_version>(const SSL *ssl); | ||
649 | |||
650 | =item int B<SSL_want>(const SSL *ssl); | ||
651 | |||
652 | =item int B<SSL_want_nothing>(const SSL *ssl); | ||
653 | |||
654 | =item int B<SSL_want_read>(const SSL *ssl); | ||
655 | |||
656 | =item int B<SSL_want_write>(const SSL *ssl); | ||
657 | |||
658 | =item int B<SSL_want_x509_lookup>(const SSL *ssl); | ||
659 | |||
660 | =item int B<SSL_write>(SSL *ssl, const void *buf, int num); | ||
661 | |||
662 | =item void B<SSL_set_psk_client_callback>(SSL *ssl, unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)); | ||
663 | |||
664 | =item int B<SSL_use_psk_identity_hint>(SSL *ssl, const char *hint); | ||
665 | |||
666 | =item void B<SSL_set_psk_server_callback>(SSL *ssl, unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)); | ||
667 | |||
668 | =item const char *B<SSL_get_psk_identity_hint>(SSL *ssl); | ||
669 | |||
670 | =item const char *B<SSL_get_psk_identity>(SSL *ssl); | ||
671 | |||
672 | =back | ||
673 | |||
674 | =head1 SEE ALSO | ||
675 | |||
676 | L<openssl(1)|openssl(1)>, L<crypto(3)|crypto(3)>, | ||
677 | L<SSL_accept(3)|SSL_accept(3)>, L<SSL_clear(3)|SSL_clear(3)>, | ||
678 | L<SSL_connect(3)|SSL_connect(3)>, | ||
679 | L<SSL_CIPHER_get_name(3)|SSL_CIPHER_get_name(3)>, | ||
680 | L<SSL_COMP_add_compression_method(3)|SSL_COMP_add_compression_method(3)>, | ||
681 | L<SSL_CTX_add_extra_chain_cert(3)|SSL_CTX_add_extra_chain_cert(3)>, | ||
682 | L<SSL_CTX_add_session(3)|SSL_CTX_add_session(3)>, | ||
683 | L<SSL_CTX_ctrl(3)|SSL_CTX_ctrl(3)>, | ||
684 | L<SSL_CTX_flush_sessions(3)|SSL_CTX_flush_sessions(3)>, | ||
685 | L<SSL_CTX_get_ex_new_index(3)|SSL_CTX_get_ex_new_index(3)>, | ||
686 | L<SSL_CTX_get_verify_mode(3)|SSL_CTX_get_verify_mode(3)>, | ||
687 | L<SSL_CTX_load_verify_locations(3)|SSL_CTX_load_verify_locations(3)> | ||
688 | L<SSL_CTX_new(3)|SSL_CTX_new(3)>, | ||
689 | L<SSL_CTX_sess_number(3)|SSL_CTX_sess_number(3)>, | ||
690 | L<SSL_CTX_sess_set_cache_size(3)|SSL_CTX_sess_set_cache_size(3)>, | ||
691 | L<SSL_CTX_sess_set_get_cb(3)|SSL_CTX_sess_set_get_cb(3)>, | ||
692 | L<SSL_CTX_sessions(3)|SSL_CTX_sessions(3)>, | ||
693 | L<SSL_CTX_set_cert_store(3)|SSL_CTX_set_cert_store(3)>, | ||
694 | L<SSL_CTX_set_cert_verify_callback(3)|SSL_CTX_set_cert_verify_callback(3)>, | ||
695 | L<SSL_CTX_set_cipher_list(3)|SSL_CTX_set_cipher_list(3)>, | ||
696 | L<SSL_CTX_set_client_CA_list(3)|SSL_CTX_set_client_CA_list(3)>, | ||
697 | L<SSL_CTX_set_client_cert_cb(3)|SSL_CTX_set_client_cert_cb(3)>, | ||
698 | L<SSL_CTX_set_default_passwd_cb(3)|SSL_CTX_set_default_passwd_cb(3)>, | ||
699 | L<SSL_CTX_set_generate_session_id(3)|SSL_CTX_set_generate_session_id(3)>, | ||
700 | L<SSL_CTX_set_info_callback(3)|SSL_CTX_set_info_callback(3)>, | ||
701 | L<SSL_CTX_set_max_cert_list(3)|SSL_CTX_set_max_cert_list(3)>, | ||
702 | L<SSL_CTX_set_mode(3)|SSL_CTX_set_mode(3)>, | ||
703 | L<SSL_CTX_set_msg_callback(3)|SSL_CTX_set_msg_callback(3)>, | ||
704 | L<SSL_CTX_set_options(3)|SSL_CTX_set_options(3)>, | ||
705 | L<SSL_CTX_set_quiet_shutdown(3)|SSL_CTX_set_quiet_shutdown(3)>, | ||
706 | L<SSL_CTX_set_session_cache_mode(3)|SSL_CTX_set_session_cache_mode(3)>, | ||
707 | L<SSL_CTX_set_session_id_context(3)|SSL_CTX_set_session_id_context(3)>, | ||
708 | L<SSL_CTX_set_ssl_version(3)|SSL_CTX_set_ssl_version(3)>, | ||
709 | L<SSL_CTX_set_timeout(3)|SSL_CTX_set_timeout(3)>, | ||
710 | L<SSL_CTX_set_tmp_rsa_callback(3)|SSL_CTX_set_tmp_rsa_callback(3)>, | ||
711 | L<SSL_CTX_set_tmp_dh_callback(3)|SSL_CTX_set_tmp_dh_callback(3)>, | ||
712 | L<SSL_CTX_set_verify(3)|SSL_CTX_set_verify(3)>, | ||
713 | L<SSL_CTX_use_certificate(3)|SSL_CTX_use_certificate(3)>, | ||
714 | L<SSL_alert_type_string(3)|SSL_alert_type_string(3)>, | ||
715 | L<SSL_do_handshake(3)|SSL_do_handshake(3)>, | ||
716 | L<SSL_get_SSL_CTX(3)|SSL_get_SSL_CTX(3)>, | ||
717 | L<SSL_get_ciphers(3)|SSL_get_ciphers(3)>, | ||
718 | L<SSL_get_client_CA_list(3)|SSL_get_client_CA_list(3)>, | ||
719 | L<SSL_get_default_timeout(3)|SSL_get_default_timeout(3)>, | ||
720 | L<SSL_get_error(3)|SSL_get_error(3)>, | ||
721 | L<SSL_get_ex_data_X509_STORE_CTX_idx(3)|SSL_get_ex_data_X509_STORE_CTX_idx(3)>, | ||
722 | L<SSL_get_ex_new_index(3)|SSL_get_ex_new_index(3)>, | ||
723 | L<SSL_get_fd(3)|SSL_get_fd(3)>, | ||
724 | L<SSL_get_peer_cert_chain(3)|SSL_get_peer_cert_chain(3)>, | ||
725 | L<SSL_get_rbio(3)|SSL_get_rbio(3)>, | ||
726 | L<SSL_get_session(3)|SSL_get_session(3)>, | ||
727 | L<SSL_get_verify_result(3)|SSL_get_verify_result(3)>, | ||
728 | L<SSL_get_version(3)|SSL_get_version(3)>, | ||
729 | L<SSL_library_init(3)|SSL_library_init(3)>, | ||
730 | L<SSL_load_client_CA_file(3)|SSL_load_client_CA_file(3)>, | ||
731 | L<SSL_new(3)|SSL_new(3)>, | ||
732 | L<SSL_pending(3)|SSL_pending(3)>, | ||
733 | L<SSL_read(3)|SSL_read(3)>, | ||
734 | L<SSL_rstate_string(3)|SSL_rstate_string(3)>, | ||
735 | L<SSL_session_reused(3)|SSL_session_reused(3)>, | ||
736 | L<SSL_set_bio(3)|SSL_set_bio(3)>, | ||
737 | L<SSL_set_connect_state(3)|SSL_set_connect_state(3)>, | ||
738 | L<SSL_set_fd(3)|SSL_set_fd(3)>, | ||
739 | L<SSL_set_session(3)|SSL_set_session(3)>, | ||
740 | L<SSL_set_shutdown(3)|SSL_set_shutdown(3)>, | ||
741 | L<SSL_shutdown(3)|SSL_shutdown(3)>, | ||
742 | L<SSL_state_string(3)|SSL_state_string(3)>, | ||
743 | L<SSL_want(3)|SSL_want(3)>, | ||
744 | L<SSL_write(3)|SSL_write(3)>, | ||
745 | L<SSL_SESSION_free(3)|SSL_SESSION_free(3)>, | ||
746 | L<SSL_SESSION_get_ex_new_index(3)|SSL_SESSION_get_ex_new_index(3)>, | ||
747 | L<SSL_SESSION_get_time(3)|SSL_SESSION_get_time(3)>, | ||
748 | L<d2i_SSL_SESSION(3)|d2i_SSL_SESSION(3)>, | ||
749 | L<SSL_CTX_set_psk_client_callback(3)|SSL_CTX_set_psk_client_callback(3)>, | ||
750 | L<SSL_CTX_use_psk_identity_hint(3)|SSL_CTX_use_psk_identity_hint(3)>, | ||
751 | L<SSL_get_psk_identity(3)|SSL_get_psk_identity(3)> | ||
752 | |||
753 | =head1 HISTORY | ||
754 | |||
755 | The L<ssl(3)|ssl(3)> document appeared in OpenSSL 0.9.2 | ||
756 | |||
757 | =cut | ||
758 | |||