SSL_SET1_PARAM(3)

πŸ“¦ version 4.4.0, in alpine 3.24, arch rolling

πŸ’– SSL_SET1_PARAM(3) β€” get & set verification parameters πŸ’–

okay so bestie, this one's from the Library Functions Manual and it's literally all about the little knob-board that controls how TLS verification behaves. let's get into it ✨


πŸŽ€ NAME πŸŽ€

SSL_CTX_get0_param, SSL_get0_param, SSL_CTX_set1_param, SSL_set1_param β€” get and set verification parameters, that's the whole vibe 🫢


✨ SYNOPSIS ✨

she lives in library β€œlibssl” libcrypto, so you're gonna want:

#include <openssl/ssl.h>

then the four little icons themselves:

X509_VERIFY_PARAM *
SSL_CTX_get0_param(SSL_CTX *ctx);

X509_VERIFY_PARAM *
SSL_get0_param(SSL *ssl);

int
SSL_CTX_set1_param(SSL_CTX *ctx, X509_VERIFY_PARAM *vpm);

int
SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm);

🌸 DESCRIPTION 🌸

the getters πŸ’…

SSL_CTX_get0_param() and SSL_get0_param() retrieve an internal pointer to the verification parameters for ctx or ssl, respectively. like, an internal pointer, okay? πŸ‘‘

⚠️ the returned pointer must not be freed by the calling application β€” not yours to yeet, bestie. but the application can modify the parameters pointed to, to suit its needs: for example to add a hostname check. so you get to redecorate, you just can't demolish the building 🏠✨

the setters πŸ¦‹

SSL_CTX_set1_param() and SSL_set1_param() set the verification parameters to vpm for ctx or ssl. straightforward, no notes, ate πŸ’…


⭐ RETURN VALUES ⭐

  • SSL_CTX_get0_param() and SSL_get0_param() return a pointer to an X509_VERIFY_PARAM structure. cute little handoff πŸŽ€
  • SSL_CTX_set1_param() and SSL_set1_param() return 1 for success or 0 for failure. classic 1-or-0 energy, no cap 🫢

🌈 EXAMPLES 🌈

say you wanna check that the hostname matches www.foo.com in the peer certificate β€” iconique behavior, honestly:

X509_VERIFY_PARAM *vpm = SSL_get0_param(ssl);
X509_VERIFY_PARAM_set1_host(vpm, "www.foo.com", 0);

see how we grabbed the internal pointer and just... used it? main character energy fr fr πŸ’œ


πŸ”₯ SEE ALSO πŸ”₯

go read those too, iykyk 🌸


πŸ‘‘ HISTORY πŸ‘‘

  • SSL_CTX_set1_param() and SSL_set1_param() first appeared in OpenSSL 1.0.0 and have been available since OpenBSD 4.9. old money πŸ’€
  • SSL_CTX_get0_param() and SSL_get0_param() first appeared in OpenSSL 1.0.2 and have been available since OpenBSD 6.3. late bloomer but slayed πŸ¦‹

k that's the page!! brought to you by Debian, dated June 8, 2025 β€” go forth and verify those params, bestie, ily, mwah πŸ’–πŸŽ€βœ¨

πŸ“¦ where this page comes from