summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibTLS/TLSv12.cpp
diff options
context:
space:
mode:
authorAnotherTest <ali.mpfard@gmail.com>2021-02-07 07:21:32 +0330
committerAndreas Kling <kling@serenityos.org>2021-04-03 11:22:01 +0200
commit2020176f0f8684e7e832988060116b75e1c8503a (patch)
tree9475ea290e071a3469cbe1be03fb9b348ec5f6f1 /Userland/Libraries/LibTLS/TLSv12.cpp
parentb5f24c84e450d9bfc794a5c656f9bcf17faf6556 (diff)
downloadserenity-2020176f0f8684e7e832988060116b75e1c8503a.zip
LibTLS: Make the TLS connection options user-configurable
The user may now request specific cipher suites, the use of SNI, and whether we should validate certificates (not that we're doing a good job of that).
Diffstat (limited to 'Userland/Libraries/LibTLS/TLSv12.cpp')
-rw-r--r--Userland/Libraries/LibTLS/TLSv12.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/Userland/Libraries/LibTLS/TLSv12.cpp b/Userland/Libraries/LibTLS/TLSv12.cpp
index 7f0abb2e39..3a70aa15bb 100644
--- a/Userland/Libraries/LibTLS/TLSv12.cpp
+++ b/Userland/Libraries/LibTLS/TLSv12.cpp
@@ -737,6 +737,9 @@ void TLSv12::set_root_certificates(Vector<Certificate> certificates)
bool Context::verify_chain() const
{
+ if (!options.validate_certificates)
+ return true;
+
const Vector<Certificate>* local_chain = nullptr;
if (is_server) {
dbgln("Unsupported: Server mode");
@@ -813,10 +816,10 @@ Optional<size_t> TLSv12::verify_chain_and_get_matching_certificate(const StringV
return {};
}
-TLSv12::TLSv12(Core::Object* parent, Version version)
+TLSv12::TLSv12(Core::Object* parent, Options options)
: Core::Socket(Core::Socket::Type::TCP, parent)
{
- m_context.version = version;
+ m_context.options = move(options);
m_context.is_server = false;
m_context.tls_buffer = ByteBuffer::create_uninitialized(0);
#ifdef SOCK_NONBLOCK