summarylogtreecommitdiffstats
path: root/0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch
blob: 627a2449353a52feba19de7293b98c0b1dc4da4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
From 491e66e92fd271b3f3f8e9e630679fac3be21593 Mon Sep 17 00:00:00 2001
From: KokaKiwi <kokakiwi+git@kokakiwi.net>
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 | 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 3c930fb0..0d73ed10 100644
--- a/lib/libimhex/source/helpers/net.cpp
+++ b/lib/libimhex/source/helpers/net.cpp
@@ -9,8 +9,6 @@
 #include <filesystem>
 #include <cstdio>
 
-#include <mbedtls/ssl.h>
-
 #include <curl/curl.h>
 #include <nlohmann/json.hpp>
 
@@ -46,23 +44,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<mbedtls_ssl_config *>(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<const u8 *>(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<Net *>(contents);
 
@@ -109,13 +90,6 @@ namespace hex {
         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
-
         curl_easy_setopt(this->m_ctx, CURLOPT_PROXY, Net::s_proxyUrl.c_str());
     }
 
@@ -251,4 +225,4 @@ namespace hex {
         Net::s_proxyUrl = url;
     }
 
-}
\ No newline at end of file
+}
-- 
2.37.0