summaryrefslogtreecommitdiffstats
path: root/external/argon2
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /external/argon2
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'external/argon2')
-rw-r--r--external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch32
-rw-r--r--external/argon2/0002-Add-WinARM64-vcxproj-config.patch185
-rw-r--r--external/argon2/ExternalPackage_argon2.mk18
-rw-r--r--external/argon2/ExternalProject_argon2.mk54
-rw-r--r--external/argon2/Makefile7
-rw-r--r--external/argon2/Module_argon2.mk18
-rw-r--r--external/argon2/README5
-rw-r--r--external/argon2/UnpackedTarball_argon2.mk21
8 files changed, 340 insertions, 0 deletions
diff --git a/external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch b/external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch
new file mode 100644
index 0000000000..538b41e3ec
--- /dev/null
+++ b/external/argon2/0001-Fix-possible-compiler-error-due-to-undefined-_MSC_VE.patch
@@ -0,0 +1,32 @@
+From 48829f87ebafbb9938d23a8f0bff4d11d770690e Mon Sep 17 00:00:00 2001
+From: Patrick Steinhardt <ps@pks.im>
+Date: Thu, 20 Feb 2020 17:37:32 +0100
+Subject: [PATCH] Fix possible compiler error due to undefined _MSC_VER
+
+In order to determine how to set up the ARGON2_PUBLIC and ARGON2_LOCAL
+macros, we check for various different environments via preprocessor
+defines. For Microsoft Visual Studio, we check that the macro _MSC_VER
+evaluates to non-zero via `#elif _MSC_VER`. This may raise a compile
+error when compiling with "-Werror=undef" if the variable isn't defined.
+
+Fix the issue by using `#elif defined(_MSC_VER)` instead.
+---
+ include/argon2.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/argon2.h b/include/argon2.h
+index fc8682c..1b471f6 100644
+--- a/include/argon2.h
++++ b/include/argon2.h
+@@ -30,7 +30,7 @@ extern "C" {
+ #ifdef A2_VISCTL
+ #define ARGON2_PUBLIC __attribute__((visibility("default")))
+ #define ARGON2_LOCAL __attribute__ ((visibility ("hidden")))
+-#elif _MSC_VER
++#elif defined(_MSC_VER)
+ #define ARGON2_PUBLIC __declspec(dllexport)
+ #define ARGON2_LOCAL
+ #else
+--
+2.43.0
+
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 0000000000..063296dd10
--- /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/ExternalPackage_argon2.mk b/external/argon2/ExternalPackage_argon2.mk
new file mode 100644
index 0000000000..6542d79254
--- /dev/null
+++ b/external/argon2/ExternalPackage_argon2.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalPackage_ExternalPackage,argon2,argon2))
+
+$(eval $(call gb_ExternalPackage_use_external_project,argon2,argon2))
+
+ifeq ($(COM),MSC)
+$(eval $(call gb_ExternalPackage_add_file,argon2,$(LIBO_LIB_FOLDER)/Argon2OptDll.dll,vs2015/build/Argon2OptDll.dll))
+endif # $(COM)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/argon2/ExternalProject_argon2.mk b/external/argon2/ExternalProject_argon2.mk
new file mode 100644
index 0000000000..7e521096af
--- /dev/null
+++ b/external/argon2/ExternalProject_argon2.mk
@@ -0,0 +1,54 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_ExternalProject_ExternalProject,argon2))
+
+$(eval $(call gb_ExternalProject_register_targets,argon2,\
+ build \
+))
+
+ifeq ($(COM),MSC)
+
+# .vcxproj needs manual SolutionDir to find header; there is a .sln file but it
+# expects "x86" where we pass "Win32"
+
+$(call gb_ExternalProject_get_state_target,argon2,build):
+ $(call gb_Trace_StartRange,argon2,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ MSBuild.exe vs2015/Argon2OptDll/Argon2OptDll.vcxproj \
+ /p:SolutionDir="$(call gb_UnpackedTarball_get_dir,argon2)/" \
+ $(gb_MSBUILD_CONFIG_AND_PLATFORM) \
+ /p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
+ $(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
+ && MSBuild.exe vs2015/Argon2OptTestCI/Argon2OptTestCI.vcxproj \
+ /p:SolutionDir="$(call gb_UnpackedTarball_get_dir,argon2)/" \
+ $(gb_MSBUILD_CONFIG_AND_PLATFORM) \
+ /p:PlatformToolset=$(VCTOOLSET) /p:VisualStudioVersion=$(VCVER) /ToolsVersion:Current \
+ $(if $(filter 10,$(WINDOWS_SDK_VERSION)),/p:WindowsTargetPlatformVersion=$(UCRTVERSION)) \
+ $(if $(CROSS_COMPILING),,&& vs2015/build/Argon2OptTestCI.exe) \
+ )
+ $(call gb_Trace_EndRange,argon2,EXTERNAL)
+
+else # $(COM)
+
+# clear MAKEFILES because Makefile relies on built-in rules
+
+$(call gb_ExternalProject_get_state_target,argon2,build):
+ $(call gb_Trace_StartRange,argon2,EXTERNAL)
+ $(call gb_ExternalProject_run,build,\
+ CFLAGS="$(CFLAGS) $(if $(filter-out WNT MACOSX,$(OS)),-fvisibility=hidden) -fPIC" \
+ MAKEFLAGS= $(MAKE) \
+ OPTTARGET=$(if $(filter X86_64,$(CPUNAME)),x86-64,forcefail) \
+ $(if $(CROSS_COMPILING),,&& $(MAKE) test) \
+ )
+ $(call gb_Trace_EndRange,argon2,EXTERNAL)
+
+endif # $(COM)
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/argon2/Makefile b/external/argon2/Makefile
new file mode 100644
index 0000000000..e4968cf85f
--- /dev/null
+++ b/external/argon2/Makefile
@@ -0,0 +1,7 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+
+module_directory:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
+
+include $(module_directory)/../../solenv/gbuild/partial_build.mk
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/argon2/Module_argon2.mk b/external/argon2/Module_argon2.mk
new file mode 100644
index 0000000000..5be66c0309
--- /dev/null
+++ b/external/argon2/Module_argon2.mk
@@ -0,0 +1,18 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_Module_Module,argon2))
+
+$(eval $(call gb_Module_add_targets,argon2,\
+ UnpackedTarball_argon2 \
+ ExternalProject_argon2 \
+ ExternalPackage_argon2 \
+))
+
+# vim: set noet sw=4 ts=4:
diff --git a/external/argon2/README b/external/argon2/README
new file mode 100644
index 0000000000..e3198017e3
--- /dev/null
+++ b/external/argon2/README
@@ -0,0 +1,5 @@
+Argon2 password hashing function
+
+This is used in ODF encryption as key derivation function.
+
+[https://github.com/P-H-C/phc-winner-argon2]
diff --git a/external/argon2/UnpackedTarball_argon2.mk b/external/argon2/UnpackedTarball_argon2.mk
new file mode 100644
index 0000000000..a91d3d6651
--- /dev/null
+++ b/external/argon2/UnpackedTarball_argon2.mk
@@ -0,0 +1,21 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t; fill-column: 100 -*-
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+
+$(eval $(call gb_UnpackedTarball_UnpackedTarball,argon2))
+
+$(eval $(call gb_UnpackedTarball_set_tarball,argon2,$(ARGON2_TARBALL)))
+
+$(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 \
+ $(if $(filter WNT_AARCH64,$(OS)_$(CPUNAME)),external/argon2/0002-Add-WinARM64-vcxproj-config.patch) \
+))
+
+# vim: set noet sw=4 ts=4: