s6-networking
Software
skarnet.org

The stls library interface

General information

libstls is a small support library for the s6-tlsc and s6-tlsd executables when they're built against the LibreSSL backend. You can use it in your own programs, but since libtls is already relatively high-level, it's probably not very useful.

Compiling

Linking

Programming

Running the TLS/SSL engine

int stls_run (struct tls *ctx, int *fds, pid_t pid, unsigned int verbosity, uint32_t options, tain_t const *tto)

This function runs a full-duplex TLS/SSL engine, reading/writing clear text from/to two file descriptors, and writing/reading ciphertext to/from two other file descriptors, until the connection is closed both ways (either with a SSL close, or with EOF) or a given subprocess dies.

stls_run will make the process die with an appropriate error message if it encounters an unrecoverable error. If there were no problems and the SSL/TLS connection closed cleanly, it returns -1. If the application subprocess dies early, stls_run returns the wstat for that subprocess, i.e. the integer containing the information about its exit code or crash signal. No matter how stls_run returns, the first four descriptors in fds are closed, but the selfpipe is untouched and the caller should free ctx itself.

int stls_s6tlsc (char const *const *argv, char const *const *envp, tain_t const *tto, uint32_t preoptions, uint32_t options, uid_t uid, gid_t gid, unsigned int verbosity, char const *servername, int *sfd)

This function implements s6-tlsc on top of LibreSSL. It has no other practical purpose; you're better off directly invoking s6-tlsc.

int stls_s6tlsd (char const *const *argv, char const *const *envp, tain_t const *tto, uint32_t preoptions, uint32_t options, uid_t uid, gid_t gid, unsigned int verbosity)

This function implements s6-tlsd on top of LibreSSL. It has no other practical purpose; you're better off directly invoking s6-tlsd.