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 /src/lib/libssl/doc | |
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@
Diffstat (limited to 'src/lib/libssl/doc')
83 files changed, 9969 insertions, 0 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. | ||