From 5f43681fb128084c45fef55af360db170bb8bcfb Mon Sep 17 00:00:00 2001 From: Federico Maccaroni Date: Mon, 29 Jan 2024 14:30:42 -0300 Subject: [PATCH] PM-3350 Go back to include argon2id and interpreter --- 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 ++-- 4 files changed, 11 insertions(+), 13 deletions(-) diff --git a/src/iOS.Autofill/iOS.Autofill.csproj b/src/iOS.Autofill/iOS.Autofill.csproj index 9ff5c1faa..9322e97c4 100644 --- a/src/iOS.Autofill/iOS.Autofill.csproj +++ b/src/iOS.Autofill/iOS.Autofill.csproj @@ -40,9 +40,9 @@ $(ReleaseCodesignProvision) $(ReleaseCodesignKey) Entitlements.plist + true + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" - diff --git a/src/iOS.Core/Services/CryptoPrimitiveService.cs b/src/iOS.Core/Services/CryptoPrimitiveService.cs index 20d9af49d..5d0cbc332 100644 --- a/src/iOS.Core/Services/CryptoPrimitiveService.cs +++ b/src/iOS.Core/Services/CryptoPrimitiveService.cs @@ -47,9 +47,8 @@ namespace Bit.iOS.Core.Services var passwordData = NSData.FromArray(password); var saltData = NSData.FromArray(salt); - // 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); + 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)); @@ -61,9 +60,8 @@ 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); - // 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); + [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 9e8e46457..870ac757a 100644 --- a/src/iOS.Extension/iOS.Extension.csproj +++ b/src/iOS.Extension/iOS.Extension.csproj @@ -35,9 +35,9 @@ $(ReleaseCodesignProvision) $(ReleaseCodesignKey) Entitlements.plist + true + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" - diff --git a/src/iOS.ShareExtension/iOS.ShareExtension.csproj b/src/iOS.ShareExtension/iOS.ShareExtension.csproj index b79b78294..8a3689aca 100644 --- a/src/iOS.ShareExtension/iOS.ShareExtension.csproj +++ b/src/iOS.ShareExtension/iOS.ShareExtension.csproj @@ -37,9 +37,9 @@ $(ReleaseCodesignProvision) $(ReleaseCodesignKey) Entitlements.plist + true + -gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a" -