1
0
mirror of https://github.com/bitwarden/mobile.git synced 2025-01-23 21:21:27 +01:00

Enabled argon2Id for iOS

This commit is contained in:
Dinis Vieira 2023-10-18 12:20:41 +01:00
parent 14b2960f30
commit 4bcc7c0d71
No known key found for this signature in database
GPG Key ID: 9389160FF6C295F3
3 changed files with 10 additions and 8 deletions

View File

@ -58,9 +58,11 @@
<CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Platforms\iOS\Entitlements.plist</CodesignEntitlements>
<MtouchInterpreter>all</MtouchInterpreter> <MtouchInterpreter>all</MtouchInterpreter>
<MtouchLink>None</MtouchLink> <MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" /> <PackageReference Include="Microsoft.Maui.Controls" Version="$(MauiVersion)" />

View File

@ -26,9 +26,11 @@
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements> <CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
<MtouchInterpreter>all</MtouchInterpreter> <MtouchInterpreter>all</MtouchInterpreter>
<MtouchLink>None</MtouchLink> <MtouchLink>None</MtouchLink>
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net8.0-ios|AnyCPU'">
<CreatePackage>false</CreatePackage> <CreatePackage>false</CreatePackage>
<MtouchExtraArgs>-gcc_flags "-L$(ProjectDir)../../lib/ios -largon2 -force_load $(ProjectDir)../../lib/ios/libargon2.a"</MtouchExtraArgs>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="CredentialProviderViewController.cs" /> <Compile Include="CredentialProviderViewController.cs" />

View File

@ -48,9 +48,8 @@ namespace Bit.iOS.Core.Services
var passwordData = NSData.FromArray(password); var passwordData = NSData.FromArray(password);
var saltData = NSData.FromArray(salt); var saltData = NSData.FromArray(salt);
// TODO: [MAUI-Migration] [Critical] argon2id_hash_raw(iterations, memory, parallelism, passwordData.Bytes, passwordData.Length,
//argon2id_hash_raw(iterations, memory, parallelism, passwordData.Bytes, passwordData.Length, saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length);
// saltData.Bytes, saltData.Length, keyData.MutableBytes, keyData.Length);
var keyBytes = new byte[keyData.Length]; var keyBytes = new byte[keyData.Length];
Marshal.Copy(keyData.Bytes, keyBytes, 0, Convert.ToInt32(keyData.Length)); Marshal.Copy(keyData.Bytes, keyBytes, 0, Convert.ToInt32(keyData.Length));
@ -59,12 +58,11 @@ namespace Bit.iOS.Core.Services
// ref: http://opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/CommonCrypto/CommonKeyDerivation.h // ref: http://opensource.apple.com/source/CommonCrypto/CommonCrypto-55010/CommonCrypto/CommonKeyDerivation.h
[DllImport(ObjCRuntime.Constants.libSystemLibrary, EntryPoint = "CCKeyDerivationPBKDF")] [DllImport(ObjCRuntime.Constants.libSystemLibrary, EntryPoint = "CCKeyDerivationPBKDF")]
private extern static int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen, private static extern int CCKeyCerivationPBKDF(uint algorithm, IntPtr password, nuint passwordLen,
IntPtr salt, nuint saltLen, uint prf, nuint rounds, IntPtr derivedKey, nuint derivedKeyLength); IntPtr salt, nuint saltLen, uint prf, nuint rounds, IntPtr derivedKey, nuint derivedKeyLength);
// TODO: [MAUI-Migration] [Critical] [DllImport("__Internal", EntryPoint = "argon2id_hash_raw")]
//[DllImport("__Internal", EntryPoint = "argon2id_hash_raw")] private static extern int argon2id_hash_raw(int timeCost, int memoryCost, int parallelism, IntPtr pwd,
//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);
// nuint pwdlen, IntPtr salt, nuint saltlen, IntPtr hash, nuint hashlen);
} }
} }