fix issue with argon2 kdf (regression from .net8 migration) by
* including armeabi-v7 and arm64-v8 .so files * switching to [LibraryImport] instead of [DllImport]
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
using Java.Lang;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -179,6 +180,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
Marshal.Copy(pbSalt, 0, saltPtr, pbSalt.Length);
|
||||||
|
|
||||||
const UInt32 Argon2_d = 0;
|
const UInt32 Argon2_d = 0;
|
||||||
|
JavaSystem.LoadLibrary("argon2");
|
||||||
|
|
||||||
int ret = argon2_hash(
|
int ret = argon2_hash(
|
||||||
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
(UInt32)uIt, (UInt32)(uMem / 1024), uPar,
|
||||||
@@ -189,7 +191,7 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
|
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
{
|
{
|
||||||
throw new Exception("argon2_hash failed with " + ret);
|
throw new System.Exception("argon2_hash failed with " + ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
pbRet = new byte[32];
|
pbRet = new byte[32];
|
||||||
@@ -214,8 +216,9 @@ namespace KeePassLib.Cryptography.KeyDerivation
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("argon2")]
|
[LibraryImport("argon2")]
|
||||||
static extern int argon2_hash(
|
[return: MarshalAs(UnmanagedType.I4)]
|
||||||
|
public static partial int argon2_hash(
|
||||||
UInt32 t_cost, UInt32 m_cost, UInt32 parallelism,
|
UInt32 t_cost, UInt32 m_cost, UInt32 parallelism,
|
||||||
IntPtr pwd, IntPtr pwdlen,
|
IntPtr pwd, IntPtr pwdlen,
|
||||||
IntPtr salt, IntPtr saltlen,
|
IntPtr salt, IntPtr saltlen,
|
||||||
|
@@ -4,6 +4,7 @@
|
|||||||
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>21</SupportedOSPlatformVersion>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Resources\values\Strings.xml" />
|
<None Remove="Resources\values\Strings.xml" />
|
||||||
|
@@ -9,6 +9,7 @@
|
|||||||
<ApplicationId>keepass2android.keepass2android</ApplicationId>
|
<ApplicationId>keepass2android.keepass2android</ApplicationId>
|
||||||
<ApplicationVersion>1</ApplicationVersion>
|
<ApplicationVersion>1</ApplicationVersion>
|
||||||
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
|
||||||
|
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Assets\fontawesome-webfont.ttf" />
|
<None Remove="Assets\fontawesome-webfont.ttf" />
|
||||||
@@ -712,9 +713,6 @@
|
|||||||
<None Remove="Resources\xml\searchable_mattest.xml" />
|
<None Remove="Resources\xml\searchable_mattest.xml" />
|
||||||
<None Remove="Resources\xml\searchable_offline.xml" />
|
<None Remove="Resources\xml\searchable_offline.xml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<AndroidNativeLibrary Include="..\java\argon2\libs\armeabi-v7a\libargon2.so" Link="libargon2.so" />
|
|
||||||
</ItemGroup>
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_kp2a">
|
<AndroidResource Include="Resources\drawable-mdpi\ic_storage_kp2a">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
@@ -728,6 +726,12 @@
|
|||||||
<Folder Include="Resources\drawable-xxhdpi\" />
|
<Folder Include="Resources\drawable-xxhdpi\" />
|
||||||
<Folder Include="Resources\drawable-xxxhdpi\" />
|
<Folder Include="Resources\drawable-xxxhdpi\" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidNativeLibrary Include="..\java\argon2\libs\arm64-v8a\libargon2.so" Link="arm64-v8a\libargon2.so" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<AndroidNativeLibrary Include="..\java\argon2\libs\armeabi-v7a\libargon2.so" Link="armeabi-v7a\libargon2.so" />
|
||||||
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.0.3" />
|
<PackageReference Include="Xamarin.AndroidX.AppCompat" Version="1.7.0.3" />
|
||||||
<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources" Version="1.7.0.3" />
|
<PackageReference Include="Xamarin.AndroidX.AppCompat.AppCompatResources" Version="1.7.0.3" />
|
||||||
|
Reference in New Issue
Block a user