summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2022-12-29 08:07:20 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2022-12-29 08:07:20 +0530
commit419e726ce0cd58277644050ed41c63dc29a80274 (patch)
tree7709f298527676f6666ea1a8f1e45d2e0b92351c
parent5b422c061a568a5cf00e6f87aa3fe0a6f19acc19 (diff)
downloadglib-networking-419e726ce0cd58277644050ed41c63dc29a80274.tar.gz
Don't try to use keychain CA certificates on iOS
SecTrustCopyAnchorCertificates is not available on iOS as certificate data for system-trusted roots is currently unavailable there.
-rw-r--r--tls/openssl/gtlsdatabase-openssl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tls/openssl/gtlsdatabase-openssl.c b/tls/openssl/gtlsdatabase-openssl.c
index e7a7ef9..1c7df2a 100644
--- a/tls/openssl/gtlsdatabase-openssl.c
+++ b/tls/openssl/gtlsdatabase-openssl.c
@@ -31,8 +31,14 @@
#include <glib/gi18n-lib.h>
#include "openssl-include.h"
+/*
+ * SecTrustCopyAnchorCertificates is only available on macOS, so we check for
+ * SEC_OS_OSX: https://github.com/Apple-FOSS-Mirror/Security/blob/master/base/SecBase.h
+ */
#ifdef __APPLE__
#include <Security/Security.h>
+#else
+#define SEC_OS_OSX 0
#endif
#ifdef G_OS_WIN32
@@ -151,7 +157,7 @@ g_tls_database_openssl_verify_chain (GTlsDatabase *database,
return result;
}
-#ifdef __APPLE__
+#if SEC_OS_OSX
static gboolean
populate_store (X509_STORE *store,
GError **error)