From fc2fed079f9bad64f2e593be3903e6f7007aaab1 Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Fri, 26 Jan 2024 10:34:28 -0300 Subject: [PATCH] PM-3350 Try to disable Interpreter to have better crash knowledge. This time testing if avoiding loading the argon2id lib we're able to not use the interpreter. --- src/App/App.csproj | 4 ++-- src/iOS.Autofill/iOS.Autofill.csproj | 4 ++-- src/iOS.Core/Services/CryptoPrimitiveService.cs | 12 +++++++----- src/iOS.Extension/iOS.Extension.csproj | 4 ++-- src/iOS.ShareExtension/iOS.ShareExtension.csproj | 4 ++-- 5 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/App/App.csproj b/src/App/App.csproj index 35458d047..8ce92674c 100644 --- a/src/App/App.csproj +++ b/src/App/App.csproj @@ -66,9 +66,9 @@ Automatic:AppStore iPhone Distribution Platforms\iOS\Entitlements.plist - true - -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" + diff --git a/src/iOS.Autofill/iOS.Autofill.csproj b/src/iOS.Autofill/iOS.Autofill.csproj index 3c5ab2431..eba3f0276 100644 --- a/src/iOS.Autofill/iOS.Autofill.csproj +++ b/src/iOS.Autofill/iOS.Autofill.csproj @@ -37,12 +37,12 @@ false - true - -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" iPhone Distribution Automatic:AppStore Entitlements.plist + diff --git a/src/iOS.Core/Services/CryptoPrimitiveService.cs b/src/iOS.Core/Services/CryptoPrimitiveService.cs index e74432dd5..20d9af49d 100644 --- a/src/iOS.Core/Services/CryptoPrimitiveService.cs +++ b/src/iOS.Core/Services/CryptoPrimitiveService.cs @@ -47,8 +47,9 @@ namespace Bit.iOS.Core.Services var passwordData = NSData.FromArray(password); var saltData = NSData.FromArray(salt); - argon2id_hash_raw(iterations, memory, parallelism, passwordData.Bytes, passwordData.Length, - saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length); + // TODO: Uncomment (Testing if without loading argon2id we can disable UseInterpreter) + //argon2id_hash_raw(iterations, memory, parallelism, passwordData.Bytes, passwordData.Length, + // saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length); var keyBytes = new byte[keyData.Length]; Marshal.Copy(keyData.Bytes, keyBytes, 0, Convert.ToInt32(keyData.Length)); @@ -60,8 +61,9 @@ namespace Bit.iOS.Core.Services private static extern int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen, IntPtr salt, nuint saltLen, uint prf, nuint rounds, IntPtr derivedKey, nuint derivedKeyLength); - [DllImport("__Internal", EntryPoint = "argon2id_hash_raw")] - private static extern int argon2id_hash_raw(int timeCost, int memoryCost, int parallelism, IntPtr pwd, - nuint pwdlen, IntPtr salt, nuint saltlen, IntPtr hash, nuint hashlen); + // TODO: Uncomment (Testing if without loading argon2id we can disable UseInterpreter) + //[DllImport("__Internal", EntryPoint = "argon2id_hash_raw")] + //private static extern int argon2id_hash_raw(int timeCost, int memoryCost, int parallelism, IntPtr pwd, + // nuint pwdlen, IntPtr salt, nuint saltlen, IntPtr hash, nuint hashlen); } } diff --git a/src/iOS.Extension/iOS.Extension.csproj b/src/iOS.Extension/iOS.Extension.csproj index 8829d9423..ded572813 100644 --- a/src/iOS.Extension/iOS.Extension.csproj +++ b/src/iOS.Extension/iOS.Extension.csproj @@ -32,12 +32,12 @@ false - true - -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" iPhone Distribution Automatic:AppStore Entitlements.plist + diff --git a/src/iOS.ShareExtension/iOS.ShareExtension.csproj b/src/iOS.ShareExtension/iOS.ShareExtension.csproj index 1f357ce2b..ba5f5a196 100644 --- a/src/iOS.ShareExtension/iOS.ShareExtension.csproj +++ b/src/iOS.ShareExtension/iOS.ShareExtension.csproj @@ -34,12 +34,12 @@ false - true - -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" iPhone Distribution Automatic:AppStore Entitlements.plist +