summaryrefslogtreecommitdiff
path: root/src/lib/libssl/doc/ssl.3
diff options
context:
space:
mode:
authorbentley <>2014-10-12 09:33:04 +0000
committerbentley <>2014-10-12 09:33:04 +0000
commit82b7f378b6907ab315a6e50322d2a0a8794a0aa9 (patch)
treea5087bf8d016a6041c2b6822fbecfd8f6c5e70b1 /src/lib/libssl/doc/ssl.3
parent0a63f0cf49369e1926567ab62e04e3355cedf0cd (diff)
downloadopenbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.tar.gz
openbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.tar.bz2
openbsd-82b7f378b6907ab315a6e50322d2a0a8794a0aa9.zip
Convert libssl manpages from pod to mdoc(7).
libcrypto has not been started yet. ok schwarze@ miod@
Diffstat (limited to 'src/lib/libssl/doc/ssl.3')
-rw-r--r--src/lib/libssl/doc/ssl.31317
1 files changed, 1317 insertions, 0 deletions
diff --git a/src/lib/libssl/doc/ssl.3 b/src/lib/libssl/doc/ssl.3
new file mode 100644
index 0000000000..901e1fdfc1
--- /dev/null
+++ b/src/lib/libssl/doc/ssl.3
@@ -0,0 +1,1317 @@
1.Dd $Mdocdate: October 12 2014 $
2.Dt SSL 3
3.Os
4.Sh NAME
5.Nm SSL
6.Nd OpenSSL SSL/TLS library
7.Sh SYNOPSIS
8.Sh DESCRIPTION
9The OpenSSL
10.Nm ssl
11library implements the Secure Sockets Layer (SSL v2/v3) and
12Transport Layer Security (TLS v1) protocols.
13It provides a rich API which is documented here.
14.Pp
15At first the library must be initialized; see
16.Xr SSL_library_init 3 .
17.Pp
18Then an
19.Vt SSL_CTX
20object is created as a framework to establish TLS/SSL enabled connections (see
21.Xr SSL_CTX_new 3 ) .
22Various options regarding certificates, algorithms, etc., can be set in this
23object.
24.Pp
25When a network connection has been created, it can be assigned to an
26.Vt SSL
27object.
28After the
29.Vt SSL
30object has been created using
31.Xr SSL_new 3 ,
32.Xr SSL_set_fd 3
33or
34.Xr SSL_set_bio 3
35can be used to associate the network connection with the object.
36.Pp
37Then the TLS/SSL handshake is performed using
38.Xr SSL_accept 3
39or
40.Xr SSL_connect 3
41respectively.
42.Xr SSL_read 3
43and
44.Xr SSL_write 3
45are used to read and write data on the TLS/SSL connection.
46.Xr SSL_shutdown 3
47can be used to shut down the TLS/SSL connection.
48.Sh DATA STRUCTURES
49Currently the OpenSSL
50.Nm ssl
51library functions deals with the following data structures:
52.Bl -tag -width Ds
53.It Vt SSL_METHOD No (SSL Method)
54That's a dispatch structure describing the internal
55.Nm ssl
56library methods/functions which implement the various protocol versions
57(SSLv1, SSLv2 and TLSv1).
58It's needed to create an
59.Vt SSL_CTX .
60.It Vt SSL_CIPHER No (SSL Cipher)
61This structure holds the algorithm information for a particular cipher which
62is a core part of the SSL/TLS protocol.
63The available ciphers are configured on an
64.Vt SSL_CTX
65basis and the actually used ones are then part of the
66.Vt SSL_SESSION .
67.It Vt SSL_CTX No (SSL Context)
68That's the global context structure which is created by a server or client
69once per program lifetime and which holds mainly default values for the
70.Vt SSL
71structures which are later created for the connections.
72.It Vt SSL_SESSION No (SSL Session)
73This is a structure containing the current TLS/SSL session details for a
74connection:
75.Vt SSL_CIPHER Ns s, client and server certificates, keys, etc.
76.It Vt SSL No (SSL Connection)
77That's the main SSL/TLS structure which is created by a server or client per
78established connection.
79This actually is the core structure in the SSL API.
80Under run-time the application usually deals with this structure which has
81links to mostly all other structures.
82.El
83.Sh HEADER FILES
84Currently the OpenSSL
85.Nm ssl
86library provides the following C header files containing the prototypes for the
87data structures and functions:
88.Bl -tag -width Ds
89.It Pa ssl.h
90That's the common header file for the SSL/TLS API.
91Include it into your program to make the API of the
92.Nm ssl
93library available.
94It internally includes both more private SSL headers and headers from the
95.Em crypto
96library.
97Whenever you need hardcore details on the internals of the SSL API, look inside
98this header file.
99.It Pa ssl2.h
100That's the sub header file dealing with the SSLv2 protocol only.
101.Bf Em
102 Usually you don't have to include it explicitly because it's already included
103by
104.Pa ssl.h .
105.Ef
106.It Pa ssl3.h
107That's the sub header file dealing with the SSLv3 protocol only.
108.Bf Em
109Usually you don't have to include it explicitly because it's already included
110by
111.Pa ssl.h .
112.Ef
113.It Pa ssl23.h
114That's the sub header file dealing with the combined use of the SSLv2 and SSLv3
115protocols.
116.Bf Em
117Usually you don't have to include it explicitly because it's already included
118by
119.Pa ssl.h .
120.Ef
121.It Pa tls1.h
122That's the sub header file dealing with the TLSv1 protocol only.
123.Bf Em
124Usually you don't have to include it explicitly because it's already included
125by
126.Pa ssl.h .
127.Ef
128.El
129.Sh API FUNCTIONS
130The functions that the OpenSSL
131.Nm ssl
132library exports are documented below:
133.Ss DEALING WITH PROTOCOL METHODS
134Here we document the various API functions which deal with the SSL/TLS protocol
135methods defined in
136.Vt SSL_METHOD
137structures.
138.Bl -tag -width Ds
139.It Xo
140.Ft const SSL_METHOD *
141.Fn SSLv2_client_method void
142.Xc
143Constructor for the SSLv2
144.Vt SSL_METHOD
145structure for a dedicated client.
146.It Xo
147.Ft const SSL_METHOD *
148.Fn SSLv2_server_method void
149.Xc
150Constructor for the SSLv2
151.Vt SSL_METHOD
152structure for a dedicated server.
153.It Xo
154.Ft const SSL_METHOD *
155.Fn SSLv2_method void
156.Xc
157Constructor for the SSLv2
158.Vt SSL_METHOD
159structure for combined client and server.
160.It Xo
161.Ft const SSL_METHOD *
162.Fn SSLv3_client_method void
163.Xc
164Constructor for the SSLv3
165.Vt SSL_METHOD
166structure for a dedicated client.
167.It Xo
168.Ft const SSL_METHOD *
169.Fn SSLv3_server_method void
170.Xc
171Constructor for the SSLv3
172.Vt SSL_METHOD
173structure for a dedicated server.
174.It Xo
175.Ft const SSL_METHOD *
176.Fn SSLv3_method void
177.Xc
178Constructor for the SSLv3
179.Vt SSL_METHOD
180structure for combined client and server.
181.It Xo
182.Ft const SSL_METHOD *
183.Fn TLSv1_client_method void
184.Xc
185Constructor for the TLSv1
186.Vt SSL_METHOD
187structure for a dedicated client.
188.It Xo
189.Ft const SSL_METHOD *
190.Fn TLSv1_server_method void
191.Xc
192Constructor for the TLSv1
193.Vt SSL_METHOD
194structure for a dedicated server.
195.It Xo
196.Ft const SSL_METHOD *
197.Fn TLSv1_method void
198.Xc
199Constructor for the TLSv1
200.Vt SSL_METHOD
201structure for combined client and server.
202.El
203.Ss DEALING WITH CIPHERS
204Here we document the various API functions which deal with the SSL/TLS ciphers
205defined in
206.Vt SSL_CIPHER
207structures.
208.Bl -tag -width Ds
209.It Xo
210.Ft char *
211.Fn SSL_CIPHER_description "SSL_CIPHER *cipher" "char *buf" "int len"
212.Xc
213Write a string to
214.Fa buf
215(with a maximum size of
216.Fa len )
217containing a human readable description of
218.Fa cipher .
219Returns
220.Fa buf .
221.It Xo
222.Ft int
223.Fn SSL_CIPHER_get_bits "SSL_CIPHER *cipher" "int *alg_bits"
224.Xc
225Determine the number of bits in
226.Fa cipher .
227Because of export crippled ciphers there are two bits:
228the bits the algorithm supports in general (stored to
229.Fa alg_bits )
230and the bits which are actually used (the return value).
231.It Xo
232.Ft const char *
233.Fn SSL_CIPHER_get_name "SSL_CIPHER *cipher"
234.Xc
235Return the internal name of
236.Fa cipher
237as a string.
238These are the various strings defined by the
239.Dv SSL2_TXT_xxx ,
240.Dv SSL3_TXT_xxx
241and
242.Dv TLS1_TXT_xxx
243definitions in the header files.
244.It Xo
245.Ft char *
246.Fn SSL_CIPHER_get_version "SSL_CIPHER *cipher"
247.Xc
248Returns a string like
249Qq TLSv1/SSLv3
250or
251Qq SSLv2
252which indicates the SSL/TLS protocol version to which
253.Fa cipher
254belongs (i.e., where it was defined in the specification the first time).
255.El
256.Ss DEALING WITH PROTOCOL CONTEXTS
257Here we document the various API functions which deal with the SSL/TLS
258protocol context defined in the
259.Vt SSL_CTX
260structure.
261.Bl -tag -width Ds
262.It Xo
263.Ft int
264.Fn SSL_CTX_add_client_CA "SSL_CTX *ctx" "X509 *x"
265.Xc
266.It Xo
267.Ft long
268.Fn SSL_CTX_add_extra_chain_cert "SSL_CTX *ctx" "X509 *x509"
269.Xc
270.It Xo
271.Ft int
272.Fn SSL_CTX_add_session "SSL_CTX *ctx" "SSL_SESSION *c"
273.Xc
274.It Xo
275.Ft int
276.Fn SSL_CTX_check_private_key "const SSL_CTX *ctx"
277.Xc
278.It Xo
279.Ft long
280.Fn SSL_CTX_ctrl "SSL_CTX *ctx" "int cmd" "long larg" "char *parg"
281.Xc
282.It Xo
283.Ft void
284.Fn SSL_CTX_flush_sessions "SSL_CTX *s" "long t"
285.Xc
286.It Xo
287.Ft void
288.Fn SSL_CTX_free "SSL_CTX *a"
289.Xc
290.It Xo
291.Ft char *
292.Fn SSL_CTX_get_app_data "SSL_CTX *ctx"
293.Xc
294.It Xo
295.Ft X509_STORE *
296.Fn SSL_CTX_get_cert_store "SSL_CTX *ctx"
297.Xc
298.It Xo
299.Ft STACK *
300.Fn SSL_CTX_get_client_CA_list "const SSL_CTX *ctx"
301.Xc
302.It Xo
303.Ft int
304.Fn "(*SSL_CTX_get_client_cert_cb(SSL_CTX *ctx))"
305.Fa "SSL *ssl" "X509 **x509" "EVP_PKEY **pkey"
306.Xc
307.It Xo
308.Ft char *
309.Fn SSL_CTX_get_ex_data "const SSL_CTX *s" "int idx"
310.Xc
311.It Xo
312.Ft int
313.Fo SSL_CTX_get_ex_new_index
314.Fa "long argl"
315.Fa "void *argp"
316.Fa "CRYPTO_EX_new *new_func"
317.Fa "CRYPTO_EX_dup *dup_func"
318.Fa "CRYPTO_EX_free *free_func"
319.Fc
320.Xc
321.It Xo
322.Ft void
323.Fo "(*SSL_CTX_get_info_callback(const SSL_CTX *ctx))"
324.Fa "SSL *ssl"
325.Fa "int cb"
326.Fa "int ret"
327.Fc
328.Xc
329.It Xo
330.Ft int
331.Fn SSL_CTX_get_quiet_shutdown "const SSL_CTX *ctx"
332.Xc
333.It Xo
334.Ft int
335.Fn SSL_CTX_get_session_cache_mode "SSL_CTX *ctx"
336.Xc
337.It Xo
338.Ft long
339.Fn SSL_CTX_get_timeout "const SSL_CTX *ctx"
340.Xc
341.It Xo
342.Ft int
343.Fo "(*SSL_CTX_get_verify_callback(const SSL_CTX *ctx))"
344.Fa "int ok"
345.Fa "X509_STORE_CTX *ctx"
346.Fc
347.Xc
348.It Xo
349.Ft int
350.Fn SSL_CTX_get_verify_mode "SSL_CTX *ctx"
351.Xc
352.It Xo
353.Ft int
354.Fn SSL_CTX_load_verify_locations "SSL_CTX *ctx" "char *CAfile" "char *CApath"
355.Xc
356.It Xo
357.Ft long
358.Fn SSL_CTX_need_tmp_RSA "SSL_CTX *ctx"
359.Xc
360.It Xo
361.Ft SSL_CTX *
362.Fn SSL_CTX_new "const SSL_METHOD *meth"
363.Xc
364.It Xo
365.Ft int
366.Fn SSL_CTX_remove_session "SSL_CTX *ctx" "SSL_SESSION *c"
367.Xc
368.It Xo
369.Ft int
370.Fn SSL_CTX_sess_accept "SSL_CTX *ctx"
371.Xc
372.It Xo
373.Ft int
374.Fn SSL_CTX_sess_accept_good "SSL_CTX *ctx"
375.Xc
376.It Xo
377.Ft int
378.Fn SSL_CTX_sess_accept_renegotiate "SSL_CTX *ctx"
379.Xc
380.It Xo
381.Ft int
382.Fn SSL_CTX_sess_cache_full "SSL_CTX *ctx"
383.Xc
384.It Xo
385.Ft int
386.Fn SSL_CTX_sess_cb_hits "SSL_CTX *ctx"
387.Xc
388.It Xo
389.Ft int
390.Fn SSL_CTX_sess_connect "SSL_CTX *ctx"
391.Xc
392.It Xo
393.Ft int
394.Fn SSL_CTX_sess_connect_good "SSL_CTX *ctx"
395.Xc
396.It Xo
397.Ft int
398.Fn SSL_CTX_sess_connect_renegotiate "SSL_CTX *ctx"
399.Xc
400.It Xo
401.Ft int
402.Fn SSL_CTX_sess_get_cache_size "SSL_CTX *ctx"
403.Xc
404.It Xo
405.Ft SSL_SESSION *
406.Fo "(*SSL_CTX_sess_get_get_cb(SSL_CTX *ctx))"
407.Fa "SSL *ssl"
408.Fa "unsigned char *data"
409.Fa "int len"
410.Fa "int *copy"
411.Fc
412.Xc
413.It Xo
414.Ft int
415.Fn "(*SSL_CTX_sess_get_new_cb(SSL_CTX *ctx))" "SSL *ssl" "SSL_SESSION *sess"
416.Xc
417.It Xo
418.Ft void
419.Fo "(*SSL_CTX_sess_get_remove_cb(SSL_CTX *ctx))"
420.Fa "SSL_CTX *ctx"
421.Fa "SSL_SESSION *sess"
422.Fc
423.Xc
424.It Xo
425.Ft int
426.Fn SSL_CTX_sess_hits "SSL_CTX *ctx"
427.Xc
428.It Xo
429.Ft int
430.Fn SSL_CTX_sess_misses "SSL_CTX *ctx"
431.Xc
432.It Xo
433.Ft int
434.Fn SSL_CTX_sess_number "SSL_CTX *ctx"
435.Xc
436.It Xo
437.Ft void
438.Fn SSL_CTX_sess_set_cache_size "SSL_CTX *ctx" "long t"
439.Xc
440.It Xo
441.Ft void
442.Fo SSL_CTX_sess_set_get_cb
443.Fa "SSL_CTX *ctx"
444.Fa "SSL_SESSION *(*cb)(SSL *ssl, unsigned char *data, int len, int *copy)"
445.Fc
446.Xc
447.It Xo
448.Ft void
449.Fo SSL_CTX_sess_set_new_cb
450.Fa "SSL_CTX *ctx"
451.Fa "int (*cb)(SSL *ssl, SSL_SESSION *sess)"
452.Fc
453.Xc
454.It Xo
455.Ft void
456.Fo SSL_CTX_sess_set_remove_cb
457.Fa "SSL_CTX *ctx"
458.Fa "void (*cb)(SSL_CTX *ctx, SSL_SESSION *sess)"
459.Fc
460.Xc
461.It Xo
462.Ft int
463.Fn SSL_CTX_sess_timeouts "SSL_CTX *ctx"
464.Xc
465.It Xo
466.Ft LHASH *
467.Fn SSL_CTX_sessions "SSL_CTX *ctx"
468.Xc
469.It Xo
470.Ft void
471.Fn SSL_CTX_set_app_data "SSL_CTX *ctx" "void *arg"
472.Xc
473.It Xo
474.Ft void
475.Fn SSL_CTX_set_cert_store "SSL_CTX *ctx" "X509_STORE *cs"
476.Xc
477.It Xo
478.Ft void
479.Fn SSL_CTX_set_cert_verify_cb "SSL_CTX *ctx" "int (*cb)()" "char *arg"
480.Xc
481.It Xo
482.Ft int
483.Fn SSL_CTX_set_cipher_list "SSL_CTX *ctx" "char *str"
484.Xc
485.It Xo
486.Ft void
487.Fn SSL_CTX_set_client_CA_list "SSL_CTX *ctx" "STACK *list"
488.Xc
489.It Xo
490.Ft void
491.Fo SSL_CTX_set_client_cert_cb
492.Fa "SSL_CTX *ctx"
493.Fa "int (*cb)(SSL *ssl, X509 **x509, EVP_PKEY **pkey)"
494.Fc
495.Xc
496.It Xo
497.Ft void
498.Fn SSL_CTX_set_default_passwd_cb "SSL_CTX *ctx" "pem_password_cb *cb"
499.Xc
500.It Xo
501.Ft void
502.Fn SSL_CTX_set_default_read_ahead "SSL_CTX *ctx" "int m"
503.Xc
504.It Xo
505.Ft int
506.Fn SSL_CTX_set_default_verify_paths "SSL_CTX *ctx"
507.Xc
508.It Xo
509.Ft int
510.Fn SSL_CTX_set_ex_data "SSL_CTX *s" "int idx" "char *arg"
511.Xc
512.It Xo
513.Ft void
514.Fo SSL_CTX_set_info_callback
515.Fa "SSL_CTX *ctx"
516.Fa "void (*cb)(SSL *ssl, int cb, int ret)"
517.Fc
518.Xc
519.It Xo
520.Ft void
521.Fo SSL_CTX_set_msg_callback
522.Fa "SSL_CTX *ctx"
523.Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \
524size_t len, SSL *ssl, void *arg)"
525.Fc
526.Xc
527.It Xo
528.Ft void
529.Fn SSL_CTX_set_msg_callback_arg "SSL_CTX *ctx" "void *arg"
530.Xc
531.It Xo
532.Ft void
533.Fn SSL_CTX_set_options "SSL_CTX *ctx" "unsigned long op"
534.Xc
535.It Xo
536.Ft void
537.Fn SSL_CTX_set_quiet_shutdown "SSL_CTX *ctx" "int mode"
538.Xc
539.It Xo
540.Ft void
541.Fn SSL_CTX_set_session_cache_mode "SSL_CTX *ctx" "int mode"
542.Xc
543.It Xo
544.Ft int
545.Fn SSL_CTX_set_ssl_version "SSL_CTX *ctx" "const SSL_METHOD *meth"
546.Xc
547.It Xo
548.Ft void
549.Fn SSL_CTX_set_timeout "SSL_CTX *ctx" "long t"
550.Xc
551.It Xo
552.Ft long
553.Fn SSL_CTX_set_tmp_dh "SSL_CTX* ctx" "DH *dh"
554.Xc
555.It Xo
556.Ft long
557.Fn SSL_CTX_set_tmp_dh_callback "SSL_CTX *ctx" "DH *(*cb)(void)"
558.Xc
559.It Xo
560.Ft long
561.Fn SSL_CTX_set_tmp_rsa "SSL_CTX *ctx" "RSA *rsa"
562.Xc
563.It Xo
564.Fn SSL_CTX_set_tmp_rsa_callback
565.Xc
566.Ft long
567.Fo SSL_CTX_set_tmp_rsa_callback
568.Fa "SSL_CTX *ctx"
569.Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)"
570.Fc
571.Pp
572Sets the callback which will be called when a temporary private key is
573required.
574The
575.Fa export
576flag will be set if the reason for needing a temp key is that an export
577ciphersuite is in use, in which case,
578.Fa keylength
579will contain the required keylength in bits.
580.\" XXX using what?
581Generate a key of appropriate size (using ???) and return it.
582.It Xo
583.Fn SSL_set_tmp_rsa_callback
584.Xc
585.Ft long
586.Fo SSL_set_tmp_rsa_callback
587.Fa "SSL *ssl"
588.Fa "RSA *(*cb)(SSL *ssl, int export, int keylength)"
589.Fc
590.Pp
591The same as
592.Fn SSL_CTX_set_tmp_rsa_callback ,
593except it operates on an
594.Vt SSL
595session instead of a context.
596.It Xo
597.Ft void
598.Fn SSL_CTX_set_verify "SSL_CTX *ctx" "int mode" "int (*cb)(void)"
599.Xc
600.It Xo
601.Ft int
602.Fn SSL_CTX_use_PrivateKey "SSL_CTX *ctx" "EVP_PKEY *pkey"
603.Xc
604.It Xo
605.Ft int
606.Fo SSL_CTX_use_PrivateKey_ASN1
607.Fa "int type"
608.Fa "SSL_CTX *ctx"
609.Fa "unsigned char *d"
610.Fa "long len"
611.Fc
612.Xc
613.It Xo
614.Ft int
615.Fn SSL_CTX_use_PrivateKey_file "SSL_CTX *ctx" "char *file" "int type"
616.Xc
617.It Xo
618.Ft int
619.Fn SSL_CTX_use_RSAPrivateKey "SSL_CTX *ctx" "RSA *rsa"
620.Xc
621.It Xo
622.Ft int
623.Fn SSL_CTX_use_RSAPrivateKey_ASN1 "SSL_CTX *ctx" "unsigned char *d" "long len"
624.Xc
625.It Xo
626.Ft int
627.Fn SSL_CTX_use_RSAPrivateKey_file "SSL_CTX *ctx" "char *file" "int type"
628.Xc
629.It Xo
630.Ft int
631.Fn SSL_CTX_use_certificate "SSL_CTX *ctx" "X509 *x"
632.Xc
633.It Xo
634.Ft int
635.Fn SSL_CTX_use_certificate_ASN1 "SSL_CTX *ctx" "int len" "unsigned char *d"
636.Xc
637.It Xo
638.Ft int
639.Fn SSL_CTX_use_certificate_file "SSL_CTX *ctx" "char *file" "int type"
640.Xc
641.It Xo
642.Ft void
643.Fo SSL_CTX_set_psk_client_callback
644.Fa "SSL_CTX *ctx"
645.Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \
646unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)"
647.Fc
648.Xc
649.It Xo
650.Ft int
651.Fn SSL_CTX_use_psk_identity_hint "SSL_CTX *ctx" "const char *hint"
652.Xc
653.It Xo
654.Ft void
655.Fo SSL_CTX_set_psk_server_callback
656.Fa "SSL_CTX *ctx"
657.Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \
658unsigned char *psk, int max_psk_len)"
659.Fc
660.Xc
661.El
662.Ss DEALING WITH SESSIONS
663Here we document the various API functions which deal with the SSL/TLS sessions
664defined in the
665.Vt SSL_SESSION
666structures.
667.Bl -tag -width Ds
668.It Xo
669.Ft int
670.Fn SSL_SESSION_cmp "const SSL_SESSION *a" "const SSL_SESSION *b"
671.Xc
672.It Xo
673.Ft void
674.Fn SSL_SESSION_free "SSL_SESSION *ss"
675.Xc
676.It Xo
677.Ft char *
678.Fn SSL_SESSION_get_app_data "SSL_SESSION *s"
679.Xc
680.It Xo
681.Ft char *
682.Fn SSL_SESSION_get_ex_data "const SSL_SESSION *s" "int idx"
683.Xc
684.It Xo
685.Ft int
686.Fo SSL_SESSION_get_ex_new_index
687.Fa "long argl"
688.Fa "char *argp"
689.Fa "int (*new_func)(void)"
690.Fa "int (*dup_func)(void), void (*free_func)(void)"
691.Fc
692.Xc
693.It Xo
694.Ft long
695.Fn SSL_SESSION_get_time "const SSL_SESSION *s"
696.Xc
697.It Xo
698.Ft long
699.Fn SSL_SESSION_get_timeout "const SSL_SESSION *s"
700.Xc
701.It Xo
702.Ft unsigned long
703.Fn SSL_SESSION_hash "const SSL_SESSION *a"
704.Xc
705.It Xo
706.Ft SSL_SESSION *
707.Fn SSL_SESSION_new void
708.Xc
709.It Xo
710.Ft int
711.Fn SSL_SESSION_print "BIO *bp" "const SSL_SESSION *x"
712.Xc
713.It Xo
714.Ft int
715.Fn SSL_SESSION_print_fp "FILE *fp" "const SSL_SESSION *x"
716.Xc
717.It Xo
718.Ft void
719.Fn SSL_SESSION_set_app_data "SSL_SESSION *s" "char *a"
720.Xc
721.It Xo
722.Ft int
723.Fn SSL_SESSION_set_ex_data "SSL_SESSION *s" "int idx" "char *arg"
724.Xc
725.It Xo
726.Ft long
727.Fn SSL_SESSION_set_time "SSL_SESSION *s" "long t"
728.Xc
729.It Xo
730.Ft long
731.Fn SSL_SESSION_set_timeout "SSL_SESSION *s" "long t"
732.Xc
733.El
734.Ss DEALING WITH CONNECTIONS
735Here we document the various API functions which deal with the SSL/TLS
736connection defined in the
737.Vt SSL
738structure.
739.Bl -tag -width Ds
740.It Xo
741.Ft int
742.Fn SSL_accept "SSL *ssl"
743.Xc
744.It Xo
745.Ft int
746.Fn SSL_add_dir_cert_subjects_to_stack "STACK *stack" "const char *dir"
747.Xc
748.It Xo
749.Ft int
750.Fn SSL_add_file_cert_subjects_to_stack "STACK *stack" "const char *file"
751.Xc
752.It Xo
753.Ft int
754.Fn SSL_add_client_CA "SSL *ssl" "X509 *x"
755.Xc
756.It Xo
757.Ft char *
758.Fn SSL_alert_desc_string "int value"
759.Xc
760.It Xo
761.Ft char *
762.Fn SSL_alert_desc_string_long "int value"
763.Xc
764.It Xo
765.Ft char *
766.Fn SSL_alert_type_string "int value"
767.Xc
768.It Xo
769.Ft char *
770.Fn SSL_alert_type_string_long "int value"
771.Xc
772.It Xo
773.Ft int
774.Fn SSL_check_private_key "const SSL *ssl"
775.Xc
776.It Xo
777.Ft void
778.Fn SSL_clear "SSL *ssl"
779.Xc
780.It Xo
781.Ft long
782.Fn SSL_clear_num_renegotiations "SSL *ssl"
783.Xc
784.It Xo
785.Ft int
786.Fn SSL_connect "SSL *ssl"
787.Xc
788.It Xo
789.Ft void
790.Fn SSL_copy_session_id "SSL *t" "const SSL *f"
791.Xc
792.It Xo
793.Ft long
794.Fn SSL_ctrl "SSL *ssl" "int cmd" "long larg" "char *parg"
795.Xc
796.It Xo
797.Ft int
798.Fn SSL_do_handshake "SSL *ssl"
799.Xc
800.It Xo
801.Ft SSL *
802.Fn SSL_dup "SSL *ssl"
803.Xc
804.It Xo
805.Ft STACK *
806.Fn SSL_dup_CA_list "STACK *sk"
807.Xc
808.It Xo
809.Ft void
810.Fn SSL_free "SSL *ssl"
811.Xc
812.It Xo
813.Ft SSL_CTX *
814.Fn SSL_get_SSL_CTX "const SSL *ssl"
815.Xc
816.It Xo
817.Ft char *
818.Fn SSL_get_app_data "SSL *ssl"
819.Xc
820.It Xo
821.Ft X509 *
822.Fn SSL_get_certificate "const SSL *ssl"
823.Xc
824.It Xo
825.Ft const char *
826.Fn SSL_get_cipher "const SSL *ssl"
827.Xc
828.It Xo
829.Ft int
830.Fn SSL_get_cipher_bits "const SSL *ssl" "int *alg_bits"
831.Xc
832.It Xo
833.Ft char *
834.Fn SSL_get_cipher_list "const SSL *ssl" "int n"
835.Xc
836.It Xo
837.Ft char *
838.Fn SSL_get_cipher_name "const SSL *ssl"
839.Xc
840.It Xo
841.Ft char *
842.Fn SSL_get_cipher_version "const SSL *ssl"
843.Xc
844.It Xo
845.Ft STACK *
846.Fn SSL_get_ciphers "const SSL *ssl"
847.Xc
848.It Xo
849.Ft STACK *
850.Fn SSL_get_client_CA_list "const SSL *ssl"
851.Xc
852.It Xo
853.Ft SSL_CIPHER *
854.Fn SSL_get_current_cipher "SSL *ssl"
855.Xc
856.It Xo
857.Ft long
858.Fn SSL_get_default_timeout "const SSL *ssl"
859.Xc
860.It Xo
861.Ft int
862.Fn SSL_get_error "const SSL *ssl" "int i"
863.Xc
864.It Xo
865.Ft char *
866.Fn SSL_get_ex_data "const SSL *ssl" "int idx"
867.Xc
868.It Xo
869.Ft int
870.Fn SSL_get_ex_data_X509_STORE_CTX_idx void
871.Xc
872.It Xo
873.Ft int
874.Fo SSL_get_ex_new_index
875.Fa "long argl"
876.Fa "char *argp"
877.Fa "int (*new_func)(void)"
878.Fa "int (*dup_func)(void)"
879.Fa "void (*free_func)(void)"
880.Fc
881.Xc
882.It Xo
883.Ft int
884.Fn SSL_get_fd "const SSL *ssl"
885.Xc
886.It Xo
887.Ft void
888.Fn "(*SSL_get_info_callback(const SSL *ssl))"
889.Xc
890.It Xo
891.Ft STACK *
892.Fn SSL_get_peer_cert_chain "const SSL *ssl"
893.Xc
894.It Xo
895.Ft X509 *
896.Fn SSL_get_peer_certificate "const SSL *ssl"
897.Xc
898.It Xo
899.Ft EVP_PKEY *
900.Fn SSL_get_privatekey "SSL *ssl"
901.Xc
902.It Xo
903.Ft int
904.Fn SSL_get_quiet_shutdown "const SSL *ssl"
905.Xc
906.It Xo
907.Ft BIO *
908.Fn SSL_get_rbio "const SSL *ssl"
909.Xc
910.It Xo
911.Ft int
912.Fn SSL_get_read_ahead "const SSL *ssl"
913.Xc
914.It Xo
915.Ft SSL_SESSION *
916.Fn SSL_get_session "const SSL *ssl"
917.Xc
918.It Xo
919.Ft char *
920.Fn SSL_get_shared_ciphers "const SSL *ssl" "char *buf" "int len"
921.Xc
922.It Xo
923.Ft int
924.Fn SSL_get_shutdown "const SSL *ssl"
925.Xc
926.It Xo
927.Ft const SSL_METHOD *
928.Fn SSL_get_ssl_method "SSL *ssl"
929.Xc
930.It Xo
931.Ft int
932.Fn SSL_get_state "const SSL *ssl"
933.Xc
934.It Xo
935.Ft long
936.Fn SSL_get_time "const SSL *ssl"
937.Xc
938.It Xo
939.Ft long
940.Fn SSL_get_timeout "const SSL *ssl"
941.Xc
942.It Xo
943.Ft int
944.Fn "(*SSL_get_verify_callback(const SSL *ssl))" int "X509_STORE_CTX *"
945.Xc
946.It Xo
947.Ft int
948.Fn SSL_get_verify_mode "const SSL *ssl"
949.Xc
950.It Xo
951.Ft long
952.Fn SSL_get_verify_result "const SSL *ssl"
953.Xc
954.It Xo
955.Ft char *
956.Fn SSL_get_version "const SSL *ssl"
957.Xc
958.It Xo
959.Ft BIO *
960.Fn SSL_get_wbio "const SSL *ssl"
961.Xc
962.It Xo
963.Ft int
964.Fn SSL_in_accept_init "SSL *ssl"
965.Xc
966.It Xo
967.Ft int
968.Fn SSL_in_before "SSL *ssl"
969.Xc
970.It Xo
971.Ft int
972.Fn SSL_in_connect_init "SSL *ssl"
973.Xc
974.It Xo
975.Ft int
976.Fn SSL_in_init "SSL *ssl"
977.Xc
978.It Xo
979.Ft int
980.Fn SSL_is_init_finished "SSL *ssl"
981.Xc
982.It Xo
983.Ft STACK *
984.Fn SSL_load_client_CA_file "char *file"
985.Xc
986.It Xo
987.Ft void
988.Fn SSL_load_error_strings "void"
989.Xc
990.It Xo
991.Ft SSL *
992.Fn SSL_new "SSL_CTX *ctx"
993.Xc
994.It Xo
995.Ft long
996.Fn SSL_num_renegotiations "SSL *ssl"
997.Xc
998.It Xo
999.Ft int
1000.Fn SSL_peek "SSL *ssl" "void *buf" "int num"
1001.Xc
1002.It Xo
1003.Ft int
1004.Fn SSL_pending "const SSL *ssl"
1005.Xc
1006.It Xo
1007.Ft int
1008.Fn SSL_read "SSL *ssl" "void *buf" "int num"
1009.Xc
1010.It Xo
1011.Ft int
1012.Fn SSL_renegotiate "SSL *ssl"
1013.Xc
1014.It Xo
1015.Ft char *
1016.Fn SSL_rstate_string "SSL *ssl"
1017.Xc
1018.It Xo
1019.Ft char *
1020.Fn SSL_rstate_string_long "SSL *ssl"
1021.Xc
1022.It Xo
1023.Ft long
1024.Fn SSL_session_reused "SSL *ssl"
1025.Xc
1026.It Xo
1027.Ft void
1028.Fn SSL_set_accept_state "SSL *ssl"
1029.Xc
1030.It Xo
1031.Ft void
1032.Fn SSL_set_app_data "SSL *ssl" "char *arg"
1033.Xc
1034.It Xo
1035.Ft void
1036.Fn SSL_set_bio "SSL *ssl" "BIO *rbio" "BIO *wbio"
1037.Xc
1038.It Xo
1039.Ft int
1040.Fn SSL_set_cipher_list "SSL *ssl" "char *str"
1041.Xc
1042.It Xo
1043.Ft void
1044.Fn SSL_set_client_CA_list "SSL *ssl" "STACK *list"
1045.Xc
1046.It Xo
1047.Ft void
1048.Fn SSL_set_connect_state "SSL *ssl"
1049.Xc
1050.It Xo
1051.Ft int
1052.Fn SSL_set_ex_data "SSL *ssl" "int idx" "char *arg"
1053.Xc
1054.It Xo
1055.Ft int
1056.Fn SSL_set_fd "SSL *ssl" "int fd"
1057.Xc
1058.It Xo
1059.Ft void
1060.Fn SSL_set_info_callback "SSL *ssl" "void (*cb)(void)"
1061.Xc
1062.It Xo
1063.Ft void
1064.Fo SSL_set_msg_callback
1065.Fa "SSL *ctx"
1066.Fa "void (*cb)(int write_p, int version, int content_type, const void *buf, \
1067size_t len, SSL *ssl, void *arg)"
1068.Fc
1069.Xc
1070.It Xo
1071.Ft void
1072.Fn SSL_set_msg_callback_arg "SSL *ctx" "void *arg"
1073.Xc
1074.It Xo
1075.Ft void
1076.Fn SSL_set_options "SSL *ssl" "unsigned long op"
1077.Xc
1078.It Xo
1079.Ft void
1080.Fn SSL_set_quiet_shutdown "SSL *ssl" "int mode"
1081.Xc
1082.It Xo
1083.Ft void
1084.Fn SSL_set_read_ahead "SSL *ssl" "int yes"
1085.Xc
1086.It Xo
1087.Ft int
1088.Fn SSL_set_rfd "SSL *ssl" "int fd"
1089.Xc
1090.It Xo
1091.Ft int
1092.Fn SSL_set_session "SSL *ssl" "SSL_SESSION *session"
1093.Xc
1094.It Xo
1095.Ft void
1096.Fn SSL_set_shutdown "SSL *ssl" "int mode"
1097.Xc
1098.It Xo
1099.Ft int
1100.Fn SSL_set_ssl_method "SSL *ssl" "const SSL_METHOD *meth"
1101.Xc
1102.It Xo
1103.Ft void
1104.Fn SSL_set_time "SSL *ssl" "long t"
1105.Xc
1106.It Xo
1107.Ft void
1108.Fn SSL_set_timeout "SSL *ssl" "long t"
1109.Xc
1110.It Xo
1111.Ft void
1112.Fn SSL_set_verify "SSL *ssl" "int mode" "int (*callback)(void)"
1113.Xc
1114.It Xo
1115.Ft void
1116.Fn SSL_set_verify_result "SSL *ssl" "long arg"
1117.Xc
1118.It Xo
1119.Ft int
1120.Fn SSL_set_wfd "SSL *ssl" "int fd"
1121.Xc
1122.It Xo
1123.Ft int
1124.Fn SSL_shutdown "SSL *ssl"
1125.Xc
1126.It Xo
1127.Ft int
1128.Fn SSL_state "const SSL *ssl"
1129.Xc
1130.It Xo
1131.Ft char *
1132.Fn SSL_state_string "const SSL *ssl"
1133.Xc
1134.It Xo
1135.Ft char *
1136.Fn SSL_state_string_long "const SSL *ssl"
1137.Xc
1138.It Xo
1139.Ft long
1140.Fn SSL_total_renegotiations "SSL *ssl"
1141.Xc
1142.It Xo
1143.Ft int
1144.Fn SSL_use_PrivateKey "SSL *ssl" "EVP_PKEY *pkey"
1145.Xc
1146.It Xo
1147.Ft int
1148.Fn SSL_use_PrivateKey_ASN1 "int type" "SSL *ssl" "unsigned char *d" "long len"
1149.Xc
1150.It Xo
1151.Ft int
1152.Fn SSL_use_PrivateKey_file "SSL *ssl" "char *file" "int type"
1153.Xc
1154.It Xo
1155.Ft int
1156.Fn SSL_use_RSAPrivateKey "SSL *ssl" "RSA *rsa"
1157.Xc
1158.It Xo
1159.Ft int
1160.Fn SSL_use_RSAPrivateKey_ASN1 "SSL *ssl" "unsigned char *d" "long len"
1161.Xc
1162.It Xo
1163.Ft int
1164.Fn SSL_use_RSAPrivateKey_file "SSL *ssl" "char *file" "int type"
1165.Xc
1166.It Xo
1167.Ft int
1168.Fn SSL_use_certificate "SSL *ssl" "X509 *x"
1169.Xc
1170.It Xo
1171.Ft int
1172.Fn SSL_use_certificate_ASN1 "SSL *ssl" "int len" "unsigned char *d"
1173.Xc
1174.It Xo
1175.Ft int
1176.Fn SSL_use_certificate_file "SSL *ssl" "char *file" "int type"
1177.Xc
1178.It Xo
1179.Ft int
1180.Fn SSL_version "const SSL *ssl"
1181.Xc
1182.It Xo
1183.Ft int
1184.Fn SSL_want "const SSL *ssl"
1185.Xc
1186.It Xo
1187.Ft int
1188.Fn SSL_want_nothing "const SSL *ssl"
1189.Xc
1190.It Xo
1191.Ft int
1192.Fn SSL_want_read "const SSL *ssl"
1193.Xc
1194.It Xo
1195.Ft int
1196.Fn SSL_want_write "const SSL *ssl"
1197.Xc
1198.It Xo
1199.Ft int
1200.Fn SSL_want_x509_lookup "const SSL *ssl"
1201.Xc
1202.It Xo
1203.Ft int
1204.Fn SSL_write "SSL *ssl" "const void *buf" "int num"
1205.Xc
1206.It Xo
1207.Ft void
1208.Fo SSL_set_psk_client_callback
1209.Fa "SSL *ssl"
1210.Fa "unsigned int (*callback)(SSL *ssl, const char *hint, char *identity, \
1211unsigned int max_identity_len, unsigned char *psk, unsigned int max_psk_len)"
1212.Fc
1213.Xc
1214.It Xo
1215.Ft int
1216.Fn SSL_use_psk_identity_hint "SSL *ssl" "const char *hint"
1217.Xc
1218.It Xo
1219.Ft void
1220.Fo SSL_set_psk_server_callback
1221.Fa "SSL *ssl"
1222.Fa "unsigned int (*callback)(SSL *ssl, const char *identity, \
1223unsigned char *psk, int max_psk_len)"
1224.Fc
1225.Xc
1226.It Xo
1227.Ft const char *
1228.Fn SSL_get_psk_identity_hint "SSL *ssl"
1229.Xc
1230.It Xo
1231.Ft const char *
1232.Fn SSL_get_psk_identity "SSL *ssl"
1233.Xc
1234.El
1235.Sh SEE ALSO
1236.Xr openssl 1 ,
1237.Xr crypto 3 ,
1238.Xr d2i_SSL_SESSION 3 ,
1239.Xr SSL_accept 3 ,
1240.Xr SSL_alert_type_string 3 ,
1241.Xr SSL_CIPHER_get_name 3 ,
1242.Xr SSL_clear 3 ,
1243.Xr SSL_COMP_add_compression_method 3 ,
1244.Xr SSL_connect 3 ,
1245.Xr SSL_CTX_add_extra_chain_cert 3 ,
1246.Xr SSL_CTX_add_session 3 ,
1247.Xr SSL_CTX_ctrl 3 ,
1248.Xr SSL_CTX_flush_sessions 3 ,
1249.Xr SSL_CTX_get_ex_new_index 3 ,
1250.Xr SSL_CTX_get_verify_mode 3 ,
1251.Xr SSL_CTX_load_verify_locations 3 ,
1252.Xr SSL_CTX_new 3 ,
1253.Xr SSL_CTX_sess_number 3 ,
1254.Xr SSL_CTX_sess_set_cache_size 3 ,
1255.Xr SSL_CTX_sess_set_get_cb 3 ,
1256.Xr SSL_CTX_sessions 3 ,
1257.Xr SSL_CTX_set_cert_store 3 ,
1258.Xr SSL_CTX_set_cert_verify_callback 3 ,
1259.Xr SSL_CTX_set_cipher_list 3 ,
1260.Xr SSL_CTX_set_client_CA_list 3 ,
1261.Xr SSL_CTX_set_client_cert_cb 3 ,
1262.Xr SSL_CTX_set_default_passwd_cb 3 ,
1263.Xr SSL_CTX_set_generate_session_id 3 ,
1264.Xr SSL_CTX_set_info_callback 3 ,
1265.Xr SSL_CTX_set_max_cert_list 3 ,
1266.Xr SSL_CTX_set_mode 3 ,
1267.Xr SSL_CTX_set_msg_callback 3 ,
1268.Xr SSL_CTX_set_options 3 ,
1269.Xr SSL_CTX_set_psk_client_callback 3 ,
1270.Xr SSL_CTX_set_quiet_shutdown 3 ,
1271.Xr SSL_CTX_set_session_cache_mode 3 ,
1272.Xr SSL_CTX_set_session_id_context 3 ,
1273.Xr SSL_CTX_set_ssl_version 3 ,
1274.Xr SSL_CTX_set_timeout 3 ,
1275.Xr SSL_CTX_set_tmp_dh_callback 3 ,
1276.Xr SSL_CTX_set_tmp_rsa_callback 3 ,
1277.Xr SSL_CTX_set_verify 3 ,
1278.Xr SSL_CTX_use_certificate 3 ,
1279.Xr SSL_CTX_use_psk_identity_hint 3 ,
1280.Xr SSL_do_handshake 3 ,
1281.Xr SSL_get_ciphers 3 ,
1282.Xr SSL_get_client_CA_list 3 ,
1283.Xr SSL_get_default_timeout 3 ,
1284.Xr SSL_get_error 3 ,
1285.Xr SSL_get_ex_data_X509_STORE_CTX_idx 3 ,
1286.Xr SSL_get_ex_new_index 3 ,
1287.Xr SSL_get_fd 3 ,
1288.Xr SSL_get_peer_cert_chain 3 ,
1289.Xr SSL_get_psk_identity 3 ,
1290.Xr SSL_get_rbio 3 ,
1291.Xr SSL_get_session 3 ,
1292.Xr SSL_get_SSL_CTX 3 ,
1293.Xr SSL_get_verify_result 3 ,
1294.Xr SSL_get_version 3 ,
1295.Xr SSL_library_init 3 ,
1296.Xr SSL_load_client_CA_file 3 ,
1297.Xr SSL_new 3 ,
1298.Xr SSL_pending 3 ,
1299.Xr SSL_read 3 ,
1300.Xr SSL_rstate_string 3 ,
1301.Xr SSL_SESSION_free 3 ,
1302.Xr SSL_SESSION_get_ex_new_index 3 ,
1303.Xr SSL_SESSION_get_time 3 ,
1304.Xr SSL_session_reused 3 ,
1305.Xr SSL_set_bio 3 ,
1306.Xr SSL_set_connect_state 3 ,
1307.Xr SSL_set_fd 3 ,
1308.Xr SSL_set_session 3 ,
1309.Xr SSL_set_shutdown 3 ,
1310.Xr SSL_shutdown 3 ,
1311.Xr SSL_state_string 3 ,
1312.Xr SSL_want 3 ,
1313.Xr SSL_write 3
1314.Sh HISTORY
1315The
1316.Xr ssl 3
1317document appeared in OpenSSL 0.9.2.