diff options
Diffstat (limited to 'src/lib/libssl/man')
84 files changed, 10313 insertions, 0 deletions
diff --git a/src/lib/libssl/man/BIO_f_ssl.3 b/src/lib/libssl/man/BIO_f_ssl.3 new file mode 100644 index 0000000000..e322fd7887 --- /dev/null +++ b/src/lib/libssl/man/BIO_f_ssl.3 | |||
| @@ -0,0 +1,479 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: BIO_f_ssl.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt BIO_F_SSL 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm BIO_f_ssl , | ||
| 9 | .Nm BIO_set_ssl , | ||
| 10 | .Nm BIO_get_ssl , | ||
| 11 | .Nm BIO_set_ssl_mode , | ||
| 12 | .Nm BIO_set_ssl_renegotiate_bytes , | ||
| 13 | .Nm BIO_get_num_renegotiates , | ||
| 14 | .Nm BIO_set_ssl_renegotiate_timeout , | ||
| 15 | .Nm BIO_new_ssl , | ||
| 16 | .Nm BIO_new_ssl_connect , | ||
| 17 | .Nm BIO_new_buffer_ssl_connect , | ||
| 18 | .Nm BIO_ssl_copy_session_id , | ||
| 19 | .Nm BIO_ssl_shutdown , | ||
| 20 | .Nm BIO_do_handshake | ||
| 21 | .Nd SSL BIO | ||
| 22 | .Sh SYNOPSIS | ||
| 23 | .In openssl/bio.h | ||
| 24 | .In openssl/ssl.h | ||
| 25 | .Ft BIO_METHOD * | ||
| 26 | .Fn BIO_f_ssl void | ||
| 27 | .Fd #define BIO_set_ssl(b,ssl,c) BIO_ctrl(b,BIO_C_SET_SSL,c,(char *)ssl) | ||
| 28 | .Fd #define BIO_get_ssl(b,sslp) BIO_ctrl(b,BIO_C_GET_SSL,0,(char *)sslp) | ||
| 29 | .Fd #define BIO_set_ssl_mode(b,client) BIO_ctrl(b,BIO_C_SSL_MODE,client,NULL) | ||
| 30 | .Fd #define BIO_set_ssl_renegotiate_bytes(b,num) \ | ||
| 31 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_BYTES,num,NULL) | ||
| 32 | .Fd #define BIO_set_ssl_renegotiate_timeout(b,seconds) \ | ||
| 33 | BIO_ctrl(b,BIO_C_SET_SSL_RENEGOTIATE_TIMEOUT,seconds,NULL) | ||
| 34 | .Fd #define BIO_get_num_renegotiates(b) \ | ||
| 35 | BIO_ctrl(b,BIO_C_SET_SSL_NUM_RENEGOTIATES,0,NULL) | ||
| 36 | .Ft BIO * | ||
| 37 | .Fn BIO_new_ssl "SSL_CTX *ctx" "int client" | ||
| 38 | .Ft BIO * | ||
| 39 | .Fn BIO_new_ssl_connect "SSL_CTX *ctx" | ||
| 40 | .Ft BIO * | ||
| 41 | .Fn BIO_new_buffer_ssl_connect "SSL_CTX *ctx" | ||
| 42 | .Ft int | ||
| 43 | .Fn BIO_ssl_copy_session_id "BIO *to" "BIO *from" | ||
| 44 | .Ft void | ||
| 45 | .Fn BIO_ssl_shutdown "BIO *bio" | ||
| 46 | .Fd #define BIO_do_handshake(b) BIO_ctrl(b,BIO_C_DO_STATE_MACHINE,0,NULL) | ||
| 47 | .Sh DESCRIPTION | ||
| 48 | .Fn BIO_f_ssl | ||
| 49 | returns the | ||
| 50 | .Vt SSL | ||
| 51 | .Vt BIO | ||
| 52 | method. | ||
| 53 | This is a filter | ||
| 54 | .Vt BIO | ||
| 55 | which is a wrapper around the OpenSSL | ||
| 56 | .Vt SSL | ||
| 57 | routines adding a | ||
| 58 | .Vt BIO | ||
| 59 | .Dq flavor | ||
| 60 | to SSL I/O. | ||
| 61 | .Pp | ||
| 62 | I/O performed on an | ||
| 63 | .Vt SSL | ||
| 64 | .Vt BIO | ||
| 65 | communicates using the SSL protocol with | ||
| 66 | the | ||
| 67 | .Vt SSL Ns 's | ||
| 68 | read and write | ||
| 69 | .Vt BIO Ns s. | ||
| 70 | If an SSL connection is not established then an attempt is made to establish | ||
| 71 | one on the first I/O call. | ||
| 72 | .Pp | ||
| 73 | If a | ||
| 74 | .Vt BIO | ||
| 75 | is appended to an | ||
| 76 | .Vt SSL | ||
| 77 | .Vt BIO | ||
| 78 | using | ||
| 79 | .Xr BIO_push 3 | ||
| 80 | it is automatically used as the | ||
| 81 | .Vt SSL | ||
| 82 | .Vt BIO Ns 's read and write | ||
| 83 | .Vt BIO Ns s. | ||
| 84 | .Pp | ||
| 85 | Calling | ||
| 86 | .Xr BIO_reset 3 | ||
| 87 | on an | ||
| 88 | .Vt SSL | ||
| 89 | .Vt BIO | ||
| 90 | closes down any current SSL connection by calling | ||
| 91 | .Xr SSL_shutdown 3 . | ||
| 92 | .Xr BIO_reset | ||
| 93 | is then sent to the next | ||
| 94 | .Vt BIO | ||
| 95 | in the chain; this will typically disconnect the underlying transport. | ||
| 96 | The | ||
| 97 | .Vt SSL | ||
| 98 | .Vt BIO | ||
| 99 | is then reset to the initial accept or connect state. | ||
| 100 | .Pp | ||
| 101 | If the close flag is set when an | ||
| 102 | .Vt SSL | ||
| 103 | .Vt BIO | ||
| 104 | is freed then the internal | ||
| 105 | .Vt SSL | ||
| 106 | structure is also freed using | ||
| 107 | .Xr SSL_free 3 . | ||
| 108 | .Pp | ||
| 109 | .Fn BIO_set_ssl | ||
| 110 | sets the internal | ||
| 111 | .Vt SSL | ||
| 112 | pointer of | ||
| 113 | .Vt BIO | ||
| 114 | .Fa b | ||
| 115 | to | ||
| 116 | .Fa ssl | ||
| 117 | using | ||
| 118 | the close flag | ||
| 119 | .Fa c . | ||
| 120 | .Pp | ||
| 121 | .Fn BIO_get_ssl | ||
| 122 | retrieves the | ||
| 123 | .Vt SSL | ||
| 124 | pointer of | ||
| 125 | .Vt BIO | ||
| 126 | .Fa b ; | ||
| 127 | it can then be manipulated using the standard SSL library functions. | ||
| 128 | .Pp | ||
| 129 | .Fn BIO_set_ssl_mode | ||
| 130 | sets the | ||
| 131 | .Vt SSL | ||
| 132 | .Vt BIO | ||
| 133 | mode to | ||
| 134 | .Fa client . | ||
| 135 | If | ||
| 136 | .Fa client | ||
| 137 | is 1, client mode is set. | ||
| 138 | If | ||
| 139 | .Fa client | ||
| 140 | is 0, server mode is set. | ||
| 141 | .Pp | ||
| 142 | .Fn BIO_set_ssl_renegotiate_bytes | ||
| 143 | sets the renegotiate byte count to | ||
| 144 | .Fa num . | ||
| 145 | When set after every | ||
| 146 | .Fa num | ||
| 147 | bytes of I/O (read and write) the SSL session is automatically renegotiated. | ||
| 148 | .Fa num | ||
| 149 | must be at least 512 bytes. | ||
| 150 | .Pp | ||
| 151 | .Fn BIO_set_ssl_renegotiate_timeout | ||
| 152 | sets the renegotiate timeout to | ||
| 153 | .Fa seconds . | ||
| 154 | When the renegotiate timeout elapses the session is automatically renegotiated. | ||
| 155 | .Pp | ||
| 156 | .Fn BIO_get_num_renegotiates | ||
| 157 | returns the total number of session renegotiations due to I/O or timeout. | ||
| 158 | .Pp | ||
| 159 | .Fn BIO_new_ssl | ||
| 160 | allocates an | ||
| 161 | .Vt SSL | ||
| 162 | .Vt BIO | ||
| 163 | using | ||
| 164 | .Vt SSL_CTX | ||
| 165 | .Va ctx | ||
| 166 | and using client mode if | ||
| 167 | .Fa client | ||
| 168 | is nonzero. | ||
| 169 | .Pp | ||
| 170 | .Fn BIO_new_ssl_connect | ||
| 171 | creates a new | ||
| 172 | .Vt BIO | ||
| 173 | chain consisting of an | ||
| 174 | .Vt SSL | ||
| 175 | .Vt BIO | ||
| 176 | (using | ||
| 177 | .Fa ctx ) | ||
| 178 | followed by a connect BIO. | ||
| 179 | .Pp | ||
| 180 | .Fn BIO_new_buffer_ssl_connect | ||
| 181 | creates a new | ||
| 182 | .Vt BIO | ||
| 183 | chain consisting of a buffering | ||
| 184 | .Vt BIO , | ||
| 185 | an | ||
| 186 | .Vt SSL | ||
| 187 | .Vt BIO | ||
| 188 | (using | ||
| 189 | .Fa ctx ) | ||
| 190 | and a connect | ||
| 191 | .Vt BIO . | ||
| 192 | .Pp | ||
| 193 | .Fn BIO_ssl_copy_session_id | ||
| 194 | copies an SSL session id between | ||
| 195 | .Vt BIO | ||
| 196 | chains | ||
| 197 | .Fa from | ||
| 198 | and | ||
| 199 | .Fa to . | ||
| 200 | It does this by locating the | ||
| 201 | .Vt SSL | ||
| 202 | .Vt BIO Ns s | ||
| 203 | in each chain and calling | ||
| 204 | .Xr SSL_copy_session_id 3 | ||
| 205 | on the internal | ||
| 206 | .Vt SSL | ||
| 207 | pointer. | ||
| 208 | .Pp | ||
| 209 | .Fn BIO_ssl_shutdown | ||
| 210 | closes down an SSL connection on | ||
| 211 | .Vt BIO | ||
| 212 | chain | ||
| 213 | .Fa bio . | ||
| 214 | It does this by locating the | ||
| 215 | .Vt SSL | ||
| 216 | .Vt BIO | ||
| 217 | in the | ||
| 218 | chain and calling | ||
| 219 | .Xr SSL_shutdown 3 | ||
| 220 | on its internal | ||
| 221 | .Vt SSL | ||
| 222 | pointer. | ||
| 223 | .Pp | ||
| 224 | .Fn BIO_do_handshake | ||
| 225 | attempts to complete an SSL handshake on the supplied | ||
| 226 | .Vt BIO | ||
| 227 | and establish the SSL connection. | ||
| 228 | It returns 1 if the connection was established successfully. | ||
| 229 | A zero or negative value is returned if the connection could not be | ||
| 230 | established; the call | ||
| 231 | .Xr BIO_should_retry 3 | ||
| 232 | should be used for non blocking connect | ||
| 233 | .Vt BIO Ns s | ||
| 234 | to determine if the call should be retried. | ||
| 235 | If an SSL connection has already been established this call has no effect. | ||
| 236 | .Sh NOTES | ||
| 237 | .Vt SSL | ||
| 238 | .Vt BIO Ns s | ||
| 239 | are exceptional in that if the underlying transport is non-blocking they can | ||
| 240 | still request a retry in exceptional circumstances. | ||
| 241 | Specifically this will happen if a session renegotiation takes place during a | ||
| 242 | .Xr BIO_read 3 | ||
| 243 | operation. | ||
| 244 | One case where this happens is when step up occurs. | ||
| 245 | .Pp | ||
| 246 | In OpenSSL 0.9.6 and later the SSL flag | ||
| 247 | .Dv SSL_AUTO_RETRY | ||
| 248 | can be set to disable this behaviour. | ||
| 249 | In other words, when this flag is set an | ||
| 250 | .Vt SSL | ||
| 251 | .Vt BIO | ||
| 252 | using a blocking transport will never request a retry. | ||
| 253 | .Pp | ||
| 254 | Since unknown | ||
| 255 | .Xr BIO_ctrl 3 | ||
| 256 | operations are sent through filter | ||
| 257 | .Vt BIO Ns s | ||
| 258 | the server name and port can be set using | ||
| 259 | .Xr BIO_set_host 3 | ||
| 260 | on the | ||
| 261 | .Vt BIO | ||
| 262 | returned by | ||
| 263 | .Fn BIO_new_ssl_connect | ||
| 264 | without having to locate the connect | ||
| 265 | .Vt BIO | ||
| 266 | first. | ||
| 267 | .Pp | ||
| 268 | Applications do not have to call | ||
| 269 | .Fn BIO_do_handshake | ||
| 270 | but may wish to do so to separate the handshake process from other I/O | ||
| 271 | processing. | ||
| 272 | .Sh RETURN VALUES | ||
| 273 | .\" XXX | ||
| 274 | This section is incomplete. | ||
| 275 | .Sh EXAMPLES | ||
| 276 | This SSL/TLS client example attempts to retrieve a page from an SSL/TLS web | ||
| 277 | server. | ||
| 278 | The I/O routines are identical to those of the unencrypted example in | ||
| 279 | .Xr BIO_s_connect 3 . | ||
| 280 | .Bd -literal | ||
| 281 | BIO *sbio, *out; | ||
| 282 | int len; | ||
| 283 | char tmpbuf[1024]; | ||
| 284 | SSL_CTX *ctx; | ||
| 285 | SSL *ssl; | ||
| 286 | |||
| 287 | ERR_load_crypto_strings(); | ||
| 288 | ERR_load_SSL_strings(); | ||
| 289 | OpenSSL_add_all_algorithms(); | ||
| 290 | |||
| 291 | /* | ||
| 292 | * We would seed the PRNG here if the platform didn't do it automatically | ||
| 293 | */ | ||
| 294 | |||
| 295 | ctx = SSL_CTX_new(SSLv23_client_method()); | ||
| 296 | |||
| 297 | /* | ||
| 298 | * We'd normally set some stuff like the verify paths and mode here because | ||
| 299 | * as things stand this will connect to any server whose certificate is | ||
| 300 | * signed by any CA. | ||
| 301 | */ | ||
| 302 | |||
| 303 | sbio = BIO_new_ssl_connect(ctx); | ||
| 304 | |||
| 305 | BIO_get_ssl(sbio, &ssl); | ||
| 306 | |||
| 307 | if (!ssl) { | ||
| 308 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
| 309 | /* whatever ... */ | ||
| 310 | } | ||
| 311 | |||
| 312 | /* Don't want any retries */ | ||
| 313 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
| 314 | |||
| 315 | /* We might want to do other things with ssl here */ | ||
| 316 | |||
| 317 | BIO_set_conn_hostname(sbio, "localhost:https"); | ||
| 318 | |||
| 319 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
| 320 | if (BIO_do_connect(sbio) <= 0) { | ||
| 321 | fprintf(stderr, "Error connecting to server\en"); | ||
| 322 | ERR_print_errors_fp(stderr); | ||
| 323 | /* whatever ... */ | ||
| 324 | } | ||
| 325 | |||
| 326 | if (BIO_do_handshake(sbio) <= 0) { | ||
| 327 | fprintf(stderr, "Error establishing SSL connection\en"); | ||
| 328 | ERR_print_errors_fp(stderr); | ||
| 329 | /* whatever ... */ | ||
| 330 | } | ||
| 331 | |||
| 332 | /* Could examine ssl here to get connection info */ | ||
| 333 | |||
| 334 | BIO_puts(sbio, "GET / HTTP/1.0\en\en"); | ||
| 335 | for (;;) { | ||
| 336 | len = BIO_read(sbio, tmpbuf, 1024); | ||
| 337 | if(len <= 0) break; | ||
| 338 | BIO_write(out, tmpbuf, len); | ||
| 339 | } | ||
| 340 | BIO_free_all(sbio); | ||
| 341 | BIO_free(out); | ||
| 342 | .Ed | ||
| 343 | .Pp | ||
| 344 | Here is a simple server example. | ||
| 345 | It makes use of a buffering | ||
| 346 | .Vt BIO | ||
| 347 | to allow lines to be read from the | ||
| 348 | .Vt SSL | ||
| 349 | .Vt BIO | ||
| 350 | using | ||
| 351 | .Xr BIO_gets 3 . | ||
| 352 | It creates a pseudo web page containing the actual request from a client and | ||
| 353 | also echoes the request to standard output. | ||
| 354 | .Bd -literal | ||
| 355 | BIO *sbio, *bbio, *acpt, *out; | ||
| 356 | int len; | ||
| 357 | char tmpbuf[1024]; | ||
| 358 | SSL_CTX *ctx; | ||
| 359 | SSL *ssl; | ||
| 360 | |||
| 361 | ERR_load_crypto_strings(); | ||
| 362 | ERR_load_SSL_strings(); | ||
| 363 | OpenSSL_add_all_algorithms(); | ||
| 364 | |||
| 365 | /* Might seed PRNG here */ | ||
| 366 | |||
| 367 | ctx = SSL_CTX_new(SSLv23_server_method()); | ||
| 368 | |||
| 369 | if (!SSL_CTX_use_certificate_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
| 370 | || !SSL_CTX_use_PrivateKey_file(ctx,"server.pem",SSL_FILETYPE_PEM) | ||
| 371 | || !SSL_CTX_check_private_key(ctx)) { | ||
| 372 | fprintf(stderr, "Error setting up SSL_CTX\en"); | ||
| 373 | ERR_print_errors_fp(stderr); | ||
| 374 | return 0; | ||
| 375 | } | ||
| 376 | |||
| 377 | /* | ||
| 378 | * Might do other things here like setting verify locations and DH and/or | ||
| 379 | * RSA temporary key callbacks | ||
| 380 | */ | ||
| 381 | |||
| 382 | /* New SSL BIO setup as server */ | ||
| 383 | sbio = BIO_new_ssl(ctx,0); | ||
| 384 | |||
| 385 | BIO_get_ssl(sbio, &ssl); | ||
| 386 | |||
| 387 | if (!ssl) { | ||
| 388 | fprintf(stderr, "Can't locate SSL pointer\en"); | ||
| 389 | /* whatever ... */ | ||
| 390 | } | ||
| 391 | |||
| 392 | /* Don't want any retries */ | ||
| 393 | SSL_set_mode(ssl, SSL_MODE_AUTO_RETRY); | ||
| 394 | |||
| 395 | /* Create the buffering BIO */ | ||
| 396 | |||
| 397 | bbio = BIO_new(BIO_f_buffer()); | ||
| 398 | |||
| 399 | /* Add to chain */ | ||
| 400 | sbio = BIO_push(bbio, sbio); | ||
| 401 | |||
| 402 | acpt = BIO_new_accept("4433"); | ||
| 403 | |||
| 404 | /* | ||
| 405 | * By doing this when a new connection is established we automatically | ||
| 406 | * have sbio inserted into it. The BIO chain is now 'swallowed' by the | ||
| 407 | * accept BIO and will be freed when the accept BIO is freed. | ||
| 408 | */ | ||
| 409 | |||
| 410 | BIO_set_accept_bios(acpt,sbio); | ||
| 411 | |||
| 412 | out = BIO_new_fp(stdout, BIO_NOCLOSE); | ||
| 413 | |||
| 414 | /* Setup accept BIO */ | ||
| 415 | if (BIO_do_accept(acpt) <= 0) { | ||
| 416 | fprintf(stderr, "Error setting up accept BIO\en"); | ||
| 417 | ERR_print_errors_fp(stderr); | ||
| 418 | return 0; | ||
| 419 | } | ||
| 420 | |||
| 421 | /* Now wait for incoming connection */ | ||
| 422 | if (BIO_do_accept(acpt) <= 0) { | ||
| 423 | fprintf(stderr, "Error in connection\en"); | ||
| 424 | ERR_print_errors_fp(stderr); | ||
| 425 | return 0; | ||
| 426 | } | ||
| 427 | |||
| 428 | /* We only want one connection so remove and free accept BIO */ | ||
| 429 | |||
| 430 | sbio = BIO_pop(acpt); | ||
| 431 | |||
| 432 | BIO_free_all(acpt); | ||
| 433 | |||
| 434 | if (BIO_do_handshake(sbio) <= 0) { | ||
| 435 | fprintf(stderr, "Error in SSL handshake\en"); | ||
| 436 | ERR_print_errors_fp(stderr); | ||
| 437 | return 0; | ||
| 438 | } | ||
| 439 | |||
| 440 | BIO_puts(sbio, "HTTP/1.0 200 OK\er\enContent-type: text/plain\er\en\er\en"); | ||
| 441 | BIO_puts(sbio, "\er\enConnection Established\er\enRequest headers:\er\en"); | ||
| 442 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
| 443 | |||
| 444 | for (;;) { | ||
| 445 | len = BIO_gets(sbio, tmpbuf, 1024); | ||
| 446 | if (len <= 0) | ||
| 447 | break; | ||
| 448 | BIO_write(sbio, tmpbuf, len); | ||
| 449 | BIO_write(out, tmpbuf, len); | ||
| 450 | /* Look for blank line signifying end of headers */ | ||
| 451 | if ((tmpbuf[0] == '\er') || (tmpbuf[0] == '\en')) | ||
| 452 | break; | ||
| 453 | } | ||
| 454 | |||
| 455 | BIO_puts(sbio, "--------------------------------------------------\er\en"); | ||
| 456 | BIO_puts(sbio, "\er\en"); | ||
| 457 | |||
| 458 | /* Since there is a buffering BIO present we had better flush it */ | ||
| 459 | BIO_flush(sbio); | ||
| 460 | |||
| 461 | BIO_free_all(sbio); | ||
| 462 | .Ed | ||
| 463 | .Sh BUGS | ||
| 464 | In OpenSSL versions before 1.0.0 the | ||
| 465 | .Xr BIO_pop 3 | ||
| 466 | call was handled incorrectly: | ||
| 467 | the I/O BIO reference count was incorrectly incremented (instead of | ||
| 468 | decremented) and dissociated with the | ||
| 469 | .Vt SSL | ||
| 470 | .Vt BIO | ||
| 471 | even if the | ||
| 472 | .Vt SSL | ||
| 473 | .Vt BIO | ||
| 474 | was not | ||
| 475 | explicitly being popped (e.g., a pop higher up the chain). | ||
| 476 | Applications which included workarounds for this bug (e.g., freeing BIOs more | ||
| 477 | than once) should be modified to handle this fix or they may free up an already | ||
| 478 | freed | ||
| 479 | .Vt BIO . | ||
diff --git a/src/lib/libssl/man/Makefile b/src/lib/libssl/man/Makefile new file mode 100644 index 0000000000..76afab5718 --- /dev/null +++ b/src/lib/libssl/man/Makefile | |||
| @@ -0,0 +1,93 @@ | |||
| 1 | # $OpenBSD: Makefile,v 1.36 2016/11/05 15:32:19 schwarze Exp $ | ||
| 2 | |||
| 3 | .include <bsd.own.mk> | ||
| 4 | |||
| 5 | MAN = BIO_f_ssl.3 \ | ||
| 6 | SSL_CIPHER_get_name.3 \ | ||
| 7 | SSL_COMP_add_compression_method.3 \ | ||
| 8 | SSL_CTX_add_extra_chain_cert.3 \ | ||
| 9 | SSL_CTX_add_session.3 \ | ||
| 10 | SSL_CTX_ctrl.3 \ | ||
| 11 | SSL_CTX_flush_sessions.3 \ | ||
| 12 | SSL_CTX_free.3 \ | ||
| 13 | SSL_CTX_get_ex_new_index.3 \ | ||
| 14 | SSL_CTX_get_verify_mode.3 \ | ||
| 15 | SSL_CTX_load_verify_locations.3 \ | ||
| 16 | SSL_CTX_new.3 \ | ||
| 17 | SSL_CTX_sess_number.3 \ | ||
| 18 | SSL_CTX_sess_set_cache_size.3 \ | ||
| 19 | SSL_CTX_sess_set_get_cb.3 \ | ||
| 20 | SSL_CTX_sessions.3 \ | ||
| 21 | SSL_CTX_set_cert_store.3 \ | ||
| 22 | SSL_CTX_set_cert_verify_callback.3 \ | ||
| 23 | SSL_CTX_set_cipher_list.3 \ | ||
| 24 | SSL_CTX_set_client_CA_list.3 \ | ||
| 25 | SSL_CTX_set_client_cert_cb.3 \ | ||
| 26 | SSL_CTX_set_default_passwd_cb.3 \ | ||
| 27 | SSL_CTX_set_generate_session_id.3 \ | ||
| 28 | SSL_CTX_set_info_callback.3 \ | ||
| 29 | SSL_CTX_set_max_cert_list.3 \ | ||
| 30 | SSL_CTX_set_mode.3 \ | ||
| 31 | SSL_CTX_set_msg_callback.3 \ | ||
| 32 | SSL_CTX_set_options.3 \ | ||
| 33 | SSL_CTX_set_psk_client_callback.3 \ | ||
| 34 | SSL_CTX_set_quiet_shutdown.3 \ | ||
| 35 | SSL_CTX_set_session_cache_mode.3 \ | ||
| 36 | SSL_CTX_set_session_id_context.3 \ | ||
| 37 | SSL_CTX_set_ssl_version.3 \ | ||
| 38 | SSL_CTX_set_timeout.3 \ | ||
| 39 | SSL_CTX_set_tmp_dh_callback.3 \ | ||
| 40 | SSL_CTX_set_tmp_rsa_callback.3 \ | ||
| 41 | SSL_CTX_set_verify.3 \ | ||
| 42 | SSL_CTX_use_certificate.3 \ | ||
| 43 | SSL_CTX_use_psk_identity_hint.3 \ | ||
| 44 | SSL_SESSION_free.3 \ | ||
| 45 | SSL_SESSION_get_ex_new_index.3 \ | ||
| 46 | SSL_SESSION_get_time.3 \ | ||
| 47 | SSL_accept.3 \ | ||
| 48 | SSL_alert_type_string.3 \ | ||
| 49 | SSL_clear.3 \ | ||
| 50 | SSL_connect.3 \ | ||
| 51 | SSL_do_handshake.3 \ | ||
| 52 | SSL_free.3 \ | ||
| 53 | SSL_get_SSL_CTX.3 \ | ||
| 54 | SSL_get_ciphers.3 \ | ||
| 55 | SSL_get_client_CA_list.3 \ | ||
| 56 | SSL_get_current_cipher.3 \ | ||
| 57 | SSL_get_default_timeout.3 \ | ||
| 58 | SSL_get_error.3 \ | ||
| 59 | SSL_get_ex_data_X509_STORE_CTX_idx.3 \ | ||
| 60 | SSL_get_ex_new_index.3 \ | ||
| 61 | SSL_get_fd.3 \ | ||
| 62 | SSL_get_peer_cert_chain.3 \ | ||
| 63 | SSL_get_peer_certificate.3 \ | ||
| 64 | SSL_get_psk_identity.3 \ | ||
| 65 | SSL_get_rbio.3 \ | ||
| 66 | SSL_get_session.3 \ | ||
| 67 | SSL_get_verify_result.3 \ | ||
| 68 | SSL_get_version.3 \ | ||
| 69 | SSL_library_init.3 \ | ||
| 70 | SSL_load_client_CA_file.3 \ | ||
| 71 | SSL_new.3 \ | ||
| 72 | SSL_pending.3 \ | ||
| 73 | SSL_read.3 \ | ||
| 74 | SSL_rstate_string.3 \ | ||
| 75 | SSL_session_reused.3 \ | ||
| 76 | SSL_set_bio.3 \ | ||
| 77 | SSL_set_connect_state.3 \ | ||
| 78 | SSL_set_fd.3 \ | ||
| 79 | SSL_set_session.3 \ | ||
| 80 | SSL_set_shutdown.3 \ | ||
| 81 | SSL_set_verify_result.3 \ | ||
| 82 | SSL_shutdown.3 \ | ||
| 83 | SSL_state_string.3 \ | ||
| 84 | SSL_want.3 \ | ||
| 85 | SSL_write.3 \ | ||
| 86 | d2i_SSL_SESSION.3 \ | ||
| 87 | ssl.3 | ||
| 88 | |||
| 89 | all clean cleandir depend includes obj tags: | ||
| 90 | |||
| 91 | install: maninstall | ||
| 92 | |||
| 93 | .include <bsd.man.mk> | ||
diff --git a/src/lib/libssl/man/SSL_CIPHER_get_name.3 b/src/lib/libssl/man/SSL_CIPHER_get_name.3 new file mode 100644 index 0000000000..c4661c8faf --- /dev/null +++ b/src/lib/libssl/man/SSL_CIPHER_get_name.3 | |||
| @@ -0,0 +1,196 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CIPHER_get_name.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CIPHER_GET_NAME 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CIPHER_get_name , | ||
| 9 | .Nm SSL_CIPHER_get_bits , | ||
| 10 | .Nm SSL_CIPHER_get_version , | ||
| 11 | .Nm SSL_CIPHER_description | ||
| 12 | .Nd get SSL_CIPHER properties | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_CIPHER_get_name "const SSL_CIPHER *cipher" | ||
| 17 | .Ft int | ||
| 18 | .Fn SSL_CIPHER_get_bits "const SSL_CIPHER *cipher" "int *alg_bits" | ||
| 19 | .Ft char * | ||
| 20 | .Fn SSL_CIPHER_get_version "const SSL_CIPHER *cipher" | ||
| 21 | .Ft char * | ||
| 22 | .Fn SSL_CIPHER_description "const SSL_CIPHER *cipher" "char *buf" "int size" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CIPHER_get_name | ||
| 25 | returns a pointer to the name of | ||
| 26 | .Fa cipher . | ||
| 27 | If the | ||
| 28 | argument is the | ||
| 29 | .Dv NULL | ||
| 30 | pointer, a pointer to the constant value | ||
| 31 | .Qq NONE | ||
| 32 | is returned. | ||
| 33 | .Pp | ||
| 34 | .Fn SSL_CIPHER_get_bits | ||
| 35 | returns the number of secret bits used for | ||
| 36 | .Fa cipher . | ||
| 37 | If | ||
| 38 | .Fa alg_bits | ||
| 39 | is not | ||
| 40 | .Dv NULL , | ||
| 41 | it contains the number of bits processed by the | ||
| 42 | chosen algorithm. | ||
| 43 | If | ||
| 44 | .Fa cipher | ||
| 45 | is | ||
| 46 | .Dv NULL , | ||
| 47 | 0 is returned. | ||
| 48 | .Pp | ||
| 49 | .Fn SSL_CIPHER_get_version | ||
| 50 | returns a string which indicates the SSL/TLS protocol version that first | ||
| 51 | defined the cipher. | ||
| 52 | This is currently | ||
| 53 | .Qq SSLv2 | ||
| 54 | or | ||
| 55 | .Qq TLSv1/SSLv3 . | ||
| 56 | In some cases it should possibly return | ||
| 57 | .Qq TLSv1.2 | ||
| 58 | but the function does not; use | ||
| 59 | .Xr SSL_CIPHER_description 3 | ||
| 60 | instead. | ||
| 61 | If | ||
| 62 | .Fa cipher | ||
| 63 | is | ||
| 64 | .Dv NULL , | ||
| 65 | .Qq (NONE) | ||
| 66 | is returned. | ||
| 67 | .Pp | ||
| 68 | .Fn SSL_CIPHER_description | ||
| 69 | returns a textual description of the cipher used into the buffer | ||
| 70 | .Fa buf | ||
| 71 | of length | ||
| 72 | .Fa len | ||
| 73 | provided. | ||
| 74 | If | ||
| 75 | .Fa buf | ||
| 76 | is | ||
| 77 | .Dv NULL , | ||
| 78 | a buffer is allocated using | ||
| 79 | .Xr asprintf 3 ; | ||
| 80 | that buffer should be freed using the | ||
| 81 | .Xr free 3 | ||
| 82 | function. | ||
| 83 | If | ||
| 84 | .Fa len | ||
| 85 | is too small, or if | ||
| 86 | .Fa buf | ||
| 87 | is | ||
| 88 | .Dv NULL | ||
| 89 | and the allocation fails, a pointer to the string | ||
| 90 | .Qq Buffer too small | ||
| 91 | is returned. | ||
| 92 | .Sh NOTES | ||
| 93 | The number of bits processed can be different from the secret bits. | ||
| 94 | For example, an export cipher like EXP-RC4-MD5 has only 40 secret bits. | ||
| 95 | The algorithm does use the full 128 bits (which would be returned for | ||
| 96 | .Fa alg_bits ) , | ||
| 97 | but 88 bits are fixed. | ||
| 98 | The search space is hence only 40 bits. | ||
| 99 | .Pp | ||
| 100 | The string returned by | ||
| 101 | .Fn SSL_CIPHER_description | ||
| 102 | in case of success consists | ||
| 103 | of cleartext information separated by one or more blanks in the following | ||
| 104 | sequence: | ||
| 105 | .Bl -tag -width Ds | ||
| 106 | .It Aq Ar ciphername | ||
| 107 | Textual representation of the cipher name. | ||
| 108 | .It Aq Ar protocol version | ||
| 109 | Protocol version: | ||
| 110 | .Em SSLv2 , | ||
| 111 | .Em SSLv3 , | ||
| 112 | .Em TLSv1.2 . | ||
| 113 | The TLSv1.0 ciphers are flagged with SSLv3. | ||
| 114 | No new ciphers were added by TLSv1.1. | ||
| 115 | .It Kx= Ns Aq Ar key exchange | ||
| 116 | Key exchange method: | ||
| 117 | .Em RSA | ||
| 118 | (for export ciphers as | ||
| 119 | .Em RSA(512) | ||
| 120 | or | ||
| 121 | .Em RSA(1024) ) , | ||
| 122 | .Em DH | ||
| 123 | (for export ciphers as | ||
| 124 | .Em DH(512) | ||
| 125 | or | ||
| 126 | .Em DH(1024) ) , | ||
| 127 | .Em DH/RSA , | ||
| 128 | .Em DH/DSS , | ||
| 129 | .Em Fortezza . | ||
| 130 | .It Au= Ns Aq Ar authentication | ||
| 131 | Authentication method: | ||
| 132 | .Em RSA , | ||
| 133 | .Em DSS , | ||
| 134 | .Em DH , | ||
| 135 | .Em None . | ||
| 136 | .Em None | ||
| 137 | is the representation of anonymous ciphers. | ||
| 138 | .It Enc= Ns Aq Ar symmetric encryption method | ||
| 139 | Encryption method with number of secret bits: | ||
| 140 | .Em DES(40) , | ||
| 141 | .Em DES(56) , | ||
| 142 | .Em 3DES(168) , | ||
| 143 | .Em RC4(40) , | ||
| 144 | .Em RC4(56) , | ||
| 145 | .Em RC4(64) , | ||
| 146 | .Em RC4(128) , | ||
| 147 | .Em RC2(40) , | ||
| 148 | .Em RC2(56) , | ||
| 149 | .Em RC2(128) , | ||
| 150 | .Em IDEA(128) , | ||
| 151 | .Em Fortezza , | ||
| 152 | .Em None . | ||
| 153 | .It Mac= Ns Aq Ar message authentication code | ||
| 154 | Message digest: | ||
| 155 | .Em MD5 , | ||
| 156 | .Em SHA1 . | ||
| 157 | .It Aq Ar export flag | ||
| 158 | If the cipher is flagged exportable with respect to old US crypto | ||
| 159 | regulations, the word | ||
| 160 | .Dq export | ||
| 161 | is printed. | ||
| 162 | .El | ||
| 163 | .Sh RETURN VALUES | ||
| 164 | See | ||
| 165 | .Sx DESCRIPTION | ||
| 166 | .Sh EXAMPLES | ||
| 167 | Some examples for the output of | ||
| 168 | .Fn SSL_CIPHER_description : | ||
| 169 | .D1 "EDH-RSA-DES-CBC3-SHA SSLv3 Kx=DH Au=RSA Enc=3DES(168) Mac=SHA1" | ||
| 170 | .D1 "EDH-DSS-DES-CBC3-SHA SSLv3 Kx=DH Au=DSS Enc=3DES(168) Mac=SHA1" | ||
| 171 | .D1 "RC4-MD5 SSLv3 Kx=RSA Au=RSA Enc=RC4(128) Mac=MD5" | ||
| 172 | .D1 "EXP-RC4-MD5 SSLv3 Kx=RSA(512) Au=RSA Enc=RC4(40) Mac=MD5 export" | ||
| 173 | .Pp | ||
| 174 | A complete list can be retrieved by invoking the following command: | ||
| 175 | .Pp | ||
| 176 | .Dl $ openssl ciphers -v ALL | ||
| 177 | .Sh SEE ALSO | ||
| 178 | .Xr openssl 1 , | ||
| 179 | .Xr ssl 3 , | ||
| 180 | .Xr SSL_get_ciphers 3 , | ||
| 181 | .Xr SSL_get_current_cipher 3 | ||
| 182 | .Sh BUGS | ||
| 183 | If | ||
| 184 | .Fn SSL_CIPHER_description | ||
| 185 | is called with | ||
| 186 | .Fa cipher | ||
| 187 | being | ||
| 188 | .Dv NULL , | ||
| 189 | the library crashes. | ||
| 190 | .Pp | ||
| 191 | If | ||
| 192 | .Fn SSL_CIPHER_description | ||
| 193 | cannot handle a built-in cipher, | ||
| 194 | the according description of the cipher property is | ||
| 195 | .Qq unknown . | ||
| 196 | This case should not occur. | ||
diff --git a/src/lib/libssl/man/SSL_COMP_add_compression_method.3 b/src/lib/libssl/man/SSL_COMP_add_compression_method.3 new file mode 100644 index 0000000000..957b2e8bed --- /dev/null +++ b/src/lib/libssl/man/SSL_COMP_add_compression_method.3 | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_COMP_add_compression_method.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_COMP_ADD_COMPRESSION_METHOD 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_COMP_add_compression_method | ||
| 9 | .Nd handle SSL/TLS integrated compression methods | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_COMP_add_compression_method "int id" "COMP_METHOD *cm" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_COMP_add_compression_method | ||
| 16 | adds the compression method | ||
| 17 | .Fa cm | ||
| 18 | with the identifier | ||
| 19 | .Fa id | ||
| 20 | to the list of available compression methods. | ||
| 21 | This list is globally maintained for all SSL operations within this application. | ||
| 22 | It cannot be set for specific SSL_CTX or SSL objects. | ||
| 23 | .Sh NOTES | ||
| 24 | The TLS standard (or SSLv3) allows the integration of compression methods | ||
| 25 | into the communication. | ||
| 26 | The TLS RFC does however not specify compression methods or their corresponding | ||
| 27 | identifiers, so there is currently no compatible way to integrate compression | ||
| 28 | with unknown peers. | ||
| 29 | It is therefore currently not recommended to integrate compression into | ||
| 30 | applications. | ||
| 31 | Applications for non-public use may agree on certain compression methods. | ||
| 32 | Using different compression methods with the same identifier will lead to | ||
| 33 | connection failure. | ||
| 34 | .Pp | ||
| 35 | An OpenSSL client speaking a protocol that allows compression (SSLv3, TLSv1) | ||
| 36 | will unconditionally send the list of all compression methods enabled with | ||
| 37 | .Fn SSL_COMP_add_compression_method | ||
| 38 | to the server during the handshake. | ||
| 39 | Unlike the mechanisms to set a cipher list, there is no method available to | ||
| 40 | restrict the list of compression method on a per connection basis. | ||
| 41 | .Pp | ||
| 42 | An OpenSSL server will match the identifiers listed by a client against | ||
| 43 | its own compression methods and will unconditionally activate compression | ||
| 44 | when a matching identifier is found. | ||
| 45 | There is no way to restrict the list of compression methods supported on a per | ||
| 46 | connection basis. | ||
| 47 | .Pp | ||
| 48 | The OpenSSL library has the compression methods | ||
| 49 | .Fn COMP_rle | ||
| 50 | and (when especially enabled during compilation) | ||
| 51 | .Fn COMP_zlib | ||
| 52 | available. | ||
| 53 | .Sh WARNINGS | ||
| 54 | Once the identities of the compression methods for the TLS protocol have | ||
| 55 | been standardized, the compression API will most likely be changed. | ||
| 56 | Using it in the current state is not recommended. | ||
| 57 | .Sh RETURN VALUES | ||
| 58 | .Fn SSL_COMP_add_compression_method | ||
| 59 | may return the following values: | ||
| 60 | .Bl -tag -width Ds | ||
| 61 | .It 0 | ||
| 62 | The operation succeeded. | ||
| 63 | .It 1 | ||
| 64 | The operation failed. | ||
| 65 | Check the error queue to find out the reason. | ||
| 66 | .El | ||
| 67 | .Sh SEE ALSO | ||
| 68 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 new file mode 100644 index 0000000000..b7ece44811 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3 | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_add_extra_chain_cert.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_ADD_EXTRA_CHAIN_CERT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_add_extra_chain_cert | ||
| 9 | .Nd add certificate to chain | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft long | ||
| 13 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX ctx" "X509 *x509" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_CTX_add_extra_chain_cert | ||
| 16 | adds the certificate | ||
| 17 | .Fa x509 | ||
| 18 | to the certificate chain presented together with the certificate. | ||
| 19 | Several certificates can be added one after the other. | ||
| 20 | .Sh NOTES | ||
| 21 | When constructing the certificate chain, the chain will be formed from | ||
| 22 | these certificates explicitly specified. | ||
| 23 | If no chain is specified, the library will try to complete the chain from the | ||
| 24 | available CA certificates in the trusted CA storage, see | ||
| 25 | .Xr SSL_CTX_load_verify_locations 3 . | ||
| 26 | .Pp | ||
| 27 | The x509 certificate provided to | ||
| 28 | .Fn SSL_CTX_add_extra_chain_cert | ||
| 29 | will be freed by the library when the | ||
| 30 | .Vt SSL_CTX | ||
| 31 | is destroyed. | ||
| 32 | An application | ||
| 33 | .Em should not | ||
| 34 | free the | ||
| 35 | .Fa x509 | ||
| 36 | object. | ||
| 37 | .Sh RETURN VALUES | ||
| 38 | .Fn SSL_CTX_add_extra_chain_cert | ||
| 39 | returns 1 on success. | ||
| 40 | Check out the error stack to find out the reason for failure otherwise. | ||
| 41 | .Sh SEE ALSO | ||
| 42 | .Xr ssl 3 , | ||
| 43 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 44 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
| 45 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_add_session.3 b/src/lib/libssl/man/SSL_CTX_add_session.3 new file mode 100644 index 0000000000..fe60c6ea92 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_add_session.3 | |||
| @@ -0,0 +1,90 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_add_session.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_ADD_SESSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_add_session , | ||
| 9 | .Nm SSL_add_session , | ||
| 10 | .Nm SSL_CTX_remove_session , | ||
| 11 | .Nm SSL_remove_session | ||
| 12 | .Nd manipulate session cache | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft int | ||
| 16 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 17 | .Ft int | ||
| 18 | .Fn SSL_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 19 | .Ft int | ||
| 20 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 21 | .Ft int | ||
| 22 | .Fn SSL_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_add_session | ||
| 25 | adds the session | ||
| 26 | .Fa c | ||
| 27 | to the context | ||
| 28 | .Fa ctx . | ||
| 29 | The reference count for session | ||
| 30 | .Fa c | ||
| 31 | is incremented by 1. | ||
| 32 | If a session with the same session id already exists, | ||
| 33 | the old session is removed by calling | ||
| 34 | .Xr SSL_SESSION_free 3 . | ||
| 35 | .Pp | ||
| 36 | .Fn SSL_CTX_remove_session | ||
| 37 | removes the session | ||
| 38 | .Fa c | ||
| 39 | from the context | ||
| 40 | .Fa ctx . | ||
| 41 | .Xr SSL_SESSION_free 3 | ||
| 42 | is called once for | ||
| 43 | .Fa c . | ||
| 44 | .Pp | ||
| 45 | .Fn SSL_add_session | ||
| 46 | and | ||
| 47 | .Fn SSL_remove_session | ||
| 48 | are synonyms for their | ||
| 49 | .Fn SSL_CTX_* | ||
| 50 | counterparts. | ||
| 51 | .Sh NOTES | ||
| 52 | When adding a new session to the internal session cache, it is examined | ||
| 53 | whether a session with the same session id already exists. | ||
| 54 | In this case it is assumed that both sessions are identical. | ||
| 55 | If the same session is stored in a different | ||
| 56 | .Vt SSL_SESSION | ||
| 57 | object, the old session is removed and replaced by the new session. | ||
| 58 | If the session is actually identical (the | ||
| 59 | .Vt SSL_SESSION | ||
| 60 | object is identical), | ||
| 61 | .Fn SSL_CTX_add_session | ||
| 62 | is a no-op, and the return value is 0. | ||
| 63 | .Pp | ||
| 64 | If a server | ||
| 65 | .Vt SSL_CTX | ||
| 66 | is configured with the | ||
| 67 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
| 68 | flag then the internal cache will not be populated automatically by new | ||
| 69 | sessions negotiated by the SSL/TLS implementation, even though the internal | ||
| 70 | cache will be searched automatically for session-resume requests (the | ||
| 71 | latter can be suppressed by | ||
| 72 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP ) . | ||
| 73 | So the application can use | ||
| 74 | .Fn SSL_CTX_add_session | ||
| 75 | directly to have full control over the sessions that can be resumed if desired. | ||
| 76 | .Sh RETURN VALUES | ||
| 77 | The following values are returned by all functions: | ||
| 78 | .Bl -tag -width Ds | ||
| 79 | .It 0 | ||
| 80 | The operation failed. | ||
| 81 | In case of the add operation, it was tried to add the same (identical) session | ||
| 82 | twice. | ||
| 83 | In case of the remove operation, the session was not found in the cache. | ||
| 84 | .It 1 | ||
| 85 | The operation succeeded. | ||
| 86 | .El | ||
| 87 | .Sh SEE ALSO | ||
| 88 | .Xr ssl 3 , | ||
| 89 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 90 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_ctrl.3 b/src/lib/libssl/man/SSL_CTX_ctrl.3 new file mode 100644 index 0000000000..47cf609491 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_ctrl.3 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_ctrl.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_CTRL 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_ctrl , | ||
| 9 | .Nm SSL_CTX_callback_ctrl , | ||
| 10 | .Nm SSL_ctrl , | ||
| 11 | .Nm SSL_callback_ctrl | ||
| 12 | .Nd internal handling functions for SSL_CTX and SSL objects | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "void *parg" | ||
| 17 | .Ft long | ||
| 18 | .Fn SSL_CTX_callback_ctrl "SSL_CTX *" "int cmd" "void (*fp)()" | ||
| 19 | .Ft long | ||
| 20 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "void *parg" | ||
| 21 | .Ft long | ||
| 22 | .Fn SSL_callback_ctrl "SSL *" "int cmd" "void (*fp)()" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | The | ||
| 25 | .Fn SSL_*_ctrl | ||
| 26 | family of functions is used to manipulate settings of | ||
| 27 | the | ||
| 28 | .Vt SSL_CTX | ||
| 29 | and | ||
| 30 | .Vt SSL | ||
| 31 | objects. | ||
| 32 | Depending on the command | ||
| 33 | .Fa cmd | ||
| 34 | the arguments | ||
| 35 | .Fa larg , | ||
| 36 | .Fa parg , | ||
| 37 | or | ||
| 38 | .Fa fp | ||
| 39 | are evaluated. | ||
| 40 | These functions should never be called directly. | ||
| 41 | All functionalities needed are made available via other functions or macros. | ||
| 42 | .Sh RETURN VALUES | ||
| 43 | The return values of the | ||
| 44 | .Fn SSL*_ctrl | ||
| 45 | functions depend on the command supplied via the | ||
| 46 | .Fn cmd | ||
| 47 | parameter. | ||
| 48 | .Sh SEE ALSO | ||
| 49 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_flush_sessions.3 b/src/lib/libssl/man/SSL_CTX_flush_sessions.3 new file mode 100644 index 0000000000..11d33e81a1 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_flush_sessions.3 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_flush_sessions.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_FLUSH_SESSIONS 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_flush_sessions , | ||
| 9 | .Nm SSL_flush_sessions | ||
| 10 | .Nd remove expired sessions | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fn SSL_CTX_flush_sessions "SSL_CTX *ctx" "long tm" | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_flush_sessions "SSL_CTX *ctx" "long tm" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_flush_sessions | ||
| 19 | causes a run through the session cache of | ||
| 20 | .Fa ctx | ||
| 21 | to remove sessions expired at time | ||
| 22 | .Fa tm . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_flush_sessions | ||
| 25 | is a synonym for | ||
| 26 | .Fn SSL_CTX_flush_sessions . | ||
| 27 | .Sh NOTES | ||
| 28 | If enabled, the internal session cache will collect all sessions established | ||
| 29 | up to the specified maximum number (see | ||
| 30 | .Fn SSL_CTX_sess_set_cache_size ) . | ||
| 31 | As sessions will not be reused ones they are expired, they should be | ||
| 32 | removed from the cache to save resources. | ||
| 33 | This can either be done automatically whenever 255 new sessions were | ||
| 34 | established (see | ||
| 35 | .Xr SSL_CTX_set_session_cache_mode 3 ) | ||
| 36 | or manually by calling | ||
| 37 | .Fn SSL_CTX_flush_sessions . | ||
| 38 | .Pp | ||
| 39 | The parameter | ||
| 40 | .Fa tm | ||
| 41 | specifies the time which should be used for the | ||
| 42 | expiration test, in most cases the actual time given by | ||
| 43 | .Fn time 0 | ||
| 44 | will be used. | ||
| 45 | .Pp | ||
| 46 | .Fn SSL_CTX_flush_sessions | ||
| 47 | will only check sessions stored in the internal cache. | ||
| 48 | When a session is found and removed, the | ||
| 49 | .Va remove_session_cb | ||
| 50 | is however called to synchronize with the external cache (see | ||
| 51 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
| 52 | .Sh RETURN VALUES | ||
| 53 | .Sh SEE ALSO | ||
| 54 | .Xr ssl 3 , | ||
| 55 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
| 56 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 57 | .Xr SSL_CTX_set_timeout 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_free.3 b/src/lib/libssl/man/SSL_CTX_free.3 new file mode 100644 index 0000000000..24a19ffaf6 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_free.3 | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_free.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_FREE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_free | ||
| 9 | .Nd free an allocated SSL_CTX object | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_CTX_free "SSL_CTX *ctx" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_CTX_free | ||
| 16 | decrements the reference count of | ||
| 17 | .Fa ctx , | ||
| 18 | and removes the | ||
| 19 | .Vt SSL_CTX | ||
| 20 | object pointed to by | ||
| 21 | .Fa ctx | ||
| 22 | and frees up the allocated memory if the reference count has reached 0. | ||
| 23 | If | ||
| 24 | .Fa ctx | ||
| 25 | is a | ||
| 26 | .Dv NULL | ||
| 27 | pointer, no action occurs. | ||
| 28 | .Pp | ||
| 29 | It also calls the | ||
| 30 | .Xr free 3 Ns ing | ||
| 31 | procedures for indirectly affected items, if applicable: | ||
| 32 | the session cache, the list of ciphers, the list of Client CAs, | ||
| 33 | the certificates and keys. | ||
| 34 | .Sh WARNINGS | ||
| 35 | If a session-remove callback is set | ||
| 36 | .Pq Xr SSL_CTX_sess_set_remove_cb 3 , | ||
| 37 | this callback will be called for each session being freed from | ||
| 38 | .Fa ctx Ns 's | ||
| 39 | session cache. | ||
| 40 | This implies that all corresponding sessions from an external session cache are | ||
| 41 | removed as well. | ||
| 42 | If this is not desired, the user should explicitly unset the callback by | ||
| 43 | calling | ||
| 44 | .Fn SSL_CTX_sess_set_remove_cb ctx NULL | ||
| 45 | prior to calling | ||
| 46 | .Fn SSL_CTX_free . | ||
| 47 | .Sh RETURN VALUES | ||
| 48 | .Fn SSL_CTX_free | ||
| 49 | does not provide diagnostic information. | ||
| 50 | .Sh SEE ALSO | ||
| 51 | .Xr ssl 3 , | ||
| 52 | .Xr SSL_CTX_new 3 , | ||
| 53 | .Xr SSL_CTX_sess_set_get_cb 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 new file mode 100644 index 0000000000..8afb1ebc96 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_get_ex_new_index.3 | |||
| @@ -0,0 +1,70 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_get_ex_new_index.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_GET_EX_NEW_INDEX 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_get_ex_new_index , | ||
| 9 | .Nm SSL_CTX_set_ex_data , | ||
| 10 | .Nm SSL_CTX_get_ex_data | ||
| 11 | .Nd internal application specific data functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fo SSL_CTX_get_ex_new_index | ||
| 16 | .Fa "long argl" | ||
| 17 | .Fa "void *argp" | ||
| 18 | .Fa "CRYPTO_EX_new *new_func" | ||
| 19 | .Fa "CRYPTO_EX_dup *dup_func" | ||
| 20 | .Fa "CRYPTO_EX_free *free_func" | ||
| 21 | .Fc | ||
| 22 | .Ft int | ||
| 23 | .Fn SSL_CTX_set_ex_data "SSL_CTX *ctx" "int idx" "void *arg" | ||
| 24 | .Ft void * | ||
| 25 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *ctx" "int idx" | ||
| 26 | .Bd -literal | ||
| 27 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 28 | int idx, long argl, void *argp); | ||
| 29 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 30 | int idx, long argl, void *argp); | ||
| 31 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
| 32 | int idx, long argl, void *argp); | ||
| 33 | .Ed | ||
| 34 | .Sh DESCRIPTION | ||
| 35 | Several OpenSSL structures can have application specific data attached to them. | ||
| 36 | These functions are used internally by OpenSSL to manipulate application | ||
| 37 | specific data attached to a specific structure. | ||
| 38 | .Pp | ||
| 39 | .Fn SSL_CTX_get_ex_new_index | ||
| 40 | is used to register a new index for application specific data. | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_CTX_set_ex_data | ||
| 43 | is used to store application data at | ||
| 44 | .Fa arg | ||
| 45 | for | ||
| 46 | .Fa idx | ||
| 47 | into the | ||
| 48 | .Fa ctx | ||
| 49 | object. | ||
| 50 | .Pp | ||
| 51 | .Fn SSL_CTX_get_ex_data | ||
| 52 | is used to retrieve the information for | ||
| 53 | .Fa idx | ||
| 54 | from | ||
| 55 | .Fa ctx . | ||
| 56 | .Pp | ||
| 57 | A detailed description for the | ||
| 58 | .Fn *_get_ex_new_index | ||
| 59 | functionality can be found in | ||
| 60 | .Xr RSA_get_ex_new_index 3 . | ||
| 61 | The | ||
| 62 | .Fn *_get_ex_data | ||
| 63 | and | ||
| 64 | .Fn *_set_ex_data | ||
| 65 | functionality is described in | ||
| 66 | .Xr CRYPTO_set_ex_data 3 . | ||
| 67 | .Sh SEE ALSO | ||
| 68 | .Xr CRYPTO_set_ex_data 3 , | ||
| 69 | .Xr RSA_get_ex_new_index 3 , | ||
| 70 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 new file mode 100644 index 0000000000..c8ada8fb21 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_get_verify_mode.3 | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_get_verify_mode.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_GET_VERIFY_MODE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_get_verify_mode , | ||
| 9 | .Nm SSL_get_verify_mode , | ||
| 10 | .Nm SSL_CTX_get_verify_depth , | ||
| 11 | .Nm SSL_get_verify_depth , | ||
| 12 | .Nm SSL_get_verify_callback , | ||
| 13 | .Nm SSL_CTX_get_verify_callback | ||
| 14 | .Nd get currently set verification parameters | ||
| 15 | .Sh SYNOPSIS | ||
| 16 | .In openssl/ssl.h | ||
| 17 | .Ft int | ||
| 18 | .Fn SSL_CTX_get_verify_mode "const SSL_CTX *ctx" | ||
| 19 | .Ft int | ||
| 20 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
| 21 | .Ft int | ||
| 22 | .Fn SSL_CTX_get_verify_depth "const SSL_CTX *ctx" | ||
| 23 | .Ft int | ||
| 24 | .Fn SSL_get_verify_depth "const SSL *ssl" | ||
| 25 | .Ft int | ||
| 26 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
| 27 | .Fa int "X509_STORE_CTX *" | ||
| 28 | .Fc | ||
| 29 | .Ft int | ||
| 30 | .Fo "(*SSL_get_verify_callback(const SSL *ssl))" | ||
| 31 | .Fa int "X509_STORE_CTX *" | ||
| 32 | .Fc | ||
| 33 | .Sh DESCRIPTION | ||
| 34 | .Fn SSL_CTX_get_verify_mode | ||
| 35 | returns the verification mode currently set in | ||
| 36 | .Fa ctx . | ||
| 37 | .Pp | ||
| 38 | .Fn SSL_get_verify_mode | ||
| 39 | returns the verification mode currently set in | ||
| 40 | .Fa ssl . | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_CTX_get_verify_depth | ||
| 43 | returns the verification depth limit currently set | ||
| 44 | in | ||
| 45 | .Fa ctx . | ||
| 46 | If no limit has been explicitly set, | ||
| 47 | \(mi1 is returned and the default value will be used. | ||
| 48 | .Pp | ||
| 49 | .Fn SSL_get_verify_depth | ||
| 50 | returns the verification depth limit currently set in | ||
| 51 | .Fa ssl . | ||
| 52 | If no limit has been explicitly set, | ||
| 53 | \(mi1 is returned and the default value will be used. | ||
| 54 | .Pp | ||
| 55 | .Fn SSL_CTX_get_verify_callback | ||
| 56 | returns a function pointer to the verification callback currently set in | ||
| 57 | .Fa ctx . | ||
| 58 | If no callback was explicitly set, the | ||
| 59 | .Dv NULL | ||
| 60 | pointer is returned and the default callback will be used. | ||
| 61 | .Pp | ||
| 62 | .Fn SSL_get_verify_callback | ||
| 63 | returns a function pointer to the verification callback currently set in | ||
| 64 | .Fa ssl . | ||
| 65 | If no callback was explicitly set, the | ||
| 66 | .Dv NULL | ||
| 67 | pointer is returned and the default callback will be used. | ||
| 68 | .Sh RETURN VALUES | ||
| 69 | See | ||
| 70 | .Sx DESCRIPTION | ||
| 71 | .Sh SEE ALSO | ||
| 72 | .Xr ssl 3 , | ||
| 73 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 new file mode 100644 index 0000000000..0d023cb475 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_load_verify_locations.3 | |||
| @@ -0,0 +1,161 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_load_verify_locations.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_LOAD_VERIFY_LOCATIONS 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_load_verify_locations | ||
| 9 | .Nd set default locations for trusted CA certificates | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fo SSL_CTX_load_verify_locations | ||
| 14 | .Fa "SSL_CTX *ctx" "const char *CAfile" "const char *CApath" | ||
| 15 | .Fc | ||
| 16 | .Sh DESCRIPTION | ||
| 17 | .Fn SSL_CTX_load_verify_locations | ||
| 18 | specifies the locations for | ||
| 19 | .Fa ctx , | ||
| 20 | at which CA certificates for verification purposes are located. | ||
| 21 | The certificates available via | ||
| 22 | .Fa CAfile | ||
| 23 | and | ||
| 24 | .Fa CApath | ||
| 25 | are trusted. | ||
| 26 | .Sh NOTES | ||
| 27 | If | ||
| 28 | .Fa CAfile | ||
| 29 | is not | ||
| 30 | .Dv NULL , | ||
| 31 | it points to a file of CA certificates in PEM format. | ||
| 32 | The file can contain several CA certificates identified by sequences of: | ||
| 33 | .Bd -literal | ||
| 34 | -----BEGIN CERTIFICATE----- | ||
| 35 | ... (CA certificate in base64 encoding) ... | ||
| 36 | -----END CERTIFICATE----- | ||
| 37 | .Ed | ||
| 38 | Before, between, and after the certificates arbitrary text is allowed which can | ||
| 39 | be used, e.g., for descriptions of the certificates. | ||
| 40 | .Pp | ||
| 41 | The | ||
| 42 | .Fa CAfile | ||
| 43 | is processed on execution of the | ||
| 44 | .Fn SSL_CTX_load_verify_locations | ||
| 45 | function. | ||
| 46 | .Pp | ||
| 47 | If | ||
| 48 | .Fa CApath | ||
| 49 | is not NULL, it points to a directory containing CA certificates in PEM format. | ||
| 50 | The files each contain one CA certificate. | ||
| 51 | The files are looked up by the CA subject name hash value, | ||
| 52 | which must hence be available. | ||
| 53 | If more than one CA certificate with the same name hash value exist, | ||
| 54 | the extension must be different (e.g., | ||
| 55 | .Pa 9d66eef0.0 , | ||
| 56 | .Pa 9d66eef0.1 , | ||
| 57 | etc.). | ||
| 58 | The search is performed in the ordering of the extension number, | ||
| 59 | regardless of other properties of the certificates. | ||
| 60 | .Pp | ||
| 61 | The certificates in | ||
| 62 | .Fa CApath | ||
| 63 | are only looked up when required, e.g., when building the certificate chain or | ||
| 64 | when actually performing the verification of a peer certificate. | ||
| 65 | .Pp | ||
| 66 | When looking up CA certificates, the OpenSSL library will first search the | ||
| 67 | certificates in | ||
| 68 | .Fa CAfile , | ||
| 69 | then those in | ||
| 70 | .Fa CApath . | ||
| 71 | Certificate matching is done based on the subject name, the key identifier (if | ||
| 72 | present), and the serial number as taken from the certificate to be verified. | ||
| 73 | If these data do not match, the next certificate will be tried. | ||
| 74 | If a first certificate matching the parameters is found, | ||
| 75 | the verification process will be performed; | ||
| 76 | no other certificates for the same parameters will be searched in case of | ||
| 77 | failure. | ||
| 78 | .Pp | ||
| 79 | In server mode, when requesting a client certificate, the server must send | ||
| 80 | the list of CAs of which it will accept client certificates. | ||
| 81 | This list is not influenced by the contents of | ||
| 82 | .Fa CAfile | ||
| 83 | or | ||
| 84 | .Fa CApath | ||
| 85 | and must explicitly be set using the | ||
| 86 | .Xr SSL_CTX_set_client_CA_list 3 | ||
| 87 | family of functions. | ||
| 88 | .Pp | ||
| 89 | When building its own certificate chain, an OpenSSL client/server will try to | ||
| 90 | fill in missing certificates from | ||
| 91 | .Fa CAfile Ns / Fa CApath , | ||
| 92 | if the | ||
| 93 | certificate chain was not explicitly specified (see | ||
| 94 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
| 95 | and | ||
| 96 | .Xr SSL_CTX_use_certificate 3 ) . | ||
| 97 | .Sh WARNINGS | ||
| 98 | If several CA certificates matching the name, key identifier, and serial | ||
| 99 | number condition are available, only the first one will be examined. | ||
| 100 | This may lead to unexpected results if the same CA certificate is available | ||
| 101 | with different expiration dates. | ||
| 102 | If a | ||
| 103 | .Dq certificate expired | ||
| 104 | verification error occurs, no other certificate will be searched. | ||
| 105 | Make sure to not have expired certificates mixed with valid ones. | ||
| 106 | .Sh RETURN VALUES | ||
| 107 | The following return values can occur: | ||
| 108 | .Bl -tag -width Ds | ||
| 109 | .It 0 | ||
| 110 | The operation failed because | ||
| 111 | .Fa CAfile | ||
| 112 | and | ||
| 113 | .Fa CApath | ||
| 114 | are | ||
| 115 | .Dv NULL | ||
| 116 | or the processing at one of the locations specified failed. | ||
| 117 | Check the error stack to find out the reason. | ||
| 118 | .It 1 | ||
| 119 | The operation succeeded. | ||
| 120 | .El | ||
| 121 | .Sh EXAMPLES | ||
| 122 | Generate a CA certificate file with descriptive text from the CA certificates | ||
| 123 | .Pa ca1.pem | ||
| 124 | .Pa ca2.pem | ||
| 125 | .Pa ca3.pem : | ||
| 126 | .Bd -literal | ||
| 127 | #!/bin/sh | ||
| 128 | rm CAfile.pem | ||
| 129 | for i in ca1.pem ca2.pem ca3.pem; do | ||
| 130 | openssl x509 -in $i -text >> CAfile.pem | ||
| 131 | done | ||
| 132 | .Ed | ||
| 133 | .Pp | ||
| 134 | Prepare the directory /some/where/certs containing several CA certificates | ||
| 135 | for use as | ||
| 136 | .Fa CApath : | ||
| 137 | .Bd -literal | ||
| 138 | $ cd /some/where/certs | ||
| 139 | $ rm -f *.[0-9]* *.r[0-9]* | ||
| 140 | $ for c in *.pem; do | ||
| 141 | > [ "$c" = "*.pem" ] && continue | ||
| 142 | > hash=$(openssl x509 -noout -hash -in "$c") | ||
| 143 | > if egrep -q -- '-BEGIN( X509 | TRUSTED | )CERTIFICATE-' "$c"; then | ||
| 144 | > suf=0 | ||
| 145 | > while [ -e $hash.$suf ]; do suf=$(( $suf + 1 )); done | ||
| 146 | > ln -s "$c" $hash.$suf | ||
| 147 | > fi | ||
| 148 | > if egrep -q -- '-BEGIN X509 CRL-' "$c"; then | ||
| 149 | > suf=0 | ||
| 150 | > while [ -e $hash.r$suf ]; do suf=$(( $suf + 1 )); done | ||
| 151 | > ln -s "$c" $hash.r$suf | ||
| 152 | > fi | ||
| 153 | > done | ||
| 154 | .Ed | ||
| 155 | .Sh SEE ALSO | ||
| 156 | .Xr ssl 3 , | ||
| 157 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
| 158 | .Xr SSL_CTX_set_cert_store 3 , | ||
| 159 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
| 160 | .Xr SSL_CTX_use_certificate 3 , | ||
| 161 | .Xr SSL_get_client_CA_list 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_new.3 b/src/lib/libssl/man/SSL_CTX_new.3 new file mode 100644 index 0000000000..872d302b24 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_new.3 | |||
| @@ -0,0 +1,111 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_new.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_NEW 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_new , | ||
| 9 | .Nm SSLv3_method , | ||
| 10 | .Nm SSLv3_server_method , | ||
| 11 | .Nm SSLv3_client_method , | ||
| 12 | .Nm TLSv1_method , | ||
| 13 | .Nm TLSv1_server_method , | ||
| 14 | .Nm TLSv1_client_method , | ||
| 15 | .Nm TLSv1_1_method , | ||
| 16 | .Nm TLSv1_1_server_method , | ||
| 17 | .Nm TLSv1_1_client_method , | ||
| 18 | .Nm SSLv23_method , | ||
| 19 | .Nm SSLv23_server_method , | ||
| 20 | .Nm SSLv23_client_method | ||
| 21 | .Nd create a new SSL_CTX object as framework for TLS/SSL enabled functions | ||
| 22 | .Sh SYNOPSIS | ||
| 23 | .In openssl/ssl.h | ||
| 24 | .Ft SSL_CTX * | ||
| 25 | .Fn SSL_CTX_new "const SSL_METHOD *method" | ||
| 26 | .Sh DESCRIPTION | ||
| 27 | .Fn SSL_CTX_new | ||
| 28 | creates a new | ||
| 29 | .Vt SSL_CTX | ||
| 30 | object as framework to establish TLS/SSL enabled connections. | ||
| 31 | .Sh NOTES | ||
| 32 | The | ||
| 33 | .Vt SSL_CTX | ||
| 34 | object uses | ||
| 35 | .Fa method | ||
| 36 | as its connection method. | ||
| 37 | The methods exist in a generic type (for client and server use), | ||
| 38 | a server only type, and a client only type. | ||
| 39 | .Fa method | ||
| 40 | can be of the following types: | ||
| 41 | .Bl -tag -width Ds | ||
| 42 | .It Fn SSLv3_method void , Fn SSLv3_server_method void , \ | ||
| 43 | Fn SSLv3_client_method void | ||
| 44 | A TLS/SSL connection established with these methods will only understand the | ||
| 45 | SSLv3 protocol. | ||
| 46 | A client will send out SSLv3 client hello messages and will indicate that it | ||
| 47 | only understands SSLv3. | ||
| 48 | A server will only understand SSLv3 client hello messages. | ||
| 49 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
| 50 | which are widely used for compatibility reasons; see | ||
| 51 | .Fn SSLv23_*_method . | ||
| 52 | .It Fn TLSv1_method void , Fn TLSv1_server_method void , \ | ||
| 53 | Fn TLSv1_client_method void | ||
| 54 | A TLS/SSL connection established with these methods will only understand the | ||
| 55 | TLSv1 protocol. | ||
| 56 | A client will send out TLSv1 client hello messages and will indicate that it | ||
| 57 | only understands TLSv1. | ||
| 58 | A server will only understand TLSv1 client hello messages. | ||
| 59 | Importantly, this means that it will not understand SSLv2 client hello messages | ||
| 60 | which are widely used for compatibility reasons; see | ||
| 61 | .Fn SSLv23_*_method . | ||
| 62 | It will also not understand SSLv3 client hello messages. | ||
| 63 | .It Fn SSLv23_method void , Fn SSLv23_server_method void , \ | ||
| 64 | Fn SSLv23_client_method void | ||
| 65 | A TLS/SSL connection established with these methods may understand the SSLv3, | ||
| 66 | TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
| 67 | .Pp | ||
| 68 | A client will send out TLSv1 client hello messages including extensions and | ||
| 69 | will indicate that it also understands TLSv1.1, TLSv1.2 and permits a fallback | ||
| 70 | to SSLv3. | ||
| 71 | A server will support SSLv3, TLSv1, TLSv1.1 and TLSv1.2 protocols. | ||
| 72 | This is the best choice when compatibility is a concern. | ||
| 73 | .El | ||
| 74 | .Pp | ||
| 75 | The list of protocols available can later be limited using the | ||
| 76 | .Dv SSL_OP_NO_SSLv3 , | ||
| 77 | .Dv SSL_OP_NO_TLSv1 , | ||
| 78 | .Dv SSL_OP_NO_TLSv1_1 , | ||
| 79 | and | ||
| 80 | .Dv SSL_OP_NO_TLSv1_2 | ||
| 81 | options of the | ||
| 82 | .Fn SSL_CTX_set_options | ||
| 83 | or | ||
| 84 | .Fn SSL_set_options | ||
| 85 | functions. | ||
| 86 | Using these options it is possible to choose, for example, | ||
| 87 | .Fn SSLv23_server_method | ||
| 88 | and be able to negotiate with all possible clients, | ||
| 89 | but to only allow newer protocols like TLSv1, TLSv1.1 or TLS v1.2. | ||
| 90 | .Pp | ||
| 91 | .Fn SSL_CTX_new | ||
| 92 | initializes the list of ciphers, the session cache setting, the callbacks, | ||
| 93 | the keys and certificates, and the options to its default values. | ||
| 94 | .Sh RETURN VALUES | ||
| 95 | The following return values can occur: | ||
| 96 | .Bl -tag -width Ds | ||
| 97 | .It Dv NULL | ||
| 98 | The creation of a new | ||
| 99 | .Vt SSL_CTX | ||
| 100 | object failed. | ||
| 101 | Check the error stack to find out the reason. | ||
| 102 | .It Pointer to an SSL_CTX object | ||
| 103 | The return value points to an allocated | ||
| 104 | .Vt SSL_CTX | ||
| 105 | object. | ||
| 106 | .El | ||
| 107 | .Sh SEE ALSO | ||
| 108 | .Xr ssl 3 , | ||
| 109 | .Xr SSL_accept 3 , | ||
| 110 | .Xr SSL_CTX_free 3 , | ||
| 111 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_sess_number.3 b/src/lib/libssl/man/SSL_CTX_sess_number.3 new file mode 100644 index 0000000000..3171fe21ea --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_sess_number.3 | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_sess_number.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SESS_NUMBER 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_sess_number , | ||
| 9 | .Nm SSL_CTX_sess_connect , | ||
| 10 | .Nm SSL_CTX_sess_connect_good , | ||
| 11 | .Nm SSL_CTX_sess_connect_renegotiate , | ||
| 12 | .Nm SSL_CTX_sess_accept , | ||
| 13 | .Nm SSL_CTX_sess_accept_good , | ||
| 14 | .Nm SSL_CTX_sess_accept_renegotiate , | ||
| 15 | .Nm SSL_CTX_sess_hits , | ||
| 16 | .Nm SSL_CTX_sess_cb_hits , | ||
| 17 | .Nm SSL_CTX_sess_misses , | ||
| 18 | .Nm SSL_CTX_sess_timeouts , | ||
| 19 | .Nm SSL_CTX_sess_cache_full | ||
| 20 | .Nd obtain session cache statistics | ||
| 21 | .Sh SYNOPSIS | ||
| 22 | .In openssl/ssl.h | ||
| 23 | .Ft long | ||
| 24 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
| 25 | .Ft long | ||
| 26 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
| 27 | .Ft long | ||
| 28 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
| 29 | .Ft long | ||
| 30 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
| 31 | .Ft long | ||
| 32 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
| 33 | .Ft long | ||
| 34 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
| 35 | .Ft long | ||
| 36 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
| 37 | .Ft long | ||
| 38 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
| 39 | .Ft long | ||
| 40 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
| 41 | .Ft long | ||
| 42 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
| 43 | .Ft long | ||
| 44 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
| 45 | .Ft long | ||
| 46 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
| 47 | .Sh DESCRIPTION | ||
| 48 | .Fn SSL_CTX_sess_number | ||
| 49 | returns the current number of sessions in the internal session cache. | ||
| 50 | .Pp | ||
| 51 | .Fn SSL_CTX_sess_connect | ||
| 52 | returns the number of started SSL/TLS handshakes in client mode. | ||
| 53 | .Pp | ||
| 54 | .Fn SSL_CTX_sess_connect_good | ||
| 55 | returns the number of successfully established SSL/TLS sessions in client mode. | ||
| 56 | .Pp | ||
| 57 | .Fn SSL_CTX_sess_connect_renegotiate | ||
| 58 | returns the number of start renegotiations in client mode. | ||
| 59 | .Pp | ||
| 60 | .Fn SSL_CTX_sess_accept | ||
| 61 | returns the number of started SSL/TLS handshakes in server mode. | ||
| 62 | .Pp | ||
| 63 | .Fn SSL_CTX_sess_accept_good | ||
| 64 | returns the number of successfully established SSL/TLS sessions in server mode. | ||
| 65 | .Pp | ||
| 66 | .Fn SSL_CTX_sess_accept_renegotiate | ||
| 67 | returns the number of start renegotiations in server mode. | ||
| 68 | .Pp | ||
| 69 | .Fn SSL_CTX_sess_hits | ||
| 70 | returns the number of successfully reused sessions. | ||
| 71 | In client mode a session set with | ||
| 72 | .Xr SSL_set_session 3 | ||
| 73 | successfully reused is counted as a hit. | ||
| 74 | In server mode a session successfully retrieved from internal or external cache | ||
| 75 | is counted as a hit. | ||
| 76 | .Pp | ||
| 77 | .Fn SSL_CTX_sess_cb_hits | ||
| 78 | returns the number of successfully retrieved sessions from the external session | ||
| 79 | cache in server mode. | ||
| 80 | .Pp | ||
| 81 | .Fn SSL_CTX_sess_misses | ||
| 82 | returns the number of sessions proposed by clients that were not found in the | ||
| 83 | internal session cache in server mode. | ||
| 84 | .Pp | ||
| 85 | .Fn SSL_CTX_sess_timeouts | ||
| 86 | returns the number of sessions proposed by clients and either found in the | ||
| 87 | internal or external session cache in server mode, | ||
| 88 | but that were invalid due to timeout. | ||
| 89 | These sessions are not included in the | ||
| 90 | .Fn SSL_CTX_sess_hits | ||
| 91 | count. | ||
| 92 | .Pp | ||
| 93 | .Fn SSL_CTX_sess_cache_full | ||
| 94 | returns the number of sessions that were removed because the maximum session | ||
| 95 | cache size was exceeded. | ||
| 96 | .Sh RETURN VALUES | ||
| 97 | The functions return the values indicated in the | ||
| 98 | .Sx DESCRIPTION | ||
| 99 | section. | ||
| 100 | .Sh SEE ALSO | ||
| 101 | .Xr ssl 3 , | ||
| 102 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
| 103 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 104 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 new file mode 100644 index 0000000000..1cc6516d20 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_sess_set_cache_size.3 | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_sess_set_cache_size.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SESS_SET_CACHE_SIZE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_sess_set_cache_size , | ||
| 9 | .Nm SSL_CTX_sess_get_cache_size | ||
| 10 | .Nd manipulate session cache size | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft long | ||
| 14 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_sess_set_cache_size | ||
| 19 | sets the size of the internal session cache of context | ||
| 20 | .Fa ctx | ||
| 21 | to | ||
| 22 | .Fa t . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_CTX_sess_get_cache_size | ||
| 25 | returns the currently valid session cache size. | ||
| 26 | .Sh NOTES | ||
| 27 | The internal session cache size is | ||
| 28 | .Dv SSL_SESSION_CACHE_MAX_SIZE_DEFAULT , | ||
| 29 | currently 1024\(mu20, so that up to 20000 sessions can be held. | ||
| 30 | This size can be modified using the | ||
| 31 | .Fn SSL_CTX_sess_set_cache_size | ||
| 32 | call. | ||
| 33 | A special case is the size 0, which is used for unlimited size. | ||
| 34 | .Pp | ||
| 35 | When the maximum number of sessions is reached, | ||
| 36 | no more new sessions are added to the cache. | ||
| 37 | New space may be added by calling | ||
| 38 | .Xr SSL_CTX_flush_sessions 3 | ||
| 39 | to remove expired sessions. | ||
| 40 | .Pp | ||
| 41 | If the size of the session cache is reduced and more sessions are already in | ||
| 42 | the session cache, | ||
| 43 | old session will be removed the next time a session shall be added. | ||
| 44 | This removal is not synchronized with the expiration of sessions. | ||
| 45 | .Sh RETURN VALUES | ||
| 46 | .Fn SSL_CTX_sess_set_cache_size | ||
| 47 | returns the previously valid size. | ||
| 48 | .Pp | ||
| 49 | .Fn SSL_CTX_sess_get_cache_size | ||
| 50 | returns the currently valid size. | ||
| 51 | .Sh SEE ALSO | ||
| 52 | .Xr ssl 3 , | ||
| 53 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 54 | .Xr SSL_CTX_sess_number 3 , | ||
| 55 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 new file mode 100644 index 0000000000..44ed2cb82a --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_sess_set_get_cb.3 | |||
| @@ -0,0 +1,159 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_sess_set_get_cb.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SESS_SET_GET_CB 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_sess_set_new_cb , | ||
| 9 | .Nm SSL_CTX_sess_set_remove_cb , | ||
| 10 | .Nm SSL_CTX_sess_set_get_cb , | ||
| 11 | .Nm SSL_CTX_sess_get_new_cb , | ||
| 12 | .Nm SSL_CTX_sess_get_remove_cb , | ||
| 13 | .Nm SSL_CTX_sess_get_get_cb | ||
| 14 | .Nd provide callback functions for server side external session caching | ||
| 15 | .Sh SYNOPSIS | ||
| 16 | .In openssl/ssl.h | ||
| 17 | .Ft void | ||
| 18 | .Fo SSL_CTX_sess_set_new_cb | ||
| 19 | .Fa "SSL_CTX *ctx" | ||
| 20 | .Fa "int (*new_session_cb)(SSL *, SSL_SESSION *)" | ||
| 21 | .Fc | ||
| 22 | .Ft void | ||
| 23 | .Fo SSL_CTX_sess_set_remove_cb | ||
| 24 | .Fa "SSL_CTX *ctx" | ||
| 25 | .Fa "void (*remove_session_cb)(SSL_CTX *ctx, SSL_SESSION *)" | ||
| 26 | .Fc | ||
| 27 | .Ft void | ||
| 28 | .Fo SSL_CTX_sess_set_get_cb | ||
| 29 | .Fa "SSL_CTX *ctx" | ||
| 30 | .Fa "SSL_SESSION (*get_session_cb)(SSL *, unsigned char *, int, int *)" | ||
| 31 | .Fc | ||
| 32 | .Ft int | ||
| 33 | .Fo "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" | ||
| 34 | .Fa "struct ssl_st *ssl" | ||
| 35 | .Fa "SSL_SESSION *sess" | ||
| 36 | .Fc | ||
| 37 | .Ft void | ||
| 38 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
| 39 | .Fa "struct ssl_ctx_st *ctx" | ||
| 40 | .Fa "SSL_SESSION *sess" | ||
| 41 | .Fc | ||
| 42 | .Ft SSL_SESSION * | ||
| 43 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
| 44 | .Fa "struct ssl_st *ssl" | ||
| 45 | .Fa "unsigned char *data" | ||
| 46 | .Fa "int len" | ||
| 47 | .Fa "int *copy" | ||
| 48 | .Fc | ||
| 49 | .Ft int | ||
| 50 | .Fo "(*new_session_cb)" | ||
| 51 | .Fa "struct ssl_st *ssl" | ||
| 52 | .Fa "SSL_SESSION *sess" | ||
| 53 | .Fc | ||
| 54 | .Ft void | ||
| 55 | .Fo "(*remove_session_cb)" | ||
| 56 | .Fa "struct ssl_ctx_st *ctx" | ||
| 57 | .Fa "SSL_SESSION *sess" | ||
| 58 | .Fc | ||
| 59 | .Ft SSL_SESSION * | ||
| 60 | .Fo "(*get_session_cb)" | ||
| 61 | .Fa "struct ssl_st *ssl" | ||
| 62 | .Fa "unsigned char *data" | ||
| 63 | .Fa "int len" | ||
| 64 | .Fa "int *copy" | ||
| 65 | .Fc | ||
| 66 | .Sh DESCRIPTION | ||
| 67 | .Fn SSL_CTX_sess_set_new_cb | ||
| 68 | sets the callback function which is automatically called whenever a new session | ||
| 69 | was negotiated. | ||
| 70 | .Pp | ||
| 71 | .Fn SSL_CTX_sess_set_remove_cb | ||
| 72 | sets the callback function which is automatically called whenever a session is | ||
| 73 | removed by the SSL engine (because it is considered faulty or the session has | ||
| 74 | become obsolete because of exceeding the timeout value). | ||
| 75 | .Pp | ||
| 76 | .Fn SSL_CTX_sess_set_get_cb | ||
| 77 | sets the callback function which is called whenever a SSL/TLS client proposes | ||
| 78 | to resume a session but the session cannot be found in the internal session | ||
| 79 | cache (see | ||
| 80 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
| 81 | (SSL/TLS server only.) | ||
| 82 | .Pp | ||
| 83 | .Fn SSL_CTX_sess_get_new_cb , | ||
| 84 | .Fn SSL_CTX_sess_get_remove_cb , | ||
| 85 | and | ||
| 86 | .Fn SSL_CTX_sess_get_get_cb | ||
| 87 | retrieve the function pointers of the provided callback functions. | ||
| 88 | If a callback function has not been set, the | ||
| 89 | .Dv NULL | ||
| 90 | pointer is returned. | ||
| 91 | .Sh NOTES | ||
| 92 | In order to allow external session caching, synchronization with the internal | ||
| 93 | session cache is realized via callback functions. | ||
| 94 | Inside these callback functions, session can be saved to disk or put into a | ||
| 95 | database using the | ||
| 96 | .Xr d2i_SSL_SESSION 3 | ||
| 97 | interface. | ||
| 98 | .Pp | ||
| 99 | The | ||
| 100 | .Fn new_session_cb | ||
| 101 | function is called whenever a new session has been negotiated and session | ||
| 102 | caching is enabled (see | ||
| 103 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
| 104 | The | ||
| 105 | .Fn new_session_cb | ||
| 106 | is passed the | ||
| 107 | .Fa ssl | ||
| 108 | connection and the ssl session | ||
| 109 | .Fa sess . | ||
| 110 | If the callback returns 0, the session will be immediately removed again. | ||
| 111 | .Pp | ||
| 112 | The | ||
| 113 | .Fn remove_session_cb | ||
| 114 | is called whenever the SSL engine removes a session from the internal cache. | ||
| 115 | This happens when the session is removed because it is expired or when a | ||
| 116 | connection was not shut down cleanly. | ||
| 117 | It also happens for all sessions in the internal session cache when | ||
| 118 | .Xr SSL_CTX_free 3 | ||
| 119 | is called. | ||
| 120 | The | ||
| 121 | .Fn remove_session_cb | ||
| 122 | function is passed the | ||
| 123 | .Fa ctx | ||
| 124 | and the | ||
| 125 | .Vt ssl | ||
| 126 | session | ||
| 127 | .Fa sess . | ||
| 128 | It does not provide any feedback. | ||
| 129 | .Pp | ||
| 130 | The | ||
| 131 | .Fn get_session_cb | ||
| 132 | function is only called on SSL/TLS servers with the session id proposed by the | ||
| 133 | client. | ||
| 134 | The | ||
| 135 | .Fn get_session_cb | ||
| 136 | function is always called, also when session caching was disabled. | ||
| 137 | The | ||
| 138 | .Fn get_session_cb | ||
| 139 | is passed the | ||
| 140 | .Fa ssl | ||
| 141 | connection, the session id of length | ||
| 142 | .Fa length | ||
| 143 | at the memory location | ||
| 144 | .Fa data . | ||
| 145 | With the parameter | ||
| 146 | .Fa copy | ||
| 147 | the callback can require the SSL engine to increment the reference count of the | ||
| 148 | .Vt SSL_SESSION | ||
| 149 | object, | ||
| 150 | Normally the reference count is not incremented and therefore the session must | ||
| 151 | not be explicitly freed with | ||
| 152 | .Xr SSL_SESSION_free 3 . | ||
| 153 | .Sh SEE ALSO | ||
| 154 | .Xr d2i_SSL_SESSION 3 , | ||
| 155 | .Xr ssl 3 , | ||
| 156 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 157 | .Xr SSL_CTX_free 3 , | ||
| 158 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 159 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_sessions.3 b/src/lib/libssl/man/SSL_CTX_sessions.3 new file mode 100644 index 0000000000..72311699c8 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_sessions.3 | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_sessions.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SESSIONS 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_sessions | ||
| 9 | .Nd access internal session cache | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft struct lhash_st * | ||
| 13 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_CTX_sessions | ||
| 16 | returns a pointer to the lhash databases containing the internal session cache | ||
| 17 | for | ||
| 18 | .Fa ctx . | ||
| 19 | .Sh NOTES | ||
| 20 | The sessions in the internal session cache are kept in an | ||
| 21 | lhash-type database | ||
| 22 | (see | ||
| 23 | .Xr lh_new 3 ) . | ||
| 24 | It is possible to directly access this database, e.g., for searching. | ||
| 25 | In parallel, | ||
| 26 | the sessions form a linked list which is maintained separately from the | ||
| 27 | lhash operations, | ||
| 28 | so that the database must not be modified directly but by using the | ||
| 29 | .Xr SSL_CTX_add_session 3 | ||
| 30 | family of functions. | ||
| 31 | .Sh SEE ALSO | ||
| 32 | .Xr lh_new 3 , | ||
| 33 | .Xr ssl 3 , | ||
| 34 | .Xr SSL_CTX_add_session 3 , | ||
| 35 | .Xr SSL_CTX_set_session_cache_mode 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_store.3 b/src/lib/libssl/man/SSL_CTX_set_cert_store.3 new file mode 100644 index 0000000000..fcd531136a --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_cert_store.3 | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_cert_store.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_CERT_STORE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_cert_store , | ||
| 9 | .Nm SSL_CTX_get_cert_store | ||
| 10 | .Nd manipulate X509 certificate verification storage | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *store" | ||
| 15 | .Ft X509_STORE * | ||
| 16 | .Fn SSL_CTX_get_cert_store "const SSL_CTX *ctx" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_set_cert_store | ||
| 19 | setsthe verification storage of | ||
| 20 | .Fa ctx | ||
| 21 | to or replaces it with | ||
| 22 | .Fa store . | ||
| 23 | If another | ||
| 24 | .Vt X509_STORE | ||
| 25 | object is currently set in | ||
| 26 | .Fa ctx , | ||
| 27 | it will be | ||
| 28 | .Xr X509_STORE_free 3 Ns ed. | ||
| 29 | .Pp | ||
| 30 | .Fn SSL_CTX_get_cert_store | ||
| 31 | returns a pointer to the current certificate verification storage. | ||
| 32 | .Sh NOTES | ||
| 33 | In order to verify the certificates presented by the peer, trusted CA | ||
| 34 | certificates must be accessed. | ||
| 35 | These CA certificates are made available via lookup methods, handled inside the | ||
| 36 | .Vt X509_STORE . | ||
| 37 | From the | ||
| 38 | .Vt X509_STORE | ||
| 39 | the | ||
| 40 | .Vt X509_STORE_CTX | ||
| 41 | used when verifying certificates is created. | ||
| 42 | .Pp | ||
| 43 | Typically the trusted certificate store is handled indirectly via using | ||
| 44 | .Xr SSL_CTX_load_verify_locations 3 . | ||
| 45 | Using the | ||
| 46 | .Fn SSL_CTX_set_cert_store | ||
| 47 | and | ||
| 48 | .Fn SSL_CTX_get_cert_store | ||
| 49 | functions it is possible to manipulate the | ||
| 50 | .Vt X509_STORE | ||
| 51 | object beyond the | ||
| 52 | .Xr SSL_CTX_load_verify_locations 3 | ||
| 53 | call. | ||
| 54 | .Pp | ||
| 55 | Currently no detailed documentation on how to use the | ||
| 56 | .Vt X509_STORE | ||
| 57 | object is available. | ||
| 58 | Not all members of the | ||
| 59 | .Vt X509_STORE | ||
| 60 | are used when the verification takes place. | ||
| 61 | So will, for example, the | ||
| 62 | .Fn verify_callback | ||
| 63 | be overridden with the | ||
| 64 | .Fn verify_callback | ||
| 65 | set via the | ||
| 66 | .Xr SSL_CTX_set_verify 3 | ||
| 67 | family of functions. | ||
| 68 | This document must therefore be updated when documentation about the | ||
| 69 | .Vt X509_STORE | ||
| 70 | object and its handling becomes available. | ||
| 71 | .Sh RETURN VALUES | ||
| 72 | .Fn SSL_CTX_set_cert_store | ||
| 73 | does not return diagnostic output. | ||
| 74 | .Pp | ||
| 75 | .Fn SSL_CTX_get_cert_store | ||
| 76 | returns the current setting. | ||
| 77 | .Sh SEE ALSO | ||
| 78 | .Xr ssl 3 , | ||
| 79 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 80 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 new file mode 100644 index 0000000000..1dc57001aa --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3 | |||
| @@ -0,0 +1,112 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_cert_verify_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_CERT_VERIFY_CALLBACK 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_cert_verify_callback | ||
| 9 | .Nd set peer certificate verification procedure | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fo SSL_CTX_set_cert_verify_callback | ||
| 14 | .Fa "SSL_CTX *ctx" | ||
| 15 | .Fa "int (*callback)(X509_STORE_CTX *, void *)" | ||
| 16 | .Fa "void *arg" | ||
| 17 | .Fc | ||
| 18 | .Sh DESCRIPTION | ||
| 19 | .Fn SSL_CTX_set_cert_verify_callback | ||
| 20 | sets the verification callback function for | ||
| 21 | .Fa ctx . | ||
| 22 | .Vt SSL | ||
| 23 | objects that are created from | ||
| 24 | .Fa ctx | ||
| 25 | inherit the setting valid at the time when | ||
| 26 | .Xr SSL_new 3 | ||
| 27 | is called. | ||
| 28 | .Sh NOTES | ||
| 29 | Whenever a certificate is verified during a SSL/TLS handshake, | ||
| 30 | a verification function is called. | ||
| 31 | If the application does not explicitly specify a verification callback | ||
| 32 | function, the built-in verification function is used. | ||
| 33 | If a verification callback | ||
| 34 | .Fa callback | ||
| 35 | is specified via | ||
| 36 | .Fn SSL_CTX_set_cert_verify_callback , | ||
| 37 | the supplied callback function is called instead. | ||
| 38 | By setting | ||
| 39 | .Fa callback | ||
| 40 | to | ||
| 41 | .Dv NULL , | ||
| 42 | the default behaviour is restored. | ||
| 43 | .Pp | ||
| 44 | When the verification must be performed, | ||
| 45 | .Fa callback | ||
| 46 | will be called with the arguments | ||
| 47 | .Fn callback "X509_STORE_CTX *x509_store_ctx" "void *arg" . | ||
| 48 | The argument | ||
| 49 | .Fa arg | ||
| 50 | is specified by the application when setting | ||
| 51 | .Fa callback . | ||
| 52 | .Pp | ||
| 53 | .Fa callback | ||
| 54 | should return 1 to indicate verification success and 0 to indicate verification | ||
| 55 | failure. | ||
| 56 | If | ||
| 57 | .Dv SSL_VERIFY_PEER | ||
| 58 | is set and | ||
| 59 | .Fa callback | ||
| 60 | returns 0, the handshake will fail. | ||
| 61 | As the verification procedure may allow the connection to continue in case of | ||
| 62 | failure (by always returning 1) the verification result must be set in any case | ||
| 63 | using the | ||
| 64 | .Fa error | ||
| 65 | member of | ||
| 66 | .Fa x509_store_ctx | ||
| 67 | so that the calling application will be informed about the detailed result of | ||
| 68 | the verification procedure! | ||
| 69 | .Pp | ||
| 70 | Within | ||
| 71 | .Fa x509_store_ctx , | ||
| 72 | .Fa callback | ||
| 73 | has access to the | ||
| 74 | .Fa verify_callback | ||
| 75 | function set using | ||
| 76 | .Xr SSL_CTX_set_verify 3 . | ||
| 77 | .Sh WARNINGS | ||
| 78 | Do not mix the verification callback described in this function with the | ||
| 79 | .Fa verify_callback | ||
| 80 | function called during the verification process. | ||
| 81 | The latter is set using the | ||
| 82 | .Xr SSL_CTX_set_verify 3 | ||
| 83 | family of functions. | ||
| 84 | .Pp | ||
| 85 | Providing a complete verification procedure including certificate purpose | ||
| 86 | settings, etc., is a complex task. | ||
| 87 | The built-in procedure is quite powerful and in most cases it should be | ||
| 88 | sufficient to modify its behaviour using the | ||
| 89 | .Fa verify_callback | ||
| 90 | function. | ||
| 91 | .Sh RETURN VALUES | ||
| 92 | .Fn SSL_CTX_set_cert_verify_callback | ||
| 93 | does not provide diagnostic information. | ||
| 94 | .Sh SEE ALSO | ||
| 95 | .Xr ssl 3 , | ||
| 96 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 97 | .Xr SSL_CTX_set_verify 3 , | ||
| 98 | .Xr SSL_get_verify_result 3 | ||
| 99 | .Sh HISTORY | ||
| 100 | Previous to OpenSSL 0.9.7, the | ||
| 101 | .Fa arg | ||
| 102 | argument to | ||
| 103 | .Fn SSL_CTX_set_cert_verify_callback | ||
| 104 | was ignored, and | ||
| 105 | .Fa callback | ||
| 106 | was called | ||
| 107 | simply as | ||
| 108 | .Ft int | ||
| 109 | .Fn (*callback) "X509_STORE_CTX *" . | ||
| 110 | To compile software written for previous versions of OpenSSL, | ||
| 111 | a dummy argument will have to be added to | ||
| 112 | .Fa callback . | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 new file mode 100644 index 0000000000..7fb094a3b1 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_cipher_list.3 | |||
| @@ -0,0 +1,82 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_cipher_list.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_CIPHER_LIST 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_cipher_list , | ||
| 9 | .Nm SSL_set_cipher_list | ||
| 10 | .Nd choose list of available SSL_CIPHERs | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft int | ||
| 14 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "const char *str" | ||
| 15 | .Ft int | ||
| 16 | .Fn SSL_set_cipher_list "SSL *ssl" "const char *str" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_set_cipher_list | ||
| 19 | sets the list of available ciphers for | ||
| 20 | .Fa ctx | ||
| 21 | using the control string | ||
| 22 | .Fa str . | ||
| 23 | The format of the string is described | ||
| 24 | in | ||
| 25 | .Xr openssl 1 . | ||
| 26 | The list of ciphers is inherited by all | ||
| 27 | .Fa ssl | ||
| 28 | objects created from | ||
| 29 | .Fa ctx . | ||
| 30 | .Pp | ||
| 31 | .Fn SSL_set_cipher_list | ||
| 32 | sets the list of ciphers only for | ||
| 33 | .Fa ssl . | ||
| 34 | .Sh NOTES | ||
| 35 | The control string | ||
| 36 | .Fa str | ||
| 37 | should be universally usable and not depend on details of the library | ||
| 38 | configuration (ciphers compiled in). | ||
| 39 | Thus no syntax checking takes place. | ||
| 40 | Items that are not recognized, because the corresponding ciphers are not | ||
| 41 | compiled in or because they are mistyped, are simply ignored. | ||
| 42 | Failure is only flagged if no ciphers could be collected at all. | ||
| 43 | .Pp | ||
| 44 | It should be noted that inclusion of a cipher to be used into the list is a | ||
| 45 | necessary condition. | ||
| 46 | On the client side, the inclusion into the list is also sufficient. | ||
| 47 | On the server side, additional restrictions apply. | ||
| 48 | All ciphers have additional requirements. | ||
| 49 | ADH ciphers don't need a certificate, but DH-parameters must have been set. | ||
| 50 | All other ciphers need a corresponding certificate and key. | ||
| 51 | .Pp | ||
| 52 | A RSA cipher can only be chosen when a RSA certificate is available. | ||
| 53 | RSA export ciphers with a keylength of 512 bits for the RSA key require a | ||
| 54 | temporary 512 bit RSA key, as typically the supplied key has a length of 1024 | ||
| 55 | bits (see | ||
| 56 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
| 57 | RSA ciphers using EDH need a certificate and key and additional DH-parameters | ||
| 58 | (see | ||
| 59 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
| 60 | .Pp | ||
| 61 | A DSA cipher can only be chosen when a DSA certificate is available. | ||
| 62 | DSA ciphers always use DH key exchange and therefore need DH-parameters (see | ||
| 63 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
| 64 | .Pp | ||
| 65 | When these conditions are not met for any cipher in the list (for example, a | ||
| 66 | client only supports export RSA ciphers with an asymmetric key length of 512 | ||
| 67 | bits and the server is not configured to use temporary RSA keys), the | ||
| 68 | .Dq no shared cipher | ||
| 69 | .Pq Dv SSL_R_NO_SHARED_CIPHER | ||
| 70 | error is generated and the handshake will fail. | ||
| 71 | .Sh RETURN VALUES | ||
| 72 | .Fn SSL_CTX_set_cipher_list | ||
| 73 | and | ||
| 74 | .Fn SSL_set_cipher_list | ||
| 75 | return 1 if any cipher could be selected and 0 on complete failure. | ||
| 76 | .Sh SEE ALSO | ||
| 77 | .Xr ciphers 1 , | ||
| 78 | .Xr ssl 3 , | ||
| 79 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
| 80 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
| 81 | .Xr SSL_CTX_use_certificate 3 , | ||
| 82 | .Xr SSL_get_ciphers 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 new file mode 100644 index 0000000000..bcc53fb0d6 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_client_CA_list.3 | |||
| @@ -0,0 +1,132 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_client_CA_list.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_CLIENT_CA_LIST 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_client_CA_list , | ||
| 9 | .Nm SSL_set_client_CA_list , | ||
| 10 | .Nm SSL_CTX_add_client_CA , | ||
| 11 | .Nm SSL_add_client_CA | ||
| 12 | .Nd set list of CAs sent to the client when requesting a client certificate | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK_OF(X509_NAME) *list" | ||
| 17 | .Ft void | ||
| 18 | .Fn SSL_set_client_CA_list "SSL *s" "STACK_OF(X509_NAME) *list" | ||
| 19 | .Ft int | ||
| 20 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *cacert" | ||
| 21 | .Ft int | ||
| 22 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *cacert" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_set_client_CA_list | ||
| 25 | sets the | ||
| 26 | .Fa list | ||
| 27 | of CAs sent to the client when requesting a client certificate for | ||
| 28 | .Fa ctx . | ||
| 29 | .Pp | ||
| 30 | .Fn SSL_set_client_CA_list | ||
| 31 | sets the | ||
| 32 | .Fa list | ||
| 33 | of CAs sent to the client when requesting a client certificate for the chosen | ||
| 34 | .Fa ssl , | ||
| 35 | overriding the setting valid for | ||
| 36 | .Fa ssl Ns 's | ||
| 37 | .Vt SSL_CTX | ||
| 38 | object. | ||
| 39 | .Pp | ||
| 40 | .Fn SSL_CTX_add_client_CA | ||
| 41 | adds the CA name extracted from | ||
| 42 | .Fa cacert | ||
| 43 | to the list of CAs sent to the client when requesting a client certificate for | ||
| 44 | .Fa ctx . | ||
| 45 | .Pp | ||
| 46 | .Fn SSL_add_client_CA | ||
| 47 | adds the CA name extracted from | ||
| 48 | .Fa cacert | ||
| 49 | to the list of CAs sent to the client when requesting a client certificate for | ||
| 50 | the chosen | ||
| 51 | .Fa ssl , | ||
| 52 | overriding the setting valid for | ||
| 53 | .Fa ssl Ns 's | ||
| 54 | .Va SSL_CTX | ||
| 55 | object. | ||
| 56 | .Sh NOTES | ||
| 57 | When a TLS/SSL server requests a client certificate (see | ||
| 58 | .Fn SSL_CTX_set_verify ) , | ||
| 59 | it sends a list of CAs for which it will accept certificates to the client. | ||
| 60 | .Pp | ||
| 61 | This list must explicitly be set using | ||
| 62 | .Fn SSL_CTX_set_client_CA_list | ||
| 63 | for | ||
| 64 | .Fa ctx | ||
| 65 | and | ||
| 66 | .Fn SSL_set_client_CA_list | ||
| 67 | for the specific | ||
| 68 | .Fa ssl . | ||
| 69 | The list specified overrides the previous setting. | ||
| 70 | The CAs listed do not become trusted | ||
| 71 | .Po | ||
| 72 | .Fa list | ||
| 73 | only contains the names, not the complete certificates | ||
| 74 | .Pc ; | ||
| 75 | use | ||
| 76 | .Xr SSL_CTX_load_verify_locations 3 | ||
| 77 | to additionally load them for verification. | ||
| 78 | .Pp | ||
| 79 | If the list of acceptable CAs is compiled in a file, the | ||
| 80 | .Xr SSL_load_client_CA_file 3 | ||
| 81 | function can be used to help importing the necessary data. | ||
| 82 | .Pp | ||
| 83 | .Fn SSL_CTX_add_client_CA | ||
| 84 | and | ||
| 85 | .Fn SSL_add_client_CA | ||
| 86 | can be used to add additional items the list of client CAs. | ||
| 87 | If no list was specified before using | ||
| 88 | .Fn SSL_CTX_set_client_CA_list | ||
| 89 | or | ||
| 90 | .Fn SSL_set_client_CA_list , | ||
| 91 | a new client CA list for | ||
| 92 | .Fa ctx | ||
| 93 | or | ||
| 94 | .Fa ssl | ||
| 95 | (as appropriate) is opened. | ||
| 96 | .Pp | ||
| 97 | These functions are only useful for TLS/SSL servers. | ||
| 98 | .Sh RETURN VALUES | ||
| 99 | .Fn SSL_CTX_set_client_CA_list | ||
| 100 | and | ||
| 101 | .Fn SSL_set_client_CA_list | ||
| 102 | do not return diagnostic information. | ||
| 103 | .Pp | ||
| 104 | .Fn SSL_CTX_add_client_CA | ||
| 105 | and | ||
| 106 | .Fn SSL_add_client_CA | ||
| 107 | have the following return values: | ||
| 108 | .Bl -tag -width Ds | ||
| 109 | .It 0 | ||
| 110 | A failure while manipulating the | ||
| 111 | .Dv STACK_OF Ns | ||
| 112 | .Pq Vt X509_NAME | ||
| 113 | object occurred or the | ||
| 114 | .Vt X509_NAME | ||
| 115 | could not be extracted from | ||
| 116 | .Fa cacert . | ||
| 117 | Check the error stack to find out the reason. | ||
| 118 | .It 1 | ||
| 119 | The operation succeeded. | ||
| 120 | .El | ||
| 121 | .Sh EXAMPLES | ||
| 122 | Scan all certificates in | ||
| 123 | .Fa CAfile | ||
| 124 | and list them as acceptable CAs: | ||
| 125 | .Bd -literal | ||
| 126 | SSL_CTX_set_client_CA_list(ctx, SSL_load_client_CA_file(CAfile)); | ||
| 127 | .Ed | ||
| 128 | .Sh SEE ALSO | ||
| 129 | .Xr ssl 3 , | ||
| 130 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 131 | .Xr SSL_get_client_CA_list 3 , | ||
| 132 | .Xr SSL_load_client_CA_file 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 new file mode 100644 index 0000000000..c4057ae4cc --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_client_cert_cb.3 | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_client_cert_cb.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_CLIENT_CERT_CB 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_client_cert_cb , | ||
| 9 | .Nm SSL_CTX_get_client_cert_cb | ||
| 10 | .Nd handle client certificate callback function | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fo SSL_CTX_set_client_cert_cb | ||
| 15 | .Fa "SSL_CTX *ctx" | ||
| 16 | .Fa "int (*client_cert_cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
| 17 | .Fc | ||
| 18 | .Ft int | ||
| 19 | .Fo "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
| 20 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
| 21 | .Fc | ||
| 22 | .Ft int | ||
| 23 | .Fn "(*client_cert_cb)" "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
| 24 | .Sh DESCRIPTION | ||
| 25 | .Fn SSL_CTX_set_client_cert_cb | ||
| 26 | sets the | ||
| 27 | .Fa client_cert_cb() | ||
| 28 | callback that is called when a client certificate is requested by a server and | ||
| 29 | no certificate was yet set for the SSL object. | ||
| 30 | .Pp | ||
| 31 | When | ||
| 32 | .Fa client_cert_cb | ||
| 33 | is | ||
| 34 | .Dv NULL , | ||
| 35 | no callback function is used. | ||
| 36 | .Pp | ||
| 37 | .Fn SSL_CTX_get_client_cert_cb | ||
| 38 | returns a pointer to the currently set callback function. | ||
| 39 | .Pp | ||
| 40 | .Fn client_cert_cb | ||
| 41 | is the application-defined callback. | ||
| 42 | If it wants to set a certificate, | ||
| 43 | a certificate/private key combination must be set using the | ||
| 44 | .Fa x509 | ||
| 45 | and | ||
| 46 | .Fa pkey | ||
| 47 | arguments and 1 must be returned. | ||
| 48 | The certificate will be installed into | ||
| 49 | .Fa ssl ; | ||
| 50 | see the | ||
| 51 | .Sx NOTES | ||
| 52 | and | ||
| 53 | .Sx BUGS | ||
| 54 | sections. | ||
| 55 | If no certificate should be set, | ||
| 56 | 0 has to be returned and no certificate will be sent. | ||
| 57 | A negative return value will suspend the handshake and the handshake function | ||
| 58 | will return immediately. | ||
| 59 | .Xr SSL_get_error 3 | ||
| 60 | will return | ||
| 61 | .Dv SSL_ERROR_WANT_X509_LOOKUP | ||
| 62 | to indicate that the handshake was suspended. | ||
| 63 | The next call to the handshake function will again lead to the call of | ||
| 64 | .Fa client_cert_cb() . | ||
| 65 | It is the job of the | ||
| 66 | .Fa client_cert_cb() | ||
| 67 | to store information | ||
| 68 | about the state of the last call, if required to continue. | ||
| 69 | .Sh NOTES | ||
| 70 | During a handshake (or renegotiation) | ||
| 71 | a server may request a certificate from the client. | ||
| 72 | A client certificate must only be sent when the server did send the request. | ||
| 73 | .Pp | ||
| 74 | When a certificate has been set using the | ||
| 75 | .Xr SSL_CTX_use_certificate 3 | ||
| 76 | family of functions, | ||
| 77 | it will be sent to the server. | ||
| 78 | The TLS standard requires that only a certificate is sent if it matches the | ||
| 79 | list of acceptable CAs sent by the server. | ||
| 80 | This constraint is violated by the default behavior of the OpenSSL library. | ||
| 81 | Using the callback function it is possible to implement a proper selection | ||
| 82 | routine or to allow a user interaction to choose the certificate to be sent. | ||
| 83 | .Pp | ||
| 84 | If a callback function is defined and no certificate was yet defined for the | ||
| 85 | .Vt SSL | ||
| 86 | object, the callback function will be called. | ||
| 87 | If the callback function returns a certificate, the OpenSSL library | ||
| 88 | will try to load the private key and certificate data into the | ||
| 89 | .Vt SSL | ||
| 90 | object using the | ||
| 91 | .Fn SSL_use_certificate | ||
| 92 | and | ||
| 93 | .Fn SSL_use_private_key | ||
| 94 | functions. | ||
| 95 | Thus it will permanently install the certificate and key for this SSL object. | ||
| 96 | It will not be reset by calling | ||
| 97 | .Xr SSL_clear 3 . | ||
| 98 | If the callback returns no certificate, the OpenSSL library will not send a | ||
| 99 | certificate. | ||
| 100 | .Sh SEE ALSO | ||
| 101 | .Xr ssl 3 , | ||
| 102 | .Xr SSL_clear 3 , | ||
| 103 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
| 104 | .Xr SSL_CTX_use_certificate 3 , | ||
| 105 | .Xr SSL_free 3 , | ||
| 106 | .Xr SSL_get_client_CA_list 3 | ||
| 107 | .Sh BUGS | ||
| 108 | The | ||
| 109 | .Fa client_cert_cb() | ||
| 110 | cannot return a complete certificate chain; | ||
| 111 | it can only return one client certificate. | ||
| 112 | If the chain only has a length of 2, | ||
| 113 | the root CA certificate may be omitted according to the TLS standard and | ||
| 114 | thus a standard conforming answer can be sent to the server. | ||
| 115 | For a longer chain, the client must send the complete chain | ||
| 116 | (with the option to leave out the root CA certificate). | ||
| 117 | This can be accomplished only by either adding the intermediate CA certificates | ||
| 118 | into the trusted certificate store for the | ||
| 119 | .Vt SSL_CTX | ||
| 120 | object (resulting in having to add CA certificates that otherwise maybe would | ||
| 121 | not be trusted), or by adding the chain certificates using the | ||
| 122 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
| 123 | function, which is only available for the | ||
| 124 | .Vt SSL_CTX | ||
| 125 | object as a whole and that therefore probably can only apply for one client | ||
| 126 | certificate, making the concept of the callback function | ||
| 127 | (to allow the choice from several certificates) questionable. | ||
| 128 | .Pp | ||
| 129 | Once the | ||
| 130 | .Vt SSL | ||
| 131 | object has been used in conjunction with the callback function, | ||
| 132 | the certificate will be set for the | ||
| 133 | .Vt SSL | ||
| 134 | object and will not be cleared even when | ||
| 135 | .Xr SSL_clear 3 | ||
| 136 | is called. | ||
| 137 | It is therefore | ||
| 138 | .Em mandatory | ||
| 139 | to destroy the | ||
| 140 | .Vt SSL | ||
| 141 | object using | ||
| 142 | .Xr SSL_free 3 | ||
| 143 | and create a new one to return to the previous state. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 new file mode 100644 index 0000000000..599c574c3d --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3 | |||
| @@ -0,0 +1,95 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_default_passwd_cb.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_DEFAULT_PASSWD_CB 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_default_passwd_cb , | ||
| 9 | .Nm SSL_CTX_set_default_passwd_cb_userdata | ||
| 10 | .Nd set passwd callback for encrypted PEM file handling | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_CTX_set_default_passwd_cb_userdata "SSL_CTX *ctx" "void *u" | ||
| 17 | .Ft int | ||
| 18 | .Fn pem_passwd_cb "char *buf" "int size" "int rwflag" "void *userdata" | ||
| 19 | .Sh DESCRIPTION | ||
| 20 | .Fn SSL_CTX_set_default_passwd_cb | ||
| 21 | sets the default password callback called when loading/storing a PEM | ||
| 22 | certificate with encryption. | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
| 25 | sets a pointer to userdata | ||
| 26 | .Fa u | ||
| 27 | which will be provided to the password callback on invocation. | ||
| 28 | .Pp | ||
| 29 | The | ||
| 30 | .Fn pem_passwd_cb , | ||
| 31 | which must be provided by the application, | ||
| 32 | hands back the password to be used during decryption. | ||
| 33 | On invocation a pointer to | ||
| 34 | .Fa userdata | ||
| 35 | is provided. | ||
| 36 | The pem_passwd_cb must write the password into the provided buffer | ||
| 37 | .Fa buf | ||
| 38 | which is of size | ||
| 39 | .Fa size . | ||
| 40 | The actual length of the password must be returned to the calling function. | ||
| 41 | .Fa rwflag | ||
| 42 | indicates whether the callback is used for reading/decryption | ||
| 43 | .Pq Fa rwflag No = 0 | ||
| 44 | or writing/encryption | ||
| 45 | .Pq Fa rwflag No = 1 . | ||
| 46 | .Sh NOTES | ||
| 47 | When loading or storing private keys, a password might be supplied to protect | ||
| 48 | the private key. | ||
| 49 | The way this password can be supplied may depend on the application. | ||
| 50 | If only one private key is handled, it can be practical to have | ||
| 51 | .Fn pem_passwd_cb | ||
| 52 | handle the password dialog interactively. | ||
| 53 | If several keys have to be handled, it can be practical to ask for the password | ||
| 54 | once, then keep it in memory and use it several times. | ||
| 55 | In the last case, the password could be stored into the | ||
| 56 | .Fa userdata | ||
| 57 | storage and the | ||
| 58 | .Fn pem_passwd_cb | ||
| 59 | only returns the password already stored. | ||
| 60 | .Pp | ||
| 61 | When asking for the password interactively, | ||
| 62 | .Fn pem_passwd_cb | ||
| 63 | can use | ||
| 64 | .Fa rwflag | ||
| 65 | to check whether an item shall be encrypted | ||
| 66 | .Pq Fa rwflag No = 1 . | ||
| 67 | In this case the password dialog may ask for the same password twice for | ||
| 68 | comparison in order to catch typos which would make decryption impossible. | ||
| 69 | .Pp | ||
| 70 | Other items in PEM formatting (certificates) can also be encrypted; it is | ||
| 71 | however atypical, as certificate information is considered public. | ||
| 72 | .Sh RETURN VALUES | ||
| 73 | .Fn SSL_CTX_set_default_passwd_cb | ||
| 74 | and | ||
| 75 | .Fn SSL_CTX_set_default_passwd_cb_userdata | ||
| 76 | do not provide diagnostic information. | ||
| 77 | .Sh EXAMPLES | ||
| 78 | The following example returns the password provided as | ||
| 79 | .Fa userdata | ||
| 80 | to the calling function. | ||
| 81 | The password is considered to be a | ||
| 82 | .Sq \e0 | ||
| 83 | terminated string. | ||
| 84 | If the password does not fit into the buffer, the password is truncated. | ||
| 85 | .Bd -literal | ||
| 86 | int pem_passwd_cb(char *buf, int size, int rwflag, void *password) | ||
| 87 | { | ||
| 88 | strncpy(buf, (char *)password, size); | ||
| 89 | buf[size - 1] = '\e0'; | ||
| 90 | return strlen(buf); | ||
| 91 | } | ||
| 92 | .Ed | ||
| 93 | .Sh SEE ALSO | ||
| 94 | .Xr ssl 3 , | ||
| 95 | .Xr SSL_CTX_use_certificate 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 new file mode 100644 index 0000000000..29ff6a123e --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_generate_session_id.3 | |||
| @@ -0,0 +1,196 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_generate_session_id.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_GENERATE_SESSION_ID 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_generate_session_id , | ||
| 9 | .Nm SSL_set_generate_session_id , | ||
| 10 | .Nm SSL_has_matching_session_id | ||
| 11 | .Nd manipulate generation of SSL session IDs (server only) | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Bd -literal | ||
| 15 | typedef int (*GEN_SESSION_CB)(const SSL *ssl, unsigned char *id, | ||
| 16 | unsigned int *id_len); | ||
| 17 | .Ed | ||
| 18 | .Ft int | ||
| 19 | .Fn SSL_CTX_set_generate_session_id "SSL_CTX *ctx" "GEN_SESSION_CB cb" | ||
| 20 | .Ft int | ||
| 21 | .Fn SSL_set_generate_session_id "SSL *ssl" "GEN_SESSION_CB" "cb);" | ||
| 22 | .Ft int | ||
| 23 | .Fo SSL_has_matching_session_id | ||
| 24 | .Fa "const SSL *ssl" "const unsigned char *id" "unsigned int id_len" | ||
| 25 | .Fc | ||
| 26 | .Sh DESCRIPTION | ||
| 27 | .Fn SSL_CTX_set_generate_session_id | ||
| 28 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
| 29 | for | ||
| 30 | .Fa ctx | ||
| 31 | to be | ||
| 32 | .Fa cb . | ||
| 33 | .Pp | ||
| 34 | .Fn SSL_set_generate_session_id | ||
| 35 | sets the callback function for generating new session ids for SSL/TLS sessions | ||
| 36 | for | ||
| 37 | .Fa ssl | ||
| 38 | to be | ||
| 39 | .Fa cb . | ||
| 40 | .Pp | ||
| 41 | .Fn SSL_has_matching_session_id | ||
| 42 | checks, whether a session with id | ||
| 43 | .Fa id | ||
| 44 | (of length | ||
| 45 | .Fa id_len ) | ||
| 46 | is already contained in the internal session cache | ||
| 47 | of the parent context of | ||
| 48 | .Fa ssl . | ||
| 49 | .Sh NOTES | ||
| 50 | When a new session is established between client and server, | ||
| 51 | the server generates a session id. | ||
| 52 | The session id is an arbitrary sequence of bytes. | ||
| 53 | The length of the session id is 16 bytes for SSLv2 sessions and between 1 and | ||
| 54 | 32 bytes for SSLv3/TLSv1. | ||
| 55 | The session id is not security critical but must be unique for the server. | ||
| 56 | Additionally, the session id is transmitted in the clear when reusing the | ||
| 57 | session so it must not contain sensitive information. | ||
| 58 | .Pp | ||
| 59 | Without a callback being set, an OpenSSL server will generate a unique session | ||
| 60 | id from pseudo random numbers of the maximum possible length. | ||
| 61 | Using the callback function, the session id can be changed to contain | ||
| 62 | additional information like, e.g., a host id in order to improve load balancing | ||
| 63 | or external caching techniques. | ||
| 64 | .Pp | ||
| 65 | The callback function receives a pointer to the memory location to put | ||
| 66 | .Fa id | ||
| 67 | into and a pointer to the maximum allowed length | ||
| 68 | .Fa id_len . | ||
| 69 | The buffer at location | ||
| 70 | .Fa id | ||
| 71 | is only guaranteed to have the size | ||
| 72 | .Fa id_len . | ||
| 73 | The callback is only allowed to generate a shorter id and reduce | ||
| 74 | .Fa id_len ; | ||
| 75 | the callback | ||
| 76 | .Em must never | ||
| 77 | increase | ||
| 78 | .Fa id_len | ||
| 79 | or write to the location | ||
| 80 | .Fa id | ||
| 81 | exceeding the given limit. | ||
| 82 | .Pp | ||
| 83 | If a SSLv2 session id is generated and | ||
| 84 | .Fa id_len | ||
| 85 | is reduced, it will be restored after the callback has finished and the session | ||
| 86 | id will be padded with 0x00. | ||
| 87 | It is not recommended to change the | ||
| 88 | .Fa id_len | ||
| 89 | for SSLv2 sessions. | ||
| 90 | The callback can use the | ||
| 91 | .Xr SSL_get_version 3 | ||
| 92 | function to check whether the session is of type SSLv2. | ||
| 93 | .Pp | ||
| 94 | The location | ||
| 95 | .Fa id | ||
| 96 | is filled with 0x00 before the callback is called, | ||
| 97 | so the callback may only fill part of the possible length and leave | ||
| 98 | .Fa id_len | ||
| 99 | untouched while maintaining reproducibility. | ||
| 100 | .Pp | ||
| 101 | Since the sessions must be distinguished, session ids must be unique. | ||
| 102 | Without the callback a random number is used, | ||
| 103 | so that the probability of generating the same session id is extremely small | ||
| 104 | (2^128 possible ids for an SSLv2 session, 2^256 for SSLv3/TLSv1). | ||
| 105 | In order to ensure the uniqueness of the generated session id, | ||
| 106 | the callback must call | ||
| 107 | .Fn SSL_has_matching_session_id | ||
| 108 | and generate another id if a conflict occurs. | ||
| 109 | If an id conflict is not resolved, the handshake will fail. | ||
| 110 | If the application codes, e.g., a unique host id, a unique process number, and | ||
| 111 | a unique sequence number into the session id, uniqueness could easily be | ||
| 112 | achieved without randomness added (it should however be taken care that | ||
| 113 | no confidential information is leaked this way). | ||
| 114 | If the application cannot guarantee uniqueness, | ||
| 115 | it is recommended to use the maximum | ||
| 116 | .Fa id_len | ||
| 117 | and fill in the bytes not used to code special information with random data to | ||
| 118 | avoid collisions. | ||
| 119 | .Pp | ||
| 120 | .Fn SSL_has_matching_session_id | ||
| 121 | will only query the internal session cache, not the external one. | ||
| 122 | Since the session id is generated before the handshake is completed, | ||
| 123 | it is not immediately added to the cache. | ||
| 124 | If another thread is using the same internal session cache, | ||
| 125 | a race condition can occur in that another thread generates the same session id. | ||
| 126 | Collisions can also occur when using an external session cache, | ||
| 127 | since the external cache is not tested with | ||
| 128 | .Fn SSL_has_matching_session_id | ||
| 129 | and the same race condition applies. | ||
| 130 | .Pp | ||
| 131 | When calling | ||
| 132 | .Fn SSL_has_matching_session_id | ||
| 133 | for an SSLv2 session with reduced | ||
| 134 | .Fa id_len Ns , | ||
| 135 | the match operation will be performed using the fixed length required and with | ||
| 136 | a 0x00 padded id. | ||
| 137 | .Pp | ||
| 138 | The callback must return 0 if it cannot generate a session id for whatever | ||
| 139 | reason and return 1 on success. | ||
| 140 | .Sh RETURN VALUES | ||
| 141 | .Fn SSL_CTX_set_generate_session_id | ||
| 142 | and | ||
| 143 | .Fn SSL_set_generate_session_id | ||
| 144 | always return 1. | ||
| 145 | .Pp | ||
| 146 | .Fn SSL_has_matching_session_id | ||
| 147 | returns 1 if another session with the same id is already in the cache. | ||
| 148 | .Sh EXAMPLES | ||
| 149 | The callback function listed will generate a session id with the server id | ||
| 150 | given, and will fill the rest with pseudo random bytes: | ||
| 151 | .Bd -literal | ||
| 152 | const char session_id_prefix = "www-18"; | ||
| 153 | |||
| 154 | #define MAX_SESSION_ID_ATTEMPTS 10 | ||
| 155 | static int | ||
| 156 | generate_session_id(const SSL *ssl, unsigned char *id, | ||
| 157 | unsigned int *id_len) | ||
| 158 | { | ||
| 159 | unsigned int count = 0; | ||
| 160 | const char *version; | ||
| 161 | |||
| 162 | version = SSL_get_version(ssl); | ||
| 163 | if (!strcmp(version, "SSLv2")) { | ||
| 164 | /* we must not change id_len */ | ||
| 165 | ; | ||
| 166 | } | ||
| 167 | |||
| 168 | do { | ||
| 169 | RAND_pseudo_bytes(id, *id_len); | ||
| 170 | /* | ||
| 171 | * Prefix the session_id with the required prefix. NB: If | ||
| 172 | * our prefix is too long, clip it \(en but there will be | ||
| 173 | * worse effects anyway, e.g., the server could only | ||
| 174 | * possibly create one session ID (the prefix!) so all | ||
| 175 | * future session negotiations will fail due to conflicts. | ||
| 176 | */ | ||
| 177 | memcpy(id, session_id_prefix, | ||
| 178 | (strlen(session_id_prefix) < *id_len) ? | ||
| 179 | strlen(session_id_prefix) : *id_len); | ||
| 180 | } while (SSL_has_matching_session_id(ssl, id, *id_len) && | ||
| 181 | (++count < MAX_SESSION_ID_ATTEMPTS)); | ||
| 182 | |||
| 183 | if (count >= MAX_SESSION_ID_ATTEMPTS) | ||
| 184 | return 0; | ||
| 185 | return 1; | ||
| 186 | } | ||
| 187 | .Ed | ||
| 188 | .Sh SEE ALSO | ||
| 189 | .Xr ssl 3 , | ||
| 190 | .Xr SSL_get_version 3 | ||
| 191 | .Sh HISTORY | ||
| 192 | .Fn SSL_CTX_set_generate_session_id , | ||
| 193 | .Fn SSL_set_generate_session_id | ||
| 194 | and | ||
| 195 | .Fn SSL_has_matching_session_id | ||
| 196 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_info_callback.3 b/src/lib/libssl/man/SSL_CTX_set_info_callback.3 new file mode 100644 index 0000000000..760c239951 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_info_callback.3 | |||
| @@ -0,0 +1,167 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_info_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_INFO_CALLBACK 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_info_callback , | ||
| 9 | .Nm SSL_CTX_get_info_callback , | ||
| 10 | .Nm SSL_set_info_callback , | ||
| 11 | .Nm SSL_get_info_callback | ||
| 12 | .Nd handle information callback for SSL connections | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_CTX_set_info_callback "SSL_CTX *ctx" "void (*callback)()" | ||
| 17 | .Ft void | ||
| 18 | .Fn "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
| 19 | .Ft void | ||
| 20 | .Fn SSL_set_info_callback "SSL *ssl" "void (*callback)()" | ||
| 21 | .Ft void | ||
| 22 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_set_info_callback | ||
| 25 | sets the | ||
| 26 | .Fa callback | ||
| 27 | function that can be used to obtain state information for SSL objects created | ||
| 28 | from | ||
| 29 | .Fa ctx | ||
| 30 | during connection setup and use. | ||
| 31 | The setting for | ||
| 32 | .Fa ctx | ||
| 33 | is overridden from the setting for a specific SSL object, if specified. | ||
| 34 | When | ||
| 35 | .Fa callback | ||
| 36 | is | ||
| 37 | .Dv NULL , | ||
| 38 | no callback function is used. | ||
| 39 | .Pp | ||
| 40 | .Fn SSL_set_info_callback | ||
| 41 | sets the | ||
| 42 | .Fa callback | ||
| 43 | function that can be used to | ||
| 44 | obtain state information for | ||
| 45 | .Fa ssl | ||
| 46 | during connection setup and use. | ||
| 47 | When | ||
| 48 | .Fa callback | ||
| 49 | is | ||
| 50 | .Dv NULL , | ||
| 51 | the callback setting currently valid for | ||
| 52 | .Fa ctx | ||
| 53 | is used. | ||
| 54 | .Pp | ||
| 55 | .Fn SSL_CTX_get_info_callback | ||
| 56 | returns a pointer to the currently set information callback function for | ||
| 57 | .Fa ctx . | ||
| 58 | .Pp | ||
| 59 | .Fn SSL_get_info_callback | ||
| 60 | returns a pointer to the currently set information callback function for | ||
| 61 | .Fa ssl . | ||
| 62 | .Sh NOTES | ||
| 63 | When setting up a connection and during use, | ||
| 64 | it is possible to obtain state information from the SSL/TLS engine. | ||
| 65 | When set, an information callback function is called whenever the state changes, | ||
| 66 | an alert appears, or an error occurs. | ||
| 67 | .Pp | ||
| 68 | The callback function is called as | ||
| 69 | .Fn callback "SSL *ssl" "int where" "int ret" . | ||
| 70 | The | ||
| 71 | .Fa where | ||
| 72 | argument specifies information about where (in which context) | ||
| 73 | the callback function was called. | ||
| 74 | If | ||
| 75 | .Fa ret | ||
| 76 | is 0, an error condition occurred. | ||
| 77 | If an alert is handled, | ||
| 78 | .Dv SSL_CB_ALERT | ||
| 79 | is set and | ||
| 80 | .Fa ret | ||
| 81 | specifies the alert information. | ||
| 82 | .Pp | ||
| 83 | .Fa where | ||
| 84 | is a bitmask made up of the following bits: | ||
| 85 | .Bl -tag -width Ds | ||
| 86 | .It Dv SSL_CB_LOOP | ||
| 87 | Callback has been called to indicate state change inside a loop. | ||
| 88 | .It Dv SSL_CB_EXIT | ||
| 89 | Callback has been called to indicate error exit of a handshake function. | ||
| 90 | (May be soft error with retry option for non-blocking setups.) | ||
| 91 | .It Dv SSL_CB_READ | ||
| 92 | Callback has been called during read operation. | ||
| 93 | .It Dv SSL_CB_WRITE | ||
| 94 | Callback has been called during write operation. | ||
| 95 | .It Dv SSL_CB_ALERT | ||
| 96 | Callback has been called due to an alert being sent or received. | ||
| 97 | .It Dv SSL_CB_READ_ALERT | ||
| 98 | .It Dv SSL_CB_WRITE_ALERT | ||
| 99 | .It Dv SSL_CB_ACCEPT_LOOP | ||
| 100 | .It Dv SSL_CB_ACCEPT_EXIT | ||
| 101 | .It Dv SSL_CB_CONNECT_LOOP | ||
| 102 | .It Dv SSL_CB_CONNECT_EXIT | ||
| 103 | .It Dv SSL_CB_HANDSHAKE_START | ||
| 104 | Callback has been called because a new handshake is started. | ||
| 105 | .It Dv SSL_CB_HANDSHAKE_DONE | ||
| 106 | Callback has been called because a handshake is finished. | ||
| 107 | .El | ||
| 108 | .Pp | ||
| 109 | The current state information can be obtained using the | ||
| 110 | .Xr SSL_state_string 3 | ||
| 111 | family of functions. | ||
| 112 | .Pp | ||
| 113 | The | ||
| 114 | .Fa ret | ||
| 115 | information can be evaluated using the | ||
| 116 | .Xr SSL_alert_type_string 3 | ||
| 117 | family of functions. | ||
| 118 | .Sh RETURN VALUES | ||
| 119 | .Fn SSL_set_info_callback | ||
| 120 | does not provide diagnostic information. | ||
| 121 | .Pp | ||
| 122 | .Fn SSL_get_info_callback | ||
| 123 | returns the current setting. | ||
| 124 | .Sh EXAMPLES | ||
| 125 | The following example callback function prints state strings, | ||
| 126 | information about alerts being handled and error messages to the | ||
| 127 | .Va bio_err | ||
| 128 | .Vt BIO . | ||
| 129 | .Bd -literal | ||
| 130 | void | ||
| 131 | apps_ssl_info_callback(SSL *s, int where, int ret) | ||
| 132 | { | ||
| 133 | const char *str; | ||
| 134 | int w; | ||
| 135 | |||
| 136 | w = where & ~SSL_ST_MASK; | ||
| 137 | |||
| 138 | if (w & SSL_ST_CONNECT) | ||
| 139 | str = "SSL_connect"; | ||
| 140 | else if (w & SSL_ST_ACCEPT) | ||
| 141 | str = "SSL_accept"; | ||
| 142 | else | ||
| 143 | str = "undefined"; | ||
| 144 | |||
| 145 | if (where & SSL_CB_LOOP) { | ||
| 146 | BIO_printf(bio_err, "%s:%s\en", str, | ||
| 147 | SSL_state_string_long(s)); | ||
| 148 | } else if (where & SSL_CB_ALERT) { | ||
| 149 | str = (where & SSL_CB_READ) ? "read" : "write"; | ||
| 150 | BIO_printf(bio_err, "SSL3 alert %s:%s:%s\en", str, | ||
| 151 | SSL_alert_type_string_long(ret), | ||
| 152 | SSL_alert_desc_string_long(ret)); | ||
| 153 | } else if (where & SSL_CB_EXIT) { | ||
| 154 | if (ret == 0) | ||
| 155 | BIO_printf(bio_err, "%s:failed in %s\en", | ||
| 156 | str, SSL_state_string_long(s)); | ||
| 157 | else if (ret < 0) { | ||
| 158 | BIO_printf(bio_err, "%s:error in %s\en", | ||
| 159 | str, SSL_state_string_long(s)); | ||
| 160 | } | ||
| 161 | } | ||
| 162 | } | ||
| 163 | .Ed | ||
| 164 | .Sh SEE ALSO | ||
| 165 | .Xr ssl 3 , | ||
| 166 | .Xr SSL_alert_type_string 3 , | ||
| 167 | .Xr SSL_state_string 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 new file mode 100644 index 0000000000..c9cd6e6d2b --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_max_cert_list.3 | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_max_cert_list.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_MAX_CERT_LIST 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_max_cert_list , | ||
| 9 | .Nm SSL_CTX_get_max_cert_list , | ||
| 10 | .Nm SSL_set_max_cert_list , | ||
| 11 | .Nm SSL_get_max_cert_list | ||
| 12 | .Nd manipulate allowed size for the peer's certificate chain | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_set_max_cert_list "SSL_CTX *ctx" "long size" | ||
| 17 | .Ft long | ||
| 18 | .Fn SSL_CTX_get_max_cert_list "SSL_CTX *ctx" | ||
| 19 | .Ft long | ||
| 20 | .Fn SSL_set_max_cert_list "SSL *ssl" "long size" | ||
| 21 | .Ft long | ||
| 22 | .Fn SSL_get_max_cert_list "SSL *ctx" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_set_max_cert_list | ||
| 25 | sets the maximum size allowed for the peer's certificate chain for all | ||
| 26 | .Vt SSL | ||
| 27 | objects created from | ||
| 28 | .Fa ctx | ||
| 29 | to be | ||
| 30 | .Fa size | ||
| 31 | bytes. | ||
| 32 | The | ||
| 33 | .Vt SSL | ||
| 34 | objects inherit the setting valid for | ||
| 35 | .Fa ctx | ||
| 36 | at the time | ||
| 37 | .Xr SSL_new 3 | ||
| 38 | is being called. | ||
| 39 | .Pp | ||
| 40 | .Fn SSL_CTX_get_max_cert_list | ||
| 41 | returns the currently set maximum size for | ||
| 42 | .Fa ctx . | ||
| 43 | .Pp | ||
| 44 | .Fn SSL_set_max_cert_list | ||
| 45 | sets the maximum size allowed for the peer's certificate chain for | ||
| 46 | .Fa ssl | ||
| 47 | to be | ||
| 48 | .Fa size | ||
| 49 | bytes. | ||
| 50 | This setting stays valid until a new value is set. | ||
| 51 | .Pp | ||
| 52 | .Fn SSL_get_max_cert_list | ||
| 53 | returns the currently set maximum size for | ||
| 54 | .Fa ssl . | ||
| 55 | .Sh NOTES | ||
| 56 | During the handshake process, the peer may send a certificate chain. | ||
| 57 | The TLS/SSL standard does not give any maximum size of the certificate chain. | ||
| 58 | The OpenSSL library handles incoming data by a dynamically allocated buffer. | ||
| 59 | In order to prevent this buffer from growing without bound due to data | ||
| 60 | received from a faulty or malicious peer, a maximum size for the certificate | ||
| 61 | chain is set. | ||
| 62 | .Pp | ||
| 63 | The default value for the maximum certificate chain size is 100kB (30kB | ||
| 64 | on the 16bit DOS platform). | ||
| 65 | This should be sufficient for usual certificate chains | ||
| 66 | (OpenSSL's default maximum chain length is 10, see | ||
| 67 | .Xr SSL_CTX_set_verify 3 , | ||
| 68 | and certificates without special extensions have a typical size of 1-2kB). | ||
| 69 | .Pp | ||
| 70 | For special applications it can be necessary to extend the maximum certificate | ||
| 71 | chain size allowed to be sent by the peer. | ||
| 72 | See for example the work on | ||
| 73 | .%T "Internet X.509 Public Key Infrastructure Proxy Certificate Profile" | ||
| 74 | and | ||
| 75 | .%T "TLS Delegation Protocol" | ||
| 76 | at | ||
| 77 | .Lk https://www.ietf.org/ | ||
| 78 | and | ||
| 79 | .Lk http://www.globus.org/ . | ||
| 80 | .Pp | ||
| 81 | Under normal conditions it should never be necessary to set a value smaller | ||
| 82 | than the default, as the buffer is handled dynamically and only uses the | ||
| 83 | memory actually required by the data sent by the peer. | ||
| 84 | .Pp | ||
| 85 | If the maximum certificate chain size allowed is exceeded, the handshake will | ||
| 86 | fail with a | ||
| 87 | .Dv SSL_R_EXCESSIVE_MESSAGE_SIZE | ||
| 88 | error. | ||
| 89 | .Sh RETURN VALUES | ||
| 90 | .Fn SSL_CTX_set_max_cert_list | ||
| 91 | and | ||
| 92 | .Fn SSL_set_max_cert_list | ||
| 93 | return the previously set value. | ||
| 94 | .Pp | ||
| 95 | .Fn SSL_CTX_get_max_cert_list | ||
| 96 | and | ||
| 97 | .Fn SSL_get_max_cert_list | ||
| 98 | return the currently set value. | ||
| 99 | .Sh SEE ALSO | ||
| 100 | .Xr ssl 3 , | ||
| 101 | .Xr SSL_CTX_set_verify 3 , | ||
| 102 | .Xr SSL_new 3 | ||
| 103 | .Sh HISTORY | ||
| 104 | .Fn SSL*_set/get_max_cert_list | ||
| 105 | were introduced in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_mode.3 b/src/lib/libssl/man/SSL_CTX_set_mode.3 new file mode 100644 index 0000000000..a2d53884da --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_mode.3 | |||
| @@ -0,0 +1,126 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_mode.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_MODE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_mode , | ||
| 9 | .Nm SSL_set_mode , | ||
| 10 | .Nm SSL_CTX_get_mode , | ||
| 11 | .Nm SSL_get_mode | ||
| 12 | .Nd manipulate SSL engine mode | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_set_mode "SSL_CTX *ctx" "long mode" | ||
| 17 | .Ft long | ||
| 18 | .Fn SSL_set_mode "SSL *ssl" "long mode" | ||
| 19 | .Ft long | ||
| 20 | .Fn SSL_CTX_get_mode "SSL_CTX *ctx" | ||
| 21 | .Ft long | ||
| 22 | .Fn SSL_get_mode "SSL *ssl" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_set_mode | ||
| 25 | adds the mode set via bitmask in | ||
| 26 | .Fa mode | ||
| 27 | to | ||
| 28 | .Fa ctx . | ||
| 29 | Options already set before are not cleared. | ||
| 30 | .Pp | ||
| 31 | .Fn SSL_set_mode | ||
| 32 | adds the mode set via bitmask in | ||
| 33 | .Fa mode | ||
| 34 | to | ||
| 35 | .Fa ssl . | ||
| 36 | Options already set before are not cleared. | ||
| 37 | .Pp | ||
| 38 | .Fn SSL_CTX_get_mode | ||
| 39 | returns the mode set for | ||
| 40 | .Fa ctx . | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_get_mode | ||
| 43 | returns the mode set for | ||
| 44 | .Fa ssl . | ||
| 45 | .Sh NOTES | ||
| 46 | The following mode changes are available: | ||
| 47 | .Bl -tag -width Ds | ||
| 48 | .It Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
| 49 | Allow | ||
| 50 | .Fn SSL_write ... n | ||
| 51 | to return | ||
| 52 | .Ms r | ||
| 53 | with | ||
| 54 | .EQ | ||
| 55 | 0 < r < n | ||
| 56 | .EN | ||
| 57 | (i.e., report success when just a single record has been written). | ||
| 58 | When not set (the default), | ||
| 59 | .Xr SSL_write 3 | ||
| 60 | will only report success once the complete chunk was written. | ||
| 61 | Once | ||
| 62 | .Xr SSL_write 3 | ||
| 63 | returns with | ||
| 64 | .Ms r , | ||
| 65 | .Ms r | ||
| 66 | bytes have been successfully written and the next call to | ||
| 67 | .Xr SSL_write 3 | ||
| 68 | must only send the | ||
| 69 | .Ms n \(mi r | ||
| 70 | bytes left, imitating the behaviour of | ||
| 71 | .Xr write 2 . | ||
| 72 | .It Dv SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER | ||
| 73 | Make it possible to retry | ||
| 74 | .Xr SSL_write 3 | ||
| 75 | with changed buffer location (the buffer contents must stay the same). | ||
| 76 | This is not the default to avoid the misconception that non-blocking | ||
| 77 | .Xr SSL_write 3 | ||
| 78 | behaves like non-blocking | ||
| 79 | .Xr write 2 . | ||
| 80 | .It Dv SSL_MODE_AUTO_RETRY | ||
| 81 | Never bother the application with retries if the transport is blocking. | ||
| 82 | If a renegotiation take place during normal operation, a | ||
| 83 | .Xr SSL_read 3 | ||
| 84 | or | ||
| 85 | .Xr SSL_write 3 | ||
| 86 | would return | ||
| 87 | with \(mi1 and indicate the need to retry with | ||
| 88 | .Dv SSL_ERROR_WANT_READ . | ||
| 89 | In a non-blocking environment applications must be prepared to handle | ||
| 90 | incomplete read/write operations. | ||
| 91 | In a blocking environment, applications are not always prepared to deal with | ||
| 92 | read/write operations returning without success report. | ||
| 93 | The flag | ||
| 94 | .Dv SSL_MODE_AUTO_RETRY | ||
| 95 | will cause read/write operations to only return after the handshake and | ||
| 96 | successful completion. | ||
| 97 | .It Dv SSL_MODE_RELEASE_BUFFERS | ||
| 98 | When we no longer need a read buffer or a write buffer for a given | ||
| 99 | .Vt SSL , | ||
| 100 | then release the memory we were using to hold it. | ||
| 101 | Released memory is either appended to a list of unused RAM chunks on the | ||
| 102 | .Vt SSL_CTX , | ||
| 103 | or simply freed if the list of unused chunks would become longer than | ||
| 104 | .Va "SSL_CTX->freelist_max_len" , | ||
| 105 | which defaults to 32. | ||
| 106 | Using this flag can save around 34k per idle SSL connection. | ||
| 107 | This flag has no effect on SSL v2 connections, or on DTLS connections. | ||
| 108 | .El | ||
| 109 | .Sh RETURN VALUES | ||
| 110 | .Fn SSL_CTX_set_mode | ||
| 111 | and | ||
| 112 | .Fn SSL_set_mode | ||
| 113 | return the new mode bitmask after adding | ||
| 114 | .Fa mode . | ||
| 115 | .Pp | ||
| 116 | .Fn SSL_CTX_get_mode | ||
| 117 | and | ||
| 118 | .Fn SSL_get_mode | ||
| 119 | return the current bitmask. | ||
| 120 | .Sh SEE ALSO | ||
| 121 | .Xr ssl 3 , | ||
| 122 | .Xr SSL_read 3 , | ||
| 123 | .Xr SSL_write 3 | ||
| 124 | .Sh HISTORY | ||
| 125 | .Dv SSL_MODE_AUTO_RETRY | ||
| 126 | was added in OpenSSL 0.9.6. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 new file mode 100644 index 0000000000..7142c40545 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_msg_callback.3 | |||
| @@ -0,0 +1,135 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_msg_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_MSG_CALLBACK 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_msg_callback , | ||
| 9 | .Nm SSL_CTX_set_msg_callback_arg , | ||
| 10 | .Nm SSL_set_msg_callback , | ||
| 11 | .Nm SSL_set_msg_callback_arg | ||
| 12 | .Nd install callback for observing protocol messages | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fo SSL_CTX_set_msg_callback | ||
| 17 | .Fa "SSL_CTX *ctx" | ||
| 18 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
| 19 | .Fc | ||
| 20 | .Ft void | ||
| 21 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
| 22 | .Ft void | ||
| 23 | .Fo SSL_set_msg_callback | ||
| 24 | .Fa "SSL *ssl" | ||
| 25 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg)" | ||
| 26 | .Fc | ||
| 27 | .Ft void | ||
| 28 | .Fn SSL_set_msg_callback_arg "SSL *ssl" "void *arg" | ||
| 29 | .Sh DESCRIPTION | ||
| 30 | .Fn SSL_CTX_set_msg_callback | ||
| 31 | or | ||
| 32 | .Fn SSL_set_msg_callback | ||
| 33 | can be used to define a message callback function | ||
| 34 | .Fa cb | ||
| 35 | for observing all SSL/TLS protocol messages (such as handshake messages) | ||
| 36 | that are received or sent. | ||
| 37 | .Fn SSL_CTX_set_msg_callback_arg | ||
| 38 | and | ||
| 39 | .Fn SSL_set_msg_callback_arg | ||
| 40 | can be used to set argument | ||
| 41 | .Fa arg | ||
| 42 | to the callback function, which is available for arbitrary application use. | ||
| 43 | .Pp | ||
| 44 | .Fn SSL_CTX_set_msg_callback | ||
| 45 | and | ||
| 46 | .Fn SSL_CTX_set_msg_callback_arg | ||
| 47 | specify default settings that will be copied to new | ||
| 48 | .Vt SSL | ||
| 49 | objects by | ||
| 50 | .Xr SSL_new 3 . | ||
| 51 | .Fn SSL_set_msg_callback | ||
| 52 | and | ||
| 53 | .Fn SSL_set_msg_callback_arg | ||
| 54 | modify the actual settings of an | ||
| 55 | .Vt SSL | ||
| 56 | object. | ||
| 57 | Using a | ||
| 58 | .Dv NULL | ||
| 59 | pointer for | ||
| 60 | .Fa cb | ||
| 61 | disables the message callback. | ||
| 62 | .Pp | ||
| 63 | When | ||
| 64 | .Fa cb | ||
| 65 | is called by the SSL/TLS library for a protocol message, | ||
| 66 | the function arguments have the following meaning: | ||
| 67 | .Bl -tag -width Ds | ||
| 68 | .It Fa write_p | ||
| 69 | This flag is 0 when a protocol message has been received and 1 when a protocol | ||
| 70 | message has been sent. | ||
| 71 | .It Fa version | ||
| 72 | The protocol version according to which the protocol message is | ||
| 73 | interpreted by the library. | ||
| 74 | Currently, this is one of | ||
| 75 | .Dv SSL2_VERSION , | ||
| 76 | .Dv SSL3_VERSION | ||
| 77 | and | ||
| 78 | .Dv TLS1_VERSION | ||
| 79 | (for SSL 2.0, SSL 3.0 and TLS 1.0, respectively). | ||
| 80 | .It Fa content_type | ||
| 81 | In the case of SSL 2.0, this is always 0. | ||
| 82 | In the case of SSL 3.0 or TLS 1.0, this is one of the | ||
| 83 | .Em ContentType | ||
| 84 | values defined in the protocol specification | ||
| 85 | .Po | ||
| 86 | .Dq change_cipher_spec(20) , | ||
| 87 | .Dq alert(21) , | ||
| 88 | .Dq handshake(22) ; | ||
| 89 | but never | ||
| 90 | .Dq application_data(23) | ||
| 91 | because the callback will only be called for protocol messages. | ||
| 92 | .Pc | ||
| 93 | .It Fa buf , Fa len | ||
| 94 | .Fa buf | ||
| 95 | points to a buffer containing the protocol message, which consists of | ||
| 96 | .Fa len | ||
| 97 | bytes. | ||
| 98 | The buffer is no longer valid after the callback function has returned. | ||
| 99 | .It Fa ssl | ||
| 100 | The | ||
| 101 | .Vt SSL | ||
| 102 | object that received or sent the message. | ||
| 103 | .It Fa arg | ||
| 104 | The user-defined argument optionally defined by | ||
| 105 | .Fn SSL_CTX_set_msg_callback_arg | ||
| 106 | or | ||
| 107 | .Fn SSL_set_msg_callback_arg . | ||
| 108 | .El | ||
| 109 | .Sh NOTES | ||
| 110 | Protocol messages are passed to the callback function after decryption | ||
| 111 | and fragment collection where applicable. | ||
| 112 | (Thus record boundaries are not visible.) | ||
| 113 | .Pp | ||
| 114 | If processing a received protocol message results in an error, | ||
| 115 | the callback function may not be called. | ||
| 116 | For example, the callback function will never see messages that are considered | ||
| 117 | too large to be processed. | ||
| 118 | .Pp | ||
| 119 | Due to automatic protocol version negotiation, | ||
| 120 | .Fa version | ||
| 121 | is not necessarily the protocol version used by the sender of the message: | ||
| 122 | If a TLS 1.0 ClientHello message is received by an SSL 3.0-only server, | ||
| 123 | .Fa version | ||
| 124 | will be | ||
| 125 | .Dv SSL3_VERSION . | ||
| 126 | .Sh SEE ALSO | ||
| 127 | .Xr ssl 3 , | ||
| 128 | .Xr SSL_new 3 | ||
| 129 | .Sh HISTORY | ||
| 130 | .Fn SSL_CTX_set_msg_callback , | ||
| 131 | .Fn SSL_CTX_set_msg_callback_arg , | ||
| 132 | .Fn SSL_set_msg_callback | ||
| 133 | and | ||
| 134 | .Fn SSL_set_msg_callback_arg | ||
| 135 | were added in OpenSSL 0.9.7. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_options.3 b/src/lib/libssl/man/SSL_CTX_set_options.3 new file mode 100644 index 0000000000..1818be0d86 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_options.3 | |||
| @@ -0,0 +1,395 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_options.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_OPTIONS 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_options , | ||
| 9 | .Nm SSL_set_options , | ||
| 10 | .Nm SSL_CTX_clear_options , | ||
| 11 | .Nm SSL_clear_options , | ||
| 12 | .Nm SSL_CTX_get_options , | ||
| 13 | .Nm SSL_get_options , | ||
| 14 | .Nm SSL_get_secure_renegotiation_support | ||
| 15 | .Nd manipulate SSL options | ||
| 16 | .Sh SYNOPSIS | ||
| 17 | .In openssl/ssl.h | ||
| 18 | .Ft long | ||
| 19 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "long options" | ||
| 20 | .Ft long | ||
| 21 | .Fn SSL_set_options "SSL *ssl" "long options" | ||
| 22 | .Ft long | ||
| 23 | .Fn SSL_CTX_clear_options "SSL_CTX *ctx" "long options" | ||
| 24 | .Ft long | ||
| 25 | .Fn SSL_clear_options "SSL *ssl" "long options" | ||
| 26 | .Ft long | ||
| 27 | .Fn SSL_CTX_get_options "SSL_CTX *ctx" | ||
| 28 | .Ft long | ||
| 29 | .Fn SSL_get_options "SSL *ssl" | ||
| 30 | .Ft long | ||
| 31 | .Fn SSL_get_secure_renegotiation_support "SSL *ssl" | ||
| 32 | .Sh DESCRIPTION | ||
| 33 | Note: all these functions are implemented using macros. | ||
| 34 | .Pp | ||
| 35 | .Fn SSL_CTX_set_options | ||
| 36 | adds the options set via bitmask in | ||
| 37 | .Fa options | ||
| 38 | to | ||
| 39 | .Fa ctx . | ||
| 40 | Options already set before are not cleared! | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_set_options | ||
| 43 | adds the options set via bitmask in | ||
| 44 | .Fa options | ||
| 45 | to | ||
| 46 | .Fa ssl . | ||
| 47 | Options already set before are not cleared! | ||
| 48 | .Pp | ||
| 49 | .Fn SSL_CTX_clear_options | ||
| 50 | clears the options set via bitmask in | ||
| 51 | .Fa options | ||
| 52 | to | ||
| 53 | .Fa ctx . | ||
| 54 | .Pp | ||
| 55 | .Fn SSL_clear_options | ||
| 56 | clears the options set via bitmask in | ||
| 57 | .Fa options | ||
| 58 | to | ||
| 59 | .Fa ssl . | ||
| 60 | .Pp | ||
| 61 | .Fn SSL_CTX_get_options | ||
| 62 | returns the options set for | ||
| 63 | .Fa ctx . | ||
| 64 | .Pp | ||
| 65 | .Fn SSL_get_options | ||
| 66 | returns the options set for | ||
| 67 | .Fa ssl . | ||
| 68 | .Pp | ||
| 69 | .Fn SSL_get_secure_renegotiation_support | ||
| 70 | indicates whether the peer supports secure renegotiation. | ||
| 71 | .Sh NOTES | ||
| 72 | The behaviour of the SSL library can be changed by setting several options. | ||
| 73 | The options are coded as bitmasks and can be combined by a bitwise OR | ||
| 74 | operation (|). | ||
| 75 | .Pp | ||
| 76 | .Fn SSL_CTX_set_options | ||
| 77 | and | ||
| 78 | .Fn SSL_set_options | ||
| 79 | affect the (external) protocol behaviour of the SSL library. | ||
| 80 | The (internal) behaviour of the API can be changed by using the similar | ||
| 81 | .Xr SSL_CTX_set_mode 3 | ||
| 82 | and | ||
| 83 | .Xr SSL_set_mode 3 | ||
| 84 | functions. | ||
| 85 | .Pp | ||
| 86 | During a handshake, the option settings of the SSL object are used. | ||
| 87 | When a new SSL object is created from a context using | ||
| 88 | .Xr SSL_new 3 , | ||
| 89 | the current option setting is copied. | ||
| 90 | Changes to | ||
| 91 | .Fa ctx | ||
| 92 | do not affect already created | ||
| 93 | .Vt SSL | ||
| 94 | objects. | ||
| 95 | .Fn SSL_clear | ||
| 96 | does not affect the settings. | ||
| 97 | .Pp | ||
| 98 | The following | ||
| 99 | .Em bug workaround | ||
| 100 | options are available: | ||
| 101 | .Bl -tag -width Ds | ||
| 102 | .It Dv SSL_OP_MICROSOFT_SESS_ID_BUG | ||
| 103 | As of | ||
| 104 | .Ox 5.8 , | ||
| 105 | this option has no effect. | ||
| 106 | .It Dv SSL_OP_NETSCAPE_CHALLENGE_BUG | ||
| 107 | As of | ||
| 108 | .Ox 5.8 , | ||
| 109 | this option has no effect. | ||
| 110 | .It Dv SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG | ||
| 111 | As of OpenSSL 0.9.8q and 1.0.0c, this option has no effect. | ||
| 112 | .It Dv SSL_OP_SSLREF2_REUSE_CERT_TYPE_BUG | ||
| 113 | As of | ||
| 114 | .Ox 5.8 , | ||
| 115 | this option has no effect. | ||
| 116 | .It Dv SSL_OP_MICROSOFT_BIG_SSLV3_BUFFER | ||
| 117 | As of | ||
| 118 | .Ox 5.8 , | ||
| 119 | this option has no effect. | ||
| 120 | .It Dv SSL_OP_SAFARI_ECDHE_ECDSA_BUG | ||
| 121 | As of | ||
| 122 | .Ox 5.8 , | ||
| 123 | this option has no effect. | ||
| 124 | .It Dv SSL_OP_SSLEAY_080_CLIENT_DH_BUG | ||
| 125 | As of | ||
| 126 | .Ox 5.8 , | ||
| 127 | this option has no effect. | ||
| 128 | .It Dv SSL_OP_TLS_D5_BUG | ||
| 129 | As of | ||
| 130 | .Ox 5.8 , | ||
| 131 | this option has no effect. | ||
| 132 | .It Dv SSL_OP_TLS_BLOCK_PADDING_BUG | ||
| 133 | As of | ||
| 134 | .Ox 5.8 , | ||
| 135 | this option has no effect. | ||
| 136 | .It Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
| 137 | Disables a countermeasure against a SSL 3.0/TLS 1.0 protocol vulnerability | ||
| 138 | affecting CBC ciphers, which cannot be handled by some broken SSL | ||
| 139 | implementations. | ||
| 140 | This option has no effect for connections using other ciphers. | ||
| 141 | .It Dv SSL_OP_TLSEXT_PADDING | ||
| 142 | Adds a padding extension to ensure the ClientHello size is never between 256 | ||
| 143 | and 511 bytes in length. | ||
| 144 | This is needed as a workaround for some implementations. | ||
| 145 | .It Dv SSL_OP_ALL | ||
| 146 | All of the above bug workarounds. | ||
| 147 | .El | ||
| 148 | .Pp | ||
| 149 | It is usually safe to use | ||
| 150 | .Dv SSL_OP_ALL | ||
| 151 | to enable the bug workaround options if compatibility with somewhat broken | ||
| 152 | implementations is desired. | ||
| 153 | .Pp | ||
| 154 | The following | ||
| 155 | .Em modifying | ||
| 156 | options are available: | ||
| 157 | .Bl -tag -width Ds | ||
| 158 | .It Dv SSL_OP_TLS_ROLLBACK_BUG | ||
| 159 | Disable version rollback attack detection. | ||
| 160 | .Pp | ||
| 161 | During the client key exchange, the client must send the same information | ||
| 162 | about acceptable SSL/TLS protocol levels as during the first hello. | ||
| 163 | Some clients violate this rule by adapting to the server's answer. | ||
| 164 | (Example: the client sends a SSLv2 hello and accepts up to SSLv3.1=TLSv1, | ||
| 165 | the server only understands up to SSLv3. | ||
| 166 | In this case the client must still use the same SSLv3.1=TLSv1 announcement. | ||
| 167 | Some clients step down to SSLv3 with respect to the server's answer and violate | ||
| 168 | the version rollback protection.) | ||
| 169 | .It Dv SSL_OP_SINGLE_DH_USE | ||
| 170 | Always create a new key when using temporary/ephemeral DH parameters | ||
| 171 | (see | ||
| 172 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
| 173 | This option must be used to prevent small subgroup attacks, when the DH | ||
| 174 | parameters were not generated using | ||
| 175 | .Dq strong | ||
| 176 | primes (e.g., when using DSA-parameters, see | ||
| 177 | .Xr openssl 1 ) . | ||
| 178 | If | ||
| 179 | .Dq strong | ||
| 180 | primes were used, it is not strictly necessary to generate a new DH key during | ||
| 181 | each handshake but it is also recommended. | ||
| 182 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 183 | should therefore be enabled whenever temporary/ephemeral DH parameters are used. | ||
| 184 | .It SSL_OP_EPHEMERAL_RSA | ||
| 185 | Always use ephemeral (temporary) RSA key when doing RSA operations (see | ||
| 186 | .Xr SSL_CTX_set_tmp_rsa_callback 3 ) . | ||
| 187 | According to the specifications, this is only done when a RSA key can only be | ||
| 188 | used for signature operations (namely under export ciphers with restricted RSA | ||
| 189 | keylength). | ||
| 190 | By setting this option, ephemeral RSA keys are always used. | ||
| 191 | This option breaks compatibility with the SSL/TLS specifications and may lead | ||
| 192 | to interoperability problems with clients and should therefore never be used. | ||
| 193 | Ciphers with EDH (ephemeral Diffie-Hellman) key exchange should be used instead. | ||
| 194 | .It Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
| 195 | When choosing a cipher, use the server's preferences instead of the client | ||
| 196 | preferences. | ||
| 197 | When not set, the SSL server will always follow the client's preferences. | ||
| 198 | When set, the SSLv3/TLSv1 server will choose following its own preferences. | ||
| 199 | Because of the different protocol, for SSLv2 the server will send its list of | ||
| 200 | preferences to the client and the client chooses. | ||
| 201 | .It Dv SSL_OP_NETSCAPE_CA_DN_BUG | ||
| 202 | As of | ||
| 203 | .Ox 5.8 , | ||
| 204 | this option has no effect. | ||
| 205 | .It Dv SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG | ||
| 206 | As of | ||
| 207 | .Ox 5.8 , | ||
| 208 | this option has no effect. | ||
| 209 | .It Dv SSL_OP_NO_SSLv2 | ||
| 210 | As of | ||
| 211 | .Ox 5.6 , | ||
| 212 | this option has no effect as SSLv2 support has been removed. | ||
| 213 | In previous versions it disabled use of the SSLv2 protocol. | ||
| 214 | .It Dv SSL_OP_NO_SSLv3 | ||
| 215 | Do not use the SSLv3 protocol. | ||
| 216 | .It Dv SSL_OP_NO_TLSv1 | ||
| 217 | Do not use the TLSv1.0 protocol. | ||
| 218 | .It Dv SSL_OP_NO_TLSv1_1 | ||
| 219 | Do not use the TLSv1.1 protocol. | ||
| 220 | .It Dv SSL_OP_NO_TLSv1_2 | ||
| 221 | Do not use the TLSv1.2 protocol. | ||
| 222 | .It Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
| 223 | When performing renegotiation as a server, always start a new session (i.e., | ||
| 224 | session resumption requests are only accepted in the initial handshake). | ||
| 225 | This option is not needed for clients. | ||
| 226 | .It Dv SSL_OP_NO_TICKET | ||
| 227 | Normally clients and servers will, where possible, transparently make use of | ||
| 228 | RFC4507bis tickets for stateless session resumption. | ||
| 229 | .Pp | ||
| 230 | If this option is set this functionality is disabled and tickets will not be | ||
| 231 | used by clients or servers. | ||
| 232 | .It Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
| 233 | As of | ||
| 234 | .Ox 5.6 , | ||
| 235 | this option has no effect. | ||
| 236 | In previous versions it allowed legacy insecure renegotiation between OpenSSL | ||
| 237 | and unpatched clients or servers. | ||
| 238 | See the | ||
| 239 | .Sx SECURE RENEGOTIATION | ||
| 240 | section for more details. | ||
| 241 | .It Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 242 | Allow legacy insecure renegotiation between OpenSSL and unpatched servers | ||
| 243 | .Em only : | ||
| 244 | this option is currently set by default. | ||
| 245 | See the | ||
| 246 | .Sx SECURE RENEGOTIATION | ||
| 247 | section for more details. | ||
| 248 | .El | ||
| 249 | .Sh SECURE RENEGOTIATION | ||
| 250 | OpenSSL 0.9.8m and later always attempts to use secure renegotiation as | ||
| 251 | described in RFC5746. | ||
| 252 | This counters the prefix attack described in CVE-2009-3555 and elsewhere. | ||
| 253 | .Pp | ||
| 254 | The deprecated and highly broken SSLv2 protocol does not support renegotiation | ||
| 255 | at all; its use is | ||
| 256 | .Em strongly | ||
| 257 | discouraged. | ||
| 258 | .Pp | ||
| 259 | This attack has far-reaching consequences which application writers should be | ||
| 260 | aware of. | ||
| 261 | In the description below an implementation supporting secure renegotiation is | ||
| 262 | referred to as | ||
| 263 | .Dq patched . | ||
| 264 | A server not supporting secure | ||
| 265 | renegotiation is referred to as | ||
| 266 | .Dq unpatched . | ||
| 267 | .Pp | ||
| 268 | The following sections describe the operations permitted by OpenSSL's secure | ||
| 269 | renegotiation implementation. | ||
| 270 | .Ss Patched client and server | ||
| 271 | Connections and renegotiation are always permitted by OpenSSL implementations. | ||
| 272 | .Ss Unpatched client and patched OpenSSL server | ||
| 273 | The initial connection succeeds but client renegotiation is denied by the | ||
| 274 | server with a | ||
| 275 | .Em no_renegotiation | ||
| 276 | warning alert if TLS v1.0 is used or a fatal | ||
| 277 | .Em handshake_failure | ||
| 278 | alert in SSL v3.0. | ||
| 279 | .Pp | ||
| 280 | If the patched OpenSSL server attempts to renegotiate a fatal | ||
| 281 | .Em handshake_failure | ||
| 282 | alert is sent. | ||
| 283 | This is because the server code may be unaware of the unpatched nature of the | ||
| 284 | client. | ||
| 285 | .Pp | ||
| 286 | .Em N.B.: | ||
| 287 | a bug in OpenSSL clients earlier than 0.9.8m (all of which are unpatched) will | ||
| 288 | result in the connection hanging if it receives a | ||
| 289 | .Em no_renegotiation | ||
| 290 | alert. | ||
| 291 | OpenSSL versions 0.9.8m and later will regard a | ||
| 292 | .Em no_renegotiation | ||
| 293 | alert as fatal and respond with a fatal | ||
| 294 | .Em handshake_failure | ||
| 295 | alert. | ||
| 296 | This is because the OpenSSL API currently has no provision to indicate to an | ||
| 297 | application that a renegotiation attempt was refused. | ||
| 298 | .Ss Patched OpenSSL client and unpatched server | ||
| 299 | If the option | ||
| 300 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 301 | is set then initial connections and renegotiation between patched OpenSSL | ||
| 302 | clients and unpatched servers succeeds. | ||
| 303 | If neither option is set then initial connections to unpatched servers will | ||
| 304 | fail. | ||
| 305 | .Pp | ||
| 306 | The option | ||
| 307 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 308 | is currently set by default even though it has security implications: | ||
| 309 | otherwise it would be impossible to connect to unpatched servers (i.e., all of | ||
| 310 | them initially) and this is clearly not acceptable. | ||
| 311 | Renegotiation is permitted because this does not add any additional security | ||
| 312 | issues: during an attack clients do not see any renegotiations anyway. | ||
| 313 | .Pp | ||
| 314 | As more servers become patched the option | ||
| 315 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 316 | will | ||
| 317 | .Em not | ||
| 318 | be set by default in a future version of OpenSSL. | ||
| 319 | .Pp | ||
| 320 | OpenSSL client applications wishing to ensure they can connect to unpatched | ||
| 321 | servers should always | ||
| 322 | .Em set | ||
| 323 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 324 | .Pp | ||
| 325 | OpenSSL client applications that want to ensure they can | ||
| 326 | .Em not | ||
| 327 | connect to unpatched servers (and thus avoid any security issues) should always | ||
| 328 | .Em clear | ||
| 329 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 330 | using | ||
| 331 | .Fn SSL_CTX_clear_options | ||
| 332 | or | ||
| 333 | .Fn SSL_clear_options . | ||
| 334 | .Sh RETURN VALUES | ||
| 335 | .Fn SSL_CTX_set_options | ||
| 336 | and | ||
| 337 | .Fn SSL_set_options | ||
| 338 | return the new options bitmask after adding | ||
| 339 | .Fa options . | ||
| 340 | .Pp | ||
| 341 | .Fn SSL_CTX_clear_options | ||
| 342 | and | ||
| 343 | .Fn SSL_clear_options | ||
| 344 | return the new options bitmask after clearing | ||
| 345 | .Fa options . | ||
| 346 | .Pp | ||
| 347 | .Fn SSL_CTX_get_options | ||
| 348 | and | ||
| 349 | .Fn SSL_get_options | ||
| 350 | return the current bitmask. | ||
| 351 | .Pp | ||
| 352 | .Fn SSL_get_secure_renegotiation_support | ||
| 353 | returns 1 is the peer supports secure renegotiation and 0 if it does not. | ||
| 354 | .Sh SEE ALSO | ||
| 355 | .Xr openssl 1 , | ||
| 356 | .Xr ssl 3 , | ||
| 357 | .Xr SSL_clear 3 , | ||
| 358 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
| 359 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
| 360 | .Xr SSL_new 3 | ||
| 361 | .Sh HISTORY | ||
| 362 | .Dv SSL_OP_CIPHER_SERVER_PREFERENCE | ||
| 363 | and | ||
| 364 | .Dv SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION | ||
| 365 | have been added in | ||
| 366 | OpenSSL 0.9.7. | ||
| 367 | .Pp | ||
| 368 | .Dv SSL_OP_TLS_ROLLBACK_BUG | ||
| 369 | has been added in OpenSSL 0.9.6 and was automatically enabled with | ||
| 370 | .Dv SSL_OP_ALL . | ||
| 371 | As of 0.9.7, it is no longer included in | ||
| 372 | .Dv SSL_OP_ALL | ||
| 373 | and must be explicitly set. | ||
| 374 | .Pp | ||
| 375 | .Dv SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS | ||
| 376 | has been added in OpenSSL 0.9.6e. | ||
| 377 | Versions up to OpenSSL 0.9.6c do not include the countermeasure that can be | ||
| 378 | disabled with this option (in OpenSSL 0.9.6d, it was always enabled). | ||
| 379 | .Pp | ||
| 380 | .Fn SSL_CTX_clear_options | ||
| 381 | and | ||
| 382 | .Fn SSL_clear_options | ||
| 383 | were first added in OpenSSL 0.9.8m. | ||
| 384 | .Pp | ||
| 385 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION , | ||
| 386 | .Dv SSL_OP_LEGACY_SERVER_CONNECT | ||
| 387 | and the function | ||
| 388 | .Fn SSL_get_secure_renegotiation_support | ||
| 389 | were first added in OpenSSL 0.9.8m. | ||
| 390 | .Pp | ||
| 391 | .Dv SSL_OP_NO_SSLv2 | ||
| 392 | and | ||
| 393 | .Dv SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION | ||
| 394 | were changed to have no effect in | ||
| 395 | .Ox 5.6 . | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 b/src/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 new file mode 100644 index 0000000000..0325a9405a --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_psk_client_callback.3 | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_psk_client_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_PSK_CLIENT_CALLBACK 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_psk_client_callback , | ||
| 9 | .Nm SSL_set_psk_client_callback | ||
| 10 | .Nd set PSK client callback | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fo SSL_CTX_set_psk_client_callback | ||
| 15 | .Fa "SSL_CTX *ctx" | ||
| 16 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
| 17 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
| 18 | .Fc | ||
| 19 | .Ft void | ||
| 20 | .Fo SSL_set_psk_client_callback | ||
| 21 | .Fa "SSL *ssl" | ||
| 22 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
| 23 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
| 24 | .Fc | ||
| 25 | .Sh DESCRIPTION | ||
| 26 | A client application must provide a callback function which is called | ||
| 27 | when the client is sending the ClientKeyExchange message to the server. | ||
| 28 | .Pp | ||
| 29 | The purpose of the callback function is to select the PSK identity and | ||
| 30 | the pre-shared key to use during the connection setup phase. | ||
| 31 | .Pp | ||
| 32 | The callback is set using functions | ||
| 33 | .Fn SSL_CTX_set_psk_client_callback | ||
| 34 | or | ||
| 35 | .Fn SSL_set_psk_client_callback . | ||
| 36 | The callback function is given the connection in parameter | ||
| 37 | .Fa ssl , | ||
| 38 | a | ||
| 39 | .Dv NULL Ns | ||
| 40 | -terminated PSK identity hint sent by the server in parameter | ||
| 41 | .Fa hint , | ||
| 42 | a buffer | ||
| 43 | .Fa identity | ||
| 44 | of length | ||
| 45 | .Fa max_identity_len | ||
| 46 | bytes where the resulting | ||
| 47 | .Dv NULL Ns | ||
| 48 | -terminated identity is to be stored, and a buffer | ||
| 49 | .Fa psk | ||
| 50 | of | ||
| 51 | length | ||
| 52 | .Fa max_psk_len | ||
| 53 | bytes where the resulting pre-shared key is to be stored. | ||
| 54 | .Sh NOTES | ||
| 55 | Note that parameter | ||
| 56 | .Fa hint | ||
| 57 | given to the callback may be | ||
| 58 | .Dv NULL . | ||
| 59 | .Sh RETURN VALUES | ||
| 60 | Return values from the client callback are interpreted as follows: | ||
| 61 | .Pp | ||
| 62 | On success (callback found a PSK identity and a pre-shared key to use) | ||
| 63 | the length (> 0) of | ||
| 64 | .Fa psk | ||
| 65 | in bytes is returned. | ||
| 66 | .Pp | ||
| 67 | Otherwise or on errors callback should return 0. | ||
| 68 | In this case the connection setup fails. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 new file mode 100644 index 0000000000..e840661125 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3 | |||
| @@ -0,0 +1,115 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_quiet_shutdown.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_QUIET_SHUTDOWN 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_quiet_shutdown , | ||
| 9 | .Nm SSL_CTX_get_quiet_shutdown , | ||
| 10 | .Nm SSL_set_quiet_shutdown , | ||
| 11 | .Nm SSL_get_quiet_shutdown | ||
| 12 | .Nd manipulate shutdown behaviour | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
| 17 | .Ft int | ||
| 18 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
| 19 | .Ft void | ||
| 20 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
| 21 | .Ft int | ||
| 22 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_CTX_set_quiet_shutdown | ||
| 25 | sets the | ||
| 26 | .Dq quiet shutdown | ||
| 27 | flag for | ||
| 28 | .Fa ctx | ||
| 29 | to be | ||
| 30 | .Fa mode . | ||
| 31 | .Vt SSL | ||
| 32 | objects created from | ||
| 33 | .Fa ctx | ||
| 34 | inherit the | ||
| 35 | .Fa mode | ||
| 36 | valid at the time | ||
| 37 | .Xr SSL_new 3 | ||
| 38 | is called. | ||
| 39 | .Fa mode | ||
| 40 | may be 0 or 1. | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_CTX_get_quiet_shutdown | ||
| 43 | returns the | ||
| 44 | .Dq quiet shutdown | ||
| 45 | setting of | ||
| 46 | .Fa ctx . | ||
| 47 | .Pp | ||
| 48 | .Fn SSL_set_quiet_shutdown | ||
| 49 | sets the | ||
| 50 | .Dq quiet shutdown | ||
| 51 | flag for | ||
| 52 | .Fa ssl | ||
| 53 | to be | ||
| 54 | .Fa mode . | ||
| 55 | The setting stays valid until | ||
| 56 | .Fa ssl | ||
| 57 | is removed with | ||
| 58 | .Xr SSL_free 3 | ||
| 59 | or | ||
| 60 | .Fn SSL_set_quiet_shutdown | ||
| 61 | is called again. | ||
| 62 | It is not changed when | ||
| 63 | .Xr SSL_clear 3 | ||
| 64 | is called. | ||
| 65 | .Fa mode | ||
| 66 | may be 0 or 1. | ||
| 67 | .Pp | ||
| 68 | .Fn SSL_get_quiet_shutdown | ||
| 69 | returns the | ||
| 70 | .Dq quiet shutdown | ||
| 71 | setting of | ||
| 72 | .Fa ssl . | ||
| 73 | .Sh NOTES | ||
| 74 | Normally when a SSL connection is finished, the parties must send out | ||
| 75 | .Dq close notify | ||
| 76 | alert messages using | ||
| 77 | .Xr SSL_shutdown 3 | ||
| 78 | for a clean shutdown. | ||
| 79 | .Pp | ||
| 80 | When setting the | ||
| 81 | .Dq quiet shutdown | ||
| 82 | flag to 1, | ||
| 83 | .Xr SSL_shutdown 3 | ||
| 84 | will set the internal flags to | ||
| 85 | .Dv SSL_SENT_SHUTDOWN Ns | Ns Dv SSL_RECEIVED_SHUTDOWN | ||
| 86 | .Po | ||
| 87 | .Xr SSL_shutdown 3 | ||
| 88 | then behaves like | ||
| 89 | .Xr SSL_set_shutdown 3 | ||
| 90 | called with | ||
| 91 | .Dv SSL_SENT_SHUTDOWN Ns | Ns Dv SSL_RECEIVED_SHUTDOWN | ||
| 92 | .Pc . | ||
| 93 | The session is thus considered to be shut down, but no | ||
| 94 | .Dq close notify | ||
| 95 | alert is sent to the peer. | ||
| 96 | This behaviour violates the TLS standard. | ||
| 97 | .Pp | ||
| 98 | The default is normal shutdown behaviour as described by the TLS standard. | ||
| 99 | .Sh RETURN VALUES | ||
| 100 | .Fn SSL_CTX_set_quiet_shutdown | ||
| 101 | and | ||
| 102 | .Fn SSL_set_quiet_shutdown | ||
| 103 | do not return diagnostic information. | ||
| 104 | .Pp | ||
| 105 | .Fn SSL_CTX_get_quiet_shutdown | ||
| 106 | and | ||
| 107 | .Fn SSL_get_quiet_shutdown | ||
| 108 | return the current setting. | ||
| 109 | .Sh SEE ALSO | ||
| 110 | .Xr ssl 3 , | ||
| 111 | .Xr SSL_clear 3 , | ||
| 112 | .Xr SSL_free 3 , | ||
| 113 | .Xr SSL_new 3 , | ||
| 114 | .Xr SSL_set_shutdown 3 , | ||
| 115 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 new file mode 100644 index 0000000000..5ba6728a8a --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_session_cache_mode.3 | |||
| @@ -0,0 +1,143 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_session_cache_mode.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_SESSION_CACHE_MODE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_session_cache_mode , | ||
| 9 | .Nm SSL_CTX_get_session_cache_mode | ||
| 10 | .Nd enable/disable session caching | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft long | ||
| 14 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX ctx" "long mode" | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX ctx" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_set_session_cache_mode | ||
| 19 | enables/disables session caching by setting the operational mode for | ||
| 20 | .Ar ctx | ||
| 21 | to | ||
| 22 | .Ar mode . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_CTX_get_session_cache_mode | ||
| 25 | returns the currently used cache mode. | ||
| 26 | .Sh NOTES | ||
| 27 | The OpenSSL library can store/retrieve SSL/TLS sessions for later reuse. | ||
| 28 | The sessions can be held in memory for each | ||
| 29 | .Fa ctx , | ||
| 30 | if more than one | ||
| 31 | .Vt SSL_CTX | ||
| 32 | object is being maintained, the sessions are unique for each | ||
| 33 | .Vt SSL_CTX | ||
| 34 | object. | ||
| 35 | .Pp | ||
| 36 | In order to reuse a session, a client must send the session's id to the server. | ||
| 37 | It can only send exactly one id. | ||
| 38 | The server then either agrees to reuse the session or it starts a full | ||
| 39 | handshake (to create a new session). | ||
| 40 | .Pp | ||
| 41 | A server will lookup up the session in its internal session storage. | ||
| 42 | If the session is not found in internal storage or lookups for the internal | ||
| 43 | storage have been deactivated | ||
| 44 | .Pq Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP , | ||
| 45 | the server will try the external storage if available. | ||
| 46 | .Pp | ||
| 47 | Since a client may try to reuse a session intended for use in a different | ||
| 48 | context, the session id context must be set by the server (see | ||
| 49 | .Xr SSL_CTX_set_session_id_context 3 ) . | ||
| 50 | .Pp | ||
| 51 | The following session cache modes and modifiers are available: | ||
| 52 | .Bl -tag -width Ds | ||
| 53 | .It Dv SSL_SESS_CACHE_OFF | ||
| 54 | No session caching for client or server takes place. | ||
| 55 | .It Dv SSL_SESS_CACHE_CLIENT | ||
| 56 | Client sessions are added to the session cache. | ||
| 57 | As there is no reliable way for the OpenSSL library to know whether a session | ||
| 58 | should be reused or which session to choose (due to the abstract BIO layer the | ||
| 59 | SSL engine does not have details about the connection), | ||
| 60 | the application must select the session to be reused by using the | ||
| 61 | .Xr SSL_set_session 3 | ||
| 62 | function. | ||
| 63 | This option is not activated by default. | ||
| 64 | .It Dv SSL_SESS_CACHE_SERVER | ||
| 65 | Server sessions are added to the session cache. | ||
| 66 | When a client proposes a session to be reused, the server looks for the | ||
| 67 | corresponding session in (first) the internal session cache (unless | ||
| 68 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
| 69 | is set), then (second) in the external cache if available. | ||
| 70 | If the session is found, the server will try to reuse the session. | ||
| 71 | This is the default. | ||
| 72 | .It Dv SSL_SESS_CACHE_BOTH | ||
| 73 | Enable both | ||
| 74 | .Dv SSL_SESS_CACHE_CLIENT | ||
| 75 | and | ||
| 76 | .Dv SSL_SESS_CACHE_SERVER | ||
| 77 | at the same time. | ||
| 78 | .It Dv SSL_SESS_CACHE_NO_AUTO_CLEAR | ||
| 79 | Normally the session cache is checked for expired sessions every 255 | ||
| 80 | connections using the | ||
| 81 | .Xr SSL_CTX_flush_sessions 3 | ||
| 82 | function. | ||
| 83 | Since this may lead to a delay which cannot be controlled, | ||
| 84 | the automatic flushing may be disabled and | ||
| 85 | .Xr SSL_CTX_flush_sessions 3 | ||
| 86 | can be called explicitly by the application. | ||
| 87 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
| 88 | By setting this flag, session-resume operations in an SSL/TLS server will not | ||
| 89 | automatically look up sessions in the internal cache, | ||
| 90 | even if sessions are automatically stored there. | ||
| 91 | If external session caching callbacks are in use, | ||
| 92 | this flag guarantees that all lookups are directed to the external cache. | ||
| 93 | As automatic lookup only applies for SSL/TLS servers, | ||
| 94 | the flag has no effect on clients. | ||
| 95 | .It Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
| 96 | Depending on the presence of | ||
| 97 | .Dv SSL_SESS_CACHE_CLIENT | ||
| 98 | and/or | ||
| 99 | .Dv SSL_SESS_CACHE_SERVER , | ||
| 100 | sessions negotiated in an SSL/TLS handshake may be cached for possible reuse. | ||
| 101 | Normally a new session is added to the internal cache as well as any external | ||
| 102 | session caching (callback) that is configured for the | ||
| 103 | .Vt SSL_CTX . | ||
| 104 | This flag will prevent sessions being stored in the internal cache | ||
| 105 | (though the application can add them manually using | ||
| 106 | .Xr SSL_CTX_add_session 3 ) . | ||
| 107 | Note: | ||
| 108 | in any SSL/TLS servers where external caching is configured, any successful | ||
| 109 | session lookups in the external cache (e.g., for session-resume requests) would | ||
| 110 | normally be copied into the local cache before processing continues \(en this | ||
| 111 | flag prevents these additions to the internal cache as well. | ||
| 112 | .It Dv SSL_SESS_CACHE_NO_INTERNAL | ||
| 113 | Enable both | ||
| 114 | .Dv SSL_SESS_CACHE_NO_INTERNAL_LOOKUP | ||
| 115 | and | ||
| 116 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
| 117 | at the same time. | ||
| 118 | .El | ||
| 119 | .Pp | ||
| 120 | The default mode is | ||
| 121 | .Dv SSL_SESS_CACHE_SERVER . | ||
| 122 | .Sh RETURN VALUES | ||
| 123 | .Fn SSL_CTX_set_session_cache_mode | ||
| 124 | returns the previously set cache mode. | ||
| 125 | .Pp | ||
| 126 | .Fn SSL_CTX_get_session_cache_mode | ||
| 127 | returns the currently set cache mode. | ||
| 128 | .Sh SEE ALSO | ||
| 129 | .Xr ssl 3 , | ||
| 130 | .Xr SSL_CTX_add_session 3 , | ||
| 131 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 132 | .Xr SSL_CTX_sess_number 3 , | ||
| 133 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
| 134 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
| 135 | .Xr SSL_CTX_set_session_id_context 3 , | ||
| 136 | .Xr SSL_CTX_set_timeout 3 , | ||
| 137 | .Xr SSL_session_reused 3 , | ||
| 138 | .Xr SSL_set_session 3 | ||
| 139 | .Sh HISTORY | ||
| 140 | .Dv SSL_SESS_CACHE_NO_INTERNAL_STORE | ||
| 141 | and | ||
| 142 | .Dv SSL_SESS_CACHE_NO_INTERNAL | ||
| 143 | were introduced in OpenSSL 0.9.6h. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 new file mode 100644 index 0000000000..37028cc6ca --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_session_id_context.3 | |||
| @@ -0,0 +1,105 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_session_id_context.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_SESSION_ID_CONTEXT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_session_id_context , | ||
| 9 | .Nm SSL_set_session_id_context | ||
| 10 | .Nd set context within which session can be reused (server side only) | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft int | ||
| 14 | .Fo SSL_CTX_set_session_id_context | ||
| 15 | .Fa "SSL_CTX *ctx" | ||
| 16 | .Fa "const unsigned char *sid_ctx" | ||
| 17 | .Fa "unsigned int sid_ctx_len" | ||
| 18 | .Fc | ||
| 19 | .Ft int | ||
| 20 | .Fo SSL_set_session_id_context | ||
| 21 | .Fa "SSL *ssl" | ||
| 22 | .Fa "const unsigned char *sid_ctx" | ||
| 23 | .Fa "unsigned int sid_ctx_len" | ||
| 24 | .Fc | ||
| 25 | .Sh DESCRIPTION | ||
| 26 | .Fn SSL_CTX_set_session_id_context | ||
| 27 | sets the context | ||
| 28 | .Fa sid_ctx | ||
| 29 | of length | ||
| 30 | .Fa sid_ctx_len | ||
| 31 | within which a session can be reused for the | ||
| 32 | .Fa ctx | ||
| 33 | object. | ||
| 34 | .Pp | ||
| 35 | .Fn SSL_set_session_id_context | ||
| 36 | sets the context | ||
| 37 | .Fa sid_ctx | ||
| 38 | of length | ||
| 39 | .Fa sid_ctx_len | ||
| 40 | within which a session can be reused for the | ||
| 41 | .Fa ssl | ||
| 42 | object. | ||
| 43 | .Sh NOTES | ||
| 44 | Sessions are generated within a certain context. | ||
| 45 | When exporting/importing sessions with | ||
| 46 | .Xr i2d_SSL_SESSION 3 | ||
| 47 | and | ||
| 48 | .Xr d2i_SSL_SESSION 3 , | ||
| 49 | it would be possible to re-import a session generated from another context | ||
| 50 | (e.g., another application), which might lead to malfunctions. | ||
| 51 | Therefore each application must set its own session id context | ||
| 52 | .Fa sid_ctx | ||
| 53 | which is used to distinguish the contexts and is stored in exported sessions. | ||
| 54 | The | ||
| 55 | .Fa sid_ctx | ||
| 56 | can be any kind of binary data with a given length; it is therefore possible | ||
| 57 | to use, for instance, the name of the application, the hostname, the service | ||
| 58 | name... | ||
| 59 | .Pp | ||
| 60 | The session id context becomes part of the session. | ||
| 61 | The session id context is set by the SSL/TLS server. | ||
| 62 | The | ||
| 63 | .Fn SSL_CTX_set_session_id_context | ||
| 64 | and | ||
| 65 | .Fn SSL_set_session_id_context | ||
| 66 | functions are therefore only useful on the server side. | ||
| 67 | .Pp | ||
| 68 | OpenSSL clients will check the session id context returned by the server when | ||
| 69 | reusing a session. | ||
| 70 | .Pp | ||
| 71 | The maximum length of the | ||
| 72 | .Fa sid_ctx | ||
| 73 | is limited to | ||
| 74 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
| 75 | .Sh WARNINGS | ||
| 76 | If the session id context is not set on an SSL/TLS server and client | ||
| 77 | certificates are used, stored sessions will not be reused but a fatal error | ||
| 78 | will be flagged and the handshake will fail. | ||
| 79 | .Pp | ||
| 80 | If a server returns a different session id context to an OpenSSL client | ||
| 81 | when reusing a session, an error will be flagged and the handshake will | ||
| 82 | fail. | ||
| 83 | OpenSSL servers will always return the correct session id context, | ||
| 84 | as an OpenSSL server checks the session id context itself before reusing | ||
| 85 | a session as described above. | ||
| 86 | .Sh RETURN VALUES | ||
| 87 | .Fn SSL_CTX_set_session_id_context | ||
| 88 | and | ||
| 89 | .Fn SSL_set_session_id_context | ||
| 90 | return the following values: | ||
| 91 | .Bl -tag -width Ds | ||
| 92 | .It 0 | ||
| 93 | The length | ||
| 94 | .Fa sid_ctx_len | ||
| 95 | of the session id context | ||
| 96 | .Fa sid_ctx | ||
| 97 | exceeded | ||
| 98 | the maximum allowed length of | ||
| 99 | .Dv SSL_MAX_SSL_SESSION_ID_LENGTH . | ||
| 100 | The error is logged to the error stack. | ||
| 101 | .It 1 | ||
| 102 | The operation succeeded. | ||
| 103 | .El | ||
| 104 | .Sh SEE ALSO | ||
| 105 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 new file mode 100644 index 0000000000..3359f195b4 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_ssl_version.3 | |||
| @@ -0,0 +1,81 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_ssl_version.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_SSL_VERSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_ssl_version , | ||
| 9 | .Nm SSL_set_ssl_method , | ||
| 10 | .Nm SSL_get_ssl_method | ||
| 11 | .Nd choose a new TLS/SSL method | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *method" | ||
| 16 | .Ft int | ||
| 17 | .Fn SSL_set_ssl_method "SSL *s" "const SSL_METHOD *method" | ||
| 18 | .Ft const SSL_METHOD * | ||
| 19 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
| 20 | .Sh DESCRIPTION | ||
| 21 | .Fn SSL_CTX_set_ssl_version | ||
| 22 | sets a new default TLS/SSL | ||
| 23 | .Fa method | ||
| 24 | for | ||
| 25 | .Vt SSL | ||
| 26 | objects newly created from this | ||
| 27 | .Fa ctx . | ||
| 28 | .Vt SSL | ||
| 29 | objects already created with | ||
| 30 | .Xr SSL_new 3 | ||
| 31 | are not affected, except when | ||
| 32 | .Xr SSL_clear 3 | ||
| 33 | is called. | ||
| 34 | .Pp | ||
| 35 | .Fn SSL_set_ssl_method | ||
| 36 | sets a new TLS/SSL | ||
| 37 | .Fa method | ||
| 38 | for a particular | ||
| 39 | .Vt SSL | ||
| 40 | object | ||
| 41 | .Fa s . | ||
| 42 | It may be reset when | ||
| 43 | .Xr SSL_clear 3 | ||
| 44 | is called. | ||
| 45 | .Pp | ||
| 46 | .Fn SSL_get_ssl_method | ||
| 47 | returns a function pointer to the TLS/SSL method set in | ||
| 48 | .Fa ssl . | ||
| 49 | .Sh NOTES | ||
| 50 | The available | ||
| 51 | .Fa method | ||
| 52 | choices are described in | ||
| 53 | .Xr SSL_CTX_new 3 . | ||
| 54 | .Pp | ||
| 55 | When | ||
| 56 | .Xr SSL_clear 3 | ||
| 57 | is called and no session is connected to an | ||
| 58 | .Vt SSL | ||
| 59 | object, the method of the | ||
| 60 | .Vt SSL | ||
| 61 | object is reset to the method currently set in the corresponding | ||
| 62 | .Vt SSL_CTX | ||
| 63 | object. | ||
| 64 | .Sh RETURN VALUES | ||
| 65 | The following return values can occur for | ||
| 66 | .Fn SSL_CTX_set_ssl_version | ||
| 67 | and | ||
| 68 | .Fn SSL_set_ssl_method : | ||
| 69 | .Bl -tag -width Ds | ||
| 70 | .It 0 | ||
| 71 | The new choice failed. | ||
| 72 | Check the error stack to find out the reason. | ||
| 73 | .It 1 | ||
| 74 | The operation succeeded. | ||
| 75 | .El | ||
| 76 | .Sh SEE ALSO | ||
| 77 | .Xr ssl 3 , | ||
| 78 | .Xr SSL_clear 3 , | ||
| 79 | .Xr SSL_CTX_new 3 , | ||
| 80 | .Xr SSL_new 3 , | ||
| 81 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_timeout.3 b/src/lib/libssl/man/SSL_CTX_set_timeout.3 new file mode 100644 index 0000000000..d8d699352e --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_timeout.3 | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_timeout.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_TIMEOUT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_timeout , | ||
| 9 | .Nm SSL_CTX_get_timeout | ||
| 10 | .Nd manipulate timeout values for session caching | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft long | ||
| 14 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
| 15 | .Ft long | ||
| 16 | .Fn SSL_CTX_get_timeout "SSL_CTX *ctx" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_set_timeout | ||
| 19 | sets the timeout for newly created sessions for | ||
| 20 | .Fa ctx | ||
| 21 | to | ||
| 22 | .Fa t . | ||
| 23 | The timeout value | ||
| 24 | .Fa t | ||
| 25 | must be given in seconds. | ||
| 26 | .Pp | ||
| 27 | .Fn SSL_CTX_get_timeout | ||
| 28 | returns the currently set timeout value for | ||
| 29 | .Fa ctx . | ||
| 30 | .Sh NOTES | ||
| 31 | Whenever a new session is created, it is assigned a maximum lifetime. | ||
| 32 | This lifetime is specified by storing the creation time of the session and the | ||
| 33 | timeout value valid at this time. | ||
| 34 | If the actual time is later than creation time plus timeout, | ||
| 35 | the session is not reused. | ||
| 36 | .Pp | ||
| 37 | Due to this realization, all sessions behave according to the timeout value | ||
| 38 | valid at the time of the session negotiation. | ||
| 39 | Changes of the timeout value do not affect already established sessions. | ||
| 40 | .Pp | ||
| 41 | The expiration time of a single session can be modified using the | ||
| 42 | .Xr SSL_SESSION_get_time 3 | ||
| 43 | family of functions. | ||
| 44 | .Pp | ||
| 45 | Expired sessions are removed from the internal session cache, whenever | ||
| 46 | .Xr SSL_CTX_flush_sessions 3 | ||
| 47 | is called, either directly by the application or automatically (see | ||
| 48 | .Xr SSL_CTX_set_session_cache_mode 3 ) . | ||
| 49 | .Pp | ||
| 50 | The default value for session timeout is decided on a per-protocol basis; see | ||
| 51 | .Xr SSL_get_default_timeout 3 . | ||
| 52 | All currently supported protocols have the same default timeout value of 300 | ||
| 53 | seconds. | ||
| 54 | .Sh RETURN VALUES | ||
| 55 | .Fn SSL_CTX_set_timeout | ||
| 56 | returns the previously set timeout value. | ||
| 57 | .Pp | ||
| 58 | .Fn SSL_CTX_get_timeout | ||
| 59 | returns the currently set timeout value. | ||
| 60 | .Sh SEE ALSO | ||
| 61 | .Xr ssl 3 , | ||
| 62 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 63 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 64 | .Xr SSL_get_default_timeout 3 , | ||
| 65 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 new file mode 100644 index 0000000000..ad734839a9 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3 | |||
| @@ -0,0 +1,235 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_tmp_dh_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_TMP_DH_CALLBACK 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_tmp_dh_callback , | ||
| 9 | .Nm SSL_CTX_set_tmp_dh , | ||
| 10 | .Nm SSL_set_tmp_dh_callback , | ||
| 11 | .Nm SSL_set_tmp_dh | ||
| 12 | .Nd handle DH keys for ephemeral key exchange | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fo SSL_CTX_set_tmp_dh_callback | ||
| 17 | .Fa "SSL_CTX *ctx" | ||
| 18 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength)" | ||
| 19 | .Fc | ||
| 20 | .Ft long | ||
| 21 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX *ctx" "DH *dh" | ||
| 22 | .Ft void | ||
| 23 | .Fo SSL_set_tmp_dh_callback | ||
| 24 | .Fa "SSL *ssl" | ||
| 25 | .Fa "DH *(*tmp_dh_callback)(SSL *ssl, int is_export, int keylength" | ||
| 26 | .Fc | ||
| 27 | .Ft long | ||
| 28 | .Fn SSL_set_tmp_dh "SSL *ssl" "DH *dh" | ||
| 29 | .Sh DESCRIPTION | ||
| 30 | .Fn SSL_CTX_set_tmp_dh_callback | ||
| 31 | sets the callback function for | ||
| 32 | .Fa ctx | ||
| 33 | to be used when a DH parameters are required to | ||
| 34 | .Fa tmp_dh_callback . | ||
| 35 | The callback is inherited by all | ||
| 36 | .Vt ssl | ||
| 37 | objects created from | ||
| 38 | .Fa ctx . | ||
| 39 | .Pp | ||
| 40 | .Fn SSL_CTX_set_tmp_dh | ||
| 41 | sets DH parameters to be used to be | ||
| 42 | .Sy dh Ns . | ||
| 43 | The key is inherited by all | ||
| 44 | .Fa ssl | ||
| 45 | objects created from | ||
| 46 | .Fa ctx . | ||
| 47 | .Pp | ||
| 48 | .Fn SSL_set_tmp_dh_callback | ||
| 49 | sets the callback only for | ||
| 50 | .Fa ssl . | ||
| 51 | .Pp | ||
| 52 | .Fn SSL_set_tmp_dh | ||
| 53 | sets the parameters only for | ||
| 54 | .Fa ssl . | ||
| 55 | .Pp | ||
| 56 | These functions apply to SSL/TLS servers only. | ||
| 57 | .Sh NOTES | ||
| 58 | When using a cipher with RSA authentication, | ||
| 59 | an ephemeral DH key exchange can take place. | ||
| 60 | Ciphers with DSA keys always use ephemeral DH keys as well. | ||
| 61 | In these cases, the session data are negotiated using the ephemeral/temporary | ||
| 62 | DH key and the key supplied and certified by the certificate chain is only used | ||
| 63 | for signing. | ||
| 64 | Anonymous ciphers (without a permanent server key) also use ephemeral DH keys. | ||
| 65 | .Pp | ||
| 66 | Using ephemeral DH key exchange yields forward secrecy, | ||
| 67 | as the connection can only be decrypted when the DH key is known. | ||
| 68 | By generating a temporary DH key inside the server application that is lost | ||
| 69 | when the application is left, it becomes impossible for an attacker to decrypt | ||
| 70 | past sessions, even if he gets hold of the normal (certified) key, | ||
| 71 | as this key was only used for signing. | ||
| 72 | .Pp | ||
| 73 | In order to perform a DH key exchange the server must use a DH group | ||
| 74 | (DH parameters) and generate a DH key. | ||
| 75 | The server will always generate a new DH key during the negotiation, | ||
| 76 | when the DH parameters are supplied via callback and/or when the | ||
| 77 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 78 | option of | ||
| 79 | .Xr SSL_CTX_set_options 3 | ||
| 80 | is set. | ||
| 81 | It will immediately create a DH key, when DH parameters are supplied via | ||
| 82 | .Fn SSL_CTX_set_tmp_dh | ||
| 83 | and | ||
| 84 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 85 | is not set. | ||
| 86 | In this case, it may happen that a key is generated on initialization without | ||
| 87 | later being needed, while on the other hand the computer time during the | ||
| 88 | negotiation is being saved. | ||
| 89 | .Pp | ||
| 90 | If | ||
| 91 | .Dq strong | ||
| 92 | primes were used to generate the DH parameters, it is not strictly necessary to | ||
| 93 | generate a new key for each handshake but it does improve forward secrecy. | ||
| 94 | If it is not assured that | ||
| 95 | .Dq strong | ||
| 96 | primes were used (see especially the section about DSA parameters below), | ||
| 97 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 98 | must be used in order to prevent small subgroup attacks. | ||
| 99 | Always using | ||
| 100 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 101 | has an impact on the computer time needed during negotiation, | ||
| 102 | but it is not very large, | ||
| 103 | so application authors/users should consider always enabling this option. | ||
| 104 | .Pp | ||
| 105 | As generating DH parameters is extremely time consuming, an application should | ||
| 106 | not generate the parameters on the fly but supply the parameters. | ||
| 107 | DH parameters can be reused, | ||
| 108 | as the actual key is newly generated during the negotiation. | ||
| 109 | The risk in reusing DH parameters is that an attacker may specialize on a very | ||
| 110 | often used DH group. | ||
| 111 | Applications should therefore generate their own DH parameters during the | ||
| 112 | installation process using the openssl | ||
| 113 | .Xr openssl 1 | ||
| 114 | application. | ||
| 115 | In order to reduce the computer time needed for this generation, | ||
| 116 | it is possible to use DSA parameters instead (see | ||
| 117 | .Xr openssl 1 ) , | ||
| 118 | but in this case | ||
| 119 | .Dv SSL_OP_SINGLE_DH_USE | ||
| 120 | is mandatory. | ||
| 121 | .Pp | ||
| 122 | Application authors may compile in DH parameters. | ||
| 123 | Files | ||
| 124 | .Pa dh512.pem , | ||
| 125 | .Pa dh1024.pem , | ||
| 126 | .Pa dh2048.pem , | ||
| 127 | and | ||
| 128 | .Pa dh4096.pem | ||
| 129 | in the | ||
| 130 | .Pa apps | ||
| 131 | directory of the current version of the OpenSSL distribution contain the | ||
| 132 | .Sq SKIP | ||
| 133 | DH parameters, | ||
| 134 | which use safe primes and were generated verifiably pseudo-randomly. | ||
| 135 | These files can be converted into C code using the | ||
| 136 | .Fl C | ||
| 137 | option of the | ||
| 138 | .Xr openssl 1 | ||
| 139 | application. | ||
| 140 | Authors may also generate their own set of parameters using | ||
| 141 | .Xr openssl 1 , | ||
| 142 | but a user may not be sure how the parameters were generated. | ||
| 143 | The generation of DH parameters during installation is therefore recommended. | ||
| 144 | .Pp | ||
| 145 | An application may either directly specify the DH parameters or can supply the | ||
| 146 | DH parameters via a callback function. | ||
| 147 | The callback approach has the advantage that the callback may supply DH | ||
| 148 | parameters for different key lengths. | ||
| 149 | .Pp | ||
| 150 | The | ||
| 151 | .Fa tmp_dh_callback | ||
| 152 | is called with the | ||
| 153 | .Fa keylength | ||
| 154 | needed and the | ||
| 155 | .Fa is_export | ||
| 156 | information. | ||
| 157 | The | ||
| 158 | .Fa is_export | ||
| 159 | flag is set when the ephemeral DH key exchange is performed with an export | ||
| 160 | cipher. | ||
| 161 | .Sh RETURN VALUES | ||
| 162 | .Fn SSL_CTX_set_tmp_dh_callback | ||
| 163 | and | ||
| 164 | .Fn SSL_set_tmp_dh_callback | ||
| 165 | do not return diagnostic output. | ||
| 166 | .Pp | ||
| 167 | .Fn SSL_CTX_set_tmp_dh | ||
| 168 | and | ||
| 169 | .Fn SSL_set_tmp_dh | ||
| 170 | do return 1 on success and 0 on failure. | ||
| 171 | Check the error queue to find out the reason of failure. | ||
| 172 | .Sh EXAMPLES | ||
| 173 | Handle DH parameters for key lengths of 512 and 1024 bits. | ||
| 174 | (Error handling partly left out.) | ||
| 175 | .Bd -literal | ||
| 176 | \&... | ||
| 177 | /* Set up ephemeral DH stuff */ | ||
| 178 | DH *dh_512 = NULL; | ||
| 179 | DH *dh_1024 = NULL; | ||
| 180 | FILE *paramfile; | ||
| 181 | |||
| 182 | \&... | ||
| 183 | |||
| 184 | /* "openssl dhparam -out dh_param_512.pem -2 512" */ | ||
| 185 | paramfile = fopen("dh_param_512.pem", "r"); | ||
| 186 | if (paramfile) { | ||
| 187 | dh_512 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
| 188 | fclose(paramfile); | ||
| 189 | } | ||
| 190 | /* "openssl dhparam -out dh_param_1024.pem -2 1024" */ | ||
| 191 | paramfile = fopen("dh_param_1024.pem", "r"); | ||
| 192 | if (paramfile) { | ||
| 193 | dh_1024 = PEM_read_DHparams(paramfile, NULL, NULL, NULL); | ||
| 194 | fclose(paramfile); | ||
| 195 | } | ||
| 196 | |||
| 197 | \&... | ||
| 198 | |||
| 199 | /* "openssl dhparam -C -2 512" etc... */ | ||
| 200 | DH *get_dh512() { ... } | ||
| 201 | DH *get_dh1024() { ... } | ||
| 202 | |||
| 203 | DH * | ||
| 204 | tmp_dh_callback(SSL *s, int is_export, int keylength) | ||
| 205 | { | ||
| 206 | DH *dh_tmp=NULL; | ||
| 207 | |||
| 208 | switch (keylength) { | ||
| 209 | case 512: | ||
| 210 | if (!dh_512) | ||
| 211 | dh_512 = get_dh512(); | ||
| 212 | dh_tmp = dh_512; | ||
| 213 | break; | ||
| 214 | case 1024: | ||
| 215 | if (!dh_1024) | ||
| 216 | dh_1024 = get_dh1024(); | ||
| 217 | dh_tmp = dh_1024; | ||
| 218 | break; | ||
| 219 | default: | ||
| 220 | /* | ||
| 221 | * Generating a key on the fly is very costly, | ||
| 222 | * so use what is there | ||
| 223 | */ | ||
| 224 | setup_dh_parameters_like_above(); | ||
| 225 | } | ||
| 226 | |||
| 227 | return(dh_tmp); | ||
| 228 | } | ||
| 229 | .Ed | ||
| 230 | .Sh SEE ALSO | ||
| 231 | .Xr openssl 1 , | ||
| 232 | .Xr ssl 3 , | ||
| 233 | .Xr SSL_CTX_set_cipher_list 3 , | ||
| 234 | .Xr SSL_CTX_set_options 3 , | ||
| 235 | .Xr SSL_CTX_set_tmp_rsa_callback 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 new file mode 100644 index 0000000000..bf68f49206 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3 | |||
| @@ -0,0 +1,231 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_tmp_rsa_callback.3,v 1.1 2016/11/05 15:32:19 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_TMP_RSA_CALLBACK.POD 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_tmp_rsa_callback , | ||
| 9 | .Nm SSL_CTX_set_tmp_rsa , | ||
| 10 | .Nm SSL_CTX_need_tmp_rsa , | ||
| 11 | .Nm SSL_set_tmp_rsa_callback , | ||
| 12 | .Nm SSL_set_tmp_rsa , | ||
| 13 | .Nm SSL_need_tmp_rsa | ||
| 14 | .Nd handle RSA keys for ephemeral key exchange | ||
| 15 | .Sh SYNOPSIS | ||
| 16 | .In openssl/ssl.h | ||
| 17 | .Ft void | ||
| 18 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
| 19 | .Fa "SSL_CTX *ctx" | ||
| 20 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
| 21 | .Fc | ||
| 22 | .Ft long | ||
| 23 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
| 24 | .Ft long | ||
| 25 | .Fn SSL_CTX_need_tmp_rsa "SSL_CTX *ctx" | ||
| 26 | .Ft void | ||
| 27 | .Fo SSL_set_tmp_rsa_callback | ||
| 28 | .Fa "SSL_CTX *ctx" | ||
| 29 | .Fa "RSA *(*tmp_rsa_callback)(SSL *ssl, int is_export, int keylength)" | ||
| 30 | .Fc | ||
| 31 | .Ft long | ||
| 32 | .Fn SSL_set_tmp_rsa "SSL *ssl" "RSA *rsa" | ||
| 33 | .Ft long | ||
| 34 | .Fn SSL_need_tmp_rsa "SSL *ssl" | ||
| 35 | .Ft RSA * | ||
| 36 | .Fn "(*tmp_rsa_callback)" "SSL *ssl" "int is_export" "int keylength" | ||
| 37 | .Sh DESCRIPTION | ||
| 38 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
| 39 | sets the callback function for | ||
| 40 | .Fa ctx | ||
| 41 | to be used when a temporary/ephemeral RSA key is required to | ||
| 42 | .Fa tmp_rsa_callback . | ||
| 43 | The callback is inherited by all | ||
| 44 | .Vt SSL | ||
| 45 | objects newly created from | ||
| 46 | .Fa ctx | ||
| 47 | with | ||
| 48 | .Xr SSL_new 3 . | ||
| 49 | Already created SSL objects are not affected. | ||
| 50 | .Pp | ||
| 51 | .Fn SSL_CTX_set_tmp_rsa | ||
| 52 | sets the temporary/ephemeral RSA key to be used to be | ||
| 53 | .Fa rsa . | ||
| 54 | The key is inherited by all | ||
| 55 | .Vt SSL | ||
| 56 | objects newly created from | ||
| 57 | .Fa ctx | ||
| 58 | with | ||
| 59 | .Xr SSL_new 3 . | ||
| 60 | Already created SSL objects are not affected. | ||
| 61 | .Pp | ||
| 62 | .Fn SSL_CTX_need_tmp_rsa | ||
| 63 | returns 1, | ||
| 64 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
| 65 | .Sq exportable | ||
| 66 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
| 67 | .Pp | ||
| 68 | .Fn SSL_set_tmp_rsa_callback | ||
| 69 | sets the callback only for | ||
| 70 | .Fa ssl . | ||
| 71 | .Pp | ||
| 72 | .Fn SSL_set_tmp_rsa | ||
| 73 | sets the key only for | ||
| 74 | .Fa ssl . | ||
| 75 | .Pp | ||
| 76 | .Fn SSL_need_tmp_rsa | ||
| 77 | returns 1, | ||
| 78 | if a temporary/ephemeral RSA key is needed for RSA-based strength-limited | ||
| 79 | .Sq exportable | ||
| 80 | ciphersuites because a RSA key with a keysize larger than 512 bits is installed. | ||
| 81 | .Pp | ||
| 82 | These functions apply to SSL/TLS servers only. | ||
| 83 | .Sh NOTES | ||
| 84 | When using a cipher with RSA authentication, | ||
| 85 | an ephemeral RSA key exchange can take place. | ||
| 86 | In this case the session data are negotiated using the ephemeral/temporary RSA | ||
| 87 | key and the RSA key supplied and certified by the certificate chain is only | ||
| 88 | used for signing. | ||
| 89 | .Pp | ||
| 90 | Under previous export restrictions, ciphers with RSA keys shorter (512 bits) | ||
| 91 | than the usual key length of 1024 bits were created. | ||
| 92 | To use these ciphers with RSA keys of usual length, an ephemeral key exchange | ||
| 93 | must be performed, as the normal (certified) key cannot be directly used. | ||
| 94 | .Pp | ||
| 95 | Using ephemeral RSA key exchange yields forward secrecy, | ||
| 96 | as the connection can only be decrypted when the RSA key is known. | ||
| 97 | By generating a temporary RSA key inside the server application that is lost | ||
| 98 | when the application is left, it becomes impossible for an attacker to decrypt | ||
| 99 | past sessions, even if he gets hold of the normal (certified) RSA key, | ||
| 100 | as this key was used for signing only. | ||
| 101 | The downside is that creating a RSA key is computationally expensive. | ||
| 102 | .Pp | ||
| 103 | Additionally, the use of ephemeral RSA key exchange is only allowed in the TLS | ||
| 104 | standard when the RSA key can be used for signing only, that is, | ||
| 105 | for export ciphers. | ||
| 106 | Using ephemeral RSA key exchange for other purposes violates the standard and | ||
| 107 | can break interoperability with clients. | ||
| 108 | It is therefore strongly recommended to not use ephemeral RSA key exchange and | ||
| 109 | use EDH (Ephemeral Diffie-Hellman) key exchange instead in order to achieve | ||
| 110 | forward secrecy (see | ||
| 111 | .Xr SSL_CTX_set_tmp_dh_callback 3 ) . | ||
| 112 | .Pp | ||
| 113 | On OpenSSL servers ephemeral RSA key exchange is therefore disabled by default | ||
| 114 | and must be explicitly enabled using the | ||
| 115 | .Dv SSL_OP_EPHEMERAL_RSA | ||
| 116 | option of | ||
| 117 | .Xr SSL_CTX_set_options 3 , | ||
| 118 | violating the TLS/SSL | ||
| 119 | standard. | ||
| 120 | When ephemeral RSA key exchange is required for export ciphers, | ||
| 121 | it will automatically be used without this option! | ||
| 122 | .Pp | ||
| 123 | An application may either directly specify the key or can supply the key via | ||
| 124 | a callback function. | ||
| 125 | The callback approach has the advantage that the callback may generate the key | ||
| 126 | only in case it is actually needed. | ||
| 127 | However, as the generation of a RSA key is costly, | ||
| 128 | it will lead to a significant delay in the handshake procedure. | ||
| 129 | Another advantage of the callback function is that it can supply keys of | ||
| 130 | different size (e.g., for | ||
| 131 | .Dv SSL_OP_EPHEMERAL_RSA | ||
| 132 | usage) while the explicit setting of the key is only useful for key size of | ||
| 133 | 512 bits to satisfy the export restricted ciphers and does give away key length | ||
| 134 | if a longer key would be allowed. | ||
| 135 | .Pp | ||
| 136 | The | ||
| 137 | .Fa tmp_rsa_callback | ||
| 138 | is called with the | ||
| 139 | .Fa keylength | ||
| 140 | needed and the | ||
| 141 | .Fa is_export | ||
| 142 | information. | ||
| 143 | The | ||
| 144 | .Fa is_export | ||
| 145 | flag is set when the ephemeral RSA key exchange is performed with an export | ||
| 146 | cipher. | ||
| 147 | .Sh RETURN VALUES | ||
| 148 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
| 149 | and | ||
| 150 | .Fn SSL_set_tmp_rsa_callback | ||
| 151 | do not return diagnostic output. | ||
| 152 | .Pp | ||
| 153 | .Fn SSL_CTX_set_tmp_rsa | ||
| 154 | and | ||
| 155 | .Fn SSL_set_tmp_rsa | ||
| 156 | return 1 on success and 0 on failure. | ||
| 157 | Check the error queue to find out the reason of failure. | ||
| 158 | .Pp | ||
| 159 | .Fn SSL_CTX_need_tmp_rsa | ||
| 160 | and | ||
| 161 | .Fn SSL_need_tmp_rsa | ||
| 162 | return 1 if a temporary RSA key is needed and 0 otherwise. | ||
| 163 | .Sh EXAMPLES | ||
| 164 | Generate temporary RSA keys to prepare ephemeral RSA key exchange. | ||
| 165 | As the generation of a RSA key costs a lot of computer time, | ||
| 166 | they are saved for later reuse. | ||
| 167 | For demonstration purposes, two keys for 512 bits and 1024 bits | ||
| 168 | respectively are generated. | ||
| 169 | .Bd -literal | ||
| 170 | \&... | ||
| 171 | |||
| 172 | /* Set up ephemeral RSA stuff */ | ||
| 173 | RSA *rsa_512 = NULL; | ||
| 174 | RSA *rsa_1024 = NULL; | ||
| 175 | |||
| 176 | rsa_512 = RSA_generate_key(512, RSA_F4, NULL, NULL); | ||
| 177 | if (rsa_512 == NULL) | ||
| 178 | evaluate_error_queue(); | ||
| 179 | |||
| 180 | rsa_1024 = RSA_generate_key(1024, RSA_F4, NULL, NULL); | ||
| 181 | if (rsa_1024 == NULL) | ||
| 182 | evaluate_error_queue(); | ||
| 183 | |||
| 184 | \&... | ||
| 185 | |||
| 186 | RSA * | ||
| 187 | tmp_rsa_callback(SSL *s, int is_export, int keylength) | ||
| 188 | { | ||
| 189 | RSA *rsa_tmp = NULL; | ||
| 190 | |||
| 191 | switch (keylength) { | ||
| 192 | case 512: | ||
| 193 | if (rsa_512) | ||
| 194 | rsa_tmp = rsa_512; | ||
| 195 | else { | ||
| 196 | /* | ||
| 197 | * generate on the fly, | ||
| 198 | * should not happen in this example | ||
| 199 | */ | ||
| 200 | rsa_tmp = RSA_generate_key(keylength, RSA_F4, NULL, | ||
| 201 | NULL); | ||
| 202 | rsa_512 = rsa_tmp; /* Remember for later reuse */ | ||
| 203 | } | ||
| 204 | break; | ||
| 205 | case 1024: | ||
| 206 | if (rsa_1024) | ||
| 207 | rsa_tmp = rsa_1024; | ||
| 208 | else | ||
| 209 | should_not_happen_in_this_example(); | ||
| 210 | break; | ||
| 211 | default: | ||
| 212 | /* | ||
| 213 | * Generating a key on the fly is very costly, | ||
| 214 | * so use what is there | ||
| 215 | */ | ||
| 216 | if (rsa_1024) | ||
| 217 | rsa_tmp = rsa_1024; | ||
| 218 | else | ||
| 219 | /* Use at least a shorter key */ | ||
| 220 | rsa_tmp = rsa_512; | ||
| 221 | } | ||
| 222 | return rsa_tmp; | ||
| 223 | } | ||
| 224 | .Ed | ||
| 225 | .Sh SEE ALSO | ||
| 226 | .Xr openssl 1 , | ||
| 227 | .Xr ssl 3 , | ||
| 228 | .Xr SSL_CTX_set_cipher_list 3 , | ||
| 229 | .Xr SSL_CTX_set_options 3 , | ||
| 230 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
| 231 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/man/SSL_CTX_set_verify.3 b/src/lib/libssl/man/SSL_CTX_set_verify.3 new file mode 100644 index 0000000000..d9821146e7 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_set_verify.3 | |||
| @@ -0,0 +1,415 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_set_verify.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_SET_VERIFY 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_set_verify , | ||
| 9 | .Nm SSL_set_verify , | ||
| 10 | .Nm SSL_CTX_set_verify_depth , | ||
| 11 | .Nm SSL_set_verify_depth | ||
| 12 | .Nd set peer certificate verification parameters | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft void | ||
| 16 | .Fo SSL_CTX_set_verify | ||
| 17 | .Fa "SSL_CTX *ctx" | ||
| 18 | .Fa "int mode" | ||
| 19 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
| 20 | .Fc | ||
| 21 | .Ft void | ||
| 22 | .Fo SSL_set_verify | ||
| 23 | .Fa "SSL *s" | ||
| 24 | .Fa "int mode" | ||
| 25 | .Fa "int (*verify_callback)(int, X509_STORE_CTX *)" | ||
| 26 | .Fc | ||
| 27 | .Ft void | ||
| 28 | .Fn SSL_CTX_set_verify_depth "SSL_CTX *ctx" "int depth" | ||
| 29 | .Ft void | ||
| 30 | .Fn SSL_set_verify_depth "SSL *s" "int depth" | ||
| 31 | .Ft int | ||
| 32 | .Fn verify_callback "int preverify_ok" "X509_STORE_CTX *x509_ctx" | ||
| 33 | .Sh DESCRIPTION | ||
| 34 | .Fn SSL_CTX_set_verify | ||
| 35 | sets the verification flags for | ||
| 36 | .Fa ctx | ||
| 37 | to be | ||
| 38 | .Fa mode | ||
| 39 | and | ||
| 40 | specifies the | ||
| 41 | .Fa verify_callback | ||
| 42 | function to be used. | ||
| 43 | If no callback function shall be specified, the | ||
| 44 | .Dv NULL | ||
| 45 | pointer can be used for | ||
| 46 | .Fa verify_callback . | ||
| 47 | .Pp | ||
| 48 | .Fn SSL_set_verify | ||
| 49 | sets the verification flags for | ||
| 50 | .Fa ssl | ||
| 51 | to be | ||
| 52 | .Fa mode | ||
| 53 | and specifies the | ||
| 54 | .Fa verify_callback | ||
| 55 | function to be used. | ||
| 56 | If no callback function shall be specified, the | ||
| 57 | .Dv NULL | ||
| 58 | pointer can be used for | ||
| 59 | .Fa verify_callback . | ||
| 60 | In this case last | ||
| 61 | .Fa verify_callback | ||
| 62 | set specifically for this | ||
| 63 | .Fa ssl | ||
| 64 | remains. | ||
| 65 | If no special callback was set before, the default callback for the underlying | ||
| 66 | .Fa ctx | ||
| 67 | is used, that was valid at the time | ||
| 68 | .Fa ssl | ||
| 69 | was created with | ||
| 70 | .Xr SSL_new 3 . | ||
| 71 | .Pp | ||
| 72 | .Fn SSL_CTX_set_verify_depth | ||
| 73 | sets the maximum | ||
| 74 | .Fa depth | ||
| 75 | for the certificate chain verification that shall be allowed for | ||
| 76 | .Fa ctx . | ||
| 77 | (See the | ||
| 78 | .Sx BUGS | ||
| 79 | section.) | ||
| 80 | .Pp | ||
| 81 | .Fn SSL_set_verify_depth | ||
| 82 | sets the maximum | ||
| 83 | .Fa depth | ||
| 84 | for the certificate chain verification that shall be allowed for | ||
| 85 | .Fa ssl . | ||
| 86 | (See the | ||
| 87 | .Sx BUGS | ||
| 88 | section.) | ||
| 89 | .Sh NOTES | ||
| 90 | The verification of certificates can be controlled by a set of bitwise ORed | ||
| 91 | .Fa mode | ||
| 92 | flags: | ||
| 93 | .Bl -tag -width Ds | ||
| 94 | .It Dv SSL_VERIFY_NONE | ||
| 95 | .Em Server mode: | ||
| 96 | the server will not send a client certificate request to the client, | ||
| 97 | so the client will not send a certificate. | ||
| 98 | .Pp | ||
| 99 | .Em Client mode: | ||
| 100 | if not using an anonymous cipher (by default disabled), | ||
| 101 | the server will send a certificate which will be checked. | ||
| 102 | The result of the certificate verification process can be checked after the | ||
| 103 | TLS/SSL handshake using the | ||
| 104 | .Xr SSL_get_verify_result 3 | ||
| 105 | function. | ||
| 106 | The handshake will be continued regardless of the verification result. | ||
| 107 | .It Dv SSL_VERIFY_PEER | ||
| 108 | .Em Server mode: | ||
| 109 | the server sends a client certificate request to the client. | ||
| 110 | The certificate returned (if any) is checked. | ||
| 111 | If the verification process fails, | ||
| 112 | the TLS/SSL handshake is immediately terminated with an alert message | ||
| 113 | containing the reason for the verification failure. | ||
| 114 | The behaviour can be controlled by the additional | ||
| 115 | .Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
| 116 | and | ||
| 117 | .Dv SSL_VERIFY_CLIENT_ONCE | ||
| 118 | flags. | ||
| 119 | .Pp | ||
| 120 | .Em Client mode: | ||
| 121 | the server certificate is verified. | ||
| 122 | If the verification process fails, | ||
| 123 | the TLS/SSL handshake is immediately terminated with an alert message | ||
| 124 | containing the reason for the verification failure. | ||
| 125 | If no server certificate is sent, because an anonymous cipher is used, | ||
| 126 | .Dv SSL_VERIFY_PEER | ||
| 127 | is ignored. | ||
| 128 | .It Dv SSL_VERIFY_FAIL_IF_NO_PEER_CERT | ||
| 129 | .Em Server mode: | ||
| 130 | if the client did not return a certificate, the TLS/SSL | ||
| 131 | handshake is immediately terminated with a | ||
| 132 | .Dq handshake failure | ||
| 133 | alert. | ||
| 134 | This flag must be used together with | ||
| 135 | .Dv SSL_VERIFY_PEER. | ||
| 136 | .Pp | ||
| 137 | .Em Client mode: | ||
| 138 | ignored | ||
| 139 | .It Dv SSL_VERIFY_CLIENT_ONCE | ||
| 140 | .Em Server mode: | ||
| 141 | only request a client certificate on the initial TLS/SSL handshake. | ||
| 142 | Do not ask for a client certificate again in case of a renegotiation. | ||
| 143 | This flag must be used together with | ||
| 144 | .Dv SSL_VERIFY_PEER . | ||
| 145 | .Pp | ||
| 146 | .Em Client mode: | ||
| 147 | ignored | ||
| 148 | .El | ||
| 149 | .Pp | ||
| 150 | Exactly one of the | ||
| 151 | .Fa mode | ||
| 152 | flags | ||
| 153 | .Dv SSL_VERIFY_NONE | ||
| 154 | and | ||
| 155 | .Dv SSL_VERIFY_PEER | ||
| 156 | must be set at any time. | ||
| 157 | .Pp | ||
| 158 | The actual verification procedure is performed either using the built-in | ||
| 159 | verification procedure or using another application provided verification | ||
| 160 | function set with | ||
| 161 | .Xr SSL_CTX_set_cert_verify_callback 3 . | ||
| 162 | The following descriptions apply in the case of the built-in procedure. | ||
| 163 | An application provided procedure also has access to the verify depth | ||
| 164 | information and the | ||
| 165 | .Fa verify_callback Ns () | ||
| 166 | function, but the way this information is used may be different. | ||
| 167 | .Pp | ||
| 168 | .Fn SSL_CTX_set_verify_depth | ||
| 169 | and | ||
| 170 | .Fn SSL_set_verify_depth | ||
| 171 | set the limit up to which depth certificates in a chain are used during the | ||
| 172 | verification procedure. | ||
| 173 | If the certificate chain is longer than allowed, | ||
| 174 | the certificates above the limit are ignored. | ||
| 175 | Error messages are generated as if these certificates would not be present, | ||
| 176 | most likely a | ||
| 177 | .Dv X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY | ||
| 178 | will be issued. | ||
| 179 | The depth count is | ||
| 180 | .Dq level 0: peer certificate , | ||
| 181 | .Dq level 1: CA certificate , | ||
| 182 | .Dq level 2: higher level CA certificate , | ||
| 183 | and so on. | ||
| 184 | Setting the maximum depth to 2 allows the levels 0, 1, and 2. | ||
| 185 | The default depth limit is 100, | ||
| 186 | allowing for the peer certificate and an additional 100 CA certificates. | ||
| 187 | .Pp | ||
| 188 | The | ||
| 189 | .Fa verify_callback | ||
| 190 | function is used to control the behaviour when the | ||
| 191 | .Dv SSL_VERIFY_PEER | ||
| 192 | flag is set. | ||
| 193 | It must be supplied by the application and receives two arguments: | ||
| 194 | .Fa preverify_ok | ||
| 195 | indicates whether the verification of the certificate in question was passed | ||
| 196 | (preverify_ok=1) or not (preverify_ok=0). | ||
| 197 | .Fa x509_ctx | ||
| 198 | is a pointer to the complete context used | ||
| 199 | for the certificate chain verification. | ||
| 200 | .Pp | ||
| 201 | The certificate chain is checked starting with the deepest nesting level | ||
| 202 | (the root CA certificate) and worked upward to the peer's certificate. | ||
| 203 | At each level signatures and issuer attributes are checked. | ||
| 204 | Whenever a verification error is found, the error number is stored in | ||
| 205 | .Fa x509_ctx | ||
| 206 | and | ||
| 207 | .Fa verify_callback | ||
| 208 | is called with | ||
| 209 | .Fa preverify_ok | ||
| 210 | equal to 0. | ||
| 211 | By applying | ||
| 212 | .Fn X509_CTX_store_* | ||
| 213 | functions | ||
| 214 | .Fa verify_callback | ||
| 215 | can locate the certificate in question and perform additional steps (see | ||
| 216 | .Sx EXAMPLES ) . | ||
| 217 | If no error is found for a certificate, | ||
| 218 | .Fa verify_callback | ||
| 219 | is called with | ||
| 220 | .Fa preverify_ok | ||
| 221 | equal to 1 before advancing to the next level. | ||
| 222 | .Pp | ||
| 223 | The return value of | ||
| 224 | .Fa verify_callback | ||
| 225 | controls the strategy of the further verification process. | ||
| 226 | If | ||
| 227 | .Fa verify_callback | ||
| 228 | returns 0, the verification process is immediately stopped with | ||
| 229 | .Dq verification failed | ||
| 230 | state. | ||
| 231 | If | ||
| 232 | .Dv SSL_VERIFY_PEER | ||
| 233 | is set, a verification failure alert is sent to the peer and the TLS/SSL | ||
| 234 | handshake is terminated. | ||
| 235 | If | ||
| 236 | .Fa verify_callback | ||
| 237 | returns 1, the verification process is continued. | ||
| 238 | If | ||
| 239 | .Fa verify_callback | ||
| 240 | always returns 1, | ||
| 241 | the TLS/SSL handshake will not be terminated with respect to verification | ||
| 242 | failures and the connection will be established. | ||
| 243 | The calling process can however retrieve the error code of the last | ||
| 244 | verification error using | ||
| 245 | .Xr SSL_get_verify_result 3 | ||
| 246 | or by maintaining its own error storage managed by | ||
| 247 | .Fa verify_callback . | ||
| 248 | .Pp | ||
| 249 | If no | ||
| 250 | .Fa verify_callback | ||
| 251 | is specified, the default callback will be used. | ||
| 252 | Its return value is identical to | ||
| 253 | .Fa preverify_ok , | ||
| 254 | so that any verification | ||
| 255 | failure will lead to a termination of the TLS/SSL handshake with an | ||
| 256 | alert message, if | ||
| 257 | .Dv SSL_VERIFY_PEER | ||
| 258 | is set. | ||
| 259 | .Sh RETURN VALUES | ||
| 260 | The | ||
| 261 | .Fn SSL*_set_verify* | ||
| 262 | functions do not provide diagnostic information. | ||
| 263 | .Sh EXAMPLES | ||
| 264 | The following code sequence realizes an example | ||
| 265 | .Fa verify_callback | ||
| 266 | function that will always continue the TLS/SSL handshake regardless of | ||
| 267 | verification failure, if wished. | ||
| 268 | The callback realizes a verification depth limit with more informational output. | ||
| 269 | .Pp | ||
| 270 | All verification errors are printed; | ||
| 271 | information about the certificate chain is printed on request. | ||
| 272 | The example is realized for a server that does allow but not require client | ||
| 273 | certificates. | ||
| 274 | .Pp | ||
| 275 | The example makes use of the ex_data technique to store application data | ||
| 276 | into/retrieve application data from the | ||
| 277 | .Vt SSL | ||
| 278 | structure (see | ||
| 279 | .Xr SSL_get_ex_new_index 3 , | ||
| 280 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 ) . | ||
| 281 | .Bd -literal | ||
| 282 | \&... | ||
| 283 | |||
| 284 | typedef struct { | ||
| 285 | int verbose_mode; | ||
| 286 | int verify_depth; | ||
| 287 | int always_continue; | ||
| 288 | } mydata_t; | ||
| 289 | int mydata_index; | ||
| 290 | \&... | ||
| 291 | static int | ||
| 292 | verify_callback(int preverify_ok, X509_STORE_CTX *ctx) | ||
| 293 | { | ||
| 294 | char buf[256]; | ||
| 295 | X509 *err_cert; | ||
| 296 | int err, depth; | ||
| 297 | SSL *ssl; | ||
| 298 | mydata_t *mydata; | ||
| 299 | |||
| 300 | err_cert = X509_STORE_CTX_get_current_cert(ctx); | ||
| 301 | err = X509_STORE_CTX_get_error(ctx); | ||
| 302 | depth = X509_STORE_CTX_get_error_depth(ctx); | ||
| 303 | |||
| 304 | /* | ||
| 305 | * Retrieve the pointer to the SSL of the connection currently | ||
| 306 | * treated * and the application specific data stored into the | ||
| 307 | * SSL object. | ||
| 308 | */ | ||
| 309 | ssl = X509_STORE_CTX_get_ex_data(ctx, | ||
| 310 | SSL_get_ex_data_X509_STORE_CTX_idx()); | ||
| 311 | mydata = SSL_get_ex_data(ssl, mydata_index); | ||
| 312 | |||
| 313 | X509_NAME_oneline(X509_get_subject_name(err_cert), buf, 256); | ||
| 314 | |||
| 315 | /* | ||
| 316 | * Catch a too long certificate chain. The depth limit set using | ||
| 317 | * SSL_CTX_set_verify_depth() is by purpose set to "limit+1" so | ||
| 318 | * that whenever the "depth>verify_depth" condition is met, we | ||
| 319 | * have violated the limit and want to log this error condition. | ||
| 320 | * We must do it here, because the CHAIN_TOO_LONG error would not | ||
| 321 | * be found explicitly; only errors introduced by cutting off the | ||
| 322 | * additional certificates would be logged. | ||
| 323 | */ | ||
| 324 | if (depth > mydata->verify_depth) { | ||
| 325 | preverify_ok = 0; | ||
| 326 | err = X509_V_ERR_CERT_CHAIN_TOO_LONG; | ||
| 327 | X509_STORE_CTX_set_error(ctx, err); | ||
| 328 | } | ||
| 329 | if (!preverify_ok) { | ||
| 330 | printf("verify error:num=%d:%s:depth=%d:%s\en", err, | ||
| 331 | X509_verify_cert_error_string(err), depth, buf); | ||
| 332 | } else if (mydata->verbose_mode) { | ||
| 333 | printf("depth=%d:%s\en", depth, buf); | ||
| 334 | } | ||
| 335 | |||
| 336 | /* | ||
| 337 | * At this point, err contains the last verification error. | ||
| 338 | * We can use it for something special | ||
| 339 | */ | ||
| 340 | if (!preverify_ok && (err == | ||
| 341 | X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT)) { | ||
| 342 | X509_NAME_oneline(X509_get_issuer_name(ctx->current_cert), | ||
| 343 | buf, 256); | ||
| 344 | printf("issuer= %s\en", buf); | ||
| 345 | } | ||
| 346 | |||
| 347 | if (mydata->always_continue) | ||
| 348 | return 1; | ||
| 349 | else | ||
| 350 | return preverify_ok; | ||
| 351 | } | ||
| 352 | \&... | ||
| 353 | |||
| 354 | mydata_t mydata; | ||
| 355 | |||
| 356 | \&... | ||
| 357 | |||
| 358 | mydata_index = SSL_get_ex_new_index(0, "mydata index", NULL, NULL, NULL); | ||
| 359 | |||
| 360 | \&... | ||
| 361 | |||
| 362 | SSL_CTX_set_verify(ctx, SSL_VERIFY_PEER|SSL_VERIFY_CLIENT_ONCE, | ||
| 363 | verify_callback); | ||
| 364 | |||
| 365 | /* | ||
| 366 | * Let the verify_callback catch the verify_depth error so that we get | ||
| 367 | * an appropriate error in the logfile. | ||
| 368 | */ | ||
| 369 | SSL_CTX_set_verify_depth(verify_depth + 1); | ||
| 370 | |||
| 371 | /* | ||
| 372 | * Set up the SSL specific data into "mydata" and store it into the SSL | ||
| 373 | * structure. | ||
| 374 | */ | ||
| 375 | mydata.verify_depth = verify_depth; ... | ||
| 376 | SSL_set_ex_data(ssl, mydata_index, &mydata); | ||
| 377 | |||
| 378 | \&... | ||
| 379 | |||
| 380 | SSL_accept(ssl); /* check of success left out for clarity */ | ||
| 381 | if (peer = SSL_get_peer_certificate(ssl)) { | ||
| 382 | if (SSL_get_verify_result(ssl) == X509_V_OK) { | ||
| 383 | /* The client sent a certificate which verified OK */ | ||
| 384 | } | ||
| 385 | } | ||
| 386 | .Ed | ||
| 387 | .Sh SEE ALSO | ||
| 388 | .Xr ssl 3 , | ||
| 389 | .Xr SSL_CTX_get_verify_mode 3 , | ||
| 390 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 391 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
| 392 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
| 393 | .Xr SSL_get_ex_new_index 3 , | ||
| 394 | .Xr SSL_get_peer_certificate 3 , | ||
| 395 | .Xr SSL_get_verify_result 3 , | ||
| 396 | .Xr SSL_new 3 | ||
| 397 | .Sh BUGS | ||
| 398 | In client mode, it is not checked whether the | ||
| 399 | .Dv SSL_VERIFY_PEER | ||
| 400 | flag is set, but whether | ||
| 401 | .Dv SSL_VERIFY_NONE | ||
| 402 | is not set. | ||
| 403 | This can lead to unexpected behaviour, if the | ||
| 404 | .Dv SSL_VERIFY_PEER | ||
| 405 | and | ||
| 406 | .Dv SSL_VERIFY_NONE | ||
| 407 | are not used as required (exactly one must be set at any time). | ||
| 408 | .Pp | ||
| 409 | The certificate verification depth set with | ||
| 410 | .Fn SSL[_CTX]_verify_depth | ||
| 411 | stops the verification at a certain depth. | ||
| 412 | The error message produced will be that of an incomplete certificate chain and | ||
| 413 | not | ||
| 414 | .Dv X509_V_ERR_CERT_CHAIN_TOO_LONG | ||
| 415 | as may be expected. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_use_certificate.3 b/src/lib/libssl/man/SSL_CTX_use_certificate.3 new file mode 100644 index 0000000000..58a9310533 --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_use_certificate.3 | |||
| @@ -0,0 +1,336 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_use_certificate.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_USE_CERTIFICATE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_use_certificate , | ||
| 9 | .Nm SSL_CTX_use_certificate_ASN1 , | ||
| 10 | .Nm SSL_CTX_use_certificate_file , | ||
| 11 | .Nm SSL_use_certificate , | ||
| 12 | .Nm SSL_use_certificate_ASN1 , | ||
| 13 | .Nm SSL_use_certificate_file , | ||
| 14 | .Nm SSL_CTX_use_certificate_chain_file , | ||
| 15 | .Nm SSL_CTX_use_certificate_chain_mem , | ||
| 16 | .Nm SSL_CTX_use_PrivateKey , | ||
| 17 | .Nm SSL_CTX_use_PrivateKey_ASN1 , | ||
| 18 | .Nm SSL_CTX_use_PrivateKey_file , | ||
| 19 | .Nm SSL_CTX_use_RSAPrivateKey , | ||
| 20 | .Nm SSL_CTX_use_RSAPrivateKey_ASN1 , | ||
| 21 | .Nm SSL_CTX_use_RSAPrivateKey_file , | ||
| 22 | .Nm SSL_use_PrivateKey_file , | ||
| 23 | .Nm SSL_use_PrivateKey_ASN1 , | ||
| 24 | .Nm SSL_use_PrivateKey , | ||
| 25 | .Nm SSL_use_RSAPrivateKey , | ||
| 26 | .Nm SSL_use_RSAPrivateKey_ASN1 , | ||
| 27 | .Nm SSL_use_RSAPrivateKey_file , | ||
| 28 | .Nm SSL_CTX_check_private_key , | ||
| 29 | .Nm SSL_check_private_key | ||
| 30 | .Nd load certificate and key data | ||
| 31 | .Sh SYNOPSIS | ||
| 32 | .In openssl/ssl.h | ||
| 33 | .Ft int | ||
| 34 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
| 35 | .Ft int | ||
| 36 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
| 37 | .Ft int | ||
| 38 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "const char *file" "int type" | ||
| 39 | .Ft int | ||
| 40 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
| 41 | .Ft int | ||
| 42 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "unsigned char *d" "int len" | ||
| 43 | .Ft int | ||
| 44 | .Fn SSL_use_certificate_file "SSL *ssl" "const char *file" "int type" | ||
| 45 | .Ft int | ||
| 46 | .Fn SSL_CTX_use_certificate_chain_file "SSL_CTX *ctx" "const char *file" | ||
| 47 | .Ft int | ||
| 48 | .Fn SSL_CTX_use_certificate_chain_mem "SSL_CTX *ctx" "void *buf" "int len" | ||
| 49 | .Ft int | ||
| 50 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
| 51 | .Ft int | ||
| 52 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
| 53 | .Fa "int pk" "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
| 54 | .Fc | ||
| 55 | .Ft int | ||
| 56 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
| 57 | .Ft int | ||
| 58 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
| 59 | .Ft int | ||
| 60 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
| 61 | .Ft int | ||
| 62 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "const char *file" "int type" | ||
| 63 | .Ft int | ||
| 64 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
| 65 | .Ft int | ||
| 66 | .Fn SSL_use_PrivateKey_ASN1 "int pk" "SSL *ssl" "unsigned char *d" "long len" | ||
| 67 | .Ft int | ||
| 68 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
| 69 | .Ft int | ||
| 70 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
| 71 | .Ft int | ||
| 72 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
| 73 | .Ft int | ||
| 74 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "const char *file" "int type" | ||
| 75 | .Ft int | ||
| 76 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
| 77 | .Ft int | ||
| 78 | .Fn SSL_check_private_key "const SSL *ssl" | ||
| 79 | .Sh DESCRIPTION | ||
| 80 | These functions load the certificates and private keys into the | ||
| 81 | .Vt SSL_CTX | ||
| 82 | or | ||
| 83 | .Vt SSL | ||
| 84 | object, respectively. | ||
| 85 | .Pp | ||
| 86 | The | ||
| 87 | .Fn SSL_CTX_* | ||
| 88 | class of functions loads the certificates and keys into the | ||
| 89 | .Vt SSL_CTX | ||
| 90 | object | ||
| 91 | .Fa ctx . | ||
| 92 | The information is passed to | ||
| 93 | .Vt SSL | ||
| 94 | objects | ||
| 95 | .Fa ssl | ||
| 96 | created from | ||
| 97 | .Fa ctx | ||
| 98 | with | ||
| 99 | .Xr SSL_new 3 | ||
| 100 | by copying, so that changes applied to | ||
| 101 | .Fa ctx | ||
| 102 | do not propagate to already existing | ||
| 103 | .Vt SSL | ||
| 104 | objects. | ||
| 105 | .Pp | ||
| 106 | The | ||
| 107 | .Fn SSL_* | ||
| 108 | class of functions only loads certificates and keys into a specific | ||
| 109 | .Vt SSL | ||
| 110 | object. | ||
| 111 | The specific information is kept when | ||
| 112 | .Xr SSL_clear 3 | ||
| 113 | is called for this | ||
| 114 | .Vt SSL | ||
| 115 | object. | ||
| 116 | .Pp | ||
| 117 | .Fn SSL_CTX_use_certificate | ||
| 118 | loads the certificate | ||
| 119 | .Fa x | ||
| 120 | into | ||
| 121 | .Fa ctx ; | ||
| 122 | .Fn SSL_use_certificate | ||
| 123 | loads | ||
| 124 | .Fa x | ||
| 125 | into | ||
| 126 | .Fa ssl . | ||
| 127 | The rest of the certificates needed to form the complete certificate chain can | ||
| 128 | be specified using the | ||
| 129 | .Xr SSL_CTX_add_extra_chain_cert 3 | ||
| 130 | function. | ||
| 131 | .Pp | ||
| 132 | .Fn SSL_CTX_use_certificate_ASN1 | ||
| 133 | loads the ASN1 encoded certificate from the memory location | ||
| 134 | .Fa d | ||
| 135 | (with length | ||
| 136 | .Fa len ) | ||
| 137 | into | ||
| 138 | .Fa ctx ; | ||
| 139 | .Fn SSL_use_certificate_ASN1 | ||
| 140 | loads the ASN1 encoded certificate into | ||
| 141 | .Fa ssl . | ||
| 142 | .Pp | ||
| 143 | .Fn SSL_CTX_use_certificate_file | ||
| 144 | loads the first certificate stored in | ||
| 145 | .Fa file | ||
| 146 | into | ||
| 147 | .Fa ctx . | ||
| 148 | The formatting | ||
| 149 | .Fa type | ||
| 150 | of the certificate must be specified from the known types | ||
| 151 | .Dv SSL_FILETYPE_PEM | ||
| 152 | and | ||
| 153 | .Dv SSL_FILETYPE_ASN1 . | ||
| 154 | .Fn SSL_use_certificate_file | ||
| 155 | loads the certificate from | ||
| 156 | .Fa file | ||
| 157 | into | ||
| 158 | .Fa ssl . | ||
| 159 | See the | ||
| 160 | .Sx NOTES | ||
| 161 | section on why | ||
| 162 | .Fn SSL_CTX_use_certificate_chain_file | ||
| 163 | should be preferred. | ||
| 164 | .Pp | ||
| 165 | The | ||
| 166 | .Fn SSL_CTX_use_certificate_chain* | ||
| 167 | functions load a certificate chain into | ||
| 168 | .Fa ctx . | ||
| 169 | The certificates must be in PEM format and must be sorted starting with the | ||
| 170 | subject's certificate (actual client or server certificate), | ||
| 171 | followed by intermediate CA certificates if applicable, | ||
| 172 | and ending at the highest level (root) CA. | ||
| 173 | There is no corresponding function working on a single | ||
| 174 | .Vt SSL | ||
| 175 | object. | ||
| 176 | .Pp | ||
| 177 | .Fn SSL_CTX_use_PrivateKey | ||
| 178 | adds | ||
| 179 | .Fa pkey | ||
| 180 | as private key to | ||
| 181 | .Fa ctx . | ||
| 182 | .Fn SSL_CTX_use_RSAPrivateKey | ||
| 183 | adds the private key | ||
| 184 | .Fa rsa | ||
| 185 | of type RSA to | ||
| 186 | .Fa ctx . | ||
| 187 | .Fn SSL_use_PrivateKey | ||
| 188 | adds | ||
| 189 | .Fa pkey | ||
| 190 | as private key to | ||
| 191 | .Fa ssl ; | ||
| 192 | .Fn SSL_use_RSAPrivateKey | ||
| 193 | adds | ||
| 194 | .Fa rsa | ||
| 195 | as private key of type RSA to | ||
| 196 | .Fa ssl . | ||
| 197 | If a certificate has already been set and the private does not belong to the | ||
| 198 | certificate, an error is returned. | ||
| 199 | To change a certificate private key pair, | ||
| 200 | the new certificate needs to be set with | ||
| 201 | .Fn SSL_use_certificate | ||
| 202 | or | ||
| 203 | .Fn SSL_CTX_use_certificate | ||
| 204 | before setting the private key with | ||
| 205 | .Fn SSL_CTX_use_PrivateKey | ||
| 206 | or | ||
| 207 | .Fn SSL_use_PrivateKey . | ||
| 208 | .Pp | ||
| 209 | .Fn SSL_CTX_use_PrivateKey_ASN1 | ||
| 210 | adds the private key of type | ||
| 211 | .Fa pk | ||
| 212 | stored at memory location | ||
| 213 | .Fa d | ||
| 214 | (length | ||
| 215 | .Fa len ) | ||
| 216 | to | ||
| 217 | .Fa ctx . | ||
| 218 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 | ||
| 219 | adds the private key of type RSA stored at memory location | ||
| 220 | .Fa d | ||
| 221 | (length | ||
| 222 | .Fa len ) | ||
| 223 | to | ||
| 224 | .Fa ctx . | ||
| 225 | .Fn SSL_use_PrivateKey_ASN1 | ||
| 226 | and | ||
| 227 | .Fn SSL_use_RSAPrivateKey_ASN1 | ||
| 228 | add the private key to | ||
| 229 | .Fa ssl . | ||
| 230 | .Pp | ||
| 231 | .Fn SSL_CTX_use_PrivateKey_file | ||
| 232 | adds the first private key found in | ||
| 233 | .Fa file | ||
| 234 | to | ||
| 235 | .Fa ctx . | ||
| 236 | The formatting | ||
| 237 | .Fa type | ||
| 238 | of the certificate must be specified from the known types | ||
| 239 | .Dv SSL_FILETYPE_PEM | ||
| 240 | and | ||
| 241 | .Dv SSL_FILETYPE_ASN1 . | ||
| 242 | .Fn SSL_CTX_use_RSAPrivateKey_file | ||
| 243 | adds the first private RSA key found in | ||
| 244 | .Fa file | ||
| 245 | to | ||
| 246 | .Fa ctx . | ||
| 247 | .Fn SSL_use_PrivateKey_file | ||
| 248 | adds the first private key found in | ||
| 249 | .Fa file | ||
| 250 | to | ||
| 251 | .Fa ssl ; | ||
| 252 | .Fn SSL_use_RSAPrivateKey_file | ||
| 253 | adds the first private RSA key found to | ||
| 254 | .Fa ssl . | ||
| 255 | .Pp | ||
| 256 | .Fn SSL_CTX_check_private_key | ||
| 257 | checks the consistency of a private key with the corresponding certificate | ||
| 258 | loaded into | ||
| 259 | .Fa ctx . | ||
| 260 | If more than one key/certificate pair (RSA/DSA) is installed, | ||
| 261 | the last item installed will be checked. | ||
| 262 | If, e.g., the last item was a RSA certificate or key, | ||
| 263 | the RSA key/certificate pair will be checked. | ||
| 264 | .Fn SSL_check_private_key | ||
| 265 | performs the same check for | ||
| 266 | .Fa ssl . | ||
| 267 | If no key/certificate was explicitly added for this | ||
| 268 | .Fa ssl , | ||
| 269 | the last item added into | ||
| 270 | .Fa ctx | ||
| 271 | will be checked. | ||
| 272 | .Sh NOTES | ||
| 273 | The internal certificate store of OpenSSL can hold two private key/certificate | ||
| 274 | pairs at a time: | ||
| 275 | one key/certificate of type RSA and one key/certificate of type DSA. | ||
| 276 | The certificate used depends on the cipher select, see also | ||
| 277 | .Xr SSL_CTX_set_cipher_list 3 . | ||
| 278 | .Pp | ||
| 279 | When reading certificates and private keys from file, files of type | ||
| 280 | .Dv SSL_FILETYPE_ASN1 | ||
| 281 | (also known as | ||
| 282 | .Em DER , | ||
| 283 | binary encoding) can only contain one certificate or private key; consequently, | ||
| 284 | .Fn SSL_CTX_use_certificate_chain_file | ||
| 285 | is only applicable to PEM formatting. | ||
| 286 | Files of type | ||
| 287 | .Dv SSL_FILETYPE_PEM | ||
| 288 | can contain more than one item. | ||
| 289 | .Pp | ||
| 290 | .Fn SSL_CTX_use_certificate_chain_file | ||
| 291 | adds the first certificate found in the file to the certificate store. | ||
| 292 | The other certificates are added to the store of chain certificates using | ||
| 293 | .Xr SSL_CTX_add_extra_chain_cert 3 . | ||
| 294 | There exists only one extra chain store, so that the same chain is appended | ||
| 295 | to both types of certificates, RSA and DSA! | ||
| 296 | If it is not intended to use both type of certificate at the same time, | ||
| 297 | it is recommended to use the | ||
| 298 | .Fn SSL_CTX_use_certificate_chain_file | ||
| 299 | instead of the | ||
| 300 | .Fn SSL_CTX_use_certificate_file | ||
| 301 | function in order to allow the use of complete certificate chains even when no | ||
| 302 | trusted CA storage is used or when the CA issuing the certificate shall not be | ||
| 303 | added to the trusted CA storage. | ||
| 304 | .Pp | ||
| 305 | If additional certificates are needed to complete the chain during the TLS | ||
| 306 | negotiation, CA certificates are additionally looked up in the locations of | ||
| 307 | trusted CA certificates (see | ||
| 308 | .Xr SSL_CTX_load_verify_locations 3 ) . | ||
| 309 | .Pp | ||
| 310 | The private keys loaded from file can be encrypted. | ||
| 311 | In order to successfully load encrypted keys, | ||
| 312 | a function returning the passphrase must have been supplied (see | ||
| 313 | .Xr SSL_CTX_set_default_passwd_cb 3 ) . | ||
| 314 | (Certificate files might be encrypted as well from the technical point of view, | ||
| 315 | it however does not make sense as the data in the certificate is considered | ||
| 316 | public anyway.) | ||
| 317 | .Sh RETURN VALUES | ||
| 318 | On success, the functions return 1. | ||
| 319 | Otherwise check out the error stack to find out the reason. | ||
| 320 | .Sh SEE ALSO | ||
| 321 | .Xr ssl 3 , | ||
| 322 | .Xr SSL_clear 3 , | ||
| 323 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
| 324 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 325 | .Xr SSL_CTX_set_cipher_list 3 , | ||
| 326 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
| 327 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
| 328 | .Xr SSL_new 3 | ||
| 329 | .Sh HISTORY | ||
| 330 | Support for DER encoded private keys | ||
| 331 | .Pq Dv SSL_FILETYPE_ASN1 | ||
| 332 | in | ||
| 333 | .Fn SSL_CTX_use_PrivateKey_file | ||
| 334 | and | ||
| 335 | .Fn SSL_use_PrivateKey_file | ||
| 336 | was added in 0.9.8. | ||
diff --git a/src/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 b/src/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 new file mode 100644 index 0000000000..7d5d6b1dfd --- /dev/null +++ b/src/lib/libssl/man/SSL_CTX_use_psk_identity_hint.3 | |||
| @@ -0,0 +1,110 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_CTX_use_psk_identity_hint.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CTX_USE_PSK_IDENTITY_HINT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_CTX_use_psk_identity_hint , | ||
| 9 | .Nm SSL_use_psk_identity_hint , | ||
| 10 | .Nm SSL_CTX_set_psk_server_callback , | ||
| 11 | .Nm SSL_set_psk_server_callback | ||
| 12 | .Nd set PSK identity hint to use | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft int | ||
| 16 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
| 17 | .Ft int | ||
| 18 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
| 19 | .Ft void | ||
| 20 | .Fo SSL_CTX_set_psk_server_callback | ||
| 21 | .Fa "SSL_CTX *ctx" | ||
| 22 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
| 23 | .Fc | ||
| 24 | .Ft void | ||
| 25 | .Fo SSL_set_psk_server_callback | ||
| 26 | .Fa "SSL *ssl" | ||
| 27 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, unsigned char *psk, int max_psk_len)" | ||
| 28 | .Fc | ||
| 29 | .Sh DESCRIPTION | ||
| 30 | .Fn SSL_CTX_use_psk_identity_hint | ||
| 31 | sets the given | ||
| 32 | .Dv NULL Ns | ||
| 33 | -terminated PSK identity hint | ||
| 34 | .Fa hint | ||
| 35 | to SSL context object | ||
| 36 | .Fa ctx . | ||
| 37 | .Fn SSL_use_psk_identity_hint | ||
| 38 | sets the given | ||
| 39 | .Dv NULL Ns | ||
| 40 | -terminated | ||
| 41 | PSK identity hint | ||
| 42 | .Fa hint | ||
| 43 | to SSL connection object | ||
| 44 | .Fa ssl . | ||
| 45 | If | ||
| 46 | .Fa hint | ||
| 47 | is | ||
| 48 | .Dv NULL | ||
| 49 | the current hint from | ||
| 50 | .Fa ctx | ||
| 51 | or | ||
| 52 | .Fa ssl | ||
| 53 | is deleted. | ||
| 54 | .Pp | ||
| 55 | In the case where PSK identity hint is | ||
| 56 | .Dv NULL , | ||
| 57 | the server does not send the | ||
| 58 | .Em ServerKeyExchange | ||
| 59 | message to the client. | ||
| 60 | .Pp | ||
| 61 | A server application must provide a callback function which is called when the | ||
| 62 | server receives the | ||
| 63 | .Em ClientKeyExchange | ||
| 64 | message from the client. | ||
| 65 | The purpose of the callback function is to validate the received PSK identity | ||
| 66 | and to fetch the pre-shared key used during the connection setup phase. | ||
| 67 | The callback is set using functions | ||
| 68 | .Fn SSL_CTX_set_psk_server_callback | ||
| 69 | or | ||
| 70 | .Fn SSL_set_psk_server_callback . | ||
| 71 | The callback function is given the connection in parameter | ||
| 72 | .Fa ssl , | ||
| 73 | .Dv NULL Ns | ||
| 74 | -terminated PSK identity sent by the client in parameter | ||
| 75 | .Fa identity , | ||
| 76 | and a buffer | ||
| 77 | .Fa psk | ||
| 78 | of length | ||
| 79 | .Fa max_psk_len | ||
| 80 | bytes where the pre-shared key is to be stored. | ||
| 81 | .Sh RETURN VALUES | ||
| 82 | .Fn SSL_CTX_use_psk_identity_hint | ||
| 83 | and | ||
| 84 | .Fn SSL_use_psk_identity_hint | ||
| 85 | return 1 on success, 0 otherwise. | ||
| 86 | .Pp | ||
| 87 | Return values from the server callback are interpreted as follows: | ||
| 88 | .Bl -tag -width Ds | ||
| 89 | .It >0 | ||
| 90 | PSK identity was found and the server callback has provided the PSK | ||
| 91 | successfully in parameter | ||
| 92 | .Fa psk . | ||
| 93 | Return value is the length of | ||
| 94 | .Fa psk | ||
| 95 | in bytes. | ||
| 96 | It is an error to return a value greater than | ||
| 97 | .Fa max_psk_len . | ||
| 98 | .Pp | ||
| 99 | If the PSK identity was not found but the callback instructs the protocol to | ||
| 100 | continue anyway, the callback must provide some random data to | ||
| 101 | .Fa psk | ||
| 102 | and return the length of the random data, so the connection will fail with | ||
| 103 | .Dq decryption_error | ||
| 104 | before it will be finished completely. | ||
| 105 | .It 0 | ||
| 106 | PSK identity was not found. | ||
| 107 | An | ||
| 108 | .Dq unknown_psk_identity | ||
| 109 | alert message will be sent and the connection setup fails. | ||
| 110 | .El | ||
diff --git a/src/lib/libssl/man/SSL_SESSION_free.3 b/src/lib/libssl/man/SSL_SESSION_free.3 new file mode 100644 index 0000000000..8eabe8da80 --- /dev/null +++ b/src/lib/libssl/man/SSL_SESSION_free.3 | |||
| @@ -0,0 +1,84 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_SESSION_free.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SESSION_FREE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_SESSION_free | ||
| 9 | .Nd free an allocated SSL_SESSION structure | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_SESSION_free "SSL_SESSION *session" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_SESSION_free | ||
| 16 | decrements the reference count of | ||
| 17 | .Fa session | ||
| 18 | and removes the | ||
| 19 | .Vt SSL_SESSION | ||
| 20 | structure pointed to by | ||
| 21 | .Fa session | ||
| 22 | and frees up the allocated memory, if the reference count has reached 0. | ||
| 23 | If | ||
| 24 | .Fa session | ||
| 25 | is a | ||
| 26 | .Dv NULL | ||
| 27 | pointer, no action occurs. | ||
| 28 | .Sh NOTES | ||
| 29 | .Vt SSL_SESSION | ||
| 30 | objects are allocated when a TLS/SSL handshake operation is successfully | ||
| 31 | completed. | ||
| 32 | Depending on the settings, see | ||
| 33 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 34 | the | ||
| 35 | .Vt SSL_SESSION | ||
| 36 | objects are internally referenced by the | ||
| 37 | .Vt SSL_CTX | ||
| 38 | and linked into its session cache. | ||
| 39 | .Vt SSL | ||
| 40 | objects may be using the | ||
| 41 | .Vt SSL_SESSION | ||
| 42 | object; as a session may be reused, several | ||
| 43 | .Vt SSL | ||
| 44 | objects may be using one | ||
| 45 | .Vt SSL_SESSION | ||
| 46 | object at the same time. | ||
| 47 | It is therefore crucial to keep the reference count (usage information) correct | ||
| 48 | and not delete a | ||
| 49 | .Vt SSL_SESSION | ||
| 50 | object that is still used, as this may lead to program failures due to dangling | ||
| 51 | pointers. | ||
| 52 | These failures may also appear delayed, e.g., when an | ||
| 53 | .Vt SSL_SESSION | ||
| 54 | object is completely freed as the reference count incorrectly becomes 0, but it | ||
| 55 | is still referenced in the internal session cache and the cache list is | ||
| 56 | processed during a | ||
| 57 | .Xr SSL_CTX_flush_sessions 3 | ||
| 58 | operation. | ||
| 59 | .Pp | ||
| 60 | .Fn SSL_SESSION_free | ||
| 61 | must only be called for | ||
| 62 | .Vt SSL_SESSION | ||
| 63 | objects, for which the reference count was explicitly incremented (e.g., by | ||
| 64 | calling | ||
| 65 | .Xr SSL_get1_session 3 ; | ||
| 66 | see | ||
| 67 | .Xr SSL_get_session 3 ) | ||
| 68 | or when the | ||
| 69 | .Vt SSL_SESSION | ||
| 70 | object was generated outside a TLS handshake operation, e.g., by using | ||
| 71 | .Xr d2i_SSL_SESSION 3 . | ||
| 72 | It must not be called on other | ||
| 73 | .Vt SSL_SESSION | ||
| 74 | objects, as this would cause incorrect reference counts and therefore program | ||
| 75 | failures. | ||
| 76 | .Sh RETURN VALUES | ||
| 77 | .Fn SSL_SESSION_free | ||
| 78 | does not provide diagnostic information. | ||
| 79 | .Sh SEE ALSO | ||
| 80 | .Xr d2i_SSL_SESSION 3 , | ||
| 81 | .Xr ssl 3 , | ||
| 82 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 83 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 84 | .Xr SSL_get_session 3 | ||
diff --git a/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 new file mode 100644 index 0000000000..0779db91b8 --- /dev/null +++ b/src/lib/libssl/man/SSL_SESSION_get_ex_new_index.3 | |||
| @@ -0,0 +1,80 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_SESSION_get_ex_new_index.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SESSION_GET_EX_NEW_INDEX 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_SESSION_get_ex_new_index , | ||
| 9 | .Nm SSL_SESSION_set_ex_data , | ||
| 10 | .Nm SSL_SESSION_get_ex_data | ||
| 11 | .Nd internal application specific data functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fo SSL_SESSION_get_ex_new_index | ||
| 16 | .Fa "long argl" | ||
| 17 | .Fa "void *argp" | ||
| 18 | .Fa "CRYPTO_EX_new *new_func" | ||
| 19 | .Fa "CRYPTO_EX_dup *dup_func" | ||
| 20 | .Fa "CRYPTO_EX_free *free_func" | ||
| 21 | .Fc | ||
| 22 | .Ft int | ||
| 23 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *session" "int idx" "void *arg" | ||
| 24 | .Ft void * | ||
| 25 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *session" "int idx" | ||
| 26 | .Bd -literal | ||
| 27 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 28 | int idx, long argl, void *argp); | ||
| 29 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 30 | int idx, long argl, void *argp); | ||
| 31 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
| 32 | int idx, long argl, void *argp); | ||
| 33 | .Ed | ||
| 34 | .Sh DESCRIPTION | ||
| 35 | Several OpenSSL structures can have application specific data attached to them. | ||
| 36 | These functions are used internally by OpenSSL to manipulate | ||
| 37 | application-specific data attached to a specific structure. | ||
| 38 | .Pp | ||
| 39 | .Fn SSL_SESSION_get_ex_new_index | ||
| 40 | is used to register a new index for application-specific data. | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_SESSION_set_ex_data | ||
| 43 | is used to store application data at | ||
| 44 | .Fa arg | ||
| 45 | for | ||
| 46 | .Fa idx | ||
| 47 | into the | ||
| 48 | .Fa session | ||
| 49 | object. | ||
| 50 | .Pp | ||
| 51 | .Fn SSL_SESSION_get_ex_data | ||
| 52 | is used to retrieve the information for | ||
| 53 | .Fa idx | ||
| 54 | from | ||
| 55 | .Fa session . | ||
| 56 | .Pp | ||
| 57 | A detailed description for the | ||
| 58 | .Fn *_get_ex_new_index | ||
| 59 | functionality | ||
| 60 | can be found in | ||
| 61 | .Xr RSA_get_ex_new_index 3 . | ||
| 62 | The | ||
| 63 | .Fn *_get_ex_data | ||
| 64 | and | ||
| 65 | .Fn *_set_ex_data | ||
| 66 | functionality is described in | ||
| 67 | .Xr CRYPTO_set_ex_data 3 . | ||
| 68 | .Sh WARNINGS | ||
| 69 | The application data is only maintained for sessions held in memory. | ||
| 70 | The application data is not included when dumping the session with | ||
| 71 | .Xr i2d_SSL_SESSION 3 | ||
| 72 | (and all functions indirectly calling the dump functions like | ||
| 73 | .Xr PEM_write_SSL_SESSION 3 | ||
| 74 | and | ||
| 75 | .Xr PEM_write_bio_SSL_SESSION 3 ) | ||
| 76 | and can therefore not be restored. | ||
| 77 | .Sh SEE ALSO | ||
| 78 | .Xr CRYPTO_set_ex_data 3 , | ||
| 79 | .Xr RSA_get_ex_new_index 3 , | ||
| 80 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_SESSION_get_time.3 b/src/lib/libssl/man/SSL_SESSION_get_time.3 new file mode 100644 index 0000000000..9641290e71 --- /dev/null +++ b/src/lib/libssl/man/SSL_SESSION_get_time.3 | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_SESSION_get_time.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SESSION_GET_TIME 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_SESSION_get_time , | ||
| 9 | .Nm SSL_SESSION_set_time , | ||
| 10 | .Nm SSL_SESSION_get_timeout , | ||
| 11 | .Nm SSL_SESSION_set_timeout , | ||
| 12 | .Nm SSL_get_time , | ||
| 13 | .Nm SSL_set_time , | ||
| 14 | .Nm SSL_get_timeout , | ||
| 15 | .Nm SSL_set_timeout | ||
| 16 | .Nd retrieve and manipulate session time and timeout settings | ||
| 17 | .Sh SYNOPSIS | ||
| 18 | .In openssl/ssl.h | ||
| 19 | .Ft long | ||
| 20 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
| 21 | .Ft long | ||
| 22 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long tm" | ||
| 23 | .Ft long | ||
| 24 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
| 25 | .Ft long | ||
| 26 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long tm" | ||
| 27 | .Ft long | ||
| 28 | .Fn SSL_get_time "const SSL_SESSION *s" | ||
| 29 | .Ft long | ||
| 30 | .Fn SSL_set_time "SSL_SESSION *s" "long tm" | ||
| 31 | .Ft long | ||
| 32 | .Fn SSL_get_timeout "const SSL_SESSION *s" | ||
| 33 | .Ft long | ||
| 34 | .Fn SSL_set_timeout "SSL_SESSION *s" "long tm" | ||
| 35 | .Sh DESCRIPTION | ||
| 36 | .Fn SSL_SESSION_get_time | ||
| 37 | returns the time at which the session | ||
| 38 | .Fa s | ||
| 39 | was established. | ||
| 40 | The time is given in seconds since the Epoch and therefore compatible to the | ||
| 41 | time delivered by the | ||
| 42 | .Xr time 3 | ||
| 43 | call. | ||
| 44 | .Pp | ||
| 45 | .Fn SSL_SESSION_set_time | ||
| 46 | replaces the creation time of the session | ||
| 47 | .Fa s | ||
| 48 | with | ||
| 49 | the chosen value | ||
| 50 | .Fa tm . | ||
| 51 | .Pp | ||
| 52 | .Fn SSL_SESSION_get_timeout | ||
| 53 | returns the timeout value set for session | ||
| 54 | .Fa s | ||
| 55 | in seconds. | ||
| 56 | .Pp | ||
| 57 | .Fn SSL_SESSION_set_timeout | ||
| 58 | sets the timeout value for session | ||
| 59 | .Fa s | ||
| 60 | in seconds to | ||
| 61 | .Fa tm . | ||
| 62 | .Pp | ||
| 63 | The | ||
| 64 | .Fn SSL_get_time , | ||
| 65 | .Fn SSL_set_time , | ||
| 66 | .Fn SSL_get_timeout , | ||
| 67 | and | ||
| 68 | .Fn SSL_set_timeout | ||
| 69 | functions are synonyms for the | ||
| 70 | .Fn SSL_SESSION_* | ||
| 71 | counterparts. | ||
| 72 | .Sh NOTES | ||
| 73 | Sessions are expired by examining the creation time and the timeout value. | ||
| 74 | Both are set at creation time of the session to the actual time and the default | ||
| 75 | timeout value at creation, respectively, as set by | ||
| 76 | .Xr SSL_CTX_set_timeout 3 . | ||
| 77 | Using these functions it is possible to extend or shorten the lifetime of the | ||
| 78 | session. | ||
| 79 | .Sh RETURN VALUES | ||
| 80 | .Fn SSL_SESSION_get_time | ||
| 81 | and | ||
| 82 | .Fn SSL_SESSION_get_timeout | ||
| 83 | return the currently valid values. | ||
| 84 | .Pp | ||
| 85 | .Fn SSL_SESSION_set_time | ||
| 86 | and | ||
| 87 | .Fn SSL_SESSION_set_timeout | ||
| 88 | return 1 on success. | ||
| 89 | .Pp | ||
| 90 | If any of the function is passed the | ||
| 91 | .Dv NULL | ||
| 92 | pointer for the session | ||
| 93 | .Fa s , | ||
| 94 | 0 is returned. | ||
| 95 | .Sh SEE ALSO | ||
| 96 | .Xr ssl 3 , | ||
| 97 | .Xr SSL_CTX_set_timeout 3 , | ||
| 98 | .Xr SSL_get_default_timeout 3 | ||
diff --git a/src/lib/libssl/man/SSL_accept.3 b/src/lib/libssl/man/SSL_accept.3 new file mode 100644 index 0000000000..944fb50c28 --- /dev/null +++ b/src/lib/libssl/man/SSL_accept.3 | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_accept.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_ACCEPT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_accept | ||
| 9 | .Nd wait for a TLS/SSL client to initiate a TLS/SSL handshake | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_accept "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_accept | ||
| 16 | waits for a TLS/SSL client to initiate the TLS/SSL handshake. | ||
| 17 | The communication channel must already have been set and assigned to the | ||
| 18 | .Fa ssl | ||
| 19 | object by setting an underlying | ||
| 20 | .Vt BIO . | ||
| 21 | .Sh NOTES | ||
| 22 | The behaviour of | ||
| 23 | .Fn SSL_accept | ||
| 24 | depends on the underlying | ||
| 25 | .Vt BIO . | ||
| 26 | .Pp | ||
| 27 | If the underlying | ||
| 28 | .Vt BIO | ||
| 29 | is | ||
| 30 | .Em blocking , | ||
| 31 | .Fn SSL_accept | ||
| 32 | will only return once the handshake has been finished or an error occurred. | ||
| 33 | .Pp | ||
| 34 | If the underlying | ||
| 35 | .Vt BIO | ||
| 36 | is | ||
| 37 | .Em non-blocking , | ||
| 38 | .Fn SSL_accept | ||
| 39 | will also return when the underlying | ||
| 40 | .Vt BIO | ||
| 41 | could not satisfy the needs of | ||
| 42 | .Fn SSL_accept | ||
| 43 | to continue the handshake, indicating the problem by the return value \(mi1. | ||
| 44 | In this case a call to | ||
| 45 | .Xr SSL_get_error 3 | ||
| 46 | with the | ||
| 47 | return value of | ||
| 48 | .Fn SSL_accept | ||
| 49 | will yield | ||
| 50 | .Dv SSL_ERROR_WANT_READ | ||
| 51 | or | ||
| 52 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 53 | The calling process then must repeat the call after taking appropriate action | ||
| 54 | to satisfy the needs of | ||
| 55 | .Fn SSL_accept . | ||
| 56 | The action depends on the underlying | ||
| 57 | .Dv BIO . | ||
| 58 | When using a non-blocking socket, nothing is to be done, but | ||
| 59 | .Xr select 2 | ||
| 60 | can be used to check for the required condition. | ||
| 61 | When using a buffering | ||
| 62 | .Vt BIO , | ||
| 63 | like a | ||
| 64 | .Vt BIO | ||
| 65 | pair, data must be written into or retrieved out of the | ||
| 66 | .Vt BIO | ||
| 67 | before being able to continue. | ||
| 68 | .Sh RETURN VALUES | ||
| 69 | The following return values can occur: | ||
| 70 | .Bl -tag -width Ds | ||
| 71 | .It 0 | ||
| 72 | The TLS/SSL handshake was not successful but was shut down controlled and by | ||
| 73 | the specifications of the TLS/SSL protocol. | ||
| 74 | Call | ||
| 75 | .Xr SSL_get_error 3 | ||
| 76 | with the return value | ||
| 77 | .Fa ret | ||
| 78 | to find out the reason. | ||
| 79 | .It 1 | ||
| 80 | The TLS/SSL handshake was successfully completed, | ||
| 81 | and a TLS/SSL connection has been established. | ||
| 82 | .It <0 | ||
| 83 | The TLS/SSL handshake was not successful because a fatal error occurred either | ||
| 84 | at the protocol level or a connection failure occurred. | ||
| 85 | The shutdown was not clean. | ||
| 86 | It can also occur of action is need to continue the operation for non-blocking | ||
| 87 | .Vt BIO Ns | ||
| 88 | s. | ||
| 89 | Call | ||
| 90 | .Xr SSL_get_error 3 | ||
| 91 | with the return value | ||
| 92 | .Fa ret | ||
| 93 | to find out the reason. | ||
| 94 | .El | ||
| 95 | .Sh SEE ALSO | ||
| 96 | .Xr bio 3 , | ||
| 97 | .Xr ssl 3 , | ||
| 98 | .Xr SSL_connect 3 , | ||
| 99 | .Xr SSL_CTX_new 3 , | ||
| 100 | .Xr SSL_do_handshake 3 , | ||
| 101 | .Xr SSL_get_error 3 , | ||
| 102 | .Xr SSL_set_connect_state 3 , | ||
| 103 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_alert_type_string.3 b/src/lib/libssl/man/SSL_alert_type_string.3 new file mode 100644 index 0000000000..ff68ba5858 --- /dev/null +++ b/src/lib/libssl/man/SSL_alert_type_string.3 | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_alert_type_string.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_ALERT_TYPE_STRING.POD 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_alert_type_string , | ||
| 9 | .Nm SSL_alert_type_string_long , | ||
| 10 | .Nm SSL_alert_desc_string , | ||
| 11 | .Nm SSL_alert_desc_string_long | ||
| 12 | .Nd get textual description of alert information | ||
| 13 | .Sh SYNOPSIS | ||
| 14 | .In openssl/ssl.h | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_alert_type_string "int value" | ||
| 17 | .Ft const char * | ||
| 18 | .Fn SSL_alert_type_string_long "int value" | ||
| 19 | .Ft const char * | ||
| 20 | .Fn SSL_alert_desc_string "int value" | ||
| 21 | .Ft const char * | ||
| 22 | .Fn SSL_alert_desc_string_long "int value" | ||
| 23 | .Sh DESCRIPTION | ||
| 24 | .Fn SSL_alert_type_string | ||
| 25 | returns a one letter string indicating the type of the alert specified by | ||
| 26 | .Fa value . | ||
| 27 | .Pp | ||
| 28 | .Fn SSL_alert_type_string_long | ||
| 29 | returns a string indicating the type of the alert specified by | ||
| 30 | .Fa value . | ||
| 31 | .Pp | ||
| 32 | .Fn SSL_alert_desc_string | ||
| 33 | returns a two letter string as a short form describing the reason of the alert | ||
| 34 | specified by | ||
| 35 | .Fa value . | ||
| 36 | .Pp | ||
| 37 | .Fn SSL_alert_desc_string_long | ||
| 38 | returns a string describing the reason of the alert specified by | ||
| 39 | .Fa value . | ||
| 40 | .Sh NOTES | ||
| 41 | When one side of an SSL/TLS communication wants to inform the peer about | ||
| 42 | a special situation, it sends an alert. | ||
| 43 | The alert is sent as a special message and does not influence the normal data | ||
| 44 | stream (unless its contents results in the communication being canceled). | ||
| 45 | .Pp | ||
| 46 | A warning alert is sent, when a non-fatal error condition occurs. | ||
| 47 | The | ||
| 48 | .Dq close notify | ||
| 49 | alert is sent as a warning alert. | ||
| 50 | Other examples for non-fatal errors are certificate errors | ||
| 51 | .Po | ||
| 52 | .Dq certificate expired , | ||
| 53 | .Dq unsupported certificate | ||
| 54 | .Pc , | ||
| 55 | for which a warning alert may be sent. | ||
| 56 | (The sending party may, however, decide to send a fatal error.) | ||
| 57 | The receiving side may cancel the connection on reception of a warning alert at | ||
| 58 | its discretion. | ||
| 59 | .Pp | ||
| 60 | Several alert messages must be sent as fatal alert messages as specified | ||
| 61 | by the TLS RFC. | ||
| 62 | A fatal alert always leads to a connection abort. | ||
| 63 | .Sh RETURN VALUES | ||
| 64 | The following strings can occur for | ||
| 65 | .Fn SSL_alert_type_string | ||
| 66 | or | ||
| 67 | .Fn SSL_alert_type_string_long : | ||
| 68 | .Bl -tag -width Ds | ||
| 69 | .It \(dqW\(dq/\(dqwarning\(dq | ||
| 70 | .It \(dqF\(dq/\(dqfatal\(dq | ||
| 71 | .It \(dqU\(dq/\(dqunknown\(dq | ||
| 72 | This indicates that no support is available for this alert type. | ||
| 73 | Probably | ||
| 74 | .Fa value | ||
| 75 | does not contain a correct alert message. | ||
| 76 | .El | ||
| 77 | .Pp | ||
| 78 | The following strings can occur for | ||
| 79 | .Fn SSL_alert_desc_string | ||
| 80 | or | ||
| 81 | .Fn SSL_alert_desc_string_long : | ||
| 82 | .Bl -tag -width Ds | ||
| 83 | .It \(dqCN\(dq/\(dqclose notify\(dq | ||
| 84 | The connection shall be closed. | ||
| 85 | This is a warning alert. | ||
| 86 | .It \(dqUM\(dq/\(dqunexpected message\(dq | ||
| 87 | An inappropriate message was received. | ||
| 88 | This alert is always fatal and should never be observed in communication | ||
| 89 | between proper implementations. | ||
| 90 | .It \(dqBM\(dq/\(dqbad record mac\(dq | ||
| 91 | This alert is returned if a record is received with an incorrect MAC. | ||
| 92 | This message is always fatal. | ||
| 93 | .It \(dqDF\(dq/\(dqdecompression failure\(dq | ||
| 94 | The decompression function received improper input | ||
| 95 | (e.g., data that would expand to excessive length). | ||
| 96 | This message is always fatal. | ||
| 97 | .It \(dqHF\(dq/\(dqhandshake failure\(dq | ||
| 98 | Reception of a handshake_failure alert message indicates that the sender was | ||
| 99 | unable to negotiate an acceptable set of security parameters given the options | ||
| 100 | available. | ||
| 101 | This is a fatal error. | ||
| 102 | .It \(dqNC\(dq/\(dqno certificate\(dq | ||
| 103 | A client, that was asked to send a certificate, does not send a certificate | ||
| 104 | (SSLv3 only). | ||
| 105 | .It \(dqBC\(dq/\(dqbad certificate\(dq | ||
| 106 | A certificate was corrupt, contained signatures that did not verify correctly, | ||
| 107 | etc. | ||
| 108 | .It \(dqUC\(dq/\(dqunsupported certificate\(dq | ||
| 109 | A certificate was of an unsupported type. | ||
| 110 | .It \(dqCR\(dq/\(dqcertificate revoked\(dq | ||
| 111 | A certificate was revoked by its signer. | ||
| 112 | .It \(dqCE\(dq/\(dqcertificate expired\(dq | ||
| 113 | A certificate has expired or is not currently valid. | ||
| 114 | .It \(dqCU\(dq/\(dqcertificate unknown\(dq | ||
| 115 | Some other (unspecified) issue arose in processing the certificate, | ||
| 116 | rendering it unacceptable. | ||
| 117 | .It \(dqIP\(dq/\(dqillegal parameter\(dq | ||
| 118 | A field in the handshake was out of range or inconsistent with other fields. | ||
| 119 | This is always fatal. | ||
| 120 | .It \(dqDC\(dq/\(dqdecryption failed\(dq | ||
| 121 | A TLSCiphertext decrypted in an invalid way: either it wasn't an even multiple | ||
| 122 | of the block length or its padding values, when checked, weren't correct. | ||
| 123 | This message is always fatal. | ||
| 124 | .It \(dqRO\(dq/\(dqrecord overflow\(dq | ||
| 125 | A TLSCiphertext record was received which had a length more than | ||
| 126 | 2^14+2048 bytes, or a record decrypted to a TLSCompressed record with more than | ||
| 127 | 2^14+1024 bytes. | ||
| 128 | This message is always fatal. | ||
| 129 | .It \(dqCA\(dq/\(dqunknown CA\(dq | ||
| 130 | A valid certificate chain or partial chain was received, | ||
| 131 | but the certificate was not accepted because the CA certificate could not be | ||
| 132 | located or couldn't be matched with a known, trusted CA. | ||
| 133 | This message is always fatal. | ||
| 134 | .It \(dqAD\(dq/\(dqaccess denied\(dq | ||
| 135 | A valid certificate was received, but when access control was applied, | ||
| 136 | the sender decided not to proceed with negotiation. | ||
| 137 | This message is always fatal. | ||
| 138 | .It \(dqDE\(dq/\(dqdecode error\(dq | ||
| 139 | A message could not be decoded because some field was out of the specified | ||
| 140 | range or the length of the message was incorrect. | ||
| 141 | This message is always fatal. | ||
| 142 | .It \(dqCY\(dq/\(dqdecrypt error\(dq | ||
| 143 | A handshake cryptographic operation failed, including being unable to correctly | ||
| 144 | verify a signature, decrypt a key exchange, or validate a finished message. | ||
| 145 | .It \(dqER\(dq/\(dqexport restriction\(dq | ||
| 146 | A negotiation not in compliance with export restrictions was detected; | ||
| 147 | for example, attempting to transfer a 1024 bit ephemeral RSA key for the | ||
| 148 | RSA_EXPORT handshake method. | ||
| 149 | This message is always fatal. | ||
| 150 | .It \(dqPV\(dq/\(dqprotocol version\(dq | ||
| 151 | The protocol version the client has attempted to negotiate is recognized, | ||
| 152 | but not supported. | ||
| 153 | (For example, old protocol versions might be avoided for security reasons.) | ||
| 154 | This message is always fatal. | ||
| 155 | .It \(dqIS\(dq/\(dqinsufficient security\(dq | ||
| 156 | Returned instead of handshake_failure when a negotiation has failed | ||
| 157 | specifically because the server requires ciphers more secure than those | ||
| 158 | supported by the client. | ||
| 159 | This message is always fatal. | ||
| 160 | .It \(dqIE\(dq/\(dqinternal error\(dq | ||
| 161 | An internal error unrelated to the peer or the correctness of the protocol | ||
| 162 | makes it impossible to continue (such as a memory allocation failure). | ||
| 163 | This message is always fatal. | ||
| 164 | .It \(dqUS\(dq/\(dquser canceled\(dq | ||
| 165 | This handshake is being canceled for some reason unrelated to a protocol | ||
| 166 | failure. | ||
| 167 | If the user cancels an operation after the handshake is complete, | ||
| 168 | just closing the connection by sending a close_notify is more appropriate. | ||
| 169 | This alert should be followed by a close_notify. | ||
| 170 | This message is generally a warning. | ||
| 171 | .It \(dqNR\(dq/\(dqno renegotiation\(dq | ||
| 172 | Sent by the client in response to a hello request or by the server in response | ||
| 173 | to a client hello after initial handshaking. | ||
| 174 | Either of these would normally lead to renegotiation; when that is not | ||
| 175 | appropriate, the recipient should respond with this alert; at that point, | ||
| 176 | the original requester can decide whether to proceed with the connection. | ||
| 177 | One case where this would be appropriate would be where a server has spawned a | ||
| 178 | process to satisfy a request; the process might receive security parameters | ||
| 179 | (key length, authentication, etc.) at startup and it might be difficult to | ||
| 180 | communicate changes to these parameters after that point. | ||
| 181 | This message is always a warning. | ||
| 182 | .It \(dqUP\(dq/\(dqunknown PSK identity\(dq | ||
| 183 | Sent by the server to indicate that it does not recognize a PSK identity or an | ||
| 184 | SRP identity. | ||
| 185 | .It \(dqUK\(dq/\(dqunknown\(dq | ||
| 186 | This indicates that no description is available for this alert type. | ||
| 187 | Probably | ||
| 188 | .Fa value | ||
| 189 | does not contain a correct alert message. | ||
| 190 | .El | ||
| 191 | .Sh SEE ALSO | ||
| 192 | .Xr ssl 3 , | ||
| 193 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/man/SSL_clear.3 b/src/lib/libssl/man/SSL_clear.3 new file mode 100644 index 0000000000..a9e318320f --- /dev/null +++ b/src/lib/libssl/man/SSL_clear.3 | |||
| @@ -0,0 +1,92 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_clear.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CLEAR 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_clear | ||
| 9 | .Nd reset SSL object to allow another connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_clear "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | Reset | ||
| 16 | .Fa ssl | ||
| 17 | to allow another connection. | ||
| 18 | All settings (method, ciphers, BIOs) are kept. | ||
| 19 | .Sh NOTES | ||
| 20 | .Fn SSL_clear | ||
| 21 | is used to prepare an | ||
| 22 | .Vt SSL | ||
| 23 | object for a new connection. | ||
| 24 | While all settings are kept, | ||
| 25 | a side effect is the handling of the current SSL session. | ||
| 26 | If a session is still | ||
| 27 | .Em open , | ||
| 28 | it is considered bad and will be removed from the session cache, | ||
| 29 | as required by RFC2246. | ||
| 30 | A session is considered open if | ||
| 31 | .Xr SSL_shutdown 3 | ||
| 32 | was not called for the connection or at least | ||
| 33 | .Xr SSL_set_shutdown 3 | ||
| 34 | was used to | ||
| 35 | set the | ||
| 36 | .Dv SSL_SENT_SHUTDOWN | ||
| 37 | state. | ||
| 38 | .Pp | ||
| 39 | If a session was closed cleanly, | ||
| 40 | the session object will be kept and all settings corresponding. | ||
| 41 | This explicitly means that for example the special method used during the | ||
| 42 | session will be kept for the next handshake. | ||
| 43 | So if the session was a TLSv1 session, a | ||
| 44 | .Vt SSL | ||
| 45 | client object will use a TLSv1 client method for the next handshake and a | ||
| 46 | .Vt SSL | ||
| 47 | server object will use a TLSv1 server method, even if | ||
| 48 | .Fn SSLv23_*_method Ns s | ||
| 49 | were chosen on startup. | ||
| 50 | This might lead to connection failures (see | ||
| 51 | .Xr SSL_new 3 ) | ||
| 52 | for a description of the method's properties. | ||
| 53 | .Sh WARNINGS | ||
| 54 | .Fn SSL_clear | ||
| 55 | resets the | ||
| 56 | .Vt SSL | ||
| 57 | object to allow for another connection. | ||
| 58 | The reset operation however keeps several settings of the last sessions | ||
| 59 | (some of these settings were made automatically during the last handshake). | ||
| 60 | It only makes sense for a new connection with the exact same peer that shares | ||
| 61 | these settings, | ||
| 62 | and may fail if that peer changes its settings between connections. | ||
| 63 | Use the sequence | ||
| 64 | .Xr SSL_get_session 3 ; | ||
| 65 | .Xr SSL_new 3 ; | ||
| 66 | .Xr SSL_set_session 3 ; | ||
| 67 | .Xr SSL_free 3 | ||
| 68 | instead to avoid such failures (or simply | ||
| 69 | .Xr SSL_free 3 ; | ||
| 70 | .Xr SSL_new 3 | ||
| 71 | if session reuse is not desired). | ||
| 72 | .Sh RETURN VALUES | ||
| 73 | The following return values can occur: | ||
| 74 | .Bl -tag -width Ds | ||
| 75 | .It 0 | ||
| 76 | The | ||
| 77 | .Fn SSL_clear | ||
| 78 | operation could not be performed. | ||
| 79 | Check the error stack to find out the reason. | ||
| 80 | .It 1 | ||
| 81 | The | ||
| 82 | .Fn SSL_clear | ||
| 83 | operation was successful. | ||
| 84 | .El | ||
| 85 | .Sh SEE ALSO | ||
| 86 | .Xr ssl 3 , | ||
| 87 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
| 88 | .Xr SSL_CTX_set_options 3 , | ||
| 89 | .Xr SSL_free 3 , | ||
| 90 | .Xr SSL_new 3 , | ||
| 91 | .Xr SSL_set_shutdown 3 , | ||
| 92 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_connect.3 b/src/lib/libssl/man/SSL_connect.3 new file mode 100644 index 0000000000..761fde3548 --- /dev/null +++ b/src/lib/libssl/man/SSL_connect.3 | |||
| @@ -0,0 +1,102 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_connect.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_CONNECT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_connect | ||
| 9 | .Nd initiate the TLS/SSL handshake with a TLS/SSL server | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_connect "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_connect | ||
| 16 | initiates the TLS/SSL handshake with a server. | ||
| 17 | The communication channel must already have been set and assigned to the | ||
| 18 | .Fa ssl | ||
| 19 | by setting an underlying | ||
| 20 | .Vt BIO . | ||
| 21 | .Sh NOTES | ||
| 22 | The behaviour of | ||
| 23 | .Fn SSL_connect | ||
| 24 | depends on the underlying | ||
| 25 | .Vt BIO . | ||
| 26 | .Pp | ||
| 27 | If the underlying | ||
| 28 | .Vt BIO | ||
| 29 | is | ||
| 30 | .Em blocking , | ||
| 31 | .Fn SSL_connect | ||
| 32 | will only return once the handshake has been finished or an error occurred. | ||
| 33 | .Pp | ||
| 34 | If the underlying | ||
| 35 | .Vt BIO | ||
| 36 | is | ||
| 37 | .Em non-blocking , | ||
| 38 | .Fn SSL_connect | ||
| 39 | will also return when the underlying | ||
| 40 | .Vt BIO | ||
| 41 | could not satisfy the needs of | ||
| 42 | .Fn SSL_connect | ||
| 43 | to continue the handshake, indicating the problem with the return value \(mi1. | ||
| 44 | In this case a call to | ||
| 45 | .Xr SSL_get_error 3 | ||
| 46 | with the return value of | ||
| 47 | .Fn SSL_connect | ||
| 48 | will yield | ||
| 49 | .Dv SSL_ERROR_WANT_READ | ||
| 50 | or | ||
| 51 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 52 | The calling process then must repeat the call after taking appropriate action | ||
| 53 | to satisfy the needs of | ||
| 54 | .Fn SSL_connect . | ||
| 55 | The action depends on the underlying | ||
| 56 | .Vt BIO . | ||
| 57 | When using a non-blocking socket, nothing is to be done, but | ||
| 58 | .Xr select 2 | ||
| 59 | can be used to check for the required condition. | ||
| 60 | When using a buffering | ||
| 61 | .Vt BIO , | ||
| 62 | like a | ||
| 63 | .Vt BIO | ||
| 64 | pair, data must be written into or retrieved out of the | ||
| 65 | .Vt BIO | ||
| 66 | before being able to continue. | ||
| 67 | .Sh RETURN VALUES | ||
| 68 | The following return values can occur: | ||
| 69 | .Bl -tag -width Ds | ||
| 70 | .It 0 | ||
| 71 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
| 72 | by the specifications of the TLS/SSL protocol. | ||
| 73 | Call | ||
| 74 | .Xr SSL_get_error 3 | ||
| 75 | with the return value | ||
| 76 | .Fa ret | ||
| 77 | to find out the reason. | ||
| 78 | .It 1 | ||
| 79 | The TLS/SSL handshake was successfully completed, | ||
| 80 | and a TLS/SSL connection has been established. | ||
| 81 | .It <0 | ||
| 82 | The TLS/SSL handshake was not successful, because either a fatal error occurred | ||
| 83 | at the protocol level or a connection failure occurred. | ||
| 84 | The shutdown was not clean. | ||
| 85 | It can also occur if action is needed to continue the operation for | ||
| 86 | non-blocking | ||
| 87 | .Vt BIO Ns s. | ||
| 88 | Call | ||
| 89 | .Xr SSL_get_error 3 | ||
| 90 | with the return value | ||
| 91 | .Fa ret | ||
| 92 | to find out the reason. | ||
| 93 | .El | ||
| 94 | .Sh SEE ALSO | ||
| 95 | .Xr bio 3 , | ||
| 96 | .Xr ssl 3 , | ||
| 97 | .Xr SSL_accept 3 , | ||
| 98 | .Xr SSL_CTX_new 3 , | ||
| 99 | .Xr SSL_do_handshake 3 , | ||
| 100 | .Xr SSL_get_error 3 , | ||
| 101 | .Xr SSL_set_connect_state 3 , | ||
| 102 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_do_handshake.3 b/src/lib/libssl/man/SSL_do_handshake.3 new file mode 100644 index 0000000000..7f8a9a4509 --- /dev/null +++ b/src/lib/libssl/man/SSL_do_handshake.3 | |||
| @@ -0,0 +1,101 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_do_handshake.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_DO_HANDSHAKE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_do_handshake | ||
| 9 | .Nd perform a TLS/SSL handshake | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_do_handshake "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_do_handshake | ||
| 16 | will wait for a SSL/TLS handshake to take place. | ||
| 17 | If the connection is in client mode, the handshake will be started. | ||
| 18 | The handshake routines may have to be explicitly set in advance using either | ||
| 19 | .Xr SSL_set_connect_state 3 | ||
| 20 | or | ||
| 21 | .Xr SSL_set_accept_state 3 . | ||
| 22 | .Sh NOTES | ||
| 23 | The behaviour of | ||
| 24 | .Fn SSL_do_handshake | ||
| 25 | depends on the underlying | ||
| 26 | .Vt BIO . | ||
| 27 | .Pp | ||
| 28 | If the underlying | ||
| 29 | .Vt BIO | ||
| 30 | is | ||
| 31 | .Em blocking , | ||
| 32 | .Fn SSL_do_handshake | ||
| 33 | will only return once the handshake has been finished or an error occurred. | ||
| 34 | .Pp | ||
| 35 | If the underlying | ||
| 36 | .Vt BIO | ||
| 37 | is | ||
| 38 | .Em non-blocking , | ||
| 39 | .Fn SSL_do_handshake | ||
| 40 | will also return when the underlying | ||
| 41 | .Vt BIO | ||
| 42 | could not satisfy the needs of | ||
| 43 | .Fn SSL_do_handshake | ||
| 44 | to continue the handshake. | ||
| 45 | In this case a call to | ||
| 46 | .Xr SSL_get_error 3 | ||
| 47 | with the return value of | ||
| 48 | .Fn SSL_do_handshake | ||
| 49 | will yield | ||
| 50 | .Dv SSL_ERROR_WANT_READ | ||
| 51 | or | ||
| 52 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 53 | The calling process then must repeat the call after taking appropriate action | ||
| 54 | to satisfy the needs of | ||
| 55 | .Fn SSL_do_handshake . | ||
| 56 | The action depends on the underlying | ||
| 57 | .Vt BIO . | ||
| 58 | When using a non-blocking socket, nothing is to be done, but | ||
| 59 | .Xr select 2 | ||
| 60 | can be used to check for the required condition. | ||
| 61 | When using a buffering | ||
| 62 | .Vt BIO , | ||
| 63 | like a | ||
| 64 | .Vt BIO | ||
| 65 | pair, data must be written into or retrieved out of the | ||
| 66 | .Vt BIO | ||
| 67 | before being able to continue. | ||
| 68 | .Sh RETURN VALUES | ||
| 69 | The following return values can occur: | ||
| 70 | .Bl -tag -width Ds | ||
| 71 | .It 0 | ||
| 72 | The TLS/SSL handshake was not successful but was shut down controlled and | ||
| 73 | by the specifications of the TLS/SSL protocol. | ||
| 74 | Call | ||
| 75 | .Xr SSL_get_error 3 | ||
| 76 | with the return value | ||
| 77 | .Fa ret | ||
| 78 | to find out the reason. | ||
| 79 | .It 1 | ||
| 80 | The TLS/SSL handshake was successfully completed, | ||
| 81 | and a TLS/SSL connection has been established. | ||
| 82 | .It <0 | ||
| 83 | The TLS/SSL handshake was not successful because either a fatal error occurred | ||
| 84 | at the protocol level or a connection failure occurred. | ||
| 85 | The shutdown was not clean. | ||
| 86 | It can also occur if action is needed to continue the operation for | ||
| 87 | non-blocking | ||
| 88 | .Vt BIO Ns s. | ||
| 89 | Call | ||
| 90 | .Xr SSL_get_error 3 | ||
| 91 | with the return value | ||
| 92 | .Fa ret | ||
| 93 | to find out the reason. | ||
| 94 | .El | ||
| 95 | .Sh SEE ALSO | ||
| 96 | .Xr bio 3 , | ||
| 97 | .Xr ssl 3 , | ||
| 98 | .Xr SSL_accept 3 , | ||
| 99 | .Xr SSL_connect 3 , | ||
| 100 | .Xr SSL_get_error 3 , | ||
| 101 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/man/SSL_free.3 b/src/lib/libssl/man/SSL_free.3 new file mode 100644 index 0000000000..fe1e6b8aa5 --- /dev/null +++ b/src/lib/libssl/man/SSL_free.3 | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_free.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_FREE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_free | ||
| 9 | .Nd free an allocated SSL structure | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_free "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_free | ||
| 16 | decrements the reference count of | ||
| 17 | .Fa ssl , | ||
| 18 | and removes the | ||
| 19 | .Vt SSL | ||
| 20 | structure pointed to by | ||
| 21 | .Fa ssl | ||
| 22 | and frees up the allocated memory if the reference count has reached 0. | ||
| 23 | If | ||
| 24 | .Fa ssl | ||
| 25 | is a | ||
| 26 | .Dv NULL | ||
| 27 | pointer, no action occurs. | ||
| 28 | .Sh NOTES | ||
| 29 | .Fn SSL_free | ||
| 30 | also calls the | ||
| 31 | .Xr free 3 Ns | ||
| 32 | ing procedures for indirectly affected items, if applicable: the buffering | ||
| 33 | .Vt BIO , | ||
| 34 | the read and write | ||
| 35 | .Vt BIOs , | ||
| 36 | cipher lists specially created for this | ||
| 37 | .Fa ssl , | ||
| 38 | the | ||
| 39 | .Sy SSL_SESSION . | ||
| 40 | Do not explicitly free these indirectly freed up items before or after calling | ||
| 41 | .Fn SSL_free , | ||
| 42 | as trying to free things twice may lead to program failure. | ||
| 43 | .Pp | ||
| 44 | The | ||
| 45 | .Fa ssl | ||
| 46 | session has reference counts from two users: the | ||
| 47 | .Vt SSL | ||
| 48 | object, for which the reference count is removed by | ||
| 49 | .Fn SSL_free | ||
| 50 | and the internal session cache. | ||
| 51 | If the session is considered bad, because | ||
| 52 | .Xr SSL_shutdown 3 | ||
| 53 | was not called for the connection and | ||
| 54 | .Xr SSL_set_shutdown 3 | ||
| 55 | was not used to set the | ||
| 56 | .Vt SSL_SENT_SHUTDOWN | ||
| 57 | state, the session will also be removed from the session cache as required by | ||
| 58 | RFC2246. | ||
| 59 | .Sh RETURN VALUES | ||
| 60 | .Fn SSL_free | ||
| 61 | does not provide diagnostic information. | ||
| 62 | .Sh SEE ALSO | ||
| 63 | .Xr ssl 3 , | ||
| 64 | .Xr SSL_clear 3 , | ||
| 65 | .Xr SSL_new 3 , | ||
| 66 | .Xr SSL_set_shutdown 3 , | ||
| 67 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_SSL_CTX.3 b/src/lib/libssl/man/SSL_get_SSL_CTX.3 new file mode 100644 index 0000000000..ee211f8fdc --- /dev/null +++ b/src/lib/libssl/man/SSL_get_SSL_CTX.3 | |||
| @@ -0,0 +1,28 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_SSL_CTX.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_SSL_CTX 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_SSL_CTX | ||
| 9 | .Nd get the SSL_CTX from which an SSL is created | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft SSL_CTX * | ||
| 13 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_SSL_CTX | ||
| 16 | returns a pointer to the | ||
| 17 | .Vt SSL_CTX | ||
| 18 | object from which | ||
| 19 | .Fa ssl | ||
| 20 | was created with | ||
| 21 | .Xr SSL_new 3 . | ||
| 22 | .Sh RETURN VALUES | ||
| 23 | The pointer to the | ||
| 24 | .Vt SSL_CTX | ||
| 25 | object is returned. | ||
| 26 | .Sh SEE ALSO | ||
| 27 | .Xr ssl 3 , | ||
| 28 | .Xr SSL_new 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_ciphers.3 b/src/lib/libssl/man/SSL_get_ciphers.3 new file mode 100644 index 0000000000..4469b73f92 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_ciphers.3 | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_ciphers.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_CIPHERS 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_ciphers , | ||
| 9 | .Nm SSL_get_cipher_list | ||
| 10 | .Nd get list of available SSL_CIPHERs | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft STACK_OF(SSL_CIPHER) * | ||
| 14 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_get_cipher_list "const SSL *ssl" "int priority" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_get_ciphers | ||
| 19 | returns the stack of available | ||
| 20 | .Vt SSL_CIPHER Ns s | ||
| 21 | for | ||
| 22 | .Fa ssl , | ||
| 23 | sorted by preference. | ||
| 24 | If | ||
| 25 | .Fa ssl | ||
| 26 | is | ||
| 27 | .Dv NULL | ||
| 28 | or no ciphers are available, | ||
| 29 | .Dv NULL | ||
| 30 | is returned. | ||
| 31 | .Pp | ||
| 32 | .Fn SSL_get_cipher_list | ||
| 33 | returns a pointer to the name of the | ||
| 34 | .Vt SSL_CIPHER | ||
| 35 | listed for | ||
| 36 | .Fa ssl | ||
| 37 | with | ||
| 38 | .Fa priority . | ||
| 39 | If | ||
| 40 | .Fa ssl | ||
| 41 | is | ||
| 42 | .Dv NULL , | ||
| 43 | no ciphers are available, or there are fewer ciphers than | ||
| 44 | .Fa priority | ||
| 45 | available, | ||
| 46 | .Dv NULL | ||
| 47 | is returned. | ||
| 48 | .Sh NOTES | ||
| 49 | The details of the ciphers obtained by | ||
| 50 | .Fn SSL_get_ciphers | ||
| 51 | can be obtained using the | ||
| 52 | .Xr SSL_CIPHER_get_name 3 | ||
| 53 | family of functions. | ||
| 54 | .Pp | ||
| 55 | Call | ||
| 56 | .Fn SSL_get_cipher_list | ||
| 57 | with | ||
| 58 | .Fa priority | ||
| 59 | starting from 0 to obtain the sorted list of available ciphers, until | ||
| 60 | .Dv NULL | ||
| 61 | is returned. | ||
| 62 | .Sh RETURN VALUES | ||
| 63 | See | ||
| 64 | .Sx DESCRIPTION . | ||
| 65 | .Sh SEE ALSO | ||
| 66 | .Xr ssl 3 , | ||
| 67 | .Xr SSL_CIPHER_get_name 3 , | ||
| 68 | .Xr SSL_CTX_set_cipher_list 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_client_CA_list.3 b/src/lib/libssl/man/SSL_get_client_CA_list.3 new file mode 100644 index 0000000000..6675bc3793 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_client_CA_list.3 | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_client_CA_list.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_CLIENT_CA_LIST 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_client_CA_list , | ||
| 9 | .Nm SSL_CTX_get_client_CA_list | ||
| 10 | .Nd get list of client CAs | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft STACK_OF(X509_NAME) * | ||
| 14 | .Fn SSL_get_client_CA_list "const SSL *s" | ||
| 15 | .Ft STACK_OF(X509_NAME) * | ||
| 16 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_CTX_get_client_CA_list | ||
| 19 | returns the list of client CAs explicitly set for | ||
| 20 | .Fa ctx | ||
| 21 | using | ||
| 22 | .Xr SSL_CTX_set_client_CA_list 3 . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_get_client_CA_list | ||
| 25 | returns the list of client CAs explicitly set for | ||
| 26 | .Fa ssl | ||
| 27 | using | ||
| 28 | .Fn SSL_set_client_CA_list | ||
| 29 | or | ||
| 30 | .Fa ssl Ns 's | ||
| 31 | .Vt SSL_CTX | ||
| 32 | object with | ||
| 33 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
| 34 | when in server mode. | ||
| 35 | In client mode, | ||
| 36 | .Fn SSL_get_client_CA_list | ||
| 37 | returns the list of client CAs sent from the server, if any. | ||
| 38 | .Sh RETURN VALUES | ||
| 39 | .Fn SSL_CTX_set_client_CA_list | ||
| 40 | and | ||
| 41 | .Fn SSL_set_client_CA_list | ||
| 42 | do not return diagnostic information. | ||
| 43 | .Pp | ||
| 44 | .Fn SSL_CTX_add_client_CA | ||
| 45 | and | ||
| 46 | .Fn SSL_add_client_CA | ||
| 47 | have the following return values: | ||
| 48 | .Bl -tag -width Ds | ||
| 49 | .It Dv STACK_OF Ns Po Vt X509_NAMES Pc | ||
| 50 | List of CA names explicitly set (for | ||
| 51 | .Fa ctx | ||
| 52 | or in server mode) or sent by the server (client mode). | ||
| 53 | .It Dv NULL | ||
| 54 | No client CA list was explicitly set (for | ||
| 55 | .Fa ctx | ||
| 56 | or in server mode) or the server did not send a list of CAs (client mode). | ||
| 57 | .El | ||
| 58 | .Sh SEE ALSO | ||
| 59 | .Xr ssl 3 , | ||
| 60 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
| 61 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_current_cipher.3 b/src/lib/libssl/man/SSL_get_current_cipher.3 new file mode 100644 index 0000000000..de46f3d21c --- /dev/null +++ b/src/lib/libssl/man/SSL_get_current_cipher.3 | |||
| @@ -0,0 +1,52 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_current_cipher.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_CURRENT_CIPHER 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_current_cipher , | ||
| 9 | .Nm SSL_get_cipher , | ||
| 10 | .Nm SSL_get_cipher_name , | ||
| 11 | .Nm SSL_get_cipher_bits , | ||
| 12 | .Nm SSL_get_cipher_version | ||
| 13 | .Nd get SSL_CIPHER of a connection | ||
| 14 | .Sh SYNOPSIS | ||
| 15 | .In openssl/ssl.h | ||
| 16 | .Ft SSL_CIPHER * | ||
| 17 | .Fn SSL_get_current_cipher "const SSL *ssl" | ||
| 18 | .Fd #define SSL_get_cipher(s) SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
| 19 | .Fd #define SSL_get_cipher_name(s) \ | ||
| 20 | SSL_CIPHER_get_name(SSL_get_current_cipher(s)) | ||
| 21 | .Fd #define SSL_get_cipher_bits(s,np) \ | ||
| 22 | SSL_CIPHER_get_bits(SSL_get_current_cipher(s),np) | ||
| 23 | .Fd #define SSL_get_cipher_version(s) \ | ||
| 24 | SSL_CIPHER_get_version(SSL_get_current_cipher(s)) | ||
| 25 | .Sh DESCRIPTION | ||
| 26 | .Fn SSL_get_current_cipher | ||
| 27 | returns a pointer to an | ||
| 28 | .Vt SSL_CIPHER | ||
| 29 | object containing the description of the actually used cipher of a connection | ||
| 30 | established with the | ||
| 31 | .Fa ssl | ||
| 32 | object. | ||
| 33 | .Pp | ||
| 34 | .Fn SSL_get_cipher | ||
| 35 | and | ||
| 36 | .Fn SSL_get_cipher_name | ||
| 37 | are identical macros to obtain the name of the currently used cipher. | ||
| 38 | .Fn SSL_get_cipher_bits | ||
| 39 | is a macro to obtain the number of secret/algorithm bits used and | ||
| 40 | .Fn SSL_get_cipher_version | ||
| 41 | returns the protocol name. | ||
| 42 | See | ||
| 43 | .Xr SSL_CIPHER_get_name 3 | ||
| 44 | for more details. | ||
| 45 | .Sh RETURN VALUES | ||
| 46 | .Fn SSL_get_current_cipher | ||
| 47 | returns the cipher actually used or | ||
| 48 | .Dv NULL , | ||
| 49 | when no session has been established. | ||
| 50 | .Sh SEE ALSO | ||
| 51 | .Xr ssl 3 , | ||
| 52 | .Xr SSL_CIPHER_get_name 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_default_timeout.3 b/src/lib/libssl/man/SSL_get_default_timeout.3 new file mode 100644 index 0000000000..a14d8041e2 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_default_timeout.3 | |||
| @@ -0,0 +1,36 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_default_timeout.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_DEFAULT_TIMEOUT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_default_timeout | ||
| 9 | .Nd get default session timeout value | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft long | ||
| 13 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_default_timeout | ||
| 16 | returns the default timeout value assigned to | ||
| 17 | .Vt SSL_SESSION | ||
| 18 | objects negotiated for the protocol valid for | ||
| 19 | .Fa ssl . | ||
| 20 | .Sh NOTES | ||
| 21 | Whenever a new session is negotiated, it is assigned a timeout value, | ||
| 22 | after which it will not be accepted for session reuse. | ||
| 23 | If the timeout value was not explicitly set using | ||
| 24 | .Xr SSL_CTX_set_timeout 3 , | ||
| 25 | the hardcoded default timeout for the protocol will be used. | ||
| 26 | .Pp | ||
| 27 | .Fn SSL_get_default_timeout | ||
| 28 | return this hardcoded value, which is 300 seconds for all currently supported | ||
| 29 | protocols (SSLv2, SSLv3, and TLSv1). | ||
| 30 | .Sh RETURN VALUES | ||
| 31 | See description. | ||
| 32 | .Sh SEE ALSO | ||
| 33 | .Xr ssl 3 , | ||
| 34 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 35 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 36 | .Xr SSL_SESSION_get_time 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_error.3 b/src/lib/libssl/man/SSL_get_error.3 new file mode 100644 index 0000000000..b3e7c9e491 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_error.3 | |||
| @@ -0,0 +1,169 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_error.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_ERROR 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_error | ||
| 9 | .Nd obtain result code for TLS/SSL I/O operation | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_get_error "const SSL *ssl" "int ret" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_error | ||
| 16 | returns a result code (suitable for the C | ||
| 17 | .Dq switch | ||
| 18 | statement) for a preceding call to | ||
| 19 | .Xr SSL_connect 3 , | ||
| 20 | .Xr SSL_accept 3 , | ||
| 21 | .Xr SSL_do_handshake 3 , | ||
| 22 | .Xr SSL_read 3 , | ||
| 23 | .Xr SSL_peek 3 , | ||
| 24 | or | ||
| 25 | .Xr SSL_write 3 | ||
| 26 | on | ||
| 27 | .Fa ssl . | ||
| 28 | The value returned by that TLS/SSL I/O function must be passed to | ||
| 29 | .Fn SSL_get_error | ||
| 30 | in parameter | ||
| 31 | .Fa ret . | ||
| 32 | .Pp | ||
| 33 | In addition to | ||
| 34 | .Fa ssl | ||
| 35 | and | ||
| 36 | .Fa ret , | ||
| 37 | .Fn SSL_get_error | ||
| 38 | inspects the current thread's OpenSSL error queue. | ||
| 39 | Thus, | ||
| 40 | .Fn SSL_get_error | ||
| 41 | must be used in the same thread that performed the TLS/SSL I/O operation, | ||
| 42 | and no other OpenSSL function calls should appear in between. | ||
| 43 | The current thread's error queue must be empty before the TLS/SSL I/O operation | ||
| 44 | is attempted, or | ||
| 45 | .Fn SSL_get_error | ||
| 46 | will not work reliably. | ||
| 47 | .Sh RETURN VALUES | ||
| 48 | The following return values can currently occur: | ||
| 49 | .Bl -tag -width Ds | ||
| 50 | .It Dv SSL_ERROR_NONE | ||
| 51 | The TLS/SSL I/O operation completed. | ||
| 52 | This result code is returned if and only if | ||
| 53 | .Fa ret | ||
| 54 | < 0. | ||
| 55 | .It Dv SSL_ERROR_ZERO_RETURN | ||
| 56 | The TLS/SSL connection has been closed. | ||
| 57 | If the protocol version is SSL 3.0 or TLS 1.0, this result code is returned | ||
| 58 | only if a closure alert has occurred in the protocol, i.e., if the connection | ||
| 59 | has been closed cleanly. | ||
| 60 | Note that in this case | ||
| 61 | .Dv SSL_ERROR_ZERO_RETURN | ||
| 62 | does not necessarily indicate that the underlying transport has been closed. | ||
| 63 | .It Dv SSL_ERROR_WANT_READ , Dv SSL_ERROR_WANT_WRITE | ||
| 64 | The operation did not complete; | ||
| 65 | the same TLS/SSL I/O function should be called again later. | ||
| 66 | If, by then, the underlying | ||
| 67 | .Vt BIO | ||
| 68 | has data available for reading (if the result code is | ||
| 69 | .Dv SSL_ERROR_WANT_READ ) | ||
| 70 | or allows writing data | ||
| 71 | .Pq Dv SSL_ERROR_WANT_WRITE , | ||
| 72 | then some TLS/SSL protocol progress will take place, | ||
| 73 | i.e., at least part of a TLS/SSL record will be read or written. | ||
| 74 | Note that the retry may again lead to a | ||
| 75 | .Dv SSL_ERROR_WANT_READ | ||
| 76 | or | ||
| 77 | .Dv SSL_ERROR_WANT_WRITE | ||
| 78 | condition. | ||
| 79 | There is no fixed upper limit for the number of iterations that may be | ||
| 80 | necessary until progress becomes visible at application protocol level. | ||
| 81 | .Pp | ||
| 82 | For socket | ||
| 83 | .Fa BIO Ns | ||
| 84 | s (e.g., when | ||
| 85 | .Fn SSL_set_fd | ||
| 86 | was used), | ||
| 87 | .Xr select 2 | ||
| 88 | or | ||
| 89 | .Xr poll 2 | ||
| 90 | on the underlying socket can be used to find out when the TLS/SSL I/O function | ||
| 91 | should be retried. | ||
| 92 | .Pp | ||
| 93 | Caveat: Any TLS/SSL I/O function can lead to either of | ||
| 94 | .Dv SSL_ERROR_WANT_READ | ||
| 95 | and | ||
| 96 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 97 | In particular, | ||
| 98 | .Xr SSL_read 3 | ||
| 99 | or | ||
| 100 | .Xr SSL_peek 3 | ||
| 101 | may want to write data and | ||
| 102 | .Xr SSL_write 3 | ||
| 103 | may want | ||
| 104 | to read data. | ||
| 105 | This is mainly because TLS/SSL handshakes may occur at any time during the | ||
| 106 | protocol (initiated by either the client or the server); | ||
| 107 | .Xr SSL_read 3 , | ||
| 108 | .Xr SSL_peek 3 , | ||
| 109 | and | ||
| 110 | .Xr SSL_write 3 | ||
| 111 | will handle any pending handshakes. | ||
| 112 | .It Dv SSL_ERROR_WANT_CONNECT , Dv SSL_ERROR_WANT_ACCEPT | ||
| 113 | The operation did not complete; the same TLS/SSL I/O function should be | ||
| 114 | called again later. | ||
| 115 | The underlying BIO was not connected yet to the peer and the call would block | ||
| 116 | in | ||
| 117 | .Xr connect 2 Ns / Ns | ||
| 118 | .Xr accept 2 . | ||
| 119 | The SSL function should be | ||
| 120 | called again when the connection is established. | ||
| 121 | These messages can only appear with a | ||
| 122 | .Xr BIO_s_connect 3 | ||
| 123 | or | ||
| 124 | .Xr BIO_s_accept 3 | ||
| 125 | .Vt BIO , | ||
| 126 | respectively. | ||
| 127 | In order to find out when the connection has been successfully established, | ||
| 128 | on many platforms | ||
| 129 | .Xr select 2 | ||
| 130 | or | ||
| 131 | .Xr poll 2 | ||
| 132 | for writing on the socket file descriptor can be used. | ||
| 133 | .It Dv SSL_ERROR_WANT_X509_LOOKUP | ||
| 134 | The operation did not complete because an application callback set by | ||
| 135 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
| 136 | has asked to be called again. | ||
| 137 | The TLS/SSL I/O function should be called again later. | ||
| 138 | Details depend on the application. | ||
| 139 | .It Dv SSL_ERROR_SYSCALL | ||
| 140 | Some I/O error occurred. | ||
| 141 | The OpenSSL error queue may contain more information on the error. | ||
| 142 | If the error queue is empty (i.e., | ||
| 143 | .Fn ERR_get_error | ||
| 144 | returns 0), | ||
| 145 | .Fa ret | ||
| 146 | can be used to find out more about the error: | ||
| 147 | If | ||
| 148 | .Fa ret | ||
| 149 | == 0, an | ||
| 150 | .Dv EOF | ||
| 151 | was observed that violates the protocol. | ||
| 152 | If | ||
| 153 | .Fa ret | ||
| 154 | == \(mi1, the underlying | ||
| 155 | .Vt BIO | ||
| 156 | reported an | ||
| 157 | I/O error (for socket I/O on Unix systems, consult | ||
| 158 | .Dv errno | ||
| 159 | for details). | ||
| 160 | .It Dv SSL_ERROR_SSL | ||
| 161 | A failure in the SSL library occurred, usually a protocol error. | ||
| 162 | The OpenSSL error queue contains more information on the error. | ||
| 163 | .El | ||
| 164 | .Sh SEE ALSO | ||
| 165 | .Xr err 3 , | ||
| 166 | .Xr ssl 3 | ||
| 167 | .Sh HISTORY | ||
| 168 | .Fn SSL_get_error | ||
| 169 | was added in SSLeay 0.8. | ||
diff --git a/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 new file mode 100644 index 0000000000..ab9b7ae376 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3 | |||
| @@ -0,0 +1,65 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_ex_data_X509_STORE_CTX_idx.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_EX_DATA_X509_STORE_CTX_IDX 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_ex_data_X509_STORE_CTX_idx | ||
| 9 | .Nd get ex_data index to access SSL structure from X509_STORE_CTX | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
| 16 | returns the index number under which the pointer to the | ||
| 17 | .Vt SSL | ||
| 18 | object is stored into the | ||
| 19 | .Vt X509_STORE_CTX | ||
| 20 | object. | ||
| 21 | .Sh NOTES | ||
| 22 | Whenever a | ||
| 23 | .Vt X509_STORE_CTX | ||
| 24 | object is created for the verification of the peer's certificate during a | ||
| 25 | handshake, a pointer to the | ||
| 26 | .Vt SSL | ||
| 27 | object is stored into the | ||
| 28 | .Vt X509_STORE_CTX | ||
| 29 | object to identify the connection affected. | ||
| 30 | To retrieve this pointer the | ||
| 31 | .Xr X509_STORE_CTX_get_ex_data 3 | ||
| 32 | function can be used with the correct index. | ||
| 33 | This index is globally the same for all | ||
| 34 | .Vt X509_STORE_CTX | ||
| 35 | objects and can be retrieved using | ||
| 36 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx . | ||
| 37 | The index value is set when | ||
| 38 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
| 39 | is first called either by the application program directly or indirectly during | ||
| 40 | other SSL setup functions or during the handshake. | ||
| 41 | .Pp | ||
| 42 | The value depends on other index values defined for | ||
| 43 | .Vt X509_STORE_CTX | ||
| 44 | objects before the SSL index is created. | ||
| 45 | .Sh RETURN VALUES | ||
| 46 | .Bl -tag -width Ds | ||
| 47 | .It \(>=0 | ||
| 48 | The index value to access the pointer. | ||
| 49 | .It <0 | ||
| 50 | An error occurred, check the error stack for a detailed error message. | ||
| 51 | .El | ||
| 52 | .Sh EXAMPLES | ||
| 53 | The index returned from | ||
| 54 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx | ||
| 55 | provides access to | ||
| 56 | .Vt SSL | ||
| 57 | object for the connection during the | ||
| 58 | .Fn verify_callback | ||
| 59 | when checking the peer's certificate. | ||
| 60 | Please check the example in | ||
| 61 | .Xr SSL_CTX_set_verify 3 . | ||
| 62 | .Sh SEE ALSO | ||
| 63 | .Xr CRYPTO_set_ex_data 3 , | ||
| 64 | .Xr ssl 3 , | ||
| 65 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_ex_new_index.3 b/src/lib/libssl/man/SSL_get_ex_new_index.3 new file mode 100644 index 0000000000..87cb281560 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_ex_new_index.3 | |||
| @@ -0,0 +1,76 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_ex_new_index.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_EX_NEW_INDEX 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_ex_new_index , | ||
| 9 | .Nm SSL_set_ex_data , | ||
| 10 | .Nm SSL_get_ex_data | ||
| 11 | .Nd internal application specific data functions | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fo SSL_get_ex_new_index | ||
| 16 | .Fa "long argl" | ||
| 17 | .Fa "void *argp" | ||
| 18 | .Fa "CRYPTO_EX_new *new_func" | ||
| 19 | .Fa "CRYPTO_EX_dup *dup_func" | ||
| 20 | .Fa "CRYPTO_EX_free *free_func" | ||
| 21 | .Fc | ||
| 22 | .Ft int | ||
| 23 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "void *arg" | ||
| 24 | .Ft void * | ||
| 25 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
| 26 | .Bd -literal | ||
| 27 | typedef int new_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 28 | int idx, long argl, void *argp); | ||
| 29 | typedef void free_func(void *parent, void *ptr, CRYPTO_EX_DATA *ad, | ||
| 30 | int idx, long argl, void *argp); | ||
| 31 | typedef int dup_func(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from, void *from_d, | ||
| 32 | int idx, long argl, void *argp); | ||
| 33 | .Ed | ||
| 34 | .Sh DESCRIPTION | ||
| 35 | Several OpenSSL structures can have application specific data attached to them. | ||
| 36 | These functions are used internally by OpenSSL to manipulate application | ||
| 37 | specific data attached to a specific structure. | ||
| 38 | .Pp | ||
| 39 | .Fn SSL_get_ex_new_index | ||
| 40 | is used to register a new index for application specific data. | ||
| 41 | .Pp | ||
| 42 | .Fn SSL_set_ex_data | ||
| 43 | is used to store application data at | ||
| 44 | .Fa arg | ||
| 45 | for | ||
| 46 | .Fa idx | ||
| 47 | into the | ||
| 48 | .Fa ssl | ||
| 49 | object. | ||
| 50 | .Pp | ||
| 51 | .Fn SSL_get_ex_data | ||
| 52 | is used to retrieve the information for | ||
| 53 | .Fa idx | ||
| 54 | from | ||
| 55 | .Fa ssl . | ||
| 56 | .Pp | ||
| 57 | A detailed description for the | ||
| 58 | .Fn *_get_ex_new_index | ||
| 59 | functionality can be found in | ||
| 60 | .Xr RSA_get_ex_new_index 3 . | ||
| 61 | The | ||
| 62 | .Fn *_get_ex_data | ||
| 63 | and | ||
| 64 | .Fn *_set_ex_data | ||
| 65 | functionality is described in | ||
| 66 | .Xr CRYPTO_set_ex_data 3 . | ||
| 67 | .Sh EXAMPLES | ||
| 68 | An example of how to use the functionality is included in the example | ||
| 69 | .Fn verify_callback | ||
| 70 | in | ||
| 71 | .Xr SSL_CTX_set_verify 3 . | ||
| 72 | .Sh SEE ALSO | ||
| 73 | .Xr CRYPTO_set_ex_data 3 , | ||
| 74 | .Xr RSA_get_ex_new_index 3 , | ||
| 75 | .Xr ssl 3 , | ||
| 76 | .Xr SSL_CTX_set_verify 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_fd.3 b/src/lib/libssl/man/SSL_get_fd.3 new file mode 100644 index 0000000000..e21e75f978 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_fd.3 | |||
| @@ -0,0 +1,46 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_fd.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_FD 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_fd , | ||
| 9 | .Nm SSL_get_rfd , | ||
| 10 | .Nm SSL_get_wfd | ||
| 11 | .Nd get file descriptor linked to an SSL object | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fn SSL_get_fd "const SSL *ssl" | ||
| 16 | .Ft int | ||
| 17 | .Fn SSL_get_rfd "const SSL *ssl" | ||
| 18 | .Ft int | ||
| 19 | .Fn SSL_get_wfd "const SSL *ssl" | ||
| 20 | .Sh DESCRIPTION | ||
| 21 | .Fn SSL_get_fd | ||
| 22 | returns the file descriptor which is linked to | ||
| 23 | .Fa ssl . | ||
| 24 | .Fn SSL_get_rfd | ||
| 25 | and | ||
| 26 | .Fn SSL_get_wfd | ||
| 27 | return the file descriptors for the read or the write channel, | ||
| 28 | which can be different. | ||
| 29 | If the read and the write channel are different, | ||
| 30 | .Fn SSL_get_fd | ||
| 31 | will return the file descriptor of the read channel. | ||
| 32 | .Sh RETURN VALUES | ||
| 33 | The following return values can occur: | ||
| 34 | .Bl -tag -width Ds | ||
| 35 | .It \(mi1 | ||
| 36 | The operation failed, because the underlying | ||
| 37 | .Vt BIO | ||
| 38 | is not of the correct type (suitable for file descriptors). | ||
| 39 | .It \(>=0 | ||
| 40 | The file descriptor linked to | ||
| 41 | .Fa ssl . | ||
| 42 | .El | ||
| 43 | .Sh SEE ALSO | ||
| 44 | .Xr bio 3 , | ||
| 45 | .Xr ssl 3 , | ||
| 46 | .Xr SSL_set_fd 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_peer_cert_chain.3 b/src/lib/libssl/man/SSL_get_peer_cert_chain.3 new file mode 100644 index 0000000000..bf5d04f3cf --- /dev/null +++ b/src/lib/libssl/man/SSL_get_peer_cert_chain.3 | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_peer_cert_chain.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_PEER_CERT_CHAIN 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_peer_cert_chain | ||
| 9 | .Nd get the X509 certificate chain of the peer | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft STACK_OF(X509) * | ||
| 13 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_peer_cert_chain | ||
| 16 | returns a pointer to | ||
| 17 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
| 18 | certificates forming the certificate chain of the peer. | ||
| 19 | If called on the client side, the stack also contains the peer's certificate; | ||
| 20 | if called on the server side, the peer's certificate must be obtained | ||
| 21 | separately using | ||
| 22 | .Xr SSL_get_peer_certificate 3 . | ||
| 23 | If the peer did not present a certificate, | ||
| 24 | .Dv NULL | ||
| 25 | is returned. | ||
| 26 | .Sh NOTES | ||
| 27 | The peer certificate chain is not necessarily available after reusing a | ||
| 28 | session, in which case a | ||
| 29 | .Dv NULL | ||
| 30 | pointer is returned. | ||
| 31 | .Pp | ||
| 32 | The reference count of the | ||
| 33 | .Dv STACK_OF Ns Po Vt X509 Pc | ||
| 34 | object is not incremented. | ||
| 35 | If the corresponding session is freed, the pointer must not be used any longer. | ||
| 36 | .Sh RETURN VALUES | ||
| 37 | The following return values can occur: | ||
| 38 | .Bl -tag -width Ds | ||
| 39 | .It Dv NULL | ||
| 40 | No certificate was presented by the peer or no connection was established or | ||
| 41 | the certificate chain is no longer available when a session is reused. | ||
| 42 | .It Pointer to a Dv STACK_OF Ns Po X509 Pc | ||
| 43 | The return value points to the certificate chain presented by the peer. | ||
| 44 | .El | ||
| 45 | .Sh SEE ALSO | ||
| 46 | .Xr ssl 3 , | ||
| 47 | .Xr SSL_get_peer_certificate 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_peer_certificate.3 b/src/lib/libssl/man/SSL_get_peer_certificate.3 new file mode 100644 index 0000000000..f1b34dfa08 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_peer_certificate.3 | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_peer_certificate.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_PEER_CERTIFICATE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_peer_certificate | ||
| 9 | .Nd get the X509 certificate of the peer | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft X509 * | ||
| 13 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_peer_certificate | ||
| 16 | returns a pointer to the X509 certificate the peer presented. | ||
| 17 | If the peer did not present a certificate, | ||
| 18 | .Dv NULL | ||
| 19 | is returned. | ||
| 20 | .Sh NOTES | ||
| 21 | Due to the protocol definition, a TLS/SSL server will always send a | ||
| 22 | certificate, if present. | ||
| 23 | A client will only send a certificate when explicitly requested to do so by the | ||
| 24 | server (see | ||
| 25 | .Xr SSL_CTX_set_verify 3 ) . | ||
| 26 | If an anonymous cipher is used, no certificates are sent. | ||
| 27 | .Pp | ||
| 28 | That a certificate is returned does not indicate information about the | ||
| 29 | verification state. | ||
| 30 | Use | ||
| 31 | .Xr SSL_get_verify_result 3 | ||
| 32 | to check the verification state. | ||
| 33 | .Pp | ||
| 34 | The reference count of the | ||
| 35 | .Vt X509 | ||
| 36 | object is incremented by one, so that it will not be destroyed when the session | ||
| 37 | containing the peer certificate is freed. | ||
| 38 | The | ||
| 39 | .Vt X509 | ||
| 40 | object must be explicitly freed using | ||
| 41 | .Xr X509_free 3 . | ||
| 42 | .Sh RETURN VALUES | ||
| 43 | The following return values can occur: | ||
| 44 | .Bl -tag -width Ds | ||
| 45 | .It Dv NULL | ||
| 46 | No certificate was presented by the peer or no connection was established. | ||
| 47 | .It Pointer to an X509 certificate | ||
| 48 | The return value points to the certificate presented by the peer. | ||
| 49 | .El | ||
| 50 | .Sh SEE ALSO | ||
| 51 | .Xr ssl 3 , | ||
| 52 | .Xr SSL_CTX_set_verify 3 , | ||
| 53 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_psk_identity.3 b/src/lib/libssl/man/SSL_get_psk_identity.3 new file mode 100644 index 0000000000..a2f91ee1c7 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_psk_identity.3 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_psk_identity.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_PSK_IDENTITY 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_psk_identity , | ||
| 9 | .Nm SSL_get_psk_identity_hint | ||
| 10 | .Nd get PSK client identity and hint | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft const char * | ||
| 14 | .Fn SSL_get_psk_identity_hint "const SSL *ssl" | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_get_psk_identity "const SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_get_psk_identity_hint | ||
| 19 | is used to retrieve the PSK identity hint used during the connection setup | ||
| 20 | related to | ||
| 21 | .Vt SSL | ||
| 22 | object | ||
| 23 | .Fa ssl . | ||
| 24 | Similarly, | ||
| 25 | .Fn SSL_get_psk_identity | ||
| 26 | is used to retrieve the PSK identity used during the connection setup. | ||
| 27 | .Sh RETURN VALUES | ||
| 28 | If | ||
| 29 | .Pf non- Dv NULL , | ||
| 30 | .Fn SSL_get_psk_identity_hint | ||
| 31 | returns the PSK identity hint and | ||
| 32 | .Fn SSL_get_psk_identity | ||
| 33 | returns the PSK identity. | ||
| 34 | Both are | ||
| 35 | .Dv NULL Ns -terminated. | ||
| 36 | .Fn SSL_get_psk_identity_hint | ||
| 37 | may return | ||
| 38 | .Dv NULL | ||
| 39 | if no PSK identity hint was used during the connection setup. | ||
| 40 | .Pp | ||
| 41 | Note that the return value is valid only during the lifetime of the | ||
| 42 | .Vt SSL | ||
| 43 | object | ||
| 44 | .Fa ssl . | ||
diff --git a/src/lib/libssl/man/SSL_get_rbio.3 b/src/lib/libssl/man/SSL_get_rbio.3 new file mode 100644 index 0000000000..adef98ec6a --- /dev/null +++ b/src/lib/libssl/man/SSL_get_rbio.3 | |||
| @@ -0,0 +1,45 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_rbio.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_RBIO 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_rbio , | ||
| 9 | .Nm SSL_get_wbio | ||
| 10 | .Nd get BIO linked to an SSL object | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft BIO * | ||
| 14 | .Fn SSL_get_rbio "SSL *ssl" | ||
| 15 | .Ft BIO * | ||
| 16 | .Fn SSL_get_wbio "SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_get_rbio | ||
| 19 | and | ||
| 20 | .Fn SSL_get_wbio | ||
| 21 | return pointers to the | ||
| 22 | .Vt BIO Ns s | ||
| 23 | for the read or the write channel, which can be different. | ||
| 24 | The reference count of the | ||
| 25 | .Vt BIO | ||
| 26 | is not incremented. | ||
| 27 | .Sh RETURN VALUES | ||
| 28 | The following return values can occur: | ||
| 29 | .Bl -tag -width Ds | ||
| 30 | .It Dv NULL | ||
| 31 | No | ||
| 32 | .Vt BIO | ||
| 33 | was connected to the | ||
| 34 | .Vt SSL | ||
| 35 | object. | ||
| 36 | .It Any other pointer | ||
| 37 | The | ||
| 38 | .Vt BIO | ||
| 39 | linked to | ||
| 40 | .Fa ssl . | ||
| 41 | .El | ||
| 42 | .Sh SEE ALSO | ||
| 43 | .Xr bio 3 , | ||
| 44 | .Xr ssl 3 , | ||
| 45 | .Xr SSL_set_bio 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_session.3 b/src/lib/libssl/man/SSL_get_session.3 new file mode 100644 index 0000000000..03e47c59c2 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_session.3 | |||
| @@ -0,0 +1,97 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_session.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_SESSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_session , | ||
| 9 | .Nm SSL_get0_session , | ||
| 10 | .Nm SSL_get1_session | ||
| 11 | .Nd retrieve TLS/SSL session data | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft SSL_SESSION * | ||
| 15 | .Fn SSL_get_session "const SSL *ssl" | ||
| 16 | .Ft SSL_SESSION * | ||
| 17 | .Fn SSL_get0_session "const SSL *ssl" | ||
| 18 | .Ft SSL_SESSION * | ||
| 19 | .Fn SSL_get1_session "SSL *ssl" | ||
| 20 | .Sh DESCRIPTION | ||
| 21 | .Fn SSL_get_session | ||
| 22 | returns a pointer to the | ||
| 23 | .Vt SSL_SESSION | ||
| 24 | actually used in | ||
| 25 | .Fa ssl . | ||
| 26 | The reference count of the | ||
| 27 | .Vt SSL_SESSION | ||
| 28 | is not incremented, so that the pointer can become invalid by other operations. | ||
| 29 | .Pp | ||
| 30 | .Fn SSL_get0_session | ||
| 31 | is the same as | ||
| 32 | .Fn SSL_get_session . | ||
| 33 | .Pp | ||
| 34 | .Fn SSL_get1_session | ||
| 35 | is the same as | ||
| 36 | .Fn SSL_get_session , | ||
| 37 | but the reference count of the | ||
| 38 | .Vt SSL_SESSION | ||
| 39 | is incremented by one. | ||
| 40 | .Sh NOTES | ||
| 41 | The | ||
| 42 | Fa ssl | ||
| 43 | session contains all information required to re-establish the connection | ||
| 44 | without a new handshake. | ||
| 45 | .Pp | ||
| 46 | .Fn SSL_get0_session | ||
| 47 | returns a pointer to the actual session. | ||
| 48 | As the reference counter is not incremented, | ||
| 49 | the pointer is only valid while the connection is in use. | ||
| 50 | If | ||
| 51 | .Xr SSL_clear 3 | ||
| 52 | or | ||
| 53 | .Xr SSL_free 3 | ||
| 54 | is called, the session may be removed completely (if considered bad), | ||
| 55 | and the pointer obtained will become invalid. | ||
| 56 | Even if the session is valid, | ||
| 57 | it can be removed at any time due to timeout during | ||
| 58 | .Xr SSL_CTX_flush_sessions 3 . | ||
| 59 | .Pp | ||
| 60 | If the data is to be kept, | ||
| 61 | .Fn SSL_get1_session | ||
| 62 | will increment the reference count, so that the session will not be implicitly | ||
| 63 | removed by other operations but stays in memory. | ||
| 64 | In order to remove the session | ||
| 65 | .Xr SSL_SESSION_free 3 | ||
| 66 | must be explicitly called once to decrement the reference count again. | ||
| 67 | .Pp | ||
| 68 | .Vt SSL_SESSION | ||
| 69 | objects keep internal link information about the session cache list when being | ||
| 70 | inserted into one | ||
| 71 | .Vt SSL_CTX | ||
| 72 | object's session cache. | ||
| 73 | One | ||
| 74 | .Vt SSL_SESSION | ||
| 75 | object, regardless of its reference count, must therefore only be used with one | ||
| 76 | .Vt SSL_CTX | ||
| 77 | object (and the | ||
| 78 | .Vt SSL | ||
| 79 | objects created from this | ||
| 80 | .Vt SSL_CTX | ||
| 81 | object). | ||
| 82 | .Sh RETURN VALUES | ||
| 83 | The following return values can occur: | ||
| 84 | .Bl -tag -width Ds | ||
| 85 | .It Dv NULL | ||
| 86 | There is no session available in | ||
| 87 | .Fa ssl . | ||
| 88 | .It Pointer to an Vt SSL | ||
| 89 | The return value points to the data of an | ||
| 90 | .Vt SSL | ||
| 91 | session. | ||
| 92 | .El | ||
| 93 | .Sh SEE ALSO | ||
| 94 | .Xr ssl 3 , | ||
| 95 | .Xr SSL_clear 3 , | ||
| 96 | .Xr SSL_free 3 , | ||
| 97 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/man/SSL_get_verify_result.3 b/src/lib/libssl/man/SSL_get_verify_result.3 new file mode 100644 index 0000000000..d93feee3be --- /dev/null +++ b/src/lib/libssl/man/SSL_get_verify_result.3 | |||
| @@ -0,0 +1,49 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_verify_result.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_VERIFY_RESULT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_verify_result | ||
| 9 | .Nd get result of peer certificate verification | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft long | ||
| 13 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_verify_result | ||
| 16 | returns the result of the verification of the X509 certificate presented by the | ||
| 17 | peer, if any. | ||
| 18 | .Sh NOTES | ||
| 19 | .Fn SSL_get_verify_result | ||
| 20 | can only return one error code while the verification of a certificate can fail | ||
| 21 | because of many reasons at the same time. | ||
| 22 | Only the last verification error that occurred during the processing is | ||
| 23 | available from | ||
| 24 | .Fn SSL_get_verify_result . | ||
| 25 | .Pp | ||
| 26 | The verification result is part of the established session and is restored when | ||
| 27 | a session is reused. | ||
| 28 | .Sh RETURN VALUES | ||
| 29 | The following return values can currently occur: | ||
| 30 | .Bl -tag -width Ds | ||
| 31 | .It Dv X509_V_OK | ||
| 32 | The verification succeeded or no peer certificate was presented. | ||
| 33 | .It Any other value | ||
| 34 | Documented in | ||
| 35 | .Xr openssl 1 . | ||
| 36 | .El | ||
| 37 | .Sh SEE ALSO | ||
| 38 | .Xr openssl 1 , | ||
| 39 | .Xr ssl 3 , | ||
| 40 | .Xr SSL_get_peer_certificate 3 , | ||
| 41 | .Xr SSL_set_verify_result 3 | ||
| 42 | .Sh BUGS | ||
| 43 | If no peer certificate was presented, the returned result code is | ||
| 44 | .Dv X509_V_OK . | ||
| 45 | This is because no verification error occurred; | ||
| 46 | however, it does not indicate success. | ||
| 47 | .Fn SSL_get_verify_result | ||
| 48 | is only useful in connection with | ||
| 49 | .Xr SSL_get_peer_certificate 3 . | ||
diff --git a/src/lib/libssl/man/SSL_get_version.3 b/src/lib/libssl/man/SSL_get_version.3 new file mode 100644 index 0000000000..ebbee0cb15 --- /dev/null +++ b/src/lib/libssl/man/SSL_get_version.3 | |||
| @@ -0,0 +1,35 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_get_version.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_GET_VERSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_get_version | ||
| 9 | .Nd get the protocol version of a connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft const char * | ||
| 13 | .Fn SSL_get_version "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_get_version | ||
| 16 | returns the name of the protocol used for the connection | ||
| 17 | .Fa ssl . | ||
| 18 | .Sh RETURN VALUES | ||
| 19 | The following strings can be returned: | ||
| 20 | .Bl -tag -width Ds | ||
| 21 | .It Qq SSLv2 | ||
| 22 | The connection uses the SSLv2 protocol. | ||
| 23 | .It Qq SSLv3 | ||
| 24 | The connection uses the SSLv3 protocol. | ||
| 25 | .It Qq TLSv1 | ||
| 26 | The connection uses the TLSv1.0 protocol. | ||
| 27 | .It Qq TLSv1.1 | ||
| 28 | The connection uses the TLSv1.1 protocol. | ||
| 29 | .It Qq TLSv1.2 | ||
| 30 | The connection uses the TLSv1.2 protocol. | ||
| 31 | .It Qq unknown | ||
| 32 | This indicates that no version has been set (no connection established). | ||
| 33 | .El | ||
| 34 | .Sh SEE ALSO | ||
| 35 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_library_init.3 b/src/lib/libssl/man/SSL_library_init.3 new file mode 100644 index 0000000000..ab5326bc4d --- /dev/null +++ b/src/lib/libssl/man/SSL_library_init.3 | |||
| @@ -0,0 +1,54 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_library_init.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_LIBRARY_INIT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_library_init , | ||
| 9 | .Nm OpenSSL_add_ssl_algorithms , | ||
| 10 | .Nm SSLeay_add_ssl_algorithms | ||
| 11 | .Nd initialize SSL library by registering algorithms | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fn SSL_library_init void | ||
| 16 | .Fd #define OpenSSL_add_ssl_algorithms() SSL_library_init() | ||
| 17 | .Fd #define SSLeay_add_ssl_algorithms() SSL_library_init() | ||
| 18 | .Sh DESCRIPTION | ||
| 19 | .Fn SSL_library_init | ||
| 20 | registers the available SSL/TLS ciphers and digests. | ||
| 21 | .Pp | ||
| 22 | .Fn OpenSSL_add_ssl_algorithms | ||
| 23 | and | ||
| 24 | .Fn SSLeay_add_ssl_algorithms | ||
| 25 | are synonyms for | ||
| 26 | .Fn SSL_library_init . | ||
| 27 | .Sh NOTES | ||
| 28 | .Fn SSL_library_init | ||
| 29 | must be called before any other action takes place. | ||
| 30 | .Fn SSL_library_init | ||
| 31 | is not reentrant. | ||
| 32 | .Sh WARNING | ||
| 33 | .Fn SSL_library_init | ||
| 34 | adds ciphers and digests used directly and indirectly by SSL/TLS. | ||
| 35 | .Sh RETURN VALUES | ||
| 36 | .Fn SSL_library_init | ||
| 37 | always returns 1, so it is safe to discard the return value. | ||
| 38 | .Sh EXAMPLES | ||
| 39 | A typical TLS/SSL application will start with the library initialization, and | ||
| 40 | provide readable error messages. | ||
| 41 | .Bd -literal | ||
| 42 | SSL_load_error_strings(); /* readable error messages */ | ||
| 43 | SSL_library_init(); /* initialize library */ | ||
| 44 | .Ed | ||
| 45 | .Sh NOTES | ||
| 46 | OpenSSL 0.9.8o and 1.0.0a and later added SHA2 algorithms to | ||
| 47 | .Fn SSL_library_init . | ||
| 48 | Applications which need to use SHA2 in earlier versions of OpenSSL should call | ||
| 49 | .Fn OpenSSL_add_all_algorithms | ||
| 50 | as well. | ||
| 51 | .Sh SEE ALSO | ||
| 52 | .Xr RAND_add 3 , | ||
| 53 | .Xr ssl 3 , | ||
| 54 | .Xr SSL_load_error_strings 3 | ||
diff --git a/src/lib/libssl/man/SSL_load_client_CA_file.3 b/src/lib/libssl/man/SSL_load_client_CA_file.3 new file mode 100644 index 0000000000..21d8054fd4 --- /dev/null +++ b/src/lib/libssl/man/SSL_load_client_CA_file.3 | |||
| @@ -0,0 +1,53 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_load_client_CA_file.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_LOAD_CLIENT_CA_FILE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_load_client_CA_file | ||
| 9 | .Nd load certificate names from file | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft STACK_OF(X509_NAME) * | ||
| 13 | .Fn SSL_load_client_CA_file "const char *file" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_load_client_CA_file | ||
| 16 | reads certificates from | ||
| 17 | .Fa file | ||
| 18 | and returns a | ||
| 19 | .Dv STACK_OF Ns | ||
| 20 | .Pq Vt X509_NAME | ||
| 21 | with the subject names found. | ||
| 22 | .Sh NOTES | ||
| 23 | .Fn SSL_load_client_CA_file | ||
| 24 | reads a file of PEM formatted certificates and extracts the | ||
| 25 | .Vt X509_NAME Ns s | ||
| 26 | of the certificates found. | ||
| 27 | While the name suggests the specific usage as support function for | ||
| 28 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
| 29 | it is not limited to CA certificates. | ||
| 30 | .Sh RETURN VALUES | ||
| 31 | The following return values can occur: | ||
| 32 | .Bl -tag -width Ds | ||
| 33 | .It Dv NULL | ||
| 34 | The operation failed, check out the error stack for the reason. | ||
| 35 | .It Pointer to Dv STACK_OF Ns Po Vt X509_NAME Pc | ||
| 36 | Pointer to the subject names of the successfully read certificates. | ||
| 37 | .El | ||
| 38 | .Sh EXAMPLES | ||
| 39 | Load names of CAs from file and use it as a client CA list: | ||
| 40 | .Bd -literal | ||
| 41 | SSL_CTX *ctx; | ||
| 42 | STACK_OF(X509_NAME) *cert_names; | ||
| 43 | \&... | ||
| 44 | cert_names = SSL_load_client_CA_file("/path/to/CAfile.pem"); | ||
| 45 | if (cert_names != NULL) | ||
| 46 | SSL_CTX_set_client_CA_list(ctx, cert_names); | ||
| 47 | else | ||
| 48 | error_handling(); | ||
| 49 | \&... | ||
| 50 | .Ed | ||
| 51 | .Sh SEE ALSO | ||
| 52 | .Xr ssl 3 , | ||
| 53 | .Xr SSL_CTX_set_client_CA_list 3 | ||
diff --git a/src/lib/libssl/man/SSL_new.3 b/src/lib/libssl/man/SSL_new.3 new file mode 100644 index 0000000000..14883f46ad --- /dev/null +++ b/src/lib/libssl/man/SSL_new.3 | |||
| @@ -0,0 +1,41 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_new.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_NEW 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_new | ||
| 9 | .Nd create a new SSL structure for a connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft SSL * | ||
| 13 | .Fn SSL_new "SSL_CTX *ctx" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_new | ||
| 16 | creates a new | ||
| 17 | .Vt SSL | ||
| 18 | structure which is needed to hold the data for a TLS/SSL connection. | ||
| 19 | The new structure inherits the settings of the underlying context | ||
| 20 | .Fa ctx : | ||
| 21 | connection method (SSLv2/v3/TLSv1), options, verification settings, | ||
| 22 | timeout settings. | ||
| 23 | .Sh RETURN VALUES | ||
| 24 | The following return values can occur: | ||
| 25 | .Bl -tag -width Ds | ||
| 26 | .It Dv NULL | ||
| 27 | The creation of a new | ||
| 28 | .Vt SSL | ||
| 29 | structure failed. | ||
| 30 | Check the error stack to find out the reason. | ||
| 31 | .It Pointer to an Vt SSL No structure | ||
| 32 | The return value points to an allocated | ||
| 33 | .Vt SSL | ||
| 34 | structure. | ||
| 35 | .El | ||
| 36 | .Sh SEE ALSO | ||
| 37 | .Xr ssl 3 , | ||
| 38 | .Xr SSL_clear 3 , | ||
| 39 | .Xr SSL_CTX_set_options 3 , | ||
| 40 | .Xr SSL_free 3 , | ||
| 41 | .Xr SSL_get_SSL_CTX 3 | ||
diff --git a/src/lib/libssl/man/SSL_pending.3 b/src/lib/libssl/man/SSL_pending.3 new file mode 100644 index 0000000000..dadeec4b92 --- /dev/null +++ b/src/lib/libssl/man/SSL_pending.3 | |||
| @@ -0,0 +1,44 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_pending.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_PENDING 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_pending | ||
| 9 | .Nd obtain number of readable bytes buffered in an SSL object | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_pending "const SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_pending | ||
| 16 | returns the number of bytes which are available inside | ||
| 17 | .Fa ssl | ||
| 18 | for immediate read. | ||
| 19 | .Sh NOTES | ||
| 20 | Data are received in blocks from the peer. | ||
| 21 | Therefore data can be buffered inside | ||
| 22 | .Fa ssl | ||
| 23 | and are ready for immediate retrieval with | ||
| 24 | .Xr SSL_read 3 . | ||
| 25 | .Sh RETURN VALUES | ||
| 26 | The number of bytes pending is returned. | ||
| 27 | .Sh SEE ALSO | ||
| 28 | .Xr ssl 3 , | ||
| 29 | .Xr SSL_read 3 | ||
| 30 | .Sh BUGS | ||
| 31 | .Fn SSL_pending | ||
| 32 | takes into account only bytes from the TLS/SSL record that is currently being | ||
| 33 | processed (if any). | ||
| 34 | If the | ||
| 35 | .Vt SSL | ||
| 36 | object's | ||
| 37 | .Em read_ahead | ||
| 38 | flag is set, additional protocol bytes may have been read containing more | ||
| 39 | TLS/SSL records; these are ignored by | ||
| 40 | .Fn SSL_pending . | ||
| 41 | .Pp | ||
| 42 | Up to OpenSSL 0.9.6, | ||
| 43 | .Fn SSL_pending | ||
| 44 | does not check if the record type of pending data is application data. | ||
diff --git a/src/lib/libssl/man/SSL_read.3 b/src/lib/libssl/man/SSL_read.3 new file mode 100644 index 0000000000..662aed4daa --- /dev/null +++ b/src/lib/libssl/man/SSL_read.3 | |||
| @@ -0,0 +1,193 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_read.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_READ 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_read | ||
| 9 | .Nd read bytes from a TLS/SSL connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_read | ||
| 16 | tries to read | ||
| 17 | .Fa num | ||
| 18 | bytes from the specified | ||
| 19 | .Fa ssl | ||
| 20 | into the buffer | ||
| 21 | .Fa buf . | ||
| 22 | .Sh NOTES | ||
| 23 | If necessary, | ||
| 24 | .Fn SSL_read | ||
| 25 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
| 26 | .Xr SSL_connect 3 | ||
| 27 | or | ||
| 28 | .Xr SSL_accept 3 . | ||
| 29 | If the peer requests a re-negotiation, | ||
| 30 | it will be performed transparently during the | ||
| 31 | .Fn SSL_read | ||
| 32 | operation. | ||
| 33 | The behaviour of | ||
| 34 | .Fn SSL_read | ||
| 35 | depends on the underlying | ||
| 36 | .Vt BIO . | ||
| 37 | .Pp | ||
| 38 | For the transparent negotiation to succeed, the | ||
| 39 | .Fa ssl | ||
| 40 | must have been initialized to client or server mode. | ||
| 41 | This is being done by calling | ||
| 42 | .Xr SSL_set_connect_state 3 | ||
| 43 | or | ||
| 44 | .Xr SSL_set_accept_state 3 | ||
| 45 | before the first call to | ||
| 46 | .Fn SSL_read | ||
| 47 | or | ||
| 48 | .Xr SSL_write 3 . | ||
| 49 | .Pp | ||
| 50 | .Fn SSL_read | ||
| 51 | works based on the SSL/TLS records. | ||
| 52 | The data are received in records (with a maximum record size of 16kB for | ||
| 53 | SSLv3/TLSv1). | ||
| 54 | Only after a record has been completely received can it be processed | ||
| 55 | (decrypted and checked for integrity). | ||
| 56 | Therefore data not retrieved at the last call of | ||
| 57 | .Fn SSL_read | ||
| 58 | can still be buffered inside the SSL layer and will be retrieved on the next | ||
| 59 | call to | ||
| 60 | .Fn SSL_read . | ||
| 61 | If | ||
| 62 | .Fa num | ||
| 63 | is higher than the number of bytes buffered, | ||
| 64 | .Fn SSL_read | ||
| 65 | will return with the bytes buffered. | ||
| 66 | If no more bytes are in the buffer, | ||
| 67 | .Fn SSL_read | ||
| 68 | will trigger the processing of the next record. | ||
| 69 | Only when the record has been received and processed completely will | ||
| 70 | .Fn SSL_read | ||
| 71 | return reporting success. | ||
| 72 | At most the contents of the record will be returned. | ||
| 73 | As the size of an SSL/TLS record may exceed the maximum packet size of the | ||
| 74 | underlying transport (e.g., TCP), it may be necessary to read several packets | ||
| 75 | from the transport layer before the record is complete and | ||
| 76 | .Fn SSL_read | ||
| 77 | can succeed. | ||
| 78 | .Pp | ||
| 79 | If the underlying | ||
| 80 | .Vt BIO | ||
| 81 | is | ||
| 82 | .Em blocking , | ||
| 83 | .Fn SSL_read | ||
| 84 | will only return once the read operation has been finished or an error | ||
| 85 | has occurred, except when a renegotiation take place, in which case a | ||
| 86 | .Dv SSL_ERROR_WANT_READ | ||
| 87 | may occur. | ||
| 88 | This behavior can be controlled with the | ||
| 89 | .Dv SSL_MODE_AUTO_RETRY | ||
| 90 | flag of the | ||
| 91 | .Xr SSL_CTX_set_mode 3 | ||
| 92 | call. | ||
| 93 | .Pp | ||
| 94 | If the underlying | ||
| 95 | .Vt BIO | ||
| 96 | is | ||
| 97 | .Em non-blocking , | ||
| 98 | .Fn SSL_read | ||
| 99 | will also return when the underlying | ||
| 100 | .Vt BIO | ||
| 101 | could not satisfy the needs of | ||
| 102 | .Fn SSL_read | ||
| 103 | to continue the operation. | ||
| 104 | In this case a call to | ||
| 105 | .Xr SSL_get_error 3 | ||
| 106 | with the return value of | ||
| 107 | .Fn SSL_read | ||
| 108 | will yield | ||
| 109 | .Dv SSL_ERROR_WANT_READ | ||
| 110 | or | ||
| 111 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 112 | As at any time a re-negotiation is possible, a call to | ||
| 113 | .Fn SSL_read | ||
| 114 | can also cause write operations! | ||
| 115 | The calling process then must repeat the call after taking appropriate action | ||
| 116 | to satisfy the needs of | ||
| 117 | .Fn SSL_read . | ||
| 118 | The action depends on the underlying | ||
| 119 | .Vt BIO . | ||
| 120 | When using a non-blocking socket, nothing is to be done, but | ||
| 121 | .Xr select 2 | ||
| 122 | can be used to check for the required condition. | ||
| 123 | When using a buffering | ||
| 124 | .Vt BIO , | ||
| 125 | like a | ||
| 126 | .Vt BIO | ||
| 127 | pair, data must be written into or retrieved out of the | ||
| 128 | .Vt BIO | ||
| 129 | before being able to continue. | ||
| 130 | .Pp | ||
| 131 | .Xr SSL_pending 3 | ||
| 132 | can be used to find out whether there are buffered bytes available for | ||
| 133 | immediate retrieval. | ||
| 134 | In this case | ||
| 135 | .Fn SSL_read | ||
| 136 | can be called without blocking or actually receiving new data from the | ||
| 137 | underlying socket. | ||
| 138 | .Sh WARNING | ||
| 139 | When an | ||
| 140 | .Fn SSL_read | ||
| 141 | operation has to be repeated because of | ||
| 142 | .Dv SSL_ERROR_WANT_READ | ||
| 143 | or | ||
| 144 | .Dv SSL_ERROR_WANT_WRITE , | ||
| 145 | it must be repeated with the same arguments. | ||
| 146 | .Sh RETURN VALUES | ||
| 147 | The following return values can occur: | ||
| 148 | .Bl -tag -width Ds | ||
| 149 | .It >0 | ||
| 150 | The read operation was successful; the return value is the number of bytes | ||
| 151 | actually read from the TLS/SSL connection. | ||
| 152 | .It 0 | ||
| 153 | The read operation was not successful. | ||
| 154 | The reason may either be a clean shutdown due to a | ||
| 155 | .Dq close notify | ||
| 156 | alert sent by the peer (in which case the | ||
| 157 | .Dv SSL_RECEIVED_SHUTDOWN | ||
| 158 | flag in the ssl shutdown state is set (see | ||
| 159 | .Xr SSL_shutdown 3 | ||
| 160 | and | ||
| 161 | .Xr SSL_set_shutdown 3 ) . | ||
| 162 | It is also possible that the peer simply shut down the underlying transport and | ||
| 163 | the shutdown is incomplete. | ||
| 164 | Call | ||
| 165 | .Fn SSL_get_error | ||
| 166 | with the return value to find out whether an error occurred or the connection | ||
| 167 | was shut down cleanly | ||
| 168 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
| 169 | .Pp | ||
| 170 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
| 171 | be detected whether the underlying connection was closed. | ||
| 172 | It cannot be checked whether the closure was initiated by the peer or by | ||
| 173 | something else. | ||
| 174 | .It <0 | ||
| 175 | The read operation was not successful, because either an error occurred or | ||
| 176 | action must be taken by the calling process. | ||
| 177 | Call | ||
| 178 | .Fn SSL_get_error | ||
| 179 | with the return value to find out the reason. | ||
| 180 | .El | ||
| 181 | .Sh SEE ALSO | ||
| 182 | .Xr bio 3 , | ||
| 183 | .Xr ssl 3 , | ||
| 184 | .Xr SSL_accept 3 , | ||
| 185 | .Xr SSL_connect 3 , | ||
| 186 | .Xr SSL_CTX_new 3 , | ||
| 187 | .Xr SSL_CTX_set_mode 3 , | ||
| 188 | .Xr SSL_get_error 3 , | ||
| 189 | .Xr SSL_pending 3 , | ||
| 190 | .Xr SSL_set_connect_state 3 , | ||
| 191 | .Xr SSL_set_shutdown 3 , | ||
| 192 | .Xr SSL_shutdown 3 , | ||
| 193 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/man/SSL_rstate_string.3 b/src/lib/libssl/man/SSL_rstate_string.3 new file mode 100644 index 0000000000..4b29fed86e --- /dev/null +++ b/src/lib/libssl/man/SSL_rstate_string.3 | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_rstate_string.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_RSTATE_STRING 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_rstate_string , | ||
| 9 | .Nm SSL_rstate_string_long | ||
| 10 | .Nd get textual description of state of an SSL object during read operation | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft const char * | ||
| 14 | .Fn SSL_rstate_string "SSL *ssl" | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_rstate_string | ||
| 19 | returns a 2-letter string indicating the current read state of the | ||
| 20 | .Vt SSL | ||
| 21 | object | ||
| 22 | .Fa ssl . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_rstate_string_long | ||
| 25 | returns a string indicating the current read state of the | ||
| 26 | .Vt SSL | ||
| 27 | object | ||
| 28 | .Fa ssl . | ||
| 29 | .Sh NOTES | ||
| 30 | When performing a read operation, the SSL/TLS engine must parse the record, | ||
| 31 | consisting of header and body. | ||
| 32 | When working in a blocking environment, | ||
| 33 | .Fn SSL_rstate_string[_long] | ||
| 34 | should always return | ||
| 35 | .Qo RD Qc Ns / Ns Qo read done Qc . | ||
| 36 | .Pp | ||
| 37 | This function should only seldom be needed in applications. | ||
| 38 | .Sh RETURN VALUES | ||
| 39 | .Fn SSL_rstate_string | ||
| 40 | and | ||
| 41 | .Fn SSL_rstate_string_long | ||
| 42 | can return the following values: | ||
| 43 | .Bl -tag -width Ds | ||
| 44 | .It Qo RH Qc Ns / Ns Qo read header Qc | ||
| 45 | The header of the record is being evaluated. | ||
| 46 | .It Qo RB Qc Ns / Ns Qo read body Qc | ||
| 47 | The body of the record is being evaluated. | ||
| 48 | .It Qo RD Qc Ns / Ns Qo read done Qc | ||
| 49 | The record has been completely processed. | ||
| 50 | .It Qo unknown Qc Ns / Ns Qo unknown Qc | ||
| 51 | The read state is unknown. | ||
| 52 | This should never happen. | ||
| 53 | .El | ||
| 54 | .Sh SEE ALSO | ||
| 55 | .Xr ssl 3 | ||
diff --git a/src/lib/libssl/man/SSL_session_reused.3 b/src/lib/libssl/man/SSL_session_reused.3 new file mode 100644 index 0000000000..6d592a8d55 --- /dev/null +++ b/src/lib/libssl/man/SSL_session_reused.3 | |||
| @@ -0,0 +1,32 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_session_reused.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SESSION_REUSED 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_session_reused | ||
| 9 | .Nd query whether a reused session was negotiated during handshake | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_session_reused "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | Query whether a reused session was negotiated during the handshake. | ||
| 16 | .Sh NOTES | ||
| 17 | During the negotiation, a client can propose to reuse a session. | ||
| 18 | The server then looks up the session in its cache. | ||
| 19 | If both client and server agree on the session, | ||
| 20 | it will be reused and a flag is set that can be queried by the application. | ||
| 21 | .Sh RETURN VALUES | ||
| 22 | The following return values can occur: | ||
| 23 | .Bl -tag -width Ds | ||
| 24 | .It 0 | ||
| 25 | A new session was negotiated. | ||
| 26 | .It 1 | ||
| 27 | A session was reused. | ||
| 28 | .El | ||
| 29 | .Sh SEE ALSO | ||
| 30 | .Xr ssl 3 , | ||
| 31 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 32 | .Xr SSL_set_session 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_bio.3 b/src/lib/libssl/man/SSL_set_bio.3 new file mode 100644 index 0000000000..21750fd66c --- /dev/null +++ b/src/lib/libssl/man/SSL_set_bio.3 | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_bio.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_BIO 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_bio | ||
| 9 | .Nd connect the SSL object with a BIO | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_set_bio | ||
| 16 | connects the | ||
| 17 | .Vt BIO Ns | ||
| 18 | s | ||
| 19 | .Fa rbio | ||
| 20 | and | ||
| 21 | .Fa wbio | ||
| 22 | for the read and write operations of the TLS/SSL (encrypted) side of | ||
| 23 | .Fa ssl . | ||
| 24 | .Pp | ||
| 25 | The SSL engine inherits the behaviour of | ||
| 26 | .Fa rbio | ||
| 27 | and | ||
| 28 | .Fa wbio , | ||
| 29 | respectively. | ||
| 30 | If a | ||
| 31 | .Vt BIO | ||
| 32 | is non-blocking, the | ||
| 33 | .Fa ssl | ||
| 34 | will also have non-blocking behaviour. | ||
| 35 | .Pp | ||
| 36 | If there was already a | ||
| 37 | .Vt BIO | ||
| 38 | connected to | ||
| 39 | .Fa ssl , | ||
| 40 | .Xr BIO_free 3 | ||
| 41 | will be called (for both the reading and writing side, if different). | ||
| 42 | .Sh RETURN VALUES | ||
| 43 | .Fn SSL_set_bio | ||
| 44 | cannot fail. | ||
| 45 | .Sh SEE ALSO | ||
| 46 | .Xr bio 3 , | ||
| 47 | .Xr ssl 3 , | ||
| 48 | .Xr SSL_accept 3 , | ||
| 49 | .Xr SSL_connect 3 , | ||
| 50 | .Xr SSL_get_rbio 3 , | ||
| 51 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_connect_state.3 b/src/lib/libssl/man/SSL_set_connect_state.3 new file mode 100644 index 0000000000..8def2ecde5 --- /dev/null +++ b/src/lib/libssl/man/SSL_set_connect_state.3 | |||
| @@ -0,0 +1,71 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_connect_state.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_CONNECT_STATE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_connect_state , | ||
| 9 | .Nm SSL_set_accept_state | ||
| 10 | .Nd prepare SSL object to work in client or server mode | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fn SSL_set_connect_state "SSL *ssl" | ||
| 15 | .Ft void | ||
| 16 | .Fn SSL_set_accept_state "SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_set_connect_state | ||
| 19 | sets | ||
| 20 | .Fa ssl | ||
| 21 | to work in client mode. | ||
| 22 | .Pp | ||
| 23 | .Fn SSL_set_accept_state | ||
| 24 | sets | ||
| 25 | .Fa ssl | ||
| 26 | to work in server mode. | ||
| 27 | .Sh NOTES | ||
| 28 | When the | ||
| 29 | .Vt SSL_CTX | ||
| 30 | object was created with | ||
| 31 | .Xr SSL_CTX_new 3 , | ||
| 32 | it was either assigned a dedicated client method, a dedicated server method, or | ||
| 33 | a generic method, that can be used for both client and server connections. | ||
| 34 | (The method might have been changed with | ||
| 35 | .Xr SSL_CTX_set_ssl_version 3 | ||
| 36 | or | ||
| 37 | .Xr SSL_set_ssl_method 3 . ) | ||
| 38 | .Pp | ||
| 39 | When beginning a new handshake, the SSL engine must know whether it must call | ||
| 40 | the connect (client) or accept (server) routines. | ||
| 41 | Even though it may be clear from the method chosen whether client or server | ||
| 42 | mode was requested, the handshake routines must be explicitly set. | ||
| 43 | .Pp | ||
| 44 | When using the | ||
| 45 | .Xr SSL_connect 3 | ||
| 46 | or | ||
| 47 | .Xr SSL_accept 3 | ||
| 48 | routines, the correct handshake routines are automatically set. | ||
| 49 | When performing a transparent negotiation using | ||
| 50 | .Xr SSL_write 3 | ||
| 51 | or | ||
| 52 | .Xr SSL_read 3 , | ||
| 53 | the handshake routines must be explicitly set in advance using either | ||
| 54 | .Fn SSL_set_connect_state | ||
| 55 | or | ||
| 56 | .Fn SSL_set_accept_state . | ||
| 57 | .Sh RETURN VALUES | ||
| 58 | .Fn SSL_set_connect_state | ||
| 59 | and | ||
| 60 | .Fn SSL_set_accept_state | ||
| 61 | do not return diagnostic information. | ||
| 62 | .Sh SEE ALSO | ||
| 63 | .Xr ssl 3 , | ||
| 64 | .Xr SSL_accept 3 , | ||
| 65 | .Xr SSL_connect 3 , | ||
| 66 | .Xr SSL_CTX_new 3 , | ||
| 67 | .Xr SSL_CTX_set_ssl_version 3 , | ||
| 68 | .Xr SSL_do_handshake 3 , | ||
| 69 | .Xr SSL_new 3 , | ||
| 70 | .Xr SSL_read 3 , | ||
| 71 | .Xr SSL_write 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_fd.3 b/src/lib/libssl/man/SSL_set_fd.3 new file mode 100644 index 0000000000..0e9d272913 --- /dev/null +++ b/src/lib/libssl/man/SSL_set_fd.3 | |||
| @@ -0,0 +1,73 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_fd.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_FD 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_fd , | ||
| 9 | .Nm SSL_set_rfd , | ||
| 10 | .Nm SSL_set_wfd | ||
| 11 | .Nd connect the SSL object with a file descriptor | ||
| 12 | .Sh SYNOPSIS | ||
| 13 | .In openssl/ssl.h | ||
| 14 | .Ft int | ||
| 15 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
| 16 | .Ft int | ||
| 17 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
| 18 | .Ft int | ||
| 19 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
| 20 | .Sh DESCRIPTION | ||
| 21 | .Fn SSL_set_fd | ||
| 22 | sets the file descriptor | ||
| 23 | .Fa fd | ||
| 24 | as the input/output facility for the TLS/SSL (encrypted) side of | ||
| 25 | .Fa ssl . | ||
| 26 | .Fa fd | ||
| 27 | will typically be the socket file descriptor of a network connection. | ||
| 28 | .Pp | ||
| 29 | When performing the operation, a socket | ||
| 30 | .Vt BIO | ||
| 31 | is automatically created to interface between the | ||
| 32 | .Fa ssl | ||
| 33 | and | ||
| 34 | .Fa fd . | ||
| 35 | The | ||
| 36 | .Vt BIO | ||
| 37 | and hence the SSL engine inherit the behaviour of | ||
| 38 | .Fa fd . | ||
| 39 | If | ||
| 40 | .Fa fd | ||
| 41 | is non-blocking, the | ||
| 42 | .Fa ssl | ||
| 43 | will also have non-blocking behaviour. | ||
| 44 | .Pp | ||
| 45 | If there was already a | ||
| 46 | .Vt BIO | ||
| 47 | connected to | ||
| 48 | .Fa ssl , | ||
| 49 | .Xr BIO_free 3 | ||
| 50 | will be called (for both the reading and writing side, if different). | ||
| 51 | .Pp | ||
| 52 | .Fn SSL_set_rfd | ||
| 53 | and | ||
| 54 | .Fn SSL_set_wfd | ||
| 55 | perform the respective action, but only for the read channel or the write | ||
| 56 | channel, which can be set independently. | ||
| 57 | .Sh RETURN VALUES | ||
| 58 | The following return values can occur: | ||
| 59 | .Bl -tag -width Ds | ||
| 60 | .It 0 | ||
| 61 | The operation failed. | ||
| 62 | Check the error stack to find out why. | ||
| 63 | .It 1 | ||
| 64 | The operation succeeded. | ||
| 65 | .El | ||
| 66 | .Sh SEE ALSO | ||
| 67 | .Xr bio 3 , | ||
| 68 | .Xr ssl 3 , | ||
| 69 | .Xr SSL_accept 3 , | ||
| 70 | .Xr SSL_connect 3 , | ||
| 71 | .Xr SSL_get_fd 3 , | ||
| 72 | .Xr SSL_set_bio 3 , | ||
| 73 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_session.3 b/src/lib/libssl/man/SSL_set_session.3 new file mode 100644 index 0000000000..28f1aa667a --- /dev/null +++ b/src/lib/libssl/man/SSL_set_session.3 | |||
| @@ -0,0 +1,68 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_session.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_SESSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_session | ||
| 9 | .Nd set a TLS/SSL session to be used during TLS/SSL connect | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_set_session | ||
| 16 | sets | ||
| 17 | .Fa session | ||
| 18 | to be used when the TLS/SSL connection is to be established. | ||
| 19 | .Fn SSL_set_session | ||
| 20 | is only useful for TLS/SSL clients. | ||
| 21 | When the session is set, the reference count of | ||
| 22 | .Fa session | ||
| 23 | is incremented | ||
| 24 | by 1. | ||
| 25 | If the session is not reused, the reference count is decremented again during | ||
| 26 | .Fn SSL_connect . | ||
| 27 | Whether the session was reused can be queried with the | ||
| 28 | .Xr SSL_session_reused 3 | ||
| 29 | call. | ||
| 30 | .Pp | ||
| 31 | If there is already a session set inside | ||
| 32 | .Fa ssl | ||
| 33 | (because it was set with | ||
| 34 | .Fn SSL_set_session | ||
| 35 | before or because the same | ||
| 36 | .Fa ssl | ||
| 37 | was already used for a connection), | ||
| 38 | .Xr SSL_SESSION_free 3 | ||
| 39 | will be called for that session. | ||
| 40 | .Sh NOTES | ||
| 41 | .Vt SSL_SESSION | ||
| 42 | objects keep internal link information about the session cache list when being | ||
| 43 | inserted into one | ||
| 44 | .Vt SSL_CTX | ||
| 45 | object's session cache. | ||
| 46 | One | ||
| 47 | .Vt SSL_SESSION | ||
| 48 | object, regardless of its reference count, must therefore only be used with one | ||
| 49 | .Vt SSL_CTX | ||
| 50 | object (and the | ||
| 51 | .Vt SSL | ||
| 52 | objects created from this | ||
| 53 | .Vt SSL_CTX | ||
| 54 | object). | ||
| 55 | .Sh RETURN VALUES | ||
| 56 | The following return values can occur: | ||
| 57 | .Bl -tag -width Ds | ||
| 58 | .It 0 | ||
| 59 | The operation failed; check the error stack to find out the reason. | ||
| 60 | .It 1 | ||
| 61 | The operation succeeded. | ||
| 62 | .El | ||
| 63 | .Sh SEE ALSO | ||
| 64 | .Xr ssl 3 , | ||
| 65 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 66 | .Xr SSL_get_session 3 , | ||
| 67 | .Xr SSL_SESSION_free 3 , | ||
| 68 | .Xr SSL_session_reused 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_shutdown.3 b/src/lib/libssl/man/SSL_set_shutdown.3 new file mode 100644 index 0000000000..81eb703c67 --- /dev/null +++ b/src/lib/libssl/man/SSL_set_shutdown.3 | |||
| @@ -0,0 +1,88 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_shutdown.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_SHUTDOWN 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_shutdown , | ||
| 9 | .Nm SSL_get_shutdown | ||
| 10 | .Nd manipulate shutdown state of an SSL connection | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft void | ||
| 14 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
| 15 | .Ft int | ||
| 16 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_set_shutdown | ||
| 19 | sets the shutdown state of | ||
| 20 | .Fa ssl | ||
| 21 | to | ||
| 22 | .Fa mode . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_get_shutdown | ||
| 25 | returns the shutdown mode of | ||
| 26 | .Fa ssl . | ||
| 27 | .Sh NOTES | ||
| 28 | The shutdown state of an ssl connection is a bitmask of: | ||
| 29 | .Bl -tag -width Ds | ||
| 30 | .It 0 | ||
| 31 | No shutdown setting, yet. | ||
| 32 | .It Dv SSL_SENT_SHUTDOWN | ||
| 33 | A | ||
| 34 | .Dq close notify | ||
| 35 | shutdown alert was sent to the peer; the connection is being considered closed | ||
| 36 | and the session is closed and correct. | ||
| 37 | .It Dv SSL_RECEIVED_SHUTDOWN | ||
| 38 | A shutdown alert was received form the peer, either a normal | ||
| 39 | .Dq close notify | ||
| 40 | or a fatal error. | ||
| 41 | .El | ||
| 42 | .Pp | ||
| 43 | .Dv SSL_SENT_SHUTDOWN | ||
| 44 | and | ||
| 45 | .Dv SSL_RECEIVED_SHUTDOWN | ||
| 46 | can be set at the same time. | ||
| 47 | .Pp | ||
| 48 | The shutdown state of the connection is used to determine the state of the | ||
| 49 | .Fa ssl | ||
| 50 | session. | ||
| 51 | If the session is still open when | ||
| 52 | .Xr SSL_clear 3 | ||
| 53 | or | ||
| 54 | .Xr SSL_free 3 | ||
| 55 | is called, it is considered bad and removed according to RFC2246. | ||
| 56 | The actual condition for a correctly closed session is | ||
| 57 | .Dv SSL_SENT_SHUTDOWN | ||
| 58 | (according to the TLS RFC, it is acceptable to only send the | ||
| 59 | .Dq close notify | ||
| 60 | alert but to not wait for the peer's answer when the underlying connection is | ||
| 61 | closed). | ||
| 62 | .Fn SSL_set_shutdown | ||
| 63 | can be used to set this state without sending a close alert to the peer (see | ||
| 64 | .Xr SSL_shutdown 3 ) . | ||
| 65 | .Pp | ||
| 66 | If a | ||
| 67 | .Dq close notify | ||
| 68 | was received, | ||
| 69 | .Dv SSL_RECEIVED_SHUTDOWN | ||
| 70 | will be set, but to set | ||
| 71 | .Dv SSL_SENT_SHUTDOWN | ||
| 72 | the application must still call | ||
| 73 | .Xr SSL_shutdown 3 | ||
| 74 | or | ||
| 75 | .Fn SSL_set_shutdown | ||
| 76 | itself. | ||
| 77 | .Sh RETURN VALUES | ||
| 78 | .Fn SSL_set_shutdown | ||
| 79 | does not return diagnostic information. | ||
| 80 | .Pp | ||
| 81 | .Fn SSL_get_shutdown | ||
| 82 | returns the current setting. | ||
| 83 | .Sh SEE ALSO | ||
| 84 | .Xr ssl 3 , | ||
| 85 | .Xr SSL_clear 3 , | ||
| 86 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
| 87 | .Xr SSL_free 3 , | ||
| 88 | .Xr SSL_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_set_verify_result.3 b/src/lib/libssl/man/SSL_set_verify_result.3 new file mode 100644 index 0000000000..298b6b28c6 --- /dev/null +++ b/src/lib/libssl/man/SSL_set_verify_result.3 | |||
| @@ -0,0 +1,42 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_set_verify_result.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SET_VERIFY_RESULT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_set_verify_result | ||
| 9 | .Nd override result of peer certificate verification | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft void | ||
| 13 | .Fn SSL_set_verify_result "SSL *ssl" "long verify_result" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_set_verify_result | ||
| 16 | sets | ||
| 17 | .Fa verify_result | ||
| 18 | of the object | ||
| 19 | .Fa ssl | ||
| 20 | to be the result of the verification of the X509 certificate presented by the | ||
| 21 | peer, if any. | ||
| 22 | .Sh NOTES | ||
| 23 | .Fn SSL_set_verify_result | ||
| 24 | overrides the verification result. | ||
| 25 | It only changes the verification result of the | ||
| 26 | .Fa ssl | ||
| 27 | object. | ||
| 28 | It does not become part of the established session, so if the session is to be | ||
| 29 | reused later, the original value will reappear. | ||
| 30 | .Pp | ||
| 31 | The valid codes for | ||
| 32 | .Fa verify_result | ||
| 33 | are documented in | ||
| 34 | .Xr openssl 1 . | ||
| 35 | .Sh RETURN VALUES | ||
| 36 | .Fn SSL_set_verify_result | ||
| 37 | does not provide a return value. | ||
| 38 | .Sh SEE ALSO | ||
| 39 | .Xr openssl 1 , | ||
| 40 | .Xr ssl 3 , | ||
| 41 | .Xr SSL_get_peer_certificate 3 , | ||
| 42 | .Xr SSL_get_verify_result 3 | ||
diff --git a/src/lib/libssl/man/SSL_shutdown.3 b/src/lib/libssl/man/SSL_shutdown.3 new file mode 100644 index 0000000000..1dfcb54bfe --- /dev/null +++ b/src/lib/libssl/man/SSL_shutdown.3 | |||
| @@ -0,0 +1,204 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_shutdown.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_SHUTDOWN 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_shutdown | ||
| 9 | .Nd shut down a TLS/SSL connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_shutdown "SSL *ssl" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_shutdown | ||
| 16 | shuts down an active TLS/SSL connection. | ||
| 17 | It sends the | ||
| 18 | .Dq close notify | ||
| 19 | shutdown alert to the peer. | ||
| 20 | .Sh NOTES | ||
| 21 | .Fn SSL_shutdown | ||
| 22 | tries to send the | ||
| 23 | .Dq close notify | ||
| 24 | shutdown alert to the peer. | ||
| 25 | Whether the operation succeeds or not, the | ||
| 26 | .Dv SSL_SENT_SHUTDOWN | ||
| 27 | flag is set and a currently open session is considered closed and good and will | ||
| 28 | be kept in the session cache for further reuse. | ||
| 29 | .Pp | ||
| 30 | The shutdown procedure consists of 2 steps: the sending of the | ||
| 31 | .Dq close notify | ||
| 32 | shutdown alert and the reception of the peer's | ||
| 33 | .Dq close notify | ||
| 34 | shutdown alert. | ||
| 35 | According to the TLS standard, it is acceptable for an application to only send | ||
| 36 | its shutdown alert and then close the underlying connection without waiting for | ||
| 37 | the peer's response (this way resources can be saved, as the process can | ||
| 38 | already terminate or serve another connection). | ||
| 39 | When the underlying connection shall be used for more communications, | ||
| 40 | the complete shutdown procedure (bidirectional | ||
| 41 | .Dq close notify | ||
| 42 | alerts) must be performed, so that the peers stay synchronized. | ||
| 43 | .Pp | ||
| 44 | .Fn SSL_shutdown | ||
| 45 | supports both uni- and bidirectional shutdown by its 2 step behavior. | ||
| 46 | .Pp | ||
| 47 | When the application is the first party to send the | ||
| 48 | .Dq close notify | ||
| 49 | alert, | ||
| 50 | .Fn SSL_shutdown | ||
| 51 | will only send the alert and then set the | ||
| 52 | .Dv SSL_SENT_SHUTDOWN | ||
| 53 | flag (so that the session is considered good and will be kept in cache). | ||
| 54 | .Fn SSL_shutdown | ||
| 55 | will then return 0. | ||
| 56 | If a unidirectional shutdown is enough | ||
| 57 | (the underlying connection shall be closed anyway), this first call to | ||
| 58 | .Fn SSL_shutdown | ||
| 59 | is sufficient. | ||
| 60 | In order to complete the bidirectional shutdown handshake, | ||
| 61 | .Fn SSL_shutdown | ||
| 62 | must be called again. | ||
| 63 | The second call will make | ||
| 64 | .Fn SSL_shutdown | ||
| 65 | wait for the peer's | ||
| 66 | .Dq close notify | ||
| 67 | shutdown alert. | ||
| 68 | On success, the second call to | ||
| 69 | .Fn SSL_shutdown | ||
| 70 | will return 1. | ||
| 71 | .Pp | ||
| 72 | If the peer already sent the | ||
| 73 | .Dq close notify | ||
| 74 | alert and it was already processed implicitly inside another function | ||
| 75 | .Pq Xr SSL_read 3 , | ||
| 76 | the | ||
| 77 | .Dv SSL_RECEIVED_SHUTDOWN | ||
| 78 | flag is set. | ||
| 79 | .Fn SSL_shutdown | ||
| 80 | will send the | ||
| 81 | .Dq close notify | ||
| 82 | alert, set the | ||
| 83 | .Dv SSL_SENT_SHUTDOWN | ||
| 84 | flag and will immediately return with 1. | ||
| 85 | Whether | ||
| 86 | .Dv SSL_RECEIVED_SHUTDOWN | ||
| 87 | is already set can be checked using the | ||
| 88 | .Fn SSL_get_shutdown | ||
| 89 | (see also the | ||
| 90 | .Xr SSL_set_shutdown 3 | ||
| 91 | call). | ||
| 92 | .Pp | ||
| 93 | It is therefore recommended to check the return value of | ||
| 94 | .Fn SSL_shutdown | ||
| 95 | and call | ||
| 96 | .Fn SSL_shutdown | ||
| 97 | again, if the bidirectional shutdown is not yet complete (return value of the | ||
| 98 | first call is 0). | ||
| 99 | As the shutdown is not specially handled in the SSLv2 protocol, | ||
| 100 | .Fn SSL_shutdown | ||
| 101 | will succeed on the first call. | ||
| 102 | .Pp | ||
| 103 | The behaviour of | ||
| 104 | .Fn SSL_shutdown | ||
| 105 | additionally depends on the underlying | ||
| 106 | .Vt BIO . | ||
| 107 | .Pp | ||
| 108 | If the underlying | ||
| 109 | .Vt BIO | ||
| 110 | is | ||
| 111 | .Em blocking , | ||
| 112 | .Fn SSL_shutdown | ||
| 113 | will only return once the | ||
| 114 | handshake step has been finished or an error occurred. | ||
| 115 | .Pp | ||
| 116 | If the underlying | ||
| 117 | .Vt BIO | ||
| 118 | is | ||
| 119 | .Em non-blocking , | ||
| 120 | .Fn SSL_shutdown | ||
| 121 | will also return when the underlying | ||
| 122 | .Vt BIO | ||
| 123 | could not satisfy the needs of | ||
| 124 | .Fn SSL_shutdown | ||
| 125 | to continue the handshake. | ||
| 126 | In this case a call to | ||
| 127 | .Xr SSL_get_error 3 | ||
| 128 | with the | ||
| 129 | return value of | ||
| 130 | .Fn SSL_shutdown | ||
| 131 | will yield | ||
| 132 | .Dv SSL_ERROR_WANT_READ | ||
| 133 | or | ||
| 134 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 135 | The calling process then must repeat the call after taking appropriate action | ||
| 136 | to satisfy the needs of | ||
| 137 | .Fn SSL_shutdown . | ||
| 138 | The action depends on the underlying | ||
| 139 | .Vt BIO . | ||
| 140 | When using a non-blocking socket, nothing is to be done, but | ||
| 141 | .Xr select 2 | ||
| 142 | can be used to check for the required condition. | ||
| 143 | When using a buffering | ||
| 144 | .Vt BIO , | ||
| 145 | like a | ||
| 146 | .Vt BIO | ||
| 147 | pair, data must be written into or retrieved out of the | ||
| 148 | .Vt BIO | ||
| 149 | before being able to continue. | ||
| 150 | .Pp | ||
| 151 | .Fn SSL_shutdown | ||
| 152 | can be modified to only set the connection to | ||
| 153 | .Dq shutdown | ||
| 154 | state but not actually send the | ||
| 155 | .Dq close notify | ||
| 156 | alert messages; see | ||
| 157 | .Xr SSL_CTX_set_quiet_shutdown 3 . | ||
| 158 | When | ||
| 159 | .Dq quiet shutdown | ||
| 160 | is enabled, | ||
| 161 | .Fn SSL_shutdown | ||
| 162 | will always succeed and return 1. | ||
| 163 | .Sh RETURN VALUES | ||
| 164 | The following return values can occur: | ||
| 165 | .Bl -tag -width Ds | ||
| 166 | .It 0 | ||
| 167 | The shutdown is not yet finished. | ||
| 168 | Call | ||
| 169 | .Fn SSL_shutdown | ||
| 170 | for a second time, if a bidirectional shutdown shall be performed. | ||
| 171 | The output of | ||
| 172 | .Xr SSL_get_error 3 | ||
| 173 | may be misleading, as an erroneous | ||
| 174 | .Dv SSL_ERROR_SYSCALL | ||
| 175 | may be flagged even though no error occurred. | ||
| 176 | .It 1 | ||
| 177 | The shutdown was successfully completed. | ||
| 178 | The | ||
| 179 | .Dq close notify | ||
| 180 | alert was sent and the peer's | ||
| 181 | .Dq close notify | ||
| 182 | alert was received. | ||
| 183 | .It \(mi1 | ||
| 184 | The shutdown was not successful because a fatal error occurred either | ||
| 185 | at the protocol level or a connection failure occurred. | ||
| 186 | It can also occur if action is need to continue the operation for non-blocking | ||
| 187 | .Vt BIO Ns | ||
| 188 | s. | ||
| 189 | Call | ||
| 190 | .Xr SSL_get_error 3 | ||
| 191 | with the return value | ||
| 192 | .Fa ret | ||
| 193 | to find out the reason. | ||
| 194 | .El | ||
| 195 | .Sh SEE ALSO | ||
| 196 | .Xr bio 3 , | ||
| 197 | .Xr ssl 3 , | ||
| 198 | .Xr SSL_accept 3 , | ||
| 199 | .Xr SSL_clear 3 , | ||
| 200 | .Xr SSL_connect 3 , | ||
| 201 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
| 202 | .Xr SSL_free 3 , | ||
| 203 | .Xr SSL_get_error 3 , | ||
| 204 | .Xr SSL_set_shutdown 3 | ||
diff --git a/src/lib/libssl/man/SSL_state_string.3 b/src/lib/libssl/man/SSL_state_string.3 new file mode 100644 index 0000000000..bde359243e --- /dev/null +++ b/src/lib/libssl/man/SSL_state_string.3 | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_state_string.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_STATE_STRING 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_state_string , | ||
| 9 | .Nm SSL_state_string_long | ||
| 10 | .Nd get textual description of state of an SSL object | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft const char * | ||
| 14 | .Fn SSL_state_string "const SSL *ssl" | ||
| 15 | .Ft const char * | ||
| 16 | .Fn SSL_state_string_long "const SSL *ssl" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn SSL_state_string | ||
| 19 | returns a 6 letter string indicating the current state of the | ||
| 20 | .Vt SSL | ||
| 21 | object | ||
| 22 | .Fa ssl . | ||
| 23 | .Pp | ||
| 24 | .Fn SSL_state_string_long | ||
| 25 | returns a string indicating the current state of the | ||
| 26 | .Vt SSL | ||
| 27 | object | ||
| 28 | .Fa ssl . | ||
| 29 | .Sh NOTES | ||
| 30 | During its use, an | ||
| 31 | .Vt SSL | ||
| 32 | object passes several states. | ||
| 33 | The state is internally maintained. | ||
| 34 | Querying the state information is not very informative before or when a | ||
| 35 | connection has been established. | ||
| 36 | It however can be of significant interest during the handshake. | ||
| 37 | .Pp | ||
| 38 | When using non-blocking sockets, | ||
| 39 | the function call performing the handshake may return with | ||
| 40 | .Dv SSL_ERROR_WANT_READ | ||
| 41 | or | ||
| 42 | .Dv SSL_ERROR_WANT_WRITE | ||
| 43 | condition, so that | ||
| 44 | .Fn SSL_state_string[_long] | ||
| 45 | may be called. | ||
| 46 | .Pp | ||
| 47 | For both blocking or non-blocking sockets, | ||
| 48 | the details state information can be used within the | ||
| 49 | .Fn info_callback | ||
| 50 | function set with the | ||
| 51 | .Xr SSL_set_info_callback 3 | ||
| 52 | call. | ||
| 53 | .Sh RETURN VALUES | ||
| 54 | Detailed description of possible states to be included later. | ||
| 55 | .Sh SEE ALSO | ||
| 56 | .Xr ssl 3 , | ||
| 57 | .Xr SSL_CTX_set_info_callback 3 | ||
diff --git a/src/lib/libssl/man/SSL_want.3 b/src/lib/libssl/man/SSL_want.3 new file mode 100644 index 0000000000..456d0728dc --- /dev/null +++ b/src/lib/libssl/man/SSL_want.3 | |||
| @@ -0,0 +1,103 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_want.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_WANT 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_want , | ||
| 9 | .Nm SSL_want_nothing , | ||
| 10 | .Nm SSL_want_read , | ||
| 11 | .Nm SSL_want_write , | ||
| 12 | .Nm SSL_want_x509_lookup | ||
| 13 | .Nd obtain state information TLS/SSL I/O operation | ||
| 14 | .Sh SYNOPSIS | ||
| 15 | .In openssl/ssl.h | ||
| 16 | .Ft int | ||
| 17 | .Fn SSL_want "const SSL *ssl" | ||
| 18 | .Ft int | ||
| 19 | .Fn SSL_want_nothing "const SSL *ssl" | ||
| 20 | .Ft int | ||
| 21 | .Fn SSL_want_read "const SSL *ssl" | ||
| 22 | .Ft int | ||
| 23 | .Fn SSL_want_write "const SSL *ssl" | ||
| 24 | .Ft int | ||
| 25 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
| 26 | .Sh DESCRIPTION | ||
| 27 | .Fn SSL_want | ||
| 28 | returns state information for the | ||
| 29 | .Vt SSL | ||
| 30 | object | ||
| 31 | .Fa ssl . | ||
| 32 | .Pp | ||
| 33 | The other | ||
| 34 | .Fn SSL_want_* | ||
| 35 | calls are shortcuts for the possible states returned by | ||
| 36 | .Fn SSL_want . | ||
| 37 | .Sh NOTES | ||
| 38 | .Fn SSL_want | ||
| 39 | examines the internal state information of the | ||
| 40 | .Vt SSL | ||
| 41 | object. | ||
| 42 | Its return values are similar to those of | ||
| 43 | .Xr SSL_get_error 3 . | ||
| 44 | Unlike | ||
| 45 | .Xr SSL_get_error 3 , | ||
| 46 | which also evaluates the error queue, | ||
| 47 | the results are obtained by examining an internal state flag only. | ||
| 48 | The information must therefore only be used for normal operation under | ||
| 49 | non-blocking I/O. | ||
| 50 | Error conditions are not handled and must be treated using | ||
| 51 | .Xr SSL_get_error 3 . | ||
| 52 | .Pp | ||
| 53 | The result returned by | ||
| 54 | .Fn SSL_want | ||
| 55 | should always be consistent with the result of | ||
| 56 | .Xr SSL_get_error 3 . | ||
| 57 | .Sh RETURN VALUES | ||
| 58 | The following return values can currently occur for | ||
| 59 | .Fn SSL_want : | ||
| 60 | .Bl -tag -width Ds | ||
| 61 | .It .Dv SSL_NOTHING | ||
| 62 | There is no data to be written or to be read. | ||
| 63 | .It .Dv SSL_WRITING | ||
| 64 | There are data in the SSL buffer that must be written to the underlying | ||
| 65 | .Vt BIO | ||
| 66 | layer in order to complete the actual | ||
| 67 | .Fn SSL_* | ||
| 68 | operation. | ||
| 69 | A call to | ||
| 70 | .Xr SSL_get_error 3 | ||
| 71 | should return | ||
| 72 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 73 | .It Dv SSL_READING | ||
| 74 | More data must be read from the underlying | ||
| 75 | .Vt BIO | ||
| 76 | layer in order to | ||
| 77 | complete the actual | ||
| 78 | .Fn SSL_* | ||
| 79 | operation. | ||
| 80 | A call to | ||
| 81 | .Xr SSL_get_error 3 | ||
| 82 | should return | ||
| 83 | .Dv SSL_ERROR_WANT_READ. | ||
| 84 | .It Dv SSL_X509_LOOKUP | ||
| 85 | The operation did not complete because an application callback set by | ||
| 86 | .Xr SSL_CTX_set_client_cert_cb 3 | ||
| 87 | has asked to be called again. | ||
| 88 | A call to | ||
| 89 | .Xr SSL_get_error 3 | ||
| 90 | should return | ||
| 91 | .Dv SSL_ERROR_WANT_X509_LOOKUP . | ||
| 92 | .El | ||
| 93 | .Pp | ||
| 94 | .Fn SSL_want_nothing , | ||
| 95 | .Fn SSL_want_read , | ||
| 96 | .Fn SSL_want_write , | ||
| 97 | and | ||
| 98 | .Fn SSL_want_x509_lookup | ||
| 99 | return 1 when the corresponding condition is true or 0 otherwise. | ||
| 100 | .Sh SEE ALSO | ||
| 101 | .Xr err 3 , | ||
| 102 | .Xr ssl 3 , | ||
| 103 | .Xr SSL_get_error 3 | ||
diff --git a/src/lib/libssl/man/SSL_write.3 b/src/lib/libssl/man/SSL_write.3 new file mode 100644 index 0000000000..a4db3d37de --- /dev/null +++ b/src/lib/libssl/man/SSL_write.3 | |||
| @@ -0,0 +1,175 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: SSL_write.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL_WRITE 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm SSL_write | ||
| 9 | .Nd write bytes to a TLS/SSL connection | ||
| 10 | .Sh SYNOPSIS | ||
| 11 | .In openssl/ssl.h | ||
| 12 | .Ft int | ||
| 13 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
| 14 | .Sh DESCRIPTION | ||
| 15 | .Fn SSL_write | ||
| 16 | writes | ||
| 17 | .Fa num | ||
| 18 | bytes from the buffer | ||
| 19 | .Fa buf | ||
| 20 | into the specified | ||
| 21 | .Fa ssl | ||
| 22 | connection. | ||
| 23 | .Sh NOTES | ||
| 24 | If necessary, | ||
| 25 | .Fn SSL_write | ||
| 26 | will negotiate a TLS/SSL session, if not already explicitly performed by | ||
| 27 | .Xr SSL_connect 3 | ||
| 28 | or | ||
| 29 | .Xr SSL_accept 3 . | ||
| 30 | If the peer requests a re-negotiation, | ||
| 31 | it will be performed transparently during the | ||
| 32 | .Fn SSL_write | ||
| 33 | operation. | ||
| 34 | The behaviour of | ||
| 35 | .Fn SSL_write | ||
| 36 | depends on the underlying | ||
| 37 | .Vt BIO . | ||
| 38 | .Pp | ||
| 39 | For the transparent negotiation to succeed, the | ||
| 40 | .Fa ssl | ||
| 41 | must have been initialized to client or server mode. | ||
| 42 | This is being done by calling | ||
| 43 | .Xr SSL_set_connect_state 3 | ||
| 44 | or | ||
| 45 | .Xr SSL_set_accept_state 3 | ||
| 46 | before the first call to an | ||
| 47 | .Xr SSL_read 3 | ||
| 48 | or | ||
| 49 | .Fn SSL_write | ||
| 50 | function. | ||
| 51 | .Pp | ||
| 52 | If the underlying | ||
| 53 | .Vt BIO | ||
| 54 | is | ||
| 55 | .Em blocking , | ||
| 56 | .Fn SSL_write | ||
| 57 | will only return once the write operation has been finished or an error | ||
| 58 | occurred, except when a renegotiation take place, in which case a | ||
| 59 | .Dv SSL_ERROR_WANT_READ | ||
| 60 | may occur. | ||
| 61 | This behaviour can be controlled with the | ||
| 62 | .Dv SSL_MODE_AUTO_RETRY | ||
| 63 | flag of the | ||
| 64 | .Xr SSL_CTX_set_mode 3 | ||
| 65 | call. | ||
| 66 | .Pp | ||
| 67 | If the underlying | ||
| 68 | .Vt BIO | ||
| 69 | is | ||
| 70 | .Em non-blocking , | ||
| 71 | .Fn SSL_write | ||
| 72 | will also return when the underlying | ||
| 73 | .Vt BIO | ||
| 74 | could not satisfy the needs of | ||
| 75 | .Fn SSL_write | ||
| 76 | to continue the operation. | ||
| 77 | In this case a call to | ||
| 78 | .Xr SSL_get_error 3 | ||
| 79 | with the return value of | ||
| 80 | .Fn SSL_write | ||
| 81 | will yield | ||
| 82 | .Dv SSL_ERROR_WANT_READ | ||
| 83 | or | ||
| 84 | .Dv SSL_ERROR_WANT_WRITE . | ||
| 85 | As at any time a re-negotiation is possible, a call to | ||
| 86 | .Fn SSL_write | ||
| 87 | can also cause read operations! | ||
| 88 | The calling process then must repeat the call after taking appropriate action | ||
| 89 | to satisfy the needs of | ||
| 90 | .Fn SSL_write . | ||
| 91 | The action depends on the underlying | ||
| 92 | .Vt BIO . | ||
| 93 | When using a non-blocking socket, nothing is to be done, but | ||
| 94 | .Xr select 2 | ||
| 95 | can be used to check for the required condition. | ||
| 96 | When using a buffering | ||
| 97 | .Vt BIO , | ||
| 98 | like a | ||
| 99 | .Vt BIO | ||
| 100 | pair, data must be written into or retrieved out of the BIO before being able | ||
| 101 | to continue. | ||
| 102 | .Pp | ||
| 103 | .Fn SSL_write | ||
| 104 | will only return with success, when the complete contents of | ||
| 105 | .Fa buf | ||
| 106 | of length | ||
| 107 | .Fa num | ||
| 108 | have been written. | ||
| 109 | This default behaviour can be changed with the | ||
| 110 | .Dv SSL_MODE_ENABLE_PARTIAL_WRITE | ||
| 111 | option of | ||
| 112 | .Xr SSL_CTX_set_mode 3 . | ||
| 113 | When this flag is set, | ||
| 114 | .Fn SSL_write | ||
| 115 | will also return with success when a partial write has been successfully | ||
| 116 | completed. | ||
| 117 | In this case the | ||
| 118 | .Fn SSL_write | ||
| 119 | operation is considered completed. | ||
| 120 | The bytes are sent and a new | ||
| 121 | .Fn SSL_write | ||
| 122 | operation with a new buffer (with the already sent bytes removed) must be | ||
| 123 | started. | ||
| 124 | A partial write is performed with the size of a message block, which is 16kB | ||
| 125 | for SSLv3/TLSv1. | ||
| 126 | .Sh WARNING | ||
| 127 | When an | ||
| 128 | .Fn SSL_write | ||
| 129 | operation has to be repeated because of | ||
| 130 | .Dv SSL_ERROR_WANT_READ | ||
| 131 | or | ||
| 132 | .Dv SSL_ERROR_WANT_WRITE , | ||
| 133 | it must be repeated with the same arguments. | ||
| 134 | .Pp | ||
| 135 | When calling | ||
| 136 | .Fn SSL_write | ||
| 137 | with | ||
| 138 | .Fa num Ns | ||
| 139 | =0 bytes to be sent the behaviour is undefined. | ||
| 140 | .Sh RETURN VALUES | ||
| 141 | The following return values can occur: | ||
| 142 | .Bl -tag -width Ds | ||
| 143 | .It >0 | ||
| 144 | The write operation was successful. | ||
| 145 | The return value is the number of bytes actually written to the TLS/SSL | ||
| 146 | connection. | ||
| 147 | .It 0 | ||
| 148 | The write operation was not successful. | ||
| 149 | Probably the underlying connection was closed. | ||
| 150 | Call | ||
| 151 | .Xr SSL_get_error 3 | ||
| 152 | with the return value to find out whether an error occurred or the connection | ||
| 153 | was shut down cleanly | ||
| 154 | .Pq Dv SSL_ERROR_ZERO_RETURN . | ||
| 155 | .Pp | ||
| 156 | SSLv2 (deprecated) does not support a shutdown alert protocol, so it can only | ||
| 157 | be detected whether the underlying connection was closed. | ||
| 158 | It cannot be checked why the closure happened. | ||
| 159 | .It <0 | ||
| 160 | The write operation was not successful, because either an error occurred or | ||
| 161 | action must be taken by the calling process. | ||
| 162 | Call | ||
| 163 | .Xr SSL_get_error 3 | ||
| 164 | with the return value to find out the reason. | ||
| 165 | .El | ||
| 166 | .Sh SEE ALSO | ||
| 167 | .Xr bio 3 , | ||
| 168 | .Xr ssl 3 , | ||
| 169 | .Xr SSL_accept 3 , | ||
| 170 | .Xr SSL_connect 3 , | ||
| 171 | .Xr SSL_CTX_new 3 , | ||
| 172 | .Xr SSL_CTX_set_mode 3 , | ||
| 173 | .Xr SSL_get_error 3 , | ||
| 174 | .Xr SSL_read 3 , | ||
| 175 | .Xr SSL_set_connect_state 3 | ||
diff --git a/src/lib/libssl/man/d2i_SSL_SESSION.3 b/src/lib/libssl/man/d2i_SSL_SESSION.3 new file mode 100644 index 0000000000..9a96a5b8ec --- /dev/null +++ b/src/lib/libssl/man/d2i_SSL_SESSION.3 | |||
| @@ -0,0 +1,129 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: d2i_SSL_SESSION.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt D2I_SSL_SESSION 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm d2i_SSL_SESSION , | ||
| 9 | .Nm i2d_SSL_SESSION | ||
| 10 | .Nd convert SSL_SESSION object from/to ASN1 representation | ||
| 11 | .Sh SYNOPSIS | ||
| 12 | .In openssl/ssl.h | ||
| 13 | .Ft SSL_SESSION * | ||
| 14 | .Fn d2i_SSL_SESSION "SSL_SESSION **a" "const unsigned char **pp" "long length" | ||
| 15 | .Ft int | ||
| 16 | .Fn i2d_SSL_SESSION "SSL_SESSION *in" "unsigned char **pp" | ||
| 17 | .Sh DESCRIPTION | ||
| 18 | .Fn d2i_SSL_SESSION | ||
| 19 | transforms the external ASN1 representation of an SSL/TLS session, | ||
| 20 | stored as binary data at location | ||
| 21 | .Fa pp | ||
| 22 | with length | ||
| 23 | .Fa length , | ||
| 24 | into | ||
| 25 | an | ||
| 26 | .Vt SSL_SESSION | ||
| 27 | object. | ||
| 28 | .Pp | ||
| 29 | .Fn i2d_SSL_SESSION | ||
| 30 | transforms the | ||
| 31 | .Vt SSL_SESSION | ||
| 32 | object | ||
| 33 | .Fa in | ||
| 34 | into the ASN1 representation and stores it into the memory location pointed to | ||
| 35 | by | ||
| 36 | .Fa pp . | ||
| 37 | The length of the resulting ASN1 representation is returned. | ||
| 38 | If | ||
| 39 | .Fa pp | ||
| 40 | is the | ||
| 41 | .Dv NULL | ||
| 42 | pointer, only the length is calculated and returned. | ||
| 43 | .Sh NOTES | ||
| 44 | The | ||
| 45 | .Vt SSL_SESSION | ||
| 46 | object is built from several | ||
| 47 | .Xr malloc 3 Ns | ||
| 48 | -ed parts; it can therefore not be moved, copied or stored directly. | ||
| 49 | In order to store session data on disk or into a database, | ||
| 50 | it must be transformed into a binary ASN1 representation. | ||
| 51 | .Pp | ||
| 52 | When using | ||
| 53 | .Fn d2i_SSL_SESSION , | ||
| 54 | the | ||
| 55 | .Vt SSL_SESSION | ||
| 56 | object is automatically allocated. | ||
| 57 | The reference count is 1, so that the session must be explicitly removed using | ||
| 58 | .Xr SSL_SESSION_free 3 , | ||
| 59 | unless the | ||
| 60 | .Vt SSL_SESSION | ||
| 61 | object is completely taken over, when being called inside the | ||
| 62 | .Xr get_session_cb 3 | ||
| 63 | (see | ||
| 64 | .Xr SSL_CTX_sess_set_get_cb 3 ) . | ||
| 65 | .Pp | ||
| 66 | .Vt SSL_SESSION | ||
| 67 | objects keep internal link information about the session cache list when being | ||
| 68 | inserted into one | ||
| 69 | .Vt SSL_CTX | ||
| 70 | object's session cache. | ||
| 71 | One | ||
| 72 | .Vt SSL_SESSION | ||
| 73 | object, regardless of its reference count, must therefore only be used with one | ||
| 74 | .Vt SSL_CTX | ||
| 75 | object (and the | ||
| 76 | .Vt SSL | ||
| 77 | objects created from this | ||
| 78 | .Vt SSL_CTX | ||
| 79 | object). | ||
| 80 | .Pp | ||
| 81 | When using | ||
| 82 | .Fn i2d_SSL_SESSION , | ||
| 83 | the memory location pointed to by | ||
| 84 | .Fa pp | ||
| 85 | must be large enough to hold the binary representation of the session. | ||
| 86 | There is no known limit on the size of the created ASN1 representation, | ||
| 87 | so the necessary amount of space should be obtained by first calling | ||
| 88 | .Fn i2d_SSL_SESSION | ||
| 89 | with | ||
| 90 | .Fa pp Ns | ||
| 91 | = Ns | ||
| 92 | .Dv NULL , | ||
| 93 | and obtain the size needed, then allocate the memory and call | ||
| 94 | .Fn i2d_SSL_SESSION | ||
| 95 | again. | ||
| 96 | Note that this will advance the value contained in | ||
| 97 | .Fa *pp | ||
| 98 | so it is necessary to save a copy of the original allocation. | ||
| 99 | For example: | ||
| 100 | .Bd -literal | ||
| 101 | int i, j; | ||
| 102 | |||
| 103 | char *p, *temp; | ||
| 104 | |||
| 105 | i = i2d_SSL_SESSION(sess, NULL); | ||
| 106 | p = temp = malloc(i); | ||
| 107 | if (temp != NULL) { | ||
| 108 | j = i2d_SSL_SESSION(sess, &temp); | ||
| 109 | assert(i == j); | ||
| 110 | assert(p + i == temp); | ||
| 111 | } | ||
| 112 | .Ed | ||
| 113 | .Sh RETURN VALUES | ||
| 114 | .Fn d2i_SSL_SESSION | ||
| 115 | returns a pointer to the newly allocated | ||
| 116 | .Vt SSL_SESSION | ||
| 117 | object. | ||
| 118 | In case of failure a | ||
| 119 | .Dv NULL | ||
| 120 | pointer is returned and the error message can be retrieved from the error | ||
| 121 | stack. | ||
| 122 | .Pp | ||
| 123 | .Fn i2d_SSL_SESSION | ||
| 124 | returns the size of the ASN1 representation in bytes. | ||
| 125 | When the session is not valid, 0 is returned and no operation is performed. | ||
| 126 | .Sh SEE ALSO | ||
| 127 | .Xr ssl 3 , | ||
| 128 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
| 129 | .Xr SSL_SESSION_free 3 | ||
diff --git a/src/lib/libssl/man/ssl.3 b/src/lib/libssl/man/ssl.3 new file mode 100644 index 0000000000..004d71f9f2 --- /dev/null +++ b/src/lib/libssl/man/ssl.3 | |||
| @@ -0,0 +1,1319 @@ | |||
| 1 | .\" | ||
| 2 | .\" $OpenBSD: ssl.3,v 1.1 2016/11/05 15:32:20 schwarze Exp $ | ||
| 3 | .\" | ||
| 4 | .Dd $Mdocdate: November 5 2016 $ | ||
| 5 | .Dt SSL 3 | ||
| 6 | .Os | ||
| 7 | .Sh NAME | ||
| 8 | .Nm ssl | ||
| 9 | .Nd OpenSSL SSL/TLS library | ||
| 10 | .Sh DESCRIPTION | ||
| 11 | The OpenSSL | ||
| 12 | .Nm ssl | ||
| 13 | library implements the Secure Sockets Layer (SSL v2/v3) and | ||
| 14 | Transport Layer Security (TLS v1) protocols. | ||
| 15 | It provides a rich API which is documented here. | ||
| 16 | .Pp | ||
| 17 | At first the library must be initialized; see | ||
| 18 | .Xr SSL_library_init 3 . | ||
| 19 | .Pp | ||
| 20 | Then an | ||
| 21 | .Vt SSL_CTX | ||
| 22 | object is created as a framework to establish TLS/SSL enabled connections (see | ||
| 23 | .Xr SSL_CTX_new 3 ) . | ||
| 24 | Various options regarding certificates, algorithms, etc., can be set in this | ||
| 25 | object. | ||
| 26 | .Pp | ||
| 27 | When a network connection has been created, it can be assigned to an | ||
| 28 | .Vt SSL | ||
| 29 | object. | ||
| 30 | After the | ||
| 31 | .Vt SSL | ||
| 32 | object has been created using | ||
| 33 | .Xr SSL_new 3 , | ||
| 34 | .Xr SSL_set_fd 3 | ||
| 35 | or | ||
| 36 | .Xr SSL_set_bio 3 | ||
| 37 | can be used to associate the network connection with the object. | ||
| 38 | .Pp | ||
| 39 | Then the TLS/SSL handshake is performed using | ||
| 40 | .Xr SSL_accept 3 | ||
| 41 | or | ||
| 42 | .Xr SSL_connect 3 | ||
| 43 | respectively. | ||
| 44 | .Xr SSL_read 3 | ||
| 45 | and | ||
| 46 | .Xr SSL_write 3 | ||
| 47 | are used to read and write data on the TLS/SSL connection. | ||
| 48 | .Xr SSL_shutdown 3 | ||
| 49 | can be used to shut down the TLS/SSL connection. | ||
| 50 | .Sh DATA STRUCTURES | ||
| 51 | Currently the OpenSSL | ||
| 52 | .Nm ssl | ||
| 53 | library functions deals with the following data structures: | ||
| 54 | .Bl -tag -width Ds | ||
| 55 | .It Vt SSL_METHOD No (SSL Method) | ||
| 56 | That's a dispatch structure describing the internal | ||
| 57 | .Nm ssl | ||
| 58 | library methods/functions which implement the various protocol versions | ||
| 59 | (SSLv1, SSLv2 and TLSv1). | ||
| 60 | It's needed to create an | ||
| 61 | .Vt SSL_CTX . | ||
| 62 | .It Vt SSL_CIPHER No (SSL Cipher) | ||
| 63 | This structure holds the algorithm information for a particular cipher which | ||
| 64 | is a core part of the SSL/TLS protocol. | ||
| 65 | The available ciphers are configured on an | ||
| 66 | .Vt SSL_CTX | ||
| 67 | basis and the actually used ones are then part of the | ||
| 68 | .Vt SSL_SESSION . | ||
| 69 | .It Vt SSL_CTX No (SSL Context) | ||
| 70 | That's the global context structure which is created by a server or client | ||
| 71 | once per program lifetime and which holds mainly default values for the | ||
| 72 | .Vt SSL | ||
| 73 | structures which are later created for the connections. | ||
| 74 | .It Vt SSL_SESSION No (SSL Session) | ||
| 75 | This is a structure containing the current TLS/SSL session details for a | ||
| 76 | connection: | ||
| 77 | .Vt SSL_CIPHER Ns s, client and server certificates, keys, etc. | ||
| 78 | .It Vt SSL No (SSL Connection) | ||
| 79 | That's the main SSL/TLS structure which is created by a server or client per | ||
| 80 | established connection. | ||
| 81 | This actually is the core structure in the SSL API. | ||
| 82 | Under run-time the application usually deals with this structure which has | ||
| 83 | links to mostly all other structures. | ||
| 84 | .El | ||
| 85 | .Sh HEADER FILES | ||
| 86 | Currently the OpenSSL | ||
| 87 | .Nm ssl | ||
| 88 | library provides the following C header files containing the prototypes for the | ||
| 89 | data structures and functions: | ||
| 90 | .Bl -tag -width Ds | ||
| 91 | .It Pa ssl.h | ||
| 92 | That's the common header file for the SSL/TLS API. | ||
| 93 | Include it into your program to make the API of the | ||
| 94 | .Nm ssl | ||
| 95 | library available. | ||
| 96 | It internally includes both more private SSL headers and headers from the | ||
| 97 | .Em crypto | ||
| 98 | library. | ||
| 99 | Whenever you need hardcore details on the internals of the SSL API, look inside | ||
| 100 | this header file. | ||
| 101 | .It Pa ssl2.h | ||
| 102 | That's the sub header file dealing with the SSLv2 protocol only. | ||
| 103 | .Bf Em | ||
| 104 | Usually you don't have to include it explicitly because it's already included | ||
| 105 | by | ||
| 106 | .Pa ssl.h . | ||
| 107 | .Ef | ||
| 108 | .It Pa ssl3.h | ||
| 109 | That's the sub header file dealing with the SSLv3 protocol only. | ||
| 110 | .Bf Em | ||
| 111 | Usually you don't have to include it explicitly because it's already included | ||
| 112 | by | ||
| 113 | .Pa ssl.h . | ||
| 114 | .Ef | ||
| 115 | .It Pa ssl23.h | ||
| 116 | That's the sub header file dealing with the combined use of the SSLv2 and SSLv3 | ||
| 117 | protocols. | ||
| 118 | .Bf Em | ||
| 119 | Usually you don't have to include it explicitly because it's already included | ||
| 120 | by | ||
| 121 | .Pa ssl.h . | ||
| 122 | .Ef | ||
| 123 | .It Pa tls1.h | ||
| 124 | That's the sub header file dealing with the TLSv1 protocol only. | ||
| 125 | .Bf Em | ||
| 126 | Usually you don't have to include it explicitly because it's already included | ||
| 127 | by | ||
| 128 | .Pa ssl.h . | ||
| 129 | .Ef | ||
| 130 | .El | ||
| 131 | .Sh API FUNCTIONS | ||
| 132 | The functions that the OpenSSL | ||
| 133 | .Nm ssl | ||
| 134 | library exports are documented below: | ||
| 135 | .Ss DEALING WITH PROTOCOL METHODS | ||
| 136 | Here we document the various API functions which deal with the SSL/TLS protocol | ||
| 137 | methods defined in | ||
| 138 | .Vt SSL_METHOD | ||
| 139 | structures. | ||
| 140 | .Bl -tag -width Ds | ||
| 141 | .It Xo | ||
| 142 | .Ft const SSL_METHOD * | ||
| 143 | .Fn SSLv2_client_method void | ||
| 144 | .Xc | ||
| 145 | Constructor for the SSLv2 | ||
| 146 | .Vt SSL_METHOD | ||
| 147 | structure for a dedicated client. | ||
| 148 | .It Xo | ||
| 149 | .Ft const SSL_METHOD * | ||
| 150 | .Fn SSLv2_server_method void | ||
| 151 | .Xc | ||
| 152 | Constructor for the SSLv2 | ||
| 153 | .Vt SSL_METHOD | ||
| 154 | structure for a dedicated server. | ||
| 155 | .It Xo | ||
| 156 | .Ft const SSL_METHOD * | ||
| 157 | .Fn SSLv2_method void | ||
| 158 | .Xc | ||
| 159 | Constructor for the SSLv2 | ||
| 160 | .Vt SSL_METHOD | ||
| 161 | structure for combined client and server. | ||
| 162 | .It Xo | ||
| 163 | .Ft const SSL_METHOD * | ||
| 164 | .Fn SSLv3_client_method void | ||
| 165 | .Xc | ||
| 166 | Constructor for the SSLv3 | ||
| 167 | .Vt SSL_METHOD | ||
| 168 | structure for a dedicated client. | ||
| 169 | .It Xo | ||
| 170 | .Ft const SSL_METHOD * | ||
| 171 | .Fn SSLv3_server_method void | ||
| 172 | .Xc | ||
| 173 | Constructor for the SSLv3 | ||
| 174 | .Vt SSL_METHOD | ||
| 175 | structure for a dedicated server. | ||
| 176 | .It Xo | ||
| 177 | .Ft const SSL_METHOD * | ||
| 178 | .Fn SSLv3_method void | ||
| 179 | .Xc | ||
| 180 | Constructor for the SSLv3 | ||
| 181 | .Vt SSL_METHOD | ||
| 182 | structure for combined client and server. | ||
| 183 | .It Xo | ||
| 184 | .Ft const SSL_METHOD * | ||
| 185 | .Fn TLSv1_client_method void | ||
| 186 | .Xc | ||
| 187 | Constructor for the TLSv1 | ||
| 188 | .Vt SSL_METHOD | ||
| 189 | structure for a dedicated client. | ||
| 190 | .It Xo | ||
| 191 | .Ft const SSL_METHOD * | ||
| 192 | .Fn TLSv1_server_method void | ||
| 193 | .Xc | ||
| 194 | Constructor for the TLSv1 | ||
| 195 | .Vt SSL_METHOD | ||
| 196 | structure for a dedicated server. | ||
| 197 | .It Xo | ||
| 198 | .Ft const SSL_METHOD * | ||
| 199 | .Fn TLSv1_method void | ||
| 200 | .Xc | ||
| 201 | Constructor for the TLSv1 | ||
| 202 | .Vt SSL_METHOD | ||
| 203 | structure for combined client and server. | ||
| 204 | .El | ||
| 205 | .Ss DEALING WITH CIPHERS | ||
| 206 | Here we document the various API functions which deal with the SSL/TLS ciphers | ||
| 207 | defined in | ||
| 208 | .Vt SSL_CIPHER | ||
| 209 | structures. | ||
| 210 | .Bl -tag -width Ds | ||
| 211 | .It Xo | ||
| 212 | .Ft char * | ||
| 213 | .Fn SSL_CIPHER_description "SSL_CIPHER *cipher" "char *buf" "int len" | ||
| 214 | .Xc | ||
| 215 | Write a string to | ||
| 216 | .Fa buf | ||
| 217 | (with a maximum size of | ||
| 218 | .Fa len ) | ||
| 219 | containing a human readable description of | ||
| 220 | .Fa cipher . | ||
| 221 | Returns | ||
| 222 | .Fa buf . | ||
| 223 | .It Xo | ||
| 224 | .Ft int | ||
| 225 | .Fn SSL_CIPHER_get_bits "SSL_CIPHER *cipher" "int *alg_bits" | ||
| 226 | .Xc | ||
| 227 | Determine the number of bits in | ||
| 228 | .Fa cipher . | ||
| 229 | Because of export crippled ciphers there are two bits: | ||
| 230 | the bits the algorithm supports in general (stored to | ||
| 231 | .Fa alg_bits ) | ||
| 232 | and the bits which are actually used (the return value). | ||
| 233 | .It Xo | ||
| 234 | .Ft const char * | ||
| 235 | .Fn SSL_CIPHER_get_name "SSL_CIPHER *cipher" | ||
| 236 | .Xc | ||
| 237 | Return the internal name of | ||
| 238 | .Fa cipher | ||
| 239 | as a string. | ||
| 240 | These are the various strings defined by the | ||
| 241 | .Dv SSL2_TXT_xxx , | ||
| 242 | .Dv SSL3_TXT_xxx | ||
| 243 | and | ||
| 244 | .Dv TLS1_TXT_xxx | ||
| 245 | definitions in the header files. | ||
| 246 | .It Xo | ||
| 247 | .Ft char * | ||
| 248 | .Fn SSL_CIPHER_get_version "SSL_CIPHER *cipher" | ||
| 249 | .Xc | ||
| 250 | Returns a string like | ||
| 251 | Qq TLSv1/SSLv3 | ||
| 252 | or | ||
| 253 | Qq SSLv2 | ||
| 254 | which indicates the SSL/TLS protocol version to which | ||
| 255 | .Fa cipher | ||
| 256 | belongs (i.e., where it was defined in the specification the first time). | ||
| 257 | .El | ||
| 258 | .Ss DEALING WITH PROTOCOL CONTEXTS | ||
| 259 | Here we document the various API functions which deal with the SSL/TLS | ||
| 260 | protocol context defined in the | ||
| 261 | .Vt SSL_CTX | ||
| 262 | structure. | ||
| 263 | .Bl -tag -width Ds | ||
| 264 | .It Xo | ||
| 265 | .Ft int | ||
| 266 | .Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *x" | ||
| 267 | .Xc | ||
| 268 | .It Xo | ||
| 269 | .Ft long | ||
| 270 | .Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509" | ||
| 271 | .Xc | ||
| 272 | .It Xo | ||
| 273 | .Ft int | ||
| 274 | .Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 275 | .Xc | ||
| 276 | .It Xo | ||
| 277 | .Ft int | ||
| 278 | .Fn SSL_CTX_check_private_key "const SSL_CTX *ctx" | ||
| 279 | .Xc | ||
| 280 | .It Xo | ||
| 281 | .Ft long | ||
| 282 | .Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "char *parg" | ||
| 283 | .Xc | ||
| 284 | .It Xo | ||
| 285 | .Ft void | ||
| 286 | .Fn SSL_CTX_flush_sessions "SSL_CTX *s" "long t" | ||
| 287 | .Xc | ||
| 288 | .It Xo | ||
| 289 | .Ft void | ||
| 290 | .Fn SSL_CTX_free "SSL_CTX *a" | ||
| 291 | .Xc | ||
| 292 | .It Xo | ||
| 293 | .Ft char * | ||
| 294 | .Fn SSL_CTX_get_app_data "SSL_CTX *ctx" | ||
| 295 | .Xc | ||
| 296 | .It Xo | ||
| 297 | .Ft X509_STORE * | ||
| 298 | .Fn SSL_CTX_get_cert_store "SSL_CTX *ctx" | ||
| 299 | .Xc | ||
| 300 | .It Xo | ||
| 301 | .Ft STACK * | ||
| 302 | .Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx" | ||
| 303 | .Xc | ||
| 304 | .It Xo | ||
| 305 | .Ft int | ||
| 306 | .Fn "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))" | ||
| 307 | .Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey" | ||
| 308 | .Xc | ||
| 309 | .It Xo | ||
| 310 | .Ft char * | ||
| 311 | .Fn SSL_CTX_get_ex_data "const SSL_CTX *s" "int idx" | ||
| 312 | .Xc | ||
| 313 | .It Xo | ||
| 314 | .Ft int | ||
| 315 | .Fo SSL_CTX_get_ex_new_index | ||
| 316 | .Fa "long argl" | ||
| 317 | .Fa "void *argp" | ||
| 318 | .Fa "CRYPTO_EX_new *new_func" | ||
| 319 | .Fa "CRYPTO_EX_dup *dup_func" | ||
| 320 | .Fa "CRYPTO_EX_free *free_func" | ||
| 321 | .Fc | ||
| 322 | .Xc | ||
| 323 | .It Xo | ||
| 324 | .Ft void | ||
| 325 | .Fo "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))" | ||
| 326 | .Fa "SSL *ssl" | ||
| 327 | .Fa "int cb" | ||
| 328 | .Fa "int ret" | ||
| 329 | .Fc | ||
| 330 | .Xc | ||
| 331 | .It Xo | ||
| 332 | .Ft int | ||
| 333 | .Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx" | ||
| 334 | .Xc | ||
| 335 | .It Xo | ||
| 336 | .Ft int | ||
| 337 | .Fn SSL_CTX_get_session_cache_mode "SSL_CTX *ctx" | ||
| 338 | .Xc | ||
| 339 | .It Xo | ||
| 340 | .Ft long | ||
| 341 | .Fn SSL_CTX_get_timeout "const SSL_CTX *ctx" | ||
| 342 | .Xc | ||
| 343 | .It Xo | ||
| 344 | .Ft int | ||
| 345 | .Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))" | ||
| 346 | .Fa "int ok" | ||
| 347 | .Fa "X509_STORE_CTX *ctx" | ||
| 348 | .Fc | ||
| 349 | .Xc | ||
| 350 | .It Xo | ||
| 351 | .Ft int | ||
| 352 | .Fn SSL_CTX_get_verify_mode "SSL_CTX *ctx" | ||
| 353 | .Xc | ||
| 354 | .It Xo | ||
| 355 | .Ft int | ||
| 356 | .Fn SSL_CTX_load_verify_locations "SSL_CTX *ctx" "char *CAfile" "char *CApath" | ||
| 357 | .Xc | ||
| 358 | .It Xo | ||
| 359 | .Ft long | ||
| 360 | .Fn SSL_CTX_need_tmp_RSA "SSL_CTX *ctx" | ||
| 361 | .Xc | ||
| 362 | .It Xo | ||
| 363 | .Ft SSL_CTX * | ||
| 364 | .Fn SSL_CTX_new "const SSL_METHOD *meth" | ||
| 365 | .Xc | ||
| 366 | .It Xo | ||
| 367 | .Ft int | ||
| 368 | .Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c" | ||
| 369 | .Xc | ||
| 370 | .It Xo | ||
| 371 | .Ft int | ||
| 372 | .Fn SSL_CTX_sess_accept "SSL_CTX *ctx" | ||
| 373 | .Xc | ||
| 374 | .It Xo | ||
| 375 | .Ft int | ||
| 376 | .Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx" | ||
| 377 | .Xc | ||
| 378 | .It Xo | ||
| 379 | .Ft int | ||
| 380 | .Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx" | ||
| 381 | .Xc | ||
| 382 | .It Xo | ||
| 383 | .Ft int | ||
| 384 | .Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx" | ||
| 385 | .Xc | ||
| 386 | .It Xo | ||
| 387 | .Ft int | ||
| 388 | .Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx" | ||
| 389 | .Xc | ||
| 390 | .It Xo | ||
| 391 | .Ft int | ||
| 392 | .Fn SSL_CTX_sess_connect "SSL_CTX *ctx" | ||
| 393 | .Xc | ||
| 394 | .It Xo | ||
| 395 | .Ft int | ||
| 396 | .Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx" | ||
| 397 | .Xc | ||
| 398 | .It Xo | ||
| 399 | .Ft int | ||
| 400 | .Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx" | ||
| 401 | .Xc | ||
| 402 | .It Xo | ||
| 403 | .Ft int | ||
| 404 | .Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx" | ||
| 405 | .Xc | ||
| 406 | .It Xo | ||
| 407 | .Ft SSL_SESSION * | ||
| 408 | .Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))" | ||
| 409 | .Fa "SSL *ssl" | ||
| 410 | .Fa "unsigned char *data" | ||
| 411 | .Fa "int len" | ||
| 412 | .Fa "int *copy" | ||
| 413 | .Fc | ||
| 414 | .Xc | ||
| 415 | .It Xo | ||
| 416 | .Ft int | ||
| 417 | .Fn "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" "SSL *ssl" "SSL_SESSION *sess" | ||
| 418 | .Xc | ||
| 419 | .It Xo | ||
| 420 | .Ft void | ||
| 421 | .Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))" | ||
| 422 | .Fa "SSL_CTX *ctx" | ||
| 423 | .Fa "SSL_SESSION *sess" | ||
| 424 | .Fc | ||
| 425 | .Xc | ||
| 426 | .It Xo | ||
| 427 | .Ft int | ||
| 428 | .Fn SSL_CTX_sess_hits "SSL_CTX *ctx" | ||
| 429 | .Xc | ||
| 430 | .It Xo | ||
| 431 | .Ft int | ||
| 432 | .Fn SSL_CTX_sess_misses "SSL_CTX *ctx" | ||
| 433 | .Xc | ||
| 434 | .It Xo | ||
| 435 | .Ft int | ||
| 436 | .Fn SSL_CTX_sess_number "SSL_CTX *ctx" | ||
| 437 | .Xc | ||
| 438 | .It Xo | ||
| 439 | .Ft void | ||
| 440 | .Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t" | ||
| 441 | .Xc | ||
| 442 | .It Xo | ||
| 443 | .Ft void | ||
| 444 | .Fo SSL_CTX_sess_set_get_cb | ||
| 445 | .Fa "SSL_CTX *ctx" | ||
| 446 | .Fa "SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)" | ||
| 447 | .Fc | ||
| 448 | .Xc | ||
| 449 | .It Xo | ||
| 450 | .Ft void | ||
| 451 | .Fo SSL_CTX_sess_set_new_cb | ||
| 452 | .Fa "SSL_CTX *ctx" | ||
| 453 | .Fa "int (*cb)(SSL *ssl, SSL_SESSION *sess)" | ||
| 454 | .Fc | ||
| 455 | .Xc | ||
| 456 | .It Xo | ||
| 457 | .Ft void | ||
| 458 | .Fo SSL_CTX_sess_set_remove_cb | ||
| 459 | .Fa "SSL_CTX *ctx" | ||
| 460 | .Fa "void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)" | ||
| 461 | .Fc | ||
| 462 | .Xc | ||
| 463 | .It Xo | ||
| 464 | .Ft int | ||
| 465 | .Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx" | ||
| 466 | .Xc | ||
| 467 | .It Xo | ||
| 468 | .Ft LHASH * | ||
| 469 | .Fn SSL_CTX_sessions "SSL_CTX *ctx" | ||
| 470 | .Xc | ||
| 471 | .It Xo | ||
| 472 | .Ft void | ||
| 473 | .Fn SSL_CTX_set_app_data "SSL_CTX *ctx" "void *arg" | ||
| 474 | .Xc | ||
| 475 | .It Xo | ||
| 476 | .Ft void | ||
| 477 | .Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *cs" | ||
| 478 | .Xc | ||
| 479 | .It Xo | ||
| 480 | .Ft void | ||
| 481 | .Fn SSL_CTX_set_cert_verify_cb "SSL_CTX *ctx" "int (*cb)()" "char *arg" | ||
| 482 | .Xc | ||
| 483 | .It Xo | ||
| 484 | .Ft int | ||
| 485 | .Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "char *str" | ||
| 486 | .Xc | ||
| 487 | .It Xo | ||
| 488 | .Ft void | ||
| 489 | .Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK *list" | ||
| 490 | .Xc | ||
| 491 | .It Xo | ||
| 492 | .Ft void | ||
| 493 | .Fo SSL_CTX_set_client_cert_cb | ||
| 494 | .Fa "SSL_CTX *ctx" | ||
| 495 | .Fa "int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)" | ||
| 496 | .Fc | ||
| 497 | .Xc | ||
| 498 | .It Xo | ||
| 499 | .Ft void | ||
| 500 | .Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb" | ||
| 501 | .Xc | ||
| 502 | .It Xo | ||
| 503 | .Ft void | ||
| 504 | .Fn SSL_CTX_set_default_read_ahead "SSL_CTX *ctx" "int m" | ||
| 505 | .Xc | ||
| 506 | .It Xo | ||
| 507 | .Ft int | ||
| 508 | .Fn SSL_CTX_set_default_verify_paths "SSL_CTX *ctx" | ||
| 509 | .Xc | ||
| 510 | .It Xo | ||
| 511 | .Ft int | ||
| 512 | .Fn SSL_CTX_set_ex_data "SSL_CTX *s" "int idx" "char *arg" | ||
| 513 | .Xc | ||
| 514 | .It Xo | ||
| 515 | .Ft void | ||
| 516 | .Fo SSL_CTX_set_info_callback | ||
| 517 | .Fa "SSL_CTX *ctx" | ||
| 518 | .Fa "void (*cb)(SSL *ssl, int cb, int ret)" | ||
| 519 | .Fc | ||
| 520 | .Xc | ||
| 521 | .It Xo | ||
| 522 | .Ft void | ||
| 523 | .Fo SSL_CTX_set_msg_callback | ||
| 524 | .Fa "SSL_CTX *ctx" | ||
| 525 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
| 526 | size_t len, SSL *ssl, void *arg)" | ||
| 527 | .Fc | ||
| 528 | .Xc | ||
| 529 | .It Xo | ||
| 530 | .Ft void | ||
| 531 | .Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg" | ||
| 532 | .Xc | ||
| 533 | .It Xo | ||
| 534 | .Ft void | ||
| 535 | .Fn SSL_CTX_set_options "SSL_CTX *ctx" "unsigned long op" | ||
| 536 | .Xc | ||
| 537 | .It Xo | ||
| 538 | .Ft void | ||
| 539 | .Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode" | ||
| 540 | .Xc | ||
| 541 | .It Xo | ||
| 542 | .Ft void | ||
| 543 | .Fn SSL_CTX_set_session_cache_mode "SSL_CTX *ctx" "int mode" | ||
| 544 | .Xc | ||
| 545 | .It Xo | ||
| 546 | .Ft int | ||
| 547 | .Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *meth" | ||
| 548 | .Xc | ||
| 549 | .It Xo | ||
| 550 | .Ft void | ||
| 551 | .Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t" | ||
| 552 | .Xc | ||
| 553 | .It Xo | ||
| 554 | .Ft long | ||
| 555 | .Fn SSL_CTX_set_tmp_dh "SSL_CTX* ctx" "DH *dh" | ||
| 556 | .Xc | ||
| 557 | .It Xo | ||
| 558 | .Ft long | ||
| 559 | .Fn SSL_CTX_set_tmp_dh_callback "SSL_CTX *ctx" "DH *(*cb)(void)" | ||
| 560 | .Xc | ||
| 561 | .It Xo | ||
| 562 | .Ft long | ||
| 563 | .Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa" | ||
| 564 | .Xc | ||
| 565 | .It Xo | ||
| 566 | .Fn SSL_CTX_set_tmp_rsa_callback | ||
| 567 | .Xc | ||
| 568 | .Ft long | ||
| 569 | .Fo SSL_CTX_set_tmp_rsa_callback | ||
| 570 | .Fa "SSL_CTX *ctx" | ||
| 571 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
| 572 | .Fc | ||
| 573 | .Pp | ||
| 574 | Sets the callback which will be called when a temporary private key is | ||
| 575 | required. | ||
| 576 | The | ||
| 577 | .Fa export | ||
| 578 | flag will be set if the reason for needing a temp key is that an export | ||
| 579 | ciphersuite is in use, in which case, | ||
| 580 | .Fa keylength | ||
| 581 | will contain the required keylength in bits. | ||
| 582 | .\" XXX using what? | ||
| 583 | Generate a key of appropriate size (using ???) and return it. | ||
| 584 | .It Xo | ||
| 585 | .Fn SSL_set_tmp_rsa_callback | ||
| 586 | .Xc | ||
| 587 | .Ft long | ||
| 588 | .Fo SSL_set_tmp_rsa_callback | ||
| 589 | .Fa "SSL *ssl" | ||
| 590 | .Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)" | ||
| 591 | .Fc | ||
| 592 | .Pp | ||
| 593 | The same as | ||
| 594 | .Fn SSL_CTX_set_tmp_rsa_callback , | ||
| 595 | except it operates on an | ||
| 596 | .Vt SSL | ||
| 597 | session instead of a context. | ||
| 598 | .It Xo | ||
| 599 | .Ft void | ||
| 600 | .Fn SSL_CTX_set_verify "SSL_CTX *ctx" "int mode" "int (*cb)(void)" | ||
| 601 | .Xc | ||
| 602 | .It Xo | ||
| 603 | .Ft int | ||
| 604 | .Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey" | ||
| 605 | .Xc | ||
| 606 | .It Xo | ||
| 607 | .Ft int | ||
| 608 | .Fo SSL_CTX_use_PrivateKey_ASN1 | ||
| 609 | .Fa "int type" | ||
| 610 | .Fa "SSL_CTX *ctx" | ||
| 611 | .Fa "unsigned char *d" | ||
| 612 | .Fa "long len" | ||
| 613 | .Fc | ||
| 614 | .Xc | ||
| 615 | .It Xo | ||
| 616 | .Ft int | ||
| 617 | .Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
| 618 | .Xc | ||
| 619 | .It Xo | ||
| 620 | .Ft int | ||
| 621 | .Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa" | ||
| 622 | .Xc | ||
| 623 | .It Xo | ||
| 624 | .Ft int | ||
| 625 | .Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len" | ||
| 626 | .Xc | ||
| 627 | .It Xo | ||
| 628 | .Ft int | ||
| 629 | .Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "char *file" "int type" | ||
| 630 | .Xc | ||
| 631 | .It Xo | ||
| 632 | .Ft int | ||
| 633 | .Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x" | ||
| 634 | .Xc | ||
| 635 | .It Xo | ||
| 636 | .Ft int | ||
| 637 | .Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d" | ||
| 638 | .Xc | ||
| 639 | .It Xo | ||
| 640 | .Ft int | ||
| 641 | .Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "char *file" "int type" | ||
| 642 | .Xc | ||
| 643 | .It Xo | ||
| 644 | .Ft void | ||
| 645 | .Fo SSL_CTX_set_psk_client_callback | ||
| 646 | .Fa "SSL_CTX *ctx" | ||
| 647 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
| 648 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
| 649 | .Fc | ||
| 650 | .Xc | ||
| 651 | .It Xo | ||
| 652 | .Ft int | ||
| 653 | .Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint" | ||
| 654 | .Xc | ||
| 655 | .It Xo | ||
| 656 | .Ft void | ||
| 657 | .Fo SSL_CTX_set_psk_server_callback | ||
| 658 | .Fa "SSL_CTX *ctx" | ||
| 659 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
| 660 | unsigned char *psk, int max_psk_len)" | ||
| 661 | .Fc | ||
| 662 | .Xc | ||
| 663 | .El | ||
| 664 | .Ss DEALING WITH SESSIONS | ||
| 665 | Here we document the various API functions which deal with the SSL/TLS sessions | ||
| 666 | defined in the | ||
| 667 | .Vt SSL_SESSION | ||
| 668 | structures. | ||
| 669 | .Bl -tag -width Ds | ||
| 670 | .It Xo | ||
| 671 | .Ft int | ||
| 672 | .Fn SSL_SESSION_cmp "const SSL_SESSION *a" "const SSL_SESSION *b" | ||
| 673 | .Xc | ||
| 674 | .It Xo | ||
| 675 | .Ft void | ||
| 676 | .Fn SSL_SESSION_free "SSL_SESSION *ss" | ||
| 677 | .Xc | ||
| 678 | .It Xo | ||
| 679 | .Ft char * | ||
| 680 | .Fn SSL_SESSION_get_app_data "SSL_SESSION *s" | ||
| 681 | .Xc | ||
| 682 | .It Xo | ||
| 683 | .Ft char * | ||
| 684 | .Fn SSL_SESSION_get_ex_data "const SSL_SESSION *s" "int idx" | ||
| 685 | .Xc | ||
| 686 | .It Xo | ||
| 687 | .Ft int | ||
| 688 | .Fo SSL_SESSION_get_ex_new_index | ||
| 689 | .Fa "long argl" | ||
| 690 | .Fa "char *argp" | ||
| 691 | .Fa "int (*new_func)(void)" | ||
| 692 | .Fa "int (*dup_func)(void), void (*free_func)(void)" | ||
| 693 | .Fc | ||
| 694 | .Xc | ||
| 695 | .It Xo | ||
| 696 | .Ft long | ||
| 697 | .Fn SSL_SESSION_get_time "const SSL_SESSION *s" | ||
| 698 | .Xc | ||
| 699 | .It Xo | ||
| 700 | .Ft long | ||
| 701 | .Fn SSL_SESSION_get_timeout "const SSL_SESSION *s" | ||
| 702 | .Xc | ||
| 703 | .It Xo | ||
| 704 | .Ft unsigned long | ||
| 705 | .Fn SSL_SESSION_hash "const SSL_SESSION *a" | ||
| 706 | .Xc | ||
| 707 | .It Xo | ||
| 708 | .Ft SSL_SESSION * | ||
| 709 | .Fn SSL_SESSION_new void | ||
| 710 | .Xc | ||
| 711 | .It Xo | ||
| 712 | .Ft int | ||
| 713 | .Fn SSL_SESSION_print "BIO *bp" "const SSL_SESSION *x" | ||
| 714 | .Xc | ||
| 715 | .It Xo | ||
| 716 | .Ft int | ||
| 717 | .Fn SSL_SESSION_print_fp "FILE *fp" "const SSL_SESSION *x" | ||
| 718 | .Xc | ||
| 719 | .It Xo | ||
| 720 | .Ft void | ||
| 721 | .Fn SSL_SESSION_set_app_data "SSL_SESSION *s" "char *a" | ||
| 722 | .Xc | ||
| 723 | .It Xo | ||
| 724 | .Ft int | ||
| 725 | .Fn SSL_SESSION_set_ex_data "SSL_SESSION *s" "int idx" "char *arg" | ||
| 726 | .Xc | ||
| 727 | .It Xo | ||
| 728 | .Ft long | ||
| 729 | .Fn SSL_SESSION_set_time "SSL_SESSION *s" "long t" | ||
| 730 | .Xc | ||
| 731 | .It Xo | ||
| 732 | .Ft long | ||
| 733 | .Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long t" | ||
| 734 | .Xc | ||
| 735 | .El | ||
| 736 | .Ss DEALING WITH CONNECTIONS | ||
| 737 | Here we document the various API functions which deal with the SSL/TLS | ||
| 738 | connection defined in the | ||
| 739 | .Vt SSL | ||
| 740 | structure. | ||
| 741 | .Bl -tag -width Ds | ||
| 742 | .It Xo | ||
| 743 | .Ft int | ||
| 744 | .Fn SSL_accept "SSL *ssl" | ||
| 745 | .Xc | ||
| 746 | .It Xo | ||
| 747 | .Ft int | ||
| 748 | .Fn SSL_add_dir_cert_subjects_to_stack "STACK *stack" "const char *dir" | ||
| 749 | .Xc | ||
| 750 | .It Xo | ||
| 751 | .Ft int | ||
| 752 | .Fn SSL_add_file_cert_subjects_to_stack "STACK *stack" "const char *file" | ||
| 753 | .Xc | ||
| 754 | .It Xo | ||
| 755 | .Ft int | ||
| 756 | .Fn SSL_add_client_CA "SSL *ssl" "X509 *x" | ||
| 757 | .Xc | ||
| 758 | .It Xo | ||
| 759 | .Ft char * | ||
| 760 | .Fn SSL_alert_desc_string "int value" | ||
| 761 | .Xc | ||
| 762 | .It Xo | ||
| 763 | .Ft char * | ||
| 764 | .Fn SSL_alert_desc_string_long "int value" | ||
| 765 | .Xc | ||
| 766 | .It Xo | ||
| 767 | .Ft char * | ||
| 768 | .Fn SSL_alert_type_string "int value" | ||
| 769 | .Xc | ||
| 770 | .It Xo | ||
| 771 | .Ft char * | ||
| 772 | .Fn SSL_alert_type_string_long "int value" | ||
| 773 | .Xc | ||
| 774 | .It Xo | ||
| 775 | .Ft int | ||
| 776 | .Fn SSL_check_private_key "const SSL *ssl" | ||
| 777 | .Xc | ||
| 778 | .It Xo | ||
| 779 | .Ft void | ||
| 780 | .Fn SSL_clear "SSL *ssl" | ||
| 781 | .Xc | ||
| 782 | .It Xo | ||
| 783 | .Ft long | ||
| 784 | .Fn SSL_clear_num_renegotiations "SSL *ssl" | ||
| 785 | .Xc | ||
| 786 | .It Xo | ||
| 787 | .Ft int | ||
| 788 | .Fn SSL_connect "SSL *ssl" | ||
| 789 | .Xc | ||
| 790 | .It Xo | ||
| 791 | .Ft void | ||
| 792 | .Fn SSL_copy_session_id "SSL *t" "const SSL *f" | ||
| 793 | .Xc | ||
| 794 | .It Xo | ||
| 795 | .Ft long | ||
| 796 | .Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "char *parg" | ||
| 797 | .Xc | ||
| 798 | .It Xo | ||
| 799 | .Ft int | ||
| 800 | .Fn SSL_do_handshake "SSL *ssl" | ||
| 801 | .Xc | ||
| 802 | .It Xo | ||
| 803 | .Ft SSL * | ||
| 804 | .Fn SSL_dup "SSL *ssl" | ||
| 805 | .Xc | ||
| 806 | .It Xo | ||
| 807 | .Ft STACK * | ||
| 808 | .Fn SSL_dup_CA_list "STACK *sk" | ||
| 809 | .Xc | ||
| 810 | .It Xo | ||
| 811 | .Ft void | ||
| 812 | .Fn SSL_free "SSL *ssl" | ||
| 813 | .Xc | ||
| 814 | .It Xo | ||
| 815 | .Ft SSL_CTX * | ||
| 816 | .Fn SSL_get_SSL_CTX "const SSL *ssl" | ||
| 817 | .Xc | ||
| 818 | .It Xo | ||
| 819 | .Ft char * | ||
| 820 | .Fn SSL_get_app_data "SSL *ssl" | ||
| 821 | .Xc | ||
| 822 | .It Xo | ||
| 823 | .Ft X509 * | ||
| 824 | .Fn SSL_get_certificate "const SSL *ssl" | ||
| 825 | .Xc | ||
| 826 | .It Xo | ||
| 827 | .Ft const char * | ||
| 828 | .Fn SSL_get_cipher "const SSL *ssl" | ||
| 829 | .Xc | ||
| 830 | .It Xo | ||
| 831 | .Ft int | ||
| 832 | .Fn SSL_get_cipher_bits "const SSL *ssl" "int *alg_bits" | ||
| 833 | .Xc | ||
| 834 | .It Xo | ||
| 835 | .Ft char * | ||
| 836 | .Fn SSL_get_cipher_list "const SSL *ssl" "int n" | ||
| 837 | .Xc | ||
| 838 | .It Xo | ||
| 839 | .Ft char * | ||
| 840 | .Fn SSL_get_cipher_name "const SSL *ssl" | ||
| 841 | .Xc | ||
| 842 | .It Xo | ||
| 843 | .Ft char * | ||
| 844 | .Fn SSL_get_cipher_version "const SSL *ssl" | ||
| 845 | .Xc | ||
| 846 | .It Xo | ||
| 847 | .Ft STACK * | ||
| 848 | .Fn SSL_get_ciphers "const SSL *ssl" | ||
| 849 | .Xc | ||
| 850 | .It Xo | ||
| 851 | .Ft STACK * | ||
| 852 | .Fn SSL_get_client_CA_list "const SSL *ssl" | ||
| 853 | .Xc | ||
| 854 | .It Xo | ||
| 855 | .Ft SSL_CIPHER * | ||
| 856 | .Fn SSL_get_current_cipher "SSL *ssl" | ||
| 857 | .Xc | ||
| 858 | .It Xo | ||
| 859 | .Ft long | ||
| 860 | .Fn SSL_get_default_timeout "const SSL *ssl" | ||
| 861 | .Xc | ||
| 862 | .It Xo | ||
| 863 | .Ft int | ||
| 864 | .Fn SSL_get_error "const SSL *ssl" "int i" | ||
| 865 | .Xc | ||
| 866 | .It Xo | ||
| 867 | .Ft char * | ||
| 868 | .Fn SSL_get_ex_data "const SSL *ssl" "int idx" | ||
| 869 | .Xc | ||
| 870 | .It Xo | ||
| 871 | .Ft int | ||
| 872 | .Fn SSL_get_ex_data_X509_STORE_CTX_idx void | ||
| 873 | .Xc | ||
| 874 | .It Xo | ||
| 875 | .Ft int | ||
| 876 | .Fo SSL_get_ex_new_index | ||
| 877 | .Fa "long argl" | ||
| 878 | .Fa "char *argp" | ||
| 879 | .Fa "int (*new_func)(void)" | ||
| 880 | .Fa "int (*dup_func)(void)" | ||
| 881 | .Fa "void (*free_func)(void)" | ||
| 882 | .Fc | ||
| 883 | .Xc | ||
| 884 | .It Xo | ||
| 885 | .Ft int | ||
| 886 | .Fn SSL_get_fd "const SSL *ssl" | ||
| 887 | .Xc | ||
| 888 | .It Xo | ||
| 889 | .Ft void | ||
| 890 | .Fn "(*SSL_get_info_callback(const SSL *ssl))" | ||
| 891 | .Xc | ||
| 892 | .It Xo | ||
| 893 | .Ft STACK * | ||
| 894 | .Fn SSL_get_peer_cert_chain "const SSL *ssl" | ||
| 895 | .Xc | ||
| 896 | .It Xo | ||
| 897 | .Ft X509 * | ||
| 898 | .Fn SSL_get_peer_certificate "const SSL *ssl" | ||
| 899 | .Xc | ||
| 900 | .It Xo | ||
| 901 | .Ft EVP_PKEY * | ||
| 902 | .Fn SSL_get_privatekey "SSL *ssl" | ||
| 903 | .Xc | ||
| 904 | .It Xo | ||
| 905 | .Ft int | ||
| 906 | .Fn SSL_get_quiet_shutdown "const SSL *ssl" | ||
| 907 | .Xc | ||
| 908 | .It Xo | ||
| 909 | .Ft BIO * | ||
| 910 | .Fn SSL_get_rbio "const SSL *ssl" | ||
| 911 | .Xc | ||
| 912 | .It Xo | ||
| 913 | .Ft int | ||
| 914 | .Fn SSL_get_read_ahead "const SSL *ssl" | ||
| 915 | .Xc | ||
| 916 | .It Xo | ||
| 917 | .Ft SSL_SESSION * | ||
| 918 | .Fn SSL_get_session "const SSL *ssl" | ||
| 919 | .Xc | ||
| 920 | .It Xo | ||
| 921 | .Ft char * | ||
| 922 | .Fn SSL_get_shared_ciphers "const SSL *ssl" "char *buf" "int len" | ||
| 923 | .Xc | ||
| 924 | .It Xo | ||
| 925 | .Ft int | ||
| 926 | .Fn SSL_get_shutdown "const SSL *ssl" | ||
| 927 | .Xc | ||
| 928 | .It Xo | ||
| 929 | .Ft const SSL_METHOD * | ||
| 930 | .Fn SSL_get_ssl_method "SSL *ssl" | ||
| 931 | .Xc | ||
| 932 | .It Xo | ||
| 933 | .Ft int | ||
| 934 | .Fn SSL_get_state "const SSL *ssl" | ||
| 935 | .Xc | ||
| 936 | .It Xo | ||
| 937 | .Ft long | ||
| 938 | .Fn SSL_get_time "const SSL *ssl" | ||
| 939 | .Xc | ||
| 940 | .It Xo | ||
| 941 | .Ft long | ||
| 942 | .Fn SSL_get_timeout "const SSL *ssl" | ||
| 943 | .Xc | ||
| 944 | .It Xo | ||
| 945 | .Ft int | ||
| 946 | .Fn "(*SSL_get_verify_callback(const SSL *ssl))" int "X509_STORE_CTX *" | ||
| 947 | .Xc | ||
| 948 | .It Xo | ||
| 949 | .Ft int | ||
| 950 | .Fn SSL_get_verify_mode "const SSL *ssl" | ||
| 951 | .Xc | ||
| 952 | .It Xo | ||
| 953 | .Ft long | ||
| 954 | .Fn SSL_get_verify_result "const SSL *ssl" | ||
| 955 | .Xc | ||
| 956 | .It Xo | ||
| 957 | .Ft char * | ||
| 958 | .Fn SSL_get_version "const SSL *ssl" | ||
| 959 | .Xc | ||
| 960 | .It Xo | ||
| 961 | .Ft BIO * | ||
| 962 | .Fn SSL_get_wbio "const SSL *ssl" | ||
| 963 | .Xc | ||
| 964 | .It Xo | ||
| 965 | .Ft int | ||
| 966 | .Fn SSL_in_accept_init "SSL *ssl" | ||
| 967 | .Xc | ||
| 968 | .It Xo | ||
| 969 | .Ft int | ||
| 970 | .Fn SSL_in_before "SSL *ssl" | ||
| 971 | .Xc | ||
| 972 | .It Xo | ||
| 973 | .Ft int | ||
| 974 | .Fn SSL_in_connect_init "SSL *ssl" | ||
| 975 | .Xc | ||
| 976 | .It Xo | ||
| 977 | .Ft int | ||
| 978 | .Fn SSL_in_init "SSL *ssl" | ||
| 979 | .Xc | ||
| 980 | .It Xo | ||
| 981 | .Ft int | ||
| 982 | .Fn SSL_is_init_finished "SSL *ssl" | ||
| 983 | .Xc | ||
| 984 | .It Xo | ||
| 985 | .Ft STACK * | ||
| 986 | .Fn SSL_load_client_CA_file "char *file" | ||
| 987 | .Xc | ||
| 988 | .It Xo | ||
| 989 | .Ft void | ||
| 990 | .Fn SSL_load_error_strings "void" | ||
| 991 | .Xc | ||
| 992 | .It Xo | ||
| 993 | .Ft SSL * | ||
| 994 | .Fn SSL_new "SSL_CTX *ctx" | ||
| 995 | .Xc | ||
| 996 | .It Xo | ||
| 997 | .Ft long | ||
| 998 | .Fn SSL_num_renegotiations "SSL *ssl" | ||
| 999 | .Xc | ||
| 1000 | .It Xo | ||
| 1001 | .Ft int | ||
| 1002 | .Fn SSL_peek "SSL *ssl" "void *buf" "int num" | ||
| 1003 | .Xc | ||
| 1004 | .It Xo | ||
| 1005 | .Ft int | ||
| 1006 | .Fn SSL_pending "const SSL *ssl" | ||
| 1007 | .Xc | ||
| 1008 | .It Xo | ||
| 1009 | .Ft int | ||
| 1010 | .Fn SSL_read "SSL *ssl" "void *buf" "int num" | ||
| 1011 | .Xc | ||
| 1012 | .It Xo | ||
| 1013 | .Ft int | ||
| 1014 | .Fn SSL_renegotiate "SSL *ssl" | ||
| 1015 | .Xc | ||
| 1016 | .It Xo | ||
| 1017 | .Ft char * | ||
| 1018 | .Fn SSL_rstate_string "SSL *ssl" | ||
| 1019 | .Xc | ||
| 1020 | .It Xo | ||
| 1021 | .Ft char * | ||
| 1022 | .Fn SSL_rstate_string_long "SSL *ssl" | ||
| 1023 | .Xc | ||
| 1024 | .It Xo | ||
| 1025 | .Ft long | ||
| 1026 | .Fn SSL_session_reused "SSL *ssl" | ||
| 1027 | .Xc | ||
| 1028 | .It Xo | ||
| 1029 | .Ft void | ||
| 1030 | .Fn SSL_set_accept_state "SSL *ssl" | ||
| 1031 | .Xc | ||
| 1032 | .It Xo | ||
| 1033 | .Ft void | ||
| 1034 | .Fn SSL_set_app_data "SSL *ssl" "char *arg" | ||
| 1035 | .Xc | ||
| 1036 | .It Xo | ||
| 1037 | .Ft void | ||
| 1038 | .Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio" | ||
| 1039 | .Xc | ||
| 1040 | .It Xo | ||
| 1041 | .Ft int | ||
| 1042 | .Fn SSL_set_cipher_list "SSL *ssl" "char *str" | ||
| 1043 | .Xc | ||
| 1044 | .It Xo | ||
| 1045 | .Ft void | ||
| 1046 | .Fn SSL_set_client_CA_list "SSL *ssl" "STACK *list" | ||
| 1047 | .Xc | ||
| 1048 | .It Xo | ||
| 1049 | .Ft void | ||
| 1050 | .Fn SSL_set_connect_state "SSL *ssl" | ||
| 1051 | .Xc | ||
| 1052 | .It Xo | ||
| 1053 | .Ft int | ||
| 1054 | .Fn SSL_set_ex_data "SSL *ssl" "int idx" "char *arg" | ||
| 1055 | .Xc | ||
| 1056 | .It Xo | ||
| 1057 | .Ft int | ||
| 1058 | .Fn SSL_set_fd "SSL *ssl" "int fd" | ||
| 1059 | .Xc | ||
| 1060 | .It Xo | ||
| 1061 | .Ft void | ||
| 1062 | .Fn SSL_set_info_callback "SSL *ssl" "void (*cb)(void)" | ||
| 1063 | .Xc | ||
| 1064 | .It Xo | ||
| 1065 | .Ft void | ||
| 1066 | .Fo SSL_set_msg_callback | ||
| 1067 | .Fa "SSL *ctx" | ||
| 1068 | .Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \ | ||
| 1069 | size_t len, SSL *ssl, void *arg)" | ||
| 1070 | .Fc | ||
| 1071 | .Xc | ||
| 1072 | .It Xo | ||
| 1073 | .Ft void | ||
| 1074 | .Fn SSL_set_msg_callback_arg "SSL *ctx" "void *arg" | ||
| 1075 | .Xc | ||
| 1076 | .It Xo | ||
| 1077 | .Ft void | ||
| 1078 | .Fn SSL_set_options "SSL *ssl" "unsigned long op" | ||
| 1079 | .Xc | ||
| 1080 | .It Xo | ||
| 1081 | .Ft void | ||
| 1082 | .Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode" | ||
| 1083 | .Xc | ||
| 1084 | .It Xo | ||
| 1085 | .Ft void | ||
| 1086 | .Fn SSL_set_read_ahead "SSL *ssl" "int yes" | ||
| 1087 | .Xc | ||
| 1088 | .It Xo | ||
| 1089 | .Ft int | ||
| 1090 | .Fn SSL_set_rfd "SSL *ssl" "int fd" | ||
| 1091 | .Xc | ||
| 1092 | .It Xo | ||
| 1093 | .Ft int | ||
| 1094 | .Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session" | ||
| 1095 | .Xc | ||
| 1096 | .It Xo | ||
| 1097 | .Ft void | ||
| 1098 | .Fn SSL_set_shutdown "SSL *ssl" "int mode" | ||
| 1099 | .Xc | ||
| 1100 | .It Xo | ||
| 1101 | .Ft int | ||
| 1102 | .Fn SSL_set_ssl_method "SSL *ssl" "const SSL_METHOD *meth" | ||
| 1103 | .Xc | ||
| 1104 | .It Xo | ||
| 1105 | .Ft void | ||
| 1106 | .Fn SSL_set_time "SSL *ssl" "long t" | ||
| 1107 | .Xc | ||
| 1108 | .It Xo | ||
| 1109 | .Ft void | ||
| 1110 | .Fn SSL_set_timeout "SSL *ssl" "long t" | ||
| 1111 | .Xc | ||
| 1112 | .It Xo | ||
| 1113 | .Ft void | ||
| 1114 | .Fn SSL_set_verify "SSL *ssl" "int mode" "int (*callback)(void)" | ||
| 1115 | .Xc | ||
| 1116 | .It Xo | ||
| 1117 | .Ft void | ||
| 1118 | .Fn SSL_set_verify_result "SSL *ssl" "long arg" | ||
| 1119 | .Xc | ||
| 1120 | .It Xo | ||
| 1121 | .Ft int | ||
| 1122 | .Fn SSL_set_wfd "SSL *ssl" "int fd" | ||
| 1123 | .Xc | ||
| 1124 | .It Xo | ||
| 1125 | .Ft int | ||
| 1126 | .Fn SSL_shutdown "SSL *ssl" | ||
| 1127 | .Xc | ||
| 1128 | .It Xo | ||
| 1129 | .Ft int | ||
| 1130 | .Fn SSL_state "const SSL *ssl" | ||
| 1131 | .Xc | ||
| 1132 | .It Xo | ||
| 1133 | .Ft char * | ||
| 1134 | .Fn SSL_state_string "const SSL *ssl" | ||
| 1135 | .Xc | ||
| 1136 | .It Xo | ||
| 1137 | .Ft char * | ||
| 1138 | .Fn SSL_state_string_long "const SSL *ssl" | ||
| 1139 | .Xc | ||
| 1140 | .It Xo | ||
| 1141 | .Ft long | ||
| 1142 | .Fn SSL_total_renegotiations "SSL *ssl" | ||
| 1143 | .Xc | ||
| 1144 | .It Xo | ||
| 1145 | .Ft int | ||
| 1146 | .Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey" | ||
| 1147 | .Xc | ||
| 1148 | .It Xo | ||
| 1149 | .Ft int | ||
| 1150 | .Fn SSL_use_PrivateKey_ASN1 "int type" "SSL *ssl" "unsigned char *d" "long len" | ||
| 1151 | .Xc | ||
| 1152 | .It Xo | ||
| 1153 | .Ft int | ||
| 1154 | .Fn SSL_use_PrivateKey_file "SSL *ssl" "char *file" "int type" | ||
| 1155 | .Xc | ||
| 1156 | .It Xo | ||
| 1157 | .Ft int | ||
| 1158 | .Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa" | ||
| 1159 | .Xc | ||
| 1160 | .It Xo | ||
| 1161 | .Ft int | ||
| 1162 | .Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len" | ||
| 1163 | .Xc | ||
| 1164 | .It Xo | ||
| 1165 | .Ft int | ||
| 1166 | .Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "char *file" "int type" | ||
| 1167 | .Xc | ||
| 1168 | .It Xo | ||
| 1169 | .Ft int | ||
| 1170 | .Fn SSL_use_certificate "SSL *ssl" "X509 *x" | ||
| 1171 | .Xc | ||
| 1172 | .It Xo | ||
| 1173 | .Ft int | ||
| 1174 | .Fn SSL_use_certificate_ASN1 "SSL *ssl" "int len" "unsigned char *d" | ||
| 1175 | .Xc | ||
| 1176 | .It Xo | ||
| 1177 | .Ft int | ||
| 1178 | .Fn SSL_use_certificate_file "SSL *ssl" "char *file" "int type" | ||
| 1179 | .Xc | ||
| 1180 | .It Xo | ||
| 1181 | .Ft int | ||
| 1182 | .Fn SSL_version "const SSL *ssl" | ||
| 1183 | .Xc | ||
| 1184 | .It Xo | ||
| 1185 | .Ft int | ||
| 1186 | .Fn SSL_want "const SSL *ssl" | ||
| 1187 | .Xc | ||
| 1188 | .It Xo | ||
| 1189 | .Ft int | ||
| 1190 | .Fn SSL_want_nothing "const SSL *ssl" | ||
| 1191 | .Xc | ||
| 1192 | .It Xo | ||
| 1193 | .Ft int | ||
| 1194 | .Fn SSL_want_read "const SSL *ssl" | ||
| 1195 | .Xc | ||
| 1196 | .It Xo | ||
| 1197 | .Ft int | ||
| 1198 | .Fn SSL_want_write "const SSL *ssl" | ||
| 1199 | .Xc | ||
| 1200 | .It Xo | ||
| 1201 | .Ft int | ||
| 1202 | .Fn SSL_want_x509_lookup "const SSL *ssl" | ||
| 1203 | .Xc | ||
| 1204 | .It Xo | ||
| 1205 | .Ft int | ||
| 1206 | .Fn SSL_write "SSL *ssl" "const void *buf" "int num" | ||
| 1207 | .Xc | ||
| 1208 | .It Xo | ||
| 1209 | .Ft void | ||
| 1210 | .Fo SSL_set_psk_client_callback | ||
| 1211 | .Fa "SSL *ssl" | ||
| 1212 | .Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \ | ||
| 1213 | unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)" | ||
| 1214 | .Fc | ||
| 1215 | .Xc | ||
| 1216 | .It Xo | ||
| 1217 | .Ft int | ||
| 1218 | .Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint" | ||
| 1219 | .Xc | ||
| 1220 | .It Xo | ||
| 1221 | .Ft void | ||
| 1222 | .Fo SSL_set_psk_server_callback | ||
| 1223 | .Fa "SSL *ssl" | ||
| 1224 | .Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \ | ||
| 1225 | unsigned char *psk, int max_psk_len)" | ||
| 1226 | .Fc | ||
| 1227 | .Xc | ||
| 1228 | .It Xo | ||
| 1229 | .Ft const char * | ||
| 1230 | .Fn SSL_get_psk_identity_hint "SSL *ssl" | ||
| 1231 | .Xc | ||
| 1232 | .It Xo | ||
| 1233 | .Ft const char * | ||
| 1234 | .Fn SSL_get_psk_identity "SSL *ssl" | ||
| 1235 | .Xc | ||
| 1236 | .El | ||
| 1237 | .Sh SEE ALSO | ||
| 1238 | .Xr openssl 1 , | ||
| 1239 | .Xr crypto 3 , | ||
| 1240 | .Xr d2i_SSL_SESSION 3 , | ||
| 1241 | .Xr SSL_accept 3 , | ||
| 1242 | .Xr SSL_alert_type_string 3 , | ||
| 1243 | .Xr SSL_CIPHER_get_name 3 , | ||
| 1244 | .Xr SSL_clear 3 , | ||
| 1245 | .Xr SSL_COMP_add_compression_method 3 , | ||
| 1246 | .Xr SSL_connect 3 , | ||
| 1247 | .Xr SSL_CTX_add_extra_chain_cert 3 , | ||
| 1248 | .Xr SSL_CTX_add_session 3 , | ||
| 1249 | .Xr SSL_CTX_ctrl 3 , | ||
| 1250 | .Xr SSL_CTX_flush_sessions 3 , | ||
| 1251 | .Xr SSL_CTX_get_ex_new_index 3 , | ||
| 1252 | .Xr SSL_CTX_get_verify_mode 3 , | ||
| 1253 | .Xr SSL_CTX_load_verify_locations 3 , | ||
| 1254 | .Xr SSL_CTX_new 3 , | ||
| 1255 | .Xr SSL_CTX_sess_number 3 , | ||
| 1256 | .Xr SSL_CTX_sess_set_cache_size 3 , | ||
| 1257 | .Xr SSL_CTX_sess_set_get_cb 3 , | ||
| 1258 | .Xr SSL_CTX_sessions 3 , | ||
| 1259 | .Xr SSL_CTX_set_cert_store 3 , | ||
| 1260 | .Xr SSL_CTX_set_cert_verify_callback 3 , | ||
| 1261 | .Xr SSL_CTX_set_cipher_list 3 , | ||
| 1262 | .Xr SSL_CTX_set_client_CA_list 3 , | ||
| 1263 | .Xr SSL_CTX_set_client_cert_cb 3 , | ||
| 1264 | .Xr SSL_CTX_set_default_passwd_cb 3 , | ||
| 1265 | .Xr SSL_CTX_set_generate_session_id 3 , | ||
| 1266 | .Xr SSL_CTX_set_info_callback 3 , | ||
| 1267 | .Xr SSL_CTX_set_max_cert_list 3 , | ||
| 1268 | .Xr SSL_CTX_set_mode 3 , | ||
| 1269 | .Xr SSL_CTX_set_msg_callback 3 , | ||
| 1270 | .Xr SSL_CTX_set_options 3 , | ||
| 1271 | .Xr SSL_CTX_set_psk_client_callback 3 , | ||
| 1272 | .Xr SSL_CTX_set_quiet_shutdown 3 , | ||
| 1273 | .Xr SSL_CTX_set_session_cache_mode 3 , | ||
| 1274 | .Xr SSL_CTX_set_session_id_context 3 , | ||
| 1275 | .Xr SSL_CTX_set_ssl_version 3 , | ||
| 1276 | .Xr SSL_CTX_set_timeout 3 , | ||
| 1277 | .Xr SSL_CTX_set_tmp_dh_callback 3 , | ||
| 1278 | .Xr SSL_CTX_set_tmp_rsa_callback 3 , | ||
| 1279 | .Xr SSL_CTX_set_verify 3 , | ||
| 1280 | .Xr SSL_CTX_use_certificate 3 , | ||
| 1281 | .Xr SSL_CTX_use_psk_identity_hint 3 , | ||
| 1282 | .Xr SSL_do_handshake 3 , | ||
| 1283 | .Xr SSL_get_ciphers 3 , | ||
| 1284 | .Xr SSL_get_client_CA_list 3 , | ||
| 1285 | .Xr SSL_get_default_timeout 3 , | ||
| 1286 | .Xr SSL_get_error 3 , | ||
| 1287 | .Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 , | ||
| 1288 | .Xr SSL_get_ex_new_index 3 , | ||
| 1289 | .Xr SSL_get_fd 3 , | ||
| 1290 | .Xr SSL_get_peer_cert_chain 3 , | ||
| 1291 | .Xr SSL_get_psk_identity 3 , | ||
| 1292 | .Xr SSL_get_rbio 3 , | ||
| 1293 | .Xr SSL_get_session 3 , | ||
| 1294 | .Xr SSL_get_SSL_CTX 3 , | ||
| 1295 | .Xr SSL_get_verify_result 3 , | ||
| 1296 | .Xr SSL_get_version 3 , | ||
| 1297 | .Xr SSL_library_init 3 , | ||
| 1298 | .Xr SSL_load_client_CA_file 3 , | ||
| 1299 | .Xr SSL_new 3 , | ||
| 1300 | .Xr SSL_pending 3 , | ||
| 1301 | .Xr SSL_read 3 , | ||
| 1302 | .Xr SSL_rstate_string 3 , | ||
| 1303 | .Xr SSL_SESSION_free 3 , | ||
| 1304 | .Xr SSL_SESSION_get_ex_new_index 3 , | ||
| 1305 | .Xr SSL_SESSION_get_time 3 , | ||
| 1306 | .Xr SSL_session_reused 3 , | ||
| 1307 | .Xr SSL_set_bio 3 , | ||
| 1308 | .Xr SSL_set_connect_state 3 , | ||
| 1309 | .Xr SSL_set_fd 3 , | ||
| 1310 | .Xr SSL_set_session 3 , | ||
| 1311 | .Xr SSL_set_shutdown 3 , | ||
| 1312 | .Xr SSL_shutdown 3 , | ||
| 1313 | .Xr SSL_state_string 3 , | ||
| 1314 | .Xr SSL_want 3 , | ||
| 1315 | .Xr SSL_write 3 | ||
| 1316 | .Sh HISTORY | ||
| 1317 | The | ||
| 1318 | .Nm | ||
| 1319 | document appeared in OpenSSL 0.9.2. | ||
