From a775d4d8db350a0db34270183cc9d22d6c0580b4 Mon Sep 17 00:00:00 2001 From: KokaKiwi Date: Mon, 31 Jan 2022 20:20:40 +0100 Subject: [PATCH 2/4] archlinux-compat: Remove unused mbedTLS code from libcurl usage --- lib/libimhex/source/helpers/net.cpp | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-) diff --git a/lib/libimhex/source/helpers/net.cpp b/lib/libimhex/source/helpers/net.cpp index a0693534..96f60fea 100644 --- a/lib/libimhex/source/helpers/net.cpp +++ b/lib/libimhex/source/helpers/net.cpp @@ -7,8 +7,6 @@ #include #include -#include - #include #include @@ -44,23 +42,6 @@ namespace hex { return fwrite(contents, size, nmemb, file); } - [[maybe_unused]] - static CURLcode sslCtxFunction(CURL *ctx, void *sslctx, void *userData) { - hex::unused(ctx, 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); @@ -106,13 +87,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() { @@ -241,4 +215,4 @@ namespace hex { return {}; } -} \ No newline at end of file +} -- 2.36.1