From dd51444fe8f2b813d7bd6435b59185e43363205b Mon Sep 17 00:00:00 2001 From: Mario Preksavec Date: Wed, 9 Aug 2017 00:39:45 +0100 Subject: [PATCH] libraries/argon2: Added (password-hashing function). Signed-off-by: David Spencer --- libraries/argon2/README | 11 +++ libraries/argon2/argon2.SlackBuild | 95 +++++++++++++++++++++++++ libraries/argon2/argon2.info | 10 +++ libraries/argon2/patches/Makefile.diff | 11 +++ libraries/argon2/patches/pkgconfig.diff | 21 ++++++ libraries/argon2/slack-desc | 19 +++++ 6 files changed, 167 insertions(+) create mode 100644 libraries/argon2/README create mode 100644 libraries/argon2/argon2.SlackBuild create mode 100644 libraries/argon2/argon2.info create mode 100644 libraries/argon2/patches/Makefile.diff create mode 100644 libraries/argon2/patches/pkgconfig.diff create mode 100644 libraries/argon2/slack-desc diff --git a/libraries/argon2/README b/libraries/argon2/README new file mode 100644 index 0000000000..d4460f624c --- /dev/null +++ b/libraries/argon2/README @@ -0,0 +1,11 @@ +This is the reference C implementation of Argon2, the password-hashing +function that won the Password Hashing Competition (PHC). + +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. + +It has a simple design aimed at the highest memory filling rate and effective +use of multiple computing units, while still providing defense against +tradeoff attacks (by exploiting the cache and memory organization of the +recent processors). diff --git a/libraries/argon2/argon2.SlackBuild b/libraries/argon2/argon2.SlackBuild new file mode 100644 index 0000000000..a72688156e --- /dev/null +++ b/libraries/argon2/argon2.SlackBuild @@ -0,0 +1,95 @@ +#!/bin/sh + +# Slackware build script for argon2 + +# Copyright 2017 Mario Preksavec, Zagreb, Croatia +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=argon2 +VERSION=${VERSION:-20170329_1eea010} +SRCNAM=phc-winner-argon2 +COMMIT=${COMMIT:-1eea0104e7cb2a38c617cf90ffa46ce5db6aceda} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + LIBDIRSUFFIX="64" +else + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $SRCNAM-COMMIT +tar xvf $CWD/$SRCNAM-$COMMIT.tar.gz +cd $SRCNAM-$COMMIT +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +sed -e "s|@@LIBDIRSUFFIX@@|$LIBDIRSUFFIX|" \ + -e "s|@@VERSION@@|$VERSION|" $CWD/patches/pkgconfig.diff | patch -p1 + +sed -e "s|@@LIBDIRSUFFIX@@|$LIBDIRSUFFIX|" $CWD/patches/Makefile.diff | patch -p1 + +make libs DESTDIR=$PKG +make install DESTDIR=$PKG + +install -Dm644 man/$PRGNAM.1 $PKG/usr/man/man1/$PRGNAM.1 +install -Dm644 lib$PRGNAM.pc $PKG/usr/lib$LIBDIRSUFFIX/pkgconfig/lib$PRGNAM.pc + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \ + | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +find $PKG/usr/man -type f -exec gzip -9 {} \; +for i in $( find $PKG/usr/man -type l ) ; do ln -s $( readlink $i ).gz $i.gz ; rm $i ; done + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README.md argon2-specs.pdf $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/libraries/argon2/argon2.info b/libraries/argon2/argon2.info new file mode 100644 index 0000000000..860af64a39 --- /dev/null +++ b/libraries/argon2/argon2.info @@ -0,0 +1,10 @@ +PRGNAM="argon2" +VERSION="20170329_1eea010" +HOMEPAGE="https://github.com/P-H-C/phc-winner-argon2/" +DOWNLOAD="https://github.com/P-H-C/phc-winner-argon2/archive/1eea010/phc-winner-argon2-1eea0104e7cb2a38c617cf90ffa46ce5db6aceda.tar.gz" +MD5SUM="c65e2070180a65c34db7190a6a932f3c" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="" +MAINTAINER="Mario Preksavec" +EMAIL="mario at slackware dot hr" diff --git a/libraries/argon2/patches/Makefile.diff b/libraries/argon2/patches/Makefile.diff new file mode 100644 index 0000000000..42506d23dd --- /dev/null +++ b/libraries/argon2/patches/Makefile.diff @@ -0,0 +1,11 @@ +--- argon2-20170329_1eea010/Makefile.orig 2017-03-29 00:44:20.000000000 +0200 ++++ argon2-20170329_1eea010/Makefile 2017-08-01 14:01:49.766250175 +0200 +@@ -114,7 +114,7 @@ + DESTDIR = + PREFIX = /usr + INCLUDE_REL = include +-LIBRARY_REL = lib ++LIBRARY_REL = lib@@LIBDIRSUFFIX@@ + BINARY_REL = bin + + INST_INCLUDE = $(DESTDIR)$(PREFIX)/$(INCLUDE_REL) diff --git a/libraries/argon2/patches/pkgconfig.diff b/libraries/argon2/patches/pkgconfig.diff new file mode 100644 index 0000000000..807de8045e --- /dev/null +++ b/libraries/argon2/patches/pkgconfig.diff @@ -0,0 +1,21 @@ +--- argon2-20170329_1eea010/libargon2.pc.orig 2017-03-29 00:44:20.000000000 +0200 ++++ argon2-20170329_1eea010/libargon2.pc 2017-08-01 13:47:25.874580099 +0200 +@@ -1,16 +1,11 @@ +-# libargon2 info for pkg-config +-## Template for downstream installers: +-## - replace @HOST_MULTIARCH@ with target arch, eg 'x86_64-linux-gnu' +-## - replace @UPSTREAM_VER@ with current version, eg '20160406' +- + prefix=/usr + exec_prefix=${prefix} +-libdir=${prefix}/lib/@HOST_MULTIARCH@ ++libdir=${prefix}/lib@@LIBDIRSUFFIX@@ + includedir=${prefix}/include + + Name: libargon2 + Description: Development libraries for libargon2 +-Version: @UPSTREAM_VER@ ++Version: @@VERSION@@ + Libs: -L${libdir} -largon2 -lrt -ldl + Cflags: + URL: https://github.com/P-H-C/phc-winner-argon2 diff --git a/libraries/argon2/slack-desc b/libraries/argon2/slack-desc new file mode 100644 index 0000000000..0be295ca69 --- /dev/null +++ b/libraries/argon2/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +argon2: argon2 (password-hashing function) +argon2: +argon2: Argon2 is a password-hashing function that summarizes the state of +argon2: the art in the design of memory-hard functions and can be used to +argon2: hash passwords for credential storage, key derivation, or other +argon2: applications. +argon2: +argon2: Homepage: https://github.com/P-H-C/phc-winner-argon2/ +argon2: +argon2: +argon2: