gnutls_init(3)

πŸ’– gnutls_init(3) πŸ’–

okay bestie, welcome to the gnutls manual, section 3 β€” this one's all about gnutls_init, and it's genuinely the glow-up moment where your session gets born ✨


🌸 NAME 🌸

gnutls_init β€” API function. that's it, that's the name, she's serving function energy πŸ’…


✨ SYNOPSIS ✨

#include <gnutls/gnutls.h>

int gnutls_init(gnutls_session_t * session, unsigned int flags);

πŸŽ€ ARGUMENTS πŸŽ€

  • gnutls_session_t * session β€” bestie this is a pointer to a gnutls_session_t type. it's the lil vessel your whole session is about to live in 🫢
  • unsigned int flags β€” these tell us whether this session is gonna be used for a server or a client. yes ma'am, we're picking a lane πŸ’…

πŸ¦‹ DESCRIPTION πŸ¦‹

so this function initializes the provided session. every session must be initialized before use β€” no skipping, no shortcuts, that's the rule β€” and after a successful initialization and use, it must be deinitialized by calling gnutls_deinit(). clean up after yourself, it's giving responsible queen πŸ‘‘

the flags can be any combination of flags from gnutls_init_flags_t. mix and match, go wild, it's your world 🌈

note that since version 3.1.2, this function enables some common TLS extensions such as session tickets and OCSP certificate status request on the client side by default. if you don't want that (fair), use the GNUTLS_NO_DEFAULT_EXTENSIONS flag to shut it down πŸ™ˆ

and now the part that lowkey matters: it is never mandatory to use gnutls_deinit() after this function fails. periodt. since gnutls 3.8.0, it is safe to unconditionally use gnutls_deinit() even after failure β€” regardless of whether the memory was initialized prior to gnutls_init(). icon behavior, honestly πŸ”₯

however, clients wanting to be portable to older versions of the library should either:

  • skip deinitialization on failure, or
  • pre-initialize the memory passed in to gnutls_init() to all zeroes via memset() or similar.

that's the vibe check. old library versions are not it, protect yourself πŸ’€


⭐ RETURNS ⭐

GNUTLS_E_SUCCESS on success, or an error code. that's it. that's the whole mood 🌟


πŸ› REPORTING BUGS πŸ›

found a bug? don't gatekeep, report it:


Copyright Β© 2001-2023 Free Software Foundation, Inc., and others.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved.

(translation: share it, remix it, just keep the receipts, bestie πŸ§ΎπŸ’–)


🌈 SEE ALSO 🌈

The full documentation for gnutls is maintained as a Texinfo manual. If the /usr/share/doc/gnutls/ directory does not contain the HTML form, visit:

https://www.gnutls.org/manual/

go read it, iykyk πŸ“šβœ¨


and that's the whole page, bestie!! πŸŽ€ this was gnutls_init(3) from the gnutls manual, version 3.8.13 β€” mwah, love u, go initialize some sessions responsibly πŸ’œπŸŒΈπŸ¦‹

πŸ“¦ where this page comes from