TLS_CLIENT(3)
π TLS_CLIENT(3) π
okay bestie, welcome to TLS_CLIENT(3) from the Library Functions Manual β this is the page for setting up a TLS connection and it is lowkey iconic β¨
πΈ NAME πΈ
tls_client, tls_server, tls_configure, tls_reset, tls_free β configure a TLS connection π«Ά
β¨ SYNOPSIS β¨
library βlibtlsβ libssl libcrypto #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 a TLS connection is represented as a struct tls object, and everyone calls it a βcontextβ π A fresh new context gets created by either the tls_client() or tls_server() functions. Use tls_client() in TLS client programs, and tls_server() in TLS server programs. Slay, but make it networking π
Then you can configure that context with tls_configure(). And yes, the same tls_config object can be used to configure multiple contexts β reuse is the vibe β¨
After configuration, tls_connect(3) can be called on objects created with tls_client(), and tls_accept_socket(3) on objects created with tls_server(). iykyk π
After use, a TLS context should be closed with tls_close(3), and then freed by calling tls_free(). Important little detail: if tls_free() is called with an argument of NULL, no action occurs. Literally nothing happens, no drama π«Ά
A TLS context can be reset by calling tls_reset(), allowing for it to be reused. This is essentially equivalent to calling tls_free(), followed by a call to the same function that was used to originally allocate the TLS context. Reset and re-enter, main character energy π
π₯ 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. Thatβs the whole vibe check π₯
π SEE ALSO π
β HISTORY β
These functions appeared in OpenBSD 5.6 and got their final names in OpenBSD 5.7. Glow-up timeline fr fr β¨
π AUTHORS π
Joel Sing <jsing@openbsd.org> β icon behavior π
xoxo, this pageβs source/version is Debian, dated July 7, 2025 β bye bestie ππ«Ά
π¦ where this page comes from
- alpine 3.24: libressl-doc 4.3.1-r0 Β· custom
- arch rolling: libressl 4.4.0-1 Β· ISC AND custom:OpenSSL
- Copyright (c) 2014 Ted Unangst <tedu@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms