1TLS_CLIENT(3)            BSD Library Functions Manual            TLS_CLIENT(3)
2

NAME

4     tls_client, tls_server, tls_configure, tls_reset, tls_free — configure a
5     TLS connection
6

SYNOPSIS

8     #include <tls.h>
9
10     struct tls *
11     tls_client(void);
12
13     struct tls *
14     tls_server(void);
15
16     int
17     tls_configure(struct tls *ctx, struct tls_config *config);
18
19     void
20     tls_free(struct tls *ctx);
21
22     void
23     tls_reset(struct tls *ctx);
24

DESCRIPTION

26     A TLS connection is represented as a struct tls object called a
27     “context”.  A new context is created by either the tls_client() or
28     tls_server() functions.  tls_client() is used in TLS client programs,
29     tls_server() in TLS server programs.
30
31     The context can then be configured with the function tls_configure().
32     The same tls_config object can be used to configure multiple contexts.
33
34     After configuration, tls_connect(3) can be called on objects created with
35     tls_client(), and tls_accept_socket(3) on objects created with
36     tls_server().
37
38     After use, a TLS context should be closed with tls_close(3), and then
39     freed by calling tls_free().  If tls_free() is called with an argument of
40     NULL, no action occurs.
41
42     A TLS context can be reset by calling tls_reset(), allowing for it to be
43     reused.  This is essentially equivalent to calling tls_free(), followed
44     by a call to the same function that was used to originally allocate the
45     TLS context.
46

RETURN VALUES

48     tls_client() and tls_server() return NULL on error or an out of memory
49     condition.
50
51     tls_configure() returns 0 on success or -1 on error.
52

SEE ALSO

54     tls_accept_socket(3), tls_config_new(3), tls_connect(3), tls_init(3)
55

HISTORY

57     These functions appeared in OpenBSD 5.6 and got their final names in
58     OpenBSD 5.7.
59

AUTHORS

61     Joel Sing <jsing@openbsd.org>
62
63BSD                             August 12, 2017                            BSD
Impressum