From 50eea778fa3359435ff04744cb74df749b665f9d Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 28 Jun 2022 09:27:51 +0000 Subject: [PATCH 1/2] chore: Use a specific version of the flutter-linux images --- .gitlab-ci.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f46184fd..b7aeaa85 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -10,11 +10,14 @@ workflow: - if: $CI_COMMIT_TAG - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH +variables: + FLUTTER_IMAGE_TAG: '3.0.3' + coverage: tags: - linux stage: coverage - image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable + image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG} dependencies: [] script: - sed -i 's/#\([^ ]\)/\1/g' pubspec.yaml @@ -39,7 +42,7 @@ e2ee_test: tags: - linux stage: coverage - image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable + image: registry.gitlab.com/famedly/company/frontend/flutter-dockerimages/flutter-linux/stable:${FLUTTER_IMAGE_TAG} dependencies: [] script: - printf "abstract class TestUser {\n static const String homeserver = '$TEST_HOMESERVER';\n static const String username = '$TEST_USER1';\n static const String username2 = '$TEST_USER2';\n static const String password = '$TEST_USER_PASSWORD';\n}" > ./test_driver/test_config.dart From c292a8602bc934bfe17be5c9f69d3b33c3eaefdb Mon Sep 17 00:00:00 2001 From: Nicolas Werner Date: Tue, 28 Jun 2022 09:43:56 +0000 Subject: [PATCH 2/2] fix: Support for OpenSSL 3.0 --- lib/src/utils/crypto/ffi.dart | 45 +++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 12 deletions(-) diff --git a/lib/src/utils/crypto/ffi.dart b/lib/src/utils/crypto/ffi.dart index 0cb79266..f4415c14 100644 --- a/lib/src/utils/crypto/ffi.dart +++ b/lib/src/utils/crypto/ffi.dart @@ -18,15 +18,27 @@ import 'dart:ffi'; import 'dart:io'; -final libcrypto = Platform.isIOS - ? DynamicLibrary.process() - : DynamicLibrary.open(Platform.isAndroid - ? 'libcrypto.so' - : Platform.isWindows - ? 'libcrypto.dll' - : Platform.isMacOS - ? 'libcrypto.1.1.dylib' - : 'libcrypto.so.1.1'); +final libcrypto = () { + if (Platform.isIOS) { + return DynamicLibrary.process(); + } else if (Platform.isAndroid) { + return DynamicLibrary.open('libcrypto.so'); + } else if (Platform.isWindows) { + return DynamicLibrary.open('libcrypto.dll'); + } else if (Platform.isMacOS) { + try { + return DynamicLibrary.open('libcrypto.3.dylib'); + } catch (_) { + return DynamicLibrary.open('libcrypto.1.1.dylib'); + } + } else { + try { + return DynamicLibrary.open('libcrypto.so.3'); + } catch (_) { + return DynamicLibrary.open('libcrypto.so.1.1'); + } + } +}(); final PKCS5_PBKDF2_HMAC = libcrypto.lookupFunction< IntPtr Function( @@ -118,6 +130,15 @@ final EVP_Digest = libcrypto.lookupFunction< Pointer alg, Pointer engine)>('EVP_Digest'); -final EVP_MD_size = libcrypto.lookupFunction< - IntPtr Function(Pointer ctx), - int Function(Pointer ctx)>('EVP_MD_size'); +final EVP_MD_size = () { + // EVP_MD_size was renamed to EVP_MD_get_size in Openssl3.0. + // There is an alias macro, but those don't exist in libraries. + // Try loading the new name first, then fall back to the old one if not found. + try { + return libcrypto.lookupFunction ctx), + int Function(Pointer ctx)>('EVP_MD_get_size'); + } catch (e) { + return libcrypto.lookupFunction ctx), + int Function(Pointer ctx)>('EVP_MD_size'); + } +}();