Skip to content

Commit 8ceea02

Browse files
committed
openssl: Re-add compatibility with Android CA certificates
The CA certificates bundles included in Android are hashed using MD5 (as used by OpenSSL pre-1.0.0) instead of SHA1 (used in 1.0.0+). The patch to use X509_NAME_hash_old() does no longer apply; hence import the proposed patch at openssl/openssl#24002 Also, pick the part of the old patch that configured the CA certificates path to be /system/etc/security/cacerts on Android and split it into its own patch.
1 parent ccbd321 commit 8ceea02

File tree

4 files changed

+670
-6
lines changed

4 files changed

+670
-6
lines changed

recipes/libsoup.recipe

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ class Recipe(recipe.Recipe):
1111
url = 'gnome://'
1212
tarball_checksum = '9b54c76f5276b05bebcaf2b6c2a141a188fc7bb1d0624eda259dac13a6665c8a'
1313
meson_options = {'vapi': 'disabled', 'tls_check': 'false', 'tests' : 'false'}
14-
# TODO: deps = ['libxml2', 'glib', 'glib-networking', 'libpsl', 'nghttp2']
15-
deps = ['glib', 'glib-networking', 'libpsl', 'nghttp2']
14+
deps = ['libxml2', 'glib', 'glib-networking', 'libpsl', 'nghttp2']
1615

1716
# sqlite ships with the system on macOS and iOS. Android also ships with
1817
# sqlite3, but it's not available from the NDK; only from Java.
@@ -30,8 +29,7 @@ class Recipe(recipe.Recipe):
3029

3130
def post_install(self):
3231
soup_deps = ['gio-2.0', 'gmodule-2.0', 'gobject-2.0', 'glib-2.0',
33-
# TODO: 'ffi', 'xml2', 'psl', 'z', 'nghttp2']
34-
'ffi', 'psl', 'z', 'nghttp2']
32+
'ffi', 'xml2', 'psl', 'z', 'nghttp2']
3533
if self.config.target_platform not in (Platform.IOS, Platform.DARWIN):
3634
soup_deps += ['sqlite3']
3735
# Meson does not generate la files

recipes/openssl.recipe

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ class Recipe(recipe.Recipe):
2626
# Portable prefix with SSL certs
2727
'openssl/0001-Load-ca-certificate.crt-from-PREFIX-etc-ssl-on-macOS.patch',
2828
# MSVC and UWP support
29-
# TODO: Android support
30-
# TODO: 'openssl/0003-openssl-Support-loading-ca-certificates-on-Android.patch',
3129
'openssl/0002-windows-makefile.tmpl-Generate-and-install-pkgconfig.patch',
3230
]
3331

@@ -178,6 +176,10 @@ class Recipe(recipe.Recipe):
178176
if self.config.target_platform == Platform.IOS:
179177
self.library_type = LibraryType.STATIC
180178
if self.config.target_platform == Platform.ANDROID:
179+
self.patches += [
180+
'openssl/0001-Android-Use-etc-system-security-cacerts-for-CA-certi.patch',
181+
'openssl/0005-get_cert_by_subject-backward-compatibility.patch',
182+
]
181183
self.prepend_env('PATH', self.get_env('ANDROID_NDK_TOOLCHAIN_BIN'), sep=os.pathsep)
182184
self.set_env('ANDROID_NDK_ROOT', self.get_env('ANDROID_NDK_HOME'))
183185

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 56ac18ba7a3f0a50cb368eb1c5bfa101ab06f39d Mon Sep 17 00:00:00 2001
2+
From: Adrian Perez de Castro <[email protected]>
3+
Date: Tue, 27 May 2025 17:08:50 +0300
4+
Subject: Android: Use /etc/system/security/cacerts for CA certificates
5+
6+
---
7+
include/internal/common.h | 4 ++++
8+
1 file changed, 4 insertions(+)
9+
10+
diff --git a/include/internal/common.h b/include/internal/common.h
11+
index 0c0415b..f7fcd43 100644
12+
--- a/include/internal/common.h
13+
+++ b/include/internal/common.h
14+
@@ -82,7 +82,11 @@ __owur static ossl_inline int ossl_assert_int(int expr, const char *exprstr,
15+
16+
# ifndef OPENSSL_SYS_VMS
17+
# define X509_CERT_AREA OPENSSLDIR
18+
+# if defined(ANDROID) || defined(__ANDROID__)
19+
+# define X509_CERT_DIR "/system/etc/security/cacerts"
20+
+# else
21+
# define X509_CERT_DIR OPENSSLDIR "/certs"
22+
+# endif
23+
# define X509_CERT_FILE OPENSSLDIR "/cert.pem"
24+
# define X509_PRIVATE_DIR OPENSSLDIR "/private"
25+
# define CTLOG_FILE OPENSSLDIR "/ct_log_list.cnf"
26+
--
27+
2.49.0
28+

0 commit comments

Comments
 (0)