mirror of
https://github.com/matrix-construct/construct
synced 2024-11-29 10:12:39 +01:00
ircd::openssl: Add overload to get cipher list from SSL_CTX.
This commit is contained in:
parent
969a15c341
commit
e4fd5111fa
2 changed files with 24 additions and 1 deletions
|
@ -127,7 +127,8 @@ namespace ircd::openssl
|
|||
string_view name(const SSL_CIPHER &);
|
||||
const SSL_CIPHER *current_cipher(const SSL &);
|
||||
string_view shared_ciphers(const mutable_buffer &buf, const SSL &);
|
||||
string_view cipher_list(const SSL &, const int &priority = -1);
|
||||
string_view cipher_list(const SSL &, const int &priority);
|
||||
std::string cipher_list(const SSL_CTX &, const int &priority = 0);
|
||||
void set_cipher_list(SSL &, const std::string &list);
|
||||
void set_cipher_list(SSL_CTX &, const std::string &list);
|
||||
void set_ecdh_auto(SSL_CTX &, const bool & = true);
|
||||
|
|
|
@ -105,6 +105,28 @@ ircd::openssl::set_cipher_list(SSL &ssl,
|
|||
call(::SSL_set_cipher_list, &ssl, list.c_str());
|
||||
}
|
||||
|
||||
std::string
|
||||
ircd::openssl::cipher_list(const SSL_CTX &ctx,
|
||||
const int &priority)
|
||||
{
|
||||
const custom_ptr<SSL> ssl
|
||||
{
|
||||
SSL_new(const_cast<SSL_CTX *>(&ctx)), SSL_free
|
||||
};
|
||||
|
||||
std::stringstream ret;
|
||||
for(int i(priority); priority? i <= priority : true; ++i)
|
||||
{
|
||||
const auto cipher(cipher_list(*ssl, i));
|
||||
if(!empty(cipher))
|
||||
ret << cipher << ':';
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return ret.str();
|
||||
}
|
||||
|
||||
ircd::string_view
|
||||
ircd::openssl::cipher_list(const SSL &ssl,
|
||||
const int &priority)
|
||||
|
|
Loading…
Reference in a new issue