tdf#105844 argon2: add vcxproj files for WinARM64 builds

Also add argon2 to crossbuild tools side.

Change-Id: I8704b2d8362a051c2d634b9db7416cdc2cf9add4
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161206
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Reviewed-by: Thorsten Behrens <thorsten.behrens@allotropia.de>
(cherry picked from commit ed1965b60840056da1eed9fd5ba5c21fdea95d56)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/161220
diff --git a/configure.ac b/configure.ac
index 62cd934..d841c7c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5880,6 +5880,7 @@ if test "$cross_compiling" = "yes"; then

    # filter permitted build targets
    PERMITTED_BUILD_TARGETS="
        ARGON2
        AVMEDIA
        BOOST
        BZIP2
diff --git a/external/argon2/0002-Add-WinARM64-vcxproj-config.patch b/external/argon2/0002-Add-WinARM64-vcxproj-config.patch
new file mode 100644
index 0000000..063296d
--- /dev/null
+++ b/external/argon2/0002-Add-WinARM64-vcxproj-config.patch
@@ -0,0 +1,185 @@
diff -ur argon2.org/vs2015/Argon2OptDll/Argon2OptDll.vcxproj argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj
--- argon2.org/vs2015/Argon2OptDll/Argon2OptDll.vcxproj	2023-12-23 01:00:49.231059537 +0100
+++ argon2/vs2015/Argon2OptDll/Argon2OptDll.vcxproj	2023-12-23 01:02:40.375527010 +0100
@@ -13,6 +13,10 @@
       <Configuration>ReleaseStatic</Configuration>
       <Platform>x64</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM64">
+      <Configuration>Release</Configuration>
+      <Platform>AMR64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
@@ -50,6 +54,12 @@
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
@@ -84,6 +94,9 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|AMR64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -107,6 +120,11 @@
     <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
     <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <OutDir>$(SolutionDir)vs2015\build\</OutDir>
+    <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
+    <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
     <OutDir>$(SolutionDir)vs2015\build\</OutDir>
     <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
@@ -158,6 +176,21 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>false</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
@@ -209,7 +242,6 @@
     <ClInclude Include="..\..\include\argon2.h" />
     <ClInclude Include="..\..\src\blake2\blake2-impl.h" />
     <ClInclude Include="..\..\src\blake2\blake2.h" />
-    <ClInclude Include="..\..\src\blake2\blamka-round-opt.h" />
     <ClInclude Include="..\..\src\blake2\blamka-round-ref.h" />
     <ClInclude Include="..\..\src\core.h" />
     <ClInclude Include="..\..\src\encoding.h" />
@@ -221,7 +253,7 @@
     <ClCompile Include="..\..\src\blake2\blake2b.c" />
     <ClCompile Include="..\..\src\core.c" />
     <ClCompile Include="..\..\src\encoding.c" />
-    <ClCompile Include="..\..\src\opt.c" />
+    <ClCompile Include="..\..\src\ref.c" />
     <ClCompile Include="..\..\src\thread.c" />
   </ItemGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
Only in argon2/vs2015/Argon2OptDll: Argon2OptDll.vcxproj~
diff -ur argon2.org/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj
--- argon2.org/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj	2023-12-23 01:00:49.231059537 +0100
+++ argon2/vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj	2023-12-23 01:02:12.518576081 +0100
@@ -17,6 +17,10 @@
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|ARM64">
+      <Configuration>Release</Configuration>
+      <Platform>ARM64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Debug|x64">
       <Configuration>Debug</Configuration>
       <Platform>x64</Platform>
@@ -51,6 +55,12 @@
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseDebugLibraries>false</UseDebugLibraries>
+    <WholeProgramOptimization>true</WholeProgramOptimization>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
@@ -85,6 +95,9 @@
   <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
+  <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
   </ImportGroup>
@@ -108,6 +121,11 @@
     <OutDir>$(SolutionDir)vs2015\build\</OutDir>
     <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
+    <OutDir>$(SolutionDir)vs2015\build\</OutDir>
+    <IntDir>$(SolutionDir)vs2015\build\$(ProjectName)\</IntDir>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
     <IncludePath>$(SolutionDir)include;$(IncludePath)</IncludePath>
     <OutDir>$(SolutionDir)vs2015\build\</OutDir>
@@ -162,6 +180,21 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
+    <ClCompile>
+      <WarningLevel>Level3</WarningLevel>
+      <Optimization>MaxSpeed</Optimization>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <IntrinsicFunctions>false</IntrinsicFunctions>
+      <SDLCheck>true</SDLCheck>
+      <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+    </ClCompile>
+    <Link>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <OptimizeReferences>true</OptimizeReferences>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+    </Link>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='ReleaseStatic|Win32'">
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
@@ -214,7 +247,7 @@
     <ClCompile Include="..\..\src\blake2\blake2b.c" />
     <ClCompile Include="..\..\src\core.c" />
     <ClCompile Include="..\..\src\encoding.c" />
-    <ClCompile Include="..\..\src\opt.c" />
+    <ClCompile Include="..\..\src\ref.c" />
     <ClCompile Include="..\..\src\test.c" />
     <ClCompile Include="..\..\src\thread.c" />
   </ItemGroup>
@@ -222,7 +255,6 @@
     <ClInclude Include="..\..\include\argon2.h" />
     <ClInclude Include="..\..\src\blake2\blake2-impl.h" />
     <ClInclude Include="..\..\src\blake2\blake2.h" />
-    <ClInclude Include="..\..\src\blake2\blamka-round-opt.h" />
     <ClInclude Include="..\..\src\blake2\blamka-round-ref.h" />
     <ClInclude Include="..\..\src\core.h" />
     <ClInclude Include="..\..\src\encoding.h" />
@@ -232,4 +264,4 @@
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
   <ImportGroup Label="ExtensionTargets">
   </ImportGroup>
-</Project>
\ No newline at end of file
+</Project>
Only in argon2/vs2015/Argon2OptTestCI: Argon2OptTestCI.vcxproj~
diff --git a/external/argon2/UnpackedTarball_argon2.mk b/external/argon2/UnpackedTarball_argon2.mk
index 0b35c2f..3addfad 100644
--- a/external/argon2/UnpackedTarball_argon2.mk
+++ b/external/argon2/UnpackedTarball_argon2.mk
@@ -15,6 +15,7 @@ $(eval $(call gb_UnpackedTarball_set_patchlevel,argon2,1))

$(eval $(call gb_UnpackedTarball_add_patches,argon2,\
	external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch \
	external/argon2/0002-Add-WinARM64-vcxproj-config.patch \
))

# vim: set noet sw=4 ts=4: