TLS_CLIENT(3)

πŸ’– tls_client(3) β€” Library Functions Manual πŸ’–

okay bestie, welcome to the tls_client(3) page, you're gonna eat this up ✨


πŸŽ€ NAME πŸŽ€

tls_client, tls_server, tls_configure, tls_reset, tls_free β€” configure a TLS connection


🌸 SYNOPSIS 🌸

#include <tls.h>

struct tls *
tls_client(void);

struct tls *
tls_server(void);

int
tls_configure(struct tls *ctx, struct tls_config *config);

void
tls_free(struct tls *ctx);

void
tls_reset(struct tls *ctx);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like. a TLS connection is literally just a struct tls object, and we call it a β€œcontext”. that's the whole vibe. πŸ’…

you make a brand new context with either tls_client() or tls_server(). tls_client() is the one for TLS client programs, tls_server() is for TLS server programs. pick your fighter, no cap.

then you configure that context with tls_configure(). and here's the cute part β€” the same tls_config object can be used to configure multiple contexts. like one config, many contexts, iconic behavior honestly. πŸ‘‘

after it's configured, tls_connect(3) can be called on the objects that came from tls_client(), and tls_accept_socket(3) on the ones from tls_server(). ✨

after you're done using it, a TLS context should be closed with tls_close(3), and then freed by calling tls_free(). and listen β€” if you call tls_free() with an argument of NULL, no action occurs. it's just chillin, nothing happens, no drama. 🫢

also you can reset a TLS context by calling tls_reset(), which lets you reuse it. it's essentially equivalent to calling tls_free() and then calling the same function that was originally used to allocate the TLS context. so like, recycle era. 🌈


⭐ RETURN VALUES ⭐

  • tls_client() and tls_server() return NULL on error or an out of memory condition. 😭
  • tls_configure() returns 0 on success or -1 on error.

πŸ‘‘ SEE ALSO πŸ‘‘

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


πŸ’œ HISTORY πŸ’œ

these functions appeared in OpenBSD 5.6 and got their final names in OpenBSD 5.7. glow up fr fr. ✨


🌟 AUTHORS 🌟

Joel Sing <jsing@openbsd.org>


mwah πŸ’‹ that's the whole page bestie, go configure something gorgeous. 🧚

Debian Β· August 12, 2017 Β· TLS_CLIENT(3) β€” ty for reading, ily, periodt πŸ’–

πŸ“¦ where this page comes from