ANDROID: Bundle cacert.pem and don't disable certificate checks

This commit is contained in:
Le Philousophe 2023-04-01 13:06:03 +02:00
parent 6d4268261c
commit dd2c020cb2
3 changed files with 25 additions and 4 deletions

View file

@ -99,7 +99,15 @@ uint32 ConnectionManager::getCloudRequestsPeriodInMicroseconds() {
}
const char *ConnectionManager::getCaCertPath() {
#if defined(DATA_PATH)
#if defined(__ANDROID__)
Common::ArchiveMemberPtr member = SearchMan.getMember("cacert.pem");
Common::FSNode *node = dynamic_cast<Common::FSNode *>(member.get());
if (!node) {
return nullptr;
}
return node->getPath().c_str();
#elif defined(DATA_PATH)
static enum {
kNotInitialized,
kFileNotFound,

View file

@ -92,7 +92,7 @@ void NetworkReadStream::initCurl(const char *url, curl_slist *headersList) {
curl_easy_setopt(_easy, CURLOPT_NOPROGRESS, 0L);
curl_easy_setopt(_easy, CURLOPT_PROGRESSFUNCTION, curlProgressCallbackOlder);
curl_easy_setopt(_easy, CURLOPT_PROGRESSDATA, this);
#if defined NINTENDO_SWITCH || defined ANDROID_PLAIN_PORT || defined PSP2
#if defined NINTENDO_SWITCH || defined PSP2
curl_easy_setopt(_easy, CURLOPT_SSL_VERIFYPEER, 0);
#endif

View file

@ -34,15 +34,28 @@ ifneq ($(DIST_FILES_SHADERS),)
$(INSTALL) -c -m 644 $(DIST_FILES_SHADERS) $(PATH_BUILD_ASSETS)/shaders
endif
ifdef DIST_ANDROID_CACERT_PEM
$(PATH_BUILD_ASSETS)/cacert.pem: $(DIST_ANDROID_CACERT_PEM) | $(PATH_BUILD_ASSETS)
$(INSTALL) -c -m 644 $(DIST_ANDROID_CACERT_PEM) $(PATH_BUILD_ASSETS)/cacert.pem
else
ifdef USE_CURL
$(PATH_BUILD_ASSETS)/cacert.pem: | $(PATH_BUILD_ASSETS)
$(QUIET_CURL)$(CURL) -s https://curl.se/ca/cacert.pem --time-cond $(PATH_BUILD_ASSETS)/cacert.pem --output $(PATH_BUILD_ASSETS)/cacert.pem
androidcacert: | $(PATH_BUILD_ASSETS)
$(QUIET_CURL)$(CURL) -s https://curl.se/ca/cacert.pem --time-cond $(PATH_BUILD_ASSETS)/cacert.pem --output $(PATH_BUILD_ASSETS)/cacert.pem
.PHONY: androidcacert
endif
endif
$(PATH_BUILD_LIBSCUMMVM): libscummvm.so | $(PATH_BUILD)
$(INSTALL) -d $(PATH_BUILD_LIB)
$(INSTALL) -c -m 644 libscummvm.so $(PATH_BUILD_LIBSCUMMVM)
$(APK_MAIN): $(PATH_BUILD_GRADLE) $(PATH_BUILD_ASSETS) $(PATH_BUILD_LIBSCUMMVM) | $(PATH_BUILD)
$(APK_MAIN): $(PATH_BUILD_GRADLE) $(PATH_BUILD_ASSETS) $(PATH_BUILD_ASSETS)/cacert.pem $(PATH_BUILD_LIBSCUMMVM) | $(PATH_BUILD)
(cd $(PATH_BUILD); ./gradlew assembleDebug)
$(CP) $(PATH_BUILD)/build/outputs/apk/debug/$(APK_MAIN) $@
$(APK_MAIN_RELEASE): $(PATH_BUILD_GRADLE) $(PATH_BUILD_ASSETS) $(PATH_BUILD_LIBSCUMMVM) | $(PATH_BUILD)
$(APK_MAIN_RELEASE): $(PATH_BUILD_GRADLE) $(PATH_BUILD_ASSETS) $(PATH_BUILD_ASSETS)/cacert.pem $(PATH_BUILD_LIBSCUMMVM) | $(PATH_BUILD)
(cd $(PATH_BUILD); ./gradlew assembleRelease)
$(CP) $(PATH_BUILD)/build/outputs/apk/release/$(APK_MAIN_RELEASE) $@