1gnutls_init(3) gnutls gnutls_init(3)
2
3
4
6 gnutls_init - API function
7
9 #include <gnutls/gnutls.h>
10
11 int gnutls_init(gnutls_session_t * session, unsigned int flags);
12
14 gnutls_session_t * session
15 is a pointer to a gnutls_session_t type.
16
17 unsigned int flags
18 indicate if this session is to be used for server or
19 client.
20
22 This function initializes the provided session. Every session must be
23 initialized before use, and after successful initialization and use
24 must be deinitialized by calling gnutls_deinit().
25
26 flags can be any combination of flags from gnutls_init_flags_t.
27
28 Note that since version 3.1.2 this function enables some common TLS ex‐
29 tensions such as session tickets and OCSP certificate status request in
30 client side by default. To prevent that use the GNUTLS_NO_DEFAULT_EX‐
31 TENSIONS flag.
32
33 Note that it is never mandatory to use gnutls_deinit() after this func‐
34 tion fails. Since gnutls 3.8.0, it is safe to unconditionally use
35 gnutls_deinit() even after failure regardless of whether the memory was
36 initialized prior to gnutls_init(); however, clients wanting to be por‐
37 table to older versions of the library should either skip deinitializa‐
38 tion on failure, or pre-initialize the memory passed in to
39 gnutls_init() to all zeroes via memset() or similar.
40
42 GNUTLS_E_SUCCESS on success, or an error code.
43
45 Report bugs to <bugs@gnutls.org>.
46 Home page: https://www.gnutls.org
47
48
50 Copyright © 2001-2023 Free Software Foundation, Inc., and others.
51 Copying and distribution of this file, with or without modification,
52 are permitted in any medium without royalty provided the copyright no‐
53 tice and this notice are preserved.
54
56 The full documentation for gnutls is maintained as a Texinfo manual.
57 If the /usr/share/doc/gnutls/ directory does not contain the HTML form
58 visit
59
60 https://www.gnutls.org/manual/
61
62gnutls 3.8.2 gnutls_init(3)