sys: Make sure libromfs is never used in libimhex

This commit is contained in:
WerWolv
2022-12-05 15:29:19 +01:00
parent 94723dbba3
commit e3f2541fde
6 changed files with 26 additions and 16 deletions

View File

@@ -9,11 +9,8 @@
#include <filesystem>
#include <cstdio>
#include <curl/curl.h>
#include <nlohmann/json.hpp>
#include <romfs/romfs.hpp>
namespace hex {
Net::Net() {
@@ -45,7 +42,7 @@ namespace hex {
}
[[maybe_unused]]
static CURLcode sslCtxFunction(CURL *ctx, void *sslctx, void *userData) {
CURLcode sslCtxFunction(CURL *ctx, void *sslctx, void *userData) {
hex::unused(ctx, userData);
auto *cfg = static_cast<mbedtls_ssl_config *>(sslctx);
@@ -53,8 +50,7 @@ namespace hex {
auto crt = static_cast<mbedtls_x509_crt*>(userData);
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_x509_crt_parse(crt, reinterpret_cast<const u8 *>(Net::s_caCert.data()), Net::s_caCert.size());
mbedtls_ssl_conf_ca_chain(cfg, crt, nullptr);
@@ -296,9 +292,13 @@ namespace hex {
}
std::string Net::s_proxyUrl;
void Net::setProxy(const std::string &url) {
Net::s_proxyUrl = url;
}
std::string Net::s_caCert;
void Net::setCACert(const std::string &content) {
Net::s_caCert = content;
}
}