From de0c264f425311abaf91aa461d53d91a1aac6072 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Mon, 31 Jan 2022 20:20:40 +0100 Subject: [PATCH 2/3] archlinux-compat: Remove unused mbedTLS code from libcurl usage --- lib/libimhex/source/helpers/net.cpp | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/lib/libimhex/source/helpers/net.cpp b/lib/libimhex/source/helpers/net.cpp index af86328..9a1362e 100644 --- a/lib/libimhex/source/helpers/net.cpp +++ b/lib/libimhex/source/helpers/net.cpp @@ -7,8 +7,6 @@ #include #include -#include - #include #include @@ -50,20 +48,6 @@ namespace hex { return fwrite(contents, size, nmemb, file); } - static CURLcode sslCtxFunction(CURL *ctx, void *sslctx, void *userdata) { - auto *cfg = static_cast(sslctx); - - static mbedtls_x509_crt crt; - mbedtls_x509_crt_init(&crt); - - auto cacert = romfs::get("cacert.pem").string(); - mbedtls_x509_crt_parse(&crt, reinterpret_cast(cacert.data()), cacert.size()); - - mbedtls_ssl_conf_ca_chain(cfg, &crt, nullptr); - - return CURLE_OK; - } - int progressCallback(void *contents, curl_off_t dlTotal, curl_off_t dlNow, curl_off_t ulTotal, curl_off_t ulNow) { auto &net = *static_cast(contents); @@ -109,13 +93,6 @@ namespace hex { curl_easy_setopt(this->m_ctx, CURLOPT_XFERINFOFUNCTION, progressCallback); curl_easy_setopt(this->m_ctx, CURLOPT_NOSIGNAL, 1L); curl_easy_setopt(this->m_ctx, CURLOPT_NOPROGRESS, 0L); - - #if defined(OS_WINDOWS) - curl_easy_setopt(this->m_ctx, CURLOPT_CAINFO, nullptr); - curl_easy_setopt(this->m_ctx, CURLOPT_CAPATH, nullptr); - curl_easy_setopt(this->m_ctx, CURLOPT_SSLCERTTYPE, "PEM"); - curl_easy_setopt(this->m_ctx, CURLOPT_SSL_CTX_FUNCTION, sslCtxFunction); - #endif } std::optional Net::execute() { @@ -244,4 +221,4 @@ namespace hex { return {}; } -} \ No newline at end of file +} -- 2.35.1