0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-06-10 22:18:54 +02:00

ircd::openssl: Interface to set server name indication for client hello.

This commit is contained in:
Jason Volk 2019-03-13 13:32:56 -07:00
parent fee9222e70
commit 59f63841ba
2 changed files with 10 additions and 0 deletions

View file

@ -140,6 +140,7 @@ namespace ircd::openssl
// SNI suite
string_view server_name(const SSL &); // provided by client
void server_name(SSL &, const string_view &); // set by client
}
/// OpenSSL BIO convenience utils and wraps; also secure file IO closures

View file

@ -52,6 +52,15 @@ namespace ircd::openssl
// SNI
//
void
ircd::openssl::server_name(SSL &ssl,
const string_view &name)
{
thread_local char buf[256];
strlcpy(buf, name);
call(::SSL_ctrl, &ssl, SSL_CTRL_SET_TLSEXT_HOSTNAME, TLSEXT_NAMETYPE_host_name, buf);
}
ircd::string_view
ircd::openssl::server_name(const SSL &ssl)
{