From 91521584547072055cb70a401d8610694d091422 Mon Sep 17 00:00:00 2001 From: zyppe <210hcl@gmail.com> Date: Fri, 9 Feb 2024 17:59:45 +0800 Subject: [PATCH] Initialize for argon2 --- .argon2.metadata | 1 + .gitignore | 1 + argon2.changes | 22 ++++++++++ argon2.spec | 108 +++++++++++++++++++++++++++++++++++++++++++++++ baselibs.conf | 1 + optflags.patch | 31 ++++++++++++++ 6 files changed, 164 insertions(+) create mode 100644 .argon2.metadata create mode 100644 .gitignore create mode 100644 argon2.changes create mode 100644 argon2.spec create mode 100644 baselibs.conf create mode 100644 optflags.patch diff --git a/.argon2.metadata b/.argon2.metadata new file mode 100644 index 0000000..72f0b1c --- /dev/null +++ b/.argon2.metadata @@ -0,0 +1 @@ +cfc6ee72f280eeaeef527163adffe425045a8d131568d3f4ed25ec0f81addbf2 argon2-0.0+git20171227.670229c.tar.xz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f5bcdcf --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +argon2-0.0+git20171227.670229c.tar.xz diff --git a/argon2.changes b/argon2.changes new file mode 100644 index 0000000..e5e367f --- /dev/null +++ b/argon2.changes @@ -0,0 +1,22 @@ +* Tue Jan 30 2018 lnussel@suse.de +- add baselibs.conf as cryptsetup also has 32bit variants +* Tue Jan 9 2018 jengelh@inai.de +- Update description. +* Tue Jan 9 2018 lnussel@suse.de +- Update to version 0.0+git20171227.670229c: + * Added ABI version number + * AVX2/AVX-512F optimizations of BLAMKA + * Set Argon2 version number from the command line + * New bindings + * Minor bug and warning fixes (no security issue) +- use _service file +* Tue Apr 18 2017 meissner@suse.com +- ship libargon2.pc (bsc#1034441) +* Thu Feb 23 2017 adam@mizerski.pl +- moved argon2-specs.pdf to doc subpackage +- added packaging of man page +* Sat Jan 28 2017 hpj@urpla.net +- make sure to call cc with -pthread option (implies -lpthread) +- run test suite +* Tue Dec 20 2016 idonmez@suse.com +- Initial release diff --git a/argon2.spec b/argon2.spec new file mode 100644 index 0000000..4321141 --- /dev/null +++ b/argon2.spec @@ -0,0 +1,108 @@ +# +# spec file for package argon2 +# +# Copyright (c) 2022-2023 ZhuningOS +# + + +%ifarch i686 x86_64 +%define no_optimize 0 +%else +%define no_optimize 1 +%endif +# for convenience +%define make %__make OPTFLAGS="%{optflags}" OPTTEST=%no_optimize LIB_ST= LIBRARY_REL=%_lib + +%define lname libargon2-1 +Name: argon2 +Version: 0.0+git20171227.670229c +Release: 2.14 +Summary: The reference C implementation of Argon2 +License: CC0-1.0 or Apache-2.0 +Group: Productivity/Networking/Security +Url: https://github.com/P-H-C/phc-winner-argon2 +Source: %{name}-%{version}.tar.xz +Source1: baselibs.conf +Patch1: optflags.patch +BuildRequires: pkgconfig +BuildRequires: sed +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%description +This is the reference C implementation of Argon2, the password-hashing function +that won the Password Hashing Competition (PHC) in 2015. + +Argon2 is a password hashing function that is parametrized by a time cost, a +memory cost and a parallelism degree, used to guard against side-channel +attacks, attacks where lots of memory is available, or attacks where a lot of +processing is available. + +%package doc +Summary: Documentation for Argon2 +Group: Documentation/Other +BuildArch: noarch + +%description doc +Documentation for Argon2, the password hashing function that won the Password +Hashing Competition (PHC) in 2015. + +%package -n %{lname} +Summary: The reference C implementation of Argon2 +Group: System/Libraries + +%description -n %{lname} +Reference C implementation of Argon2, the password-hashing function +that won the Password Hashing Competition (PHC) in 2015. + +%package devel +Summary: Development files for argon2 +Group: Development/Libraries/C and C++ +Requires: %{lname} = %{version} + +%description devel +Headers for argon2, the reference C implementation of Argon2, the +password hashing function that won the Password Hashing Competition +(PHC) in 2015. + +%prep +%autosetup + +%build +%make %{?_smp_mflags} +# fix pkgconfig file +sed -e 's:lib/@HOST_MULTIARCH@:%{_lib}:;s/@UPSTREAM_VER@/%{version}/' -i libargon2.pc + +%install +%make DESTDIR=%{buildroot} install + +install -D -m 644 man/argon2.1 %{buildroot}%{_mandir}/man1/argon2.1 +install -D -m 644 libargon2.pc %{buildroot}/%{_libdir}/pkgconfig/libargon2.pc + +%check +%make test + +%post -n %{lname} -p /sbin/ldconfig +%postun -n %{lname} -p /sbin/ldconfig + +%files +%defattr(-,root,root) +%license LICENSE +%doc CHANGELOG.md README.md +%{_bindir}/argon2 +%{_mandir}/man1/argon2.1%{ext_man} + +%files doc +%defattr(-,root,root) +%doc argon2-specs.pdf + +%files -n %{lname} +%defattr(-,root,root) +%{_libdir}/libargon2.so.1 + +%files devel +%defattr(-,root,root) +%{_includedir}/argon2.h +%{_libdir}/libargon2.so +%{_libdir}/pkgconfig/libargon2.pc + +%changelog diff --git a/baselibs.conf b/baselibs.conf new file mode 100644 index 0000000..f47e4c4 --- /dev/null +++ b/baselibs.conf @@ -0,0 +1 @@ +libargon2-1 diff --git a/optflags.patch b/optflags.patch new file mode 100644 index 0000000..9f18dc4 --- /dev/null +++ b/optflags.patch @@ -0,0 +1,31 @@ +diff --git a/Makefile b/Makefile +index 1e1129f..33fe491 100644 +--- a/Makefile ++++ b/Makefile +@@ -30,7 +30,7 @@ SRC_BENCH = src/bench.c + SRC_GENKAT = src/genkat.c + OBJ = $(SRC:.c=.o) + +-CFLAGS += -std=c89 -O3 -Wall -g -Iinclude -Isrc ++CFLAGS += $(OPTFLAGS) -Iinclude -Isrc + + ifeq ($(NO_THREADS), 1) + CFLAGS += -DARGON2_NO_THREADS +@@ -41,16 +41,12 @@ endif + CI_CFLAGS := $(CFLAGS) -Werror=declaration-after-statement -D_FORTIFY_SOURCE=2 \ + -Wextra -Wno-type-limits -Werror -coverage -DTEST_LARGE_RAM + +-OPTTARGET ?= native +-OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \ +- -o /dev/null 2>/dev/null; echo $$?) + # Detect compatible platform + ifneq ($(OPTTEST), 0) + $(info Building without optimizations) + SRC += src/ref.c + else +-$(info Building with optimizations for $(OPTTARGET)) +- CFLAGS += -march=$(OPTTARGET) ++$(info Building with optimizations) + SRC += src/opt.c + endif +