SSL_CTX_USE_SERVERINFO(3ossl)
π SSL_CTX_USE_SERVERINFO(3ossl) π
okay bestie, sit down, hydrate, because we're diving into OpenSSL's 3ossl manual for the serverinfo extension functions. no cap, this one is lowkey niche but highkey useful. let's get into it π¦
β¨ NAME β¨
SSL_CTX_use_serverinfo_ex, SSL_CTX_use_serverinfo, SSL_CTX_use_serverinfo_file β the girlies that use the serverinfo extension π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
int SSL_CTX_use_serverinfo_ex(SSL_CTX *ctx, unsigned int version,
const unsigned char *serverinfo,
size_t serverinfo_length);
int SSL_CTX_use_serverinfo(SSL_CTX *ctx, const unsigned char *serverinfo,
size_t serverinfo_length);
int SSL_CTX_use_serverinfo_file(SSL_CTX *ctx, const char *file);
like, literally just include the header and you're in π«Ά
π DESCRIPTION π
So these functions load "serverinfo" TLS extensions into the SSL_CTX. And a "serverinfo" extension? It's what gets returned in response to an empty ClientHello Extension. it's giving β¨reactiveβ¨
SSL_CTX_use_serverinfo_ex() loads one or more serverinfo extensions from a byte array into ctx. The version parameter is the main character here β it specifies the format of the byte array provided in *serverinfo, which is of length serverinfo_length. π
If version is SSL_SERVERINFOV2, then the extensions in the array must consist of:
- a 4-byte context
- a 2-byte Extension Type
- a 2-byte length
- and then
lengthbytes ofextension_data
The context and type values have the same meaning as for SSL_CTX_add_custom_ext(3). And bestie, heads up: if serverinfo is being loaded for extensions to be added to a Certificate message, then the extension will only be added for the first certificate in the message (which is always the end-entity certificate). no bonus certs, periodt. π
If version is SSL_SERVERINFOV1, then the extensions in the array must consist of:
- a 2-byte Extension Type
- a 2-byte length
- and then
lengthbytes ofextension_data
The type value has the same meaning as for SSL_CTX_add_custom_ext(3). The following default context value gets used in this case:
SSL_EXT_TLS1_2_AND_BELOW_ONLY | SSL_EXT_CLIENT_HELLO
| SSL_EXT_TLS1_2_SERVER_HELLO | SSL_EXT_IGNORE_ON_RESUMPTION
SSL_CTX_use_serverinfo() does the exact same thing as SSL_CTX_use_serverinfo_ex() except there's no version parameter, so a default version of SSL_SERVERINFOV1 is used instead. it's the chill, no-args version, we love her π
SSL_CTX_use_serverinfo_file() loads one or more serverinfo extensions from file into ctx. The extensions must be in PEM format. Each extension must be in a format as described above for SSL_CTX_use_serverinfo_ex(). And the naming rules? Each PEM extension name must begin with the phrase:
"BEGIN SERVERINFOV2 FOR "forSSL_SERVERINFOV2data"BEGIN SERVERINFO FOR "forSSL_SERVERINFOV1data
β οΈ bestie this next bit MATTERS. If more than one certificate (RSA/DSA) is installed usingSSL_CTX_use_certificate(), the serverinfo extension will be loaded into the last certificate installed. So if e.g. the last item was an RSA certificate, the loaded serverinfo extension data will be loaded for that certificate. If you want the serverinfo extension for multiple certificates, you have to callSSL_CTX_use_serverinfo()multiple times β once after each time a certificate is loaded via a call toSSL_CTX_use_certificate(). like, one cert, one call. them's the rules π₯
β RETURN VALUES β
On success, the functions return 1. On failure, the functions return 0. And when it fails? go check out the error stack to find out the reason, that's where the tea is π
π SEE ALSO π
π COPYRIGHT π
Copyright 2013-2017 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, bestie π this was OpenSSL 3.5.9, dated 2026-09-29, and it's the SSL_CTX_USE_SERVERINFO(3ossl) manual β slay, you read the whole thing, main character energy fr fr π
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms