TLS_CONFIG_PREFER_CIPHERS_CLIENT(3ssl)

πŸ“¦ version 4.1.0, in opensuse-leap 16.0

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

ok so bestie, this is a page from the Library Functions Manual, section 3, and it's all about telling TLS which protocols and ciphers are allowed to show up to the party. no cap, it's giving bouncer-at-the-club energy and honestly? iconic. πŸŽ€


✨ NAME ✨

tls_config_set_protocols, tls_config_parse_protocols, tls_config_set_alpn, tls_config_set_ciphers, tls_config_set_dheparams, tls_config_set_ecdhecurves, tls_config_prefer_ciphers_client, tls_config_prefer_ciphers_server β€” TLS protocol and cipher selection πŸ¦‹


✨ SYNOPSIS ✨

#include <tls.h>

int
tls_config_set_protocols(struct tls_config *config, uint32_t protocols);

int
tls_config_parse_protocols(uint32_t *protocols, const char *protostr);

int
tls_config_set_alpn(struct tls_config *config, const char *alpn);

int
tls_config_set_ciphers(struct tls_config *config, const char *ciphers);

int
tls_config_set_dheparams(struct tls_config *config, const char *params);

int
tls_config_set_ecdhecurves(struct tls_config *config,
    const char *curves);

void
tls_config_prefer_ciphers_client(struct tls_config *config);

void
tls_config_prefer_ciphers_server(struct tls_config *config);

✨ DESCRIPTION ✨

so these functions all do the same cute little thing: they tweak a configuration by setting parameters. 🫢 and unless it literally says otherwise, the options apply to both clients and servers. equal opportunity config, we love to see it.

tls_config_set_protocols()

this one picks which versions of the TLS protocol are even allowed to be used. the possible values are the bitwise OR of:

  • TLS_PROTOCOL_TLSv1_2
  • TLS_PROTOCOL_TLSv1_3

plus, you can also use these extra special values: TLS_PROTOCOL_TLSv1 (which is TLSv1.2, TLSv1.3), TLS_PROTOCOLS_ALL (literally all supported protocols) and TLS_PROTOCOLS_DEFAULT (TLSv1.2 and TLSv1.3). ✨

tls_config_parse_protocols()

this is the utility function bestie πŸ’… it takes a protocol string, parses it, and hands you back the corresponding value through the protocols argument. then you can pass that value straight into tls_config_set_protocols(). the protocol string is a comma or colon separated list of keywords. the valid keywords are:

  • tlsv1.2
  • tlsv1.3
  • all (all supported protocols)
  • default (an alias for secure)
  • legacy (an alias for all)
  • secure (currently TLSv1.2 and TLSv1.3)

and here's the plot twist 😭 β€” if a value has a negative prefix (in the form of a leading exclamation mark), then it gets removed from the list of available protocols instead of being added to it. subtraction era fr fr.

tls_config_set_alpn()

sets the ALPN protocols that are supported. the alpn string is a comma separated list of protocols, given in order of preference. ranking them, as one does. πŸ‘‘

tls_config_set_ciphers()

sets the list of ciphers that may be used. cipher lists are specified by name, and the permitted names are:

  • secure (or alias default)
  • compat
  • legacy
  • insecure (or alias all)

alternatively, you can specify libssl cipher strings instead. see the CIPHERS section of openssl(1) for further information. iykyk 🌸

tls_config_set_dheparams()

this one specifies the parameters that get used during Diffie-Hellman Ephemeral (DHE) key exchange. possible values are:

  • none
  • auto
  • legacy

in auto mode, the key size for the ephemeral key is automatically selected based on the size of the private key being used for signing. in legacy mode, 1024 bit ephemeral keys are used. and the default value is none, which disables DHE key exchange. 🧚

tls_config_set_ecdhecurves()

specifies the names of the elliptic curves that may be used during Elliptic Curve Diffie-Hellman Ephemeral (ECDHE) key exchange. this is a comma separated list, given in order of preference. the special value of "default" will use the default curves (currently X25519, P-256 and P-384). also, heads up: this function replaces tls_config_set_ecdhecurve(), which is deprecated. πŸ’€

tls_config_prefer_ciphers_client()

prefers ciphers in the client's cipher list when selecting a cipher suite β€” server only. and ngl, this is considered to be less secure than preferring the server's list. so, caution bestie. πŸ™ˆ

tls_config_prefer_ciphers_server()

prefers ciphers in the server's cipher list when selecting a cipher suite β€” server only. this is considered to be more secure than preferring the client's list, and it's the default. main character energy, honestly. πŸ‘‘


✨ RETURN VALUES ✨

these functions return 0 on success or -1 on error. that's it, that's the vibe check. βœ…


✨ SEE ALSO ✨

tls_config_ocsp_require_stapling(3), tls_config_set_session_id(3), tls_config_verify(3), tls_init(3), tls_load_file(3)


✨ HISTORY ✨

tls_config_set_ciphers() appeared in OpenBSD 5.6 and got its final name in OpenBSD 5.7. glow-up complete. 🌈

tls_config_set_protocols(), tls_config_parse_protocols(), tls_config_set_dheparams(), and tls_config_set_ecdhecurve() appeared in OpenBSD 5.7, tls_config_prefer_ciphers_client() and tls_config_prefer_ciphers_server() in OpenBSD 5.9, and tls_config_set_alpn() in OpenBSD 6.1.


✨ AUTHORS ✨

Joel Sing <jsing@openbsd.org> with contributions from Ted Unangst <tedu@openbsd.org> (tls_config_set_ciphers()) and Reyk Floeter <reyk@openbsd.org> (tls_config_set_ecdhecurve()) πŸ’œ


ok that's the whole page bestie, every single flag and value accounted for, no facts harmed in the making of this rewrite 🫢

and that's a wrap!! this one came from Debian, dated July 2, 2023 β€” TLS_CONFIG_SET_PROTOCOLS(3), slay, periodt. πŸ’…βœ¨πŸŽ€

πŸ“¦ where this page comes from