Initialize for argon2

This commit is contained in:
zyppe 2024-02-09 17:59:45 +08:00
commit 9152158454
6 changed files with 164 additions and 0 deletions

1
.argon2.metadata Normal file
View file

@ -0,0 +1 @@
cfc6ee72f280eeaeef527163adffe425045a8d131568d3f4ed25ec0f81addbf2 argon2-0.0+git20171227.670229c.tar.xz

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
argon2-0.0+git20171227.670229c.tar.xz

22
argon2.changes Normal file
View file

@ -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

108
argon2.spec Normal file
View file

@ -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

1
baselibs.conf Normal file
View file

@ -0,0 +1 @@
libargon2-1

31
optflags.patch Normal file
View file

@ -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