argon2, new recipe (#3485)

* argon2, new recipe
This commit is contained in:
Schrijvers Luc
2019-01-21 18:07:18 +01:00
committed by GitHub
parent f7fe3afbf1
commit 8052d839bd
3 changed files with 184 additions and 0 deletions

View File

@@ -0,0 +1,107 @@
SUMMARY="A password-hashing function"
DESCRIPTION="Argon2 is a password-hashing function that summarizes the state \
of the art in the design of memory-hard functions and can be used to hash \
passwords for credential storage, key derivation, or other applications."
HOMEPAGE="https://github.com/p-h-c/phc-winner-argon2"
COPYRIGHT="2015-2017 Daniel Dinu
2013-2017 Samuel Neves
2015-2017 Dmitry Khoravich
2015-2017 Jean-Philippe Aumasson
2015 Thomas Pornin"
LICENSE="Apache v2
Public Domain"
REVISION="1"
srcGitRev="6c8653c3b6859a2d21850fa5979327feee8ca3ee"
SOURCE_URI="https://github.com/P-H-C/phc-winner-argon2/archive/$srcGitRev.tar.gz"
CHECKSUM_SHA256="d33275eea770ce93c678e4d512cf171f878f65219bc3ffcee9f2a6cbac258853"
SOURCE_FILENAME="argon2-$srcGitRev.tar.gz"
SOURCE_DIR="phc-winner-argon2-$srcGitRev"
PATCHES="argon2-$portVersion.patchset"
if [ "$effectiveTargetArchitecture" = x86_gcc2 ]; then
PATCHES="$PATCHES
argon2-$portVersion-gcc2.patchset"
fi
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"
PROVIDES="
argon2$secondaryArchSuffix = $portVersion
lib:libargon2$secondaryArchSuffix = 1
"
if [ -z "$secondaryArchSuffix" ]; then
PROVIDES="$PROVIDES
cmd:argon2 = $portVersion
"
fi
REQUIRES="
haiku$secondaryArchSuffix
"
PROVIDES_devel="
argon2${secondaryArchSuffix}_devel = $portVersion
devel:libargon2$secondaryArchSuffix = 1
"
REQUIRES_devel="
argon2$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
haiku${secondaryArchSuffix}_devel
"
BUILD_PREREQUIRES="
cmd:gcc$secondaryArchSuffix
cmd:make
"
TEST_REQUIRES="
cmd:diff
"
defineDebugInfoPackage argon2$secondaryArchSuffix \
$libDir/libargon2.so.1
BUILD()
{
make PREFIX=$prefix
}
INSTALL()
{
make install PREFIX=$prefix \
INST_INCLUDE=$includeDir \
INST_LIBRARY=$libDir
install -d -m 755 $manDir/man1
install -m 644 -t $manDir/man1 ./man/argon2.1
if [ -n "$secondaryArchSuffix" ]; then
rm -rf $prefix/bin
fi
mkdir -p $developLibDir/pkgconfig
cat > $developLibDir/pkgconfig/libargon2.pc << EOF
bindir=$prefix/bin
exec_prefix=$prefix
libdir=$libDir
includedir=$includeDir
Name: libargon2
Description: $SUMMARY
Version: $portVersion
Libs: -L$developLibDir -largon2
Cflags: -I$includeDir
EOF
prepareInstalledDevelLibs libargon2
fixPkgconfig
packageEntries devel \
$developDir
}
TEST()
{
make OPTTARGET=none test
}

View File

@@ -0,0 +1,22 @@
From 9813da17f3570a093873b6c78dc4d3700b54a429 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Fri, 21 Dec 2018 12:05:48 +0100
Subject: remove -Wextra -Wno-type-limits for the tests (gcc2)
diff --git a/Makefile b/Makefile
index 5a1f551..a040609 100644
--- a/Makefile
+++ b/Makefile
@@ -162,7 +162,7 @@ dist:
tar -c --exclude='.??*' -z -f $(DIST)-`date "+%Y%m%d"`.tgz $(DIST)/*
test: $(SRC) src/test.c
- $(CC) $(CFLAGS) -Wextra -Wno-type-limits $^ -o testcase
+ $(CC) $(CFLAGS) $^ -o testcase
@sh kats/test.sh
./testcase
--
2.19.1

View File

@@ -0,0 +1,55 @@
From 2e078b7a9903f96377a1f7c59f95182518204895 Mon Sep 17 00:00:00 2001
From: Deposite Pirate <dpirate@metalpunks.info>
Date: Thu, 13 Sep 2018 21:33:03 +0200
Subject: Fix building on Haiku
diff --git a/Makefile b/Makefile
index 1e1129f..ea97411 100644
--- a/Makefile
+++ b/Makefile
@@ -30,13 +30,18 @@ SRC_BENCH = src/bench.c
SRC_GENKAT = src/genkat.c
OBJ = $(SRC:.c=.o)
+BUILD_PATH := $(shell pwd)
+KERNEL_NAME := $(shell uname -s)
+
CFLAGS += -std=c89 -O3 -Wall -g -Iinclude -Isrc
ifeq ($(NO_THREADS), 1)
CFLAGS += -DARGON2_NO_THREADS
else
+ifneq ($(KERNEL_NAME), Haiku)
CFLAGS += -pthread
endif
+endif
CI_CFLAGS := $(CFLAGS) -Werror=declaration-after-statement -D_FORTIFY_SOURCE=2 \
-Wextra -Wno-type-limits -Werror -coverage -DTEST_LARGE_RAM
@@ -54,9 +59,6 @@ $(info Building with optimizations for $(OPTTARGET))
SRC += src/opt.c
endif
-BUILD_PATH := $(shell pwd)
-KERNEL_NAME := $(shell uname -s)
-
LIB_NAME=argon2
ifeq ($(KERNEL_NAME), Linux)
LIB_EXT := so.$(ABI_VERSION)
@@ -91,6 +93,12 @@ ifeq ($(KERNEL_NAME), SunOS)
LIB_EXT := so
LIB_CFLAGS := -shared -fPIC
endif
+ifeq ($(KERNEL_NAME), Haiku)
+ LIB_EXT := so.$(ABI_VERSION)
+ LIB_CFLAGS := -shared -fPIC -DA2_VISCTL=1
+ SO_LDFLAGS := -Wl,-soname,lib$(LIB_NAME).$(LIB_EXT)
+ LINKED_LIB_EXT := so
+endif
ifeq ($(KERNEL_NAME), Linux)
ifeq ($(CC), clang)
--
2.19.1