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
|
From 9e72afecf7c3418f6c42c72e7976845d0b13059e 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/2] 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 ee4905a9..3ab5ea12 100644
--- a/lib/libimhex/source/helpers/net.cpp
+++ b/lib/libimhex/source/helpers/net.cpp
@@ -7,8 +7,6 @@
#include <filesystem>
#include <cstdio>
-#include <mbedtls/ssl.h>
-
#include <curl/curl.h>
#include <nlohmann/json.hpp>
@@ -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<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 +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<i32> Net::execute() {
@@ -244,4 +221,4 @@ namespace hex {
return {};
}
-}
\ No newline at end of file
+}
--
2.35.1
|