summarylogtreecommitdiffstats
path: root/0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch
diff options
context:
space:
mode:
Diffstat (limited to '0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch')
-rw-r--r--0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch68
1 files changed, 68 insertions, 0 deletions
diff --git a/0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch b/0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch
new file mode 100644
index 000000000000..25faaf43c2ce
--- /dev/null
+++ b/0002-archlinux-compat-Remove-unused-mbedTLS-code-from-lib.patch
@@ -0,0 +1,68 @@
+From de0c264f425311abaf91aa461d53d91a1aac6072 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 | 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 <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
+