Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src Fix release builds with MKARGON2=yes



details:   https://anonhg.NetBSD.org/src/rev/e9c7c2649a90
branches:  trunk
changeset: 989134:e9c7c2649a90
user:      nia <nia%NetBSD.org@localhost>
date:      Tue Oct 12 17:24:36 2021 +0000

description:
Fix release builds with MKARGON2=yes

This changes argon2 from a separately built library into a private
dependency of libcrypt and removes the argon2(1) utility (we already
have pwhash(1)). Giving libcrypt more library dependencies
complicates things (e.g. libcrypt is a dependency of openssl).
pthreads support gets disabled in argon2 for similar reasons.

For testing argon2, we rely on the libcrypt test suite.

diffstat:

 external/apache2/Makefile                       |    6 +-
 external/apache2/argon2/Makefile                |    5 -
 external/apache2/argon2/lib/Makefile            |    3 -
 external/apache2/argon2/lib/libargon2/Makefile  |   22 ---
 external/apache2/argon2/usr.bin/Makefile        |    3 -
 external/apache2/argon2/usr.bin/argon2/Makefile |   17 --
 lib/libcrypt/Makefile                           |   15 +-
 tests/usr.bin/Makefile                          |    6 +-
 tests/usr.bin/argon2/Makefile                   |    8 -
 tests/usr.bin/argon2/t_argon2.sh                |  149 ------------------------
 usr.bin/pwhash/pwhash.1                         |   13 +-
 11 files changed, 22 insertions(+), 225 deletions(-)

diffs (truncated from 328 to 300 lines):

diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/Makefile
--- a/external/apache2/Makefile Tue Oct 12 17:19:20 2021 +0000
+++ b/external/apache2/Makefile Tue Oct 12 17:24:36 2021 +0000
@@ -1,11 +1,7 @@
-#      $NetBSD: Makefile,v 1.3 2019/11/11 22:44:57 joerg Exp $
+#      $NetBSD: Makefile,v 1.4 2021/10/12 17:24:36 nia Exp $
 
 .include <bsd.own.mk>
 
-.if (defined(MKARGON2) && ${MKARGON2} != "no")
-SUBDIR+= argon2
-.endif
-
 .if (${MKLLVM} != "no" || ${MKLLVMRT} != "no")
 SUBDIR+= llvm
 .endif
diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/argon2/Makefile
--- a/external/apache2/argon2/Makefile  Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,5 +0,0 @@
-.include <bsd.own.mk>
-
-SUBDIR= lib .WAIT usr.bin
-
-.include <bsd.subdir.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/argon2/lib/Makefile
--- a/external/apache2/argon2/lib/Makefile      Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-SUBDIR=         libargon2
-
-.include <bsd.subdir.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/argon2/lib/libargon2/Makefile
--- a/external/apache2/argon2/lib/libargon2/Makefile    Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-USE_SHLIBDIR=  yes
-SHLIB_MAJOR=  1
-SHLIB_MINOR=  0
-
-#DIST=../../dist/phc-winner-argon2
-
-.PATH: ../../dist/phc-winner-argon2/src ../../dist/phc-winner-argon2/src/blake2 ../../dist/phc-winner-argon2/include
-
-INCS=          argon2.h
-INCSDIR=       /usr/include
-
-LIB=   argon2  
-SRCS=  argon2.c core.c blake2b.c thread.c encoding.c ref.c
-
-CPPFLAGS= -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc -fPIC -DARGON2_NO_THREADS
-
-OPTTARGET ?= native
-OPTTEST := $(shell $(CC) -Iinclude -Isrc -march=$(OPTTARGET) src/opt.c -c \
-                        -o /dev/null 2>/dev/null; echo $$?)
-
-install:       all incinstall
-.include <bsd.lib.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/argon2/usr.bin/Makefile
--- a/external/apache2/argon2/usr.bin/Makefile  Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,3 +0,0 @@
-SUBDIR=         argon2
-
-.include <bsd.subdir.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 external/apache2/argon2/usr.bin/argon2/Makefile
--- a/external/apache2/argon2/usr.bin/argon2/Makefile   Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-PROG=   argon2
-
-.include <bsd.init.mk>
-
-BINDIR?=        /usr/bin
-
-.PATH:  ../../dist/phc-winner-argon2/src ../../dist/phc-winner-argon2/src/blake2 ../../dist/phc-winner-argon2/man
-
-SRCS=
-SRCS=   argon2.c core.c blake2b.c thread.c encoding.c ref.c
-SRCS+=   run.c
-
-CPPFLAGS+= -DARGON2_NO_THREADS -std=c89 -O3 -Wall -g -I../../dist/phc-winner-argon2/include -Isrc 
-
-MAN=argon2.1
-
-.include <bsd.prog.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 lib/libcrypt/Makefile
--- a/lib/libcrypt/Makefile     Tue Oct 12 17:19:20 2021 +0000
+++ b/lib/libcrypt/Makefile     Tue Oct 12 17:24:36 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.27 2020/03/25 17:11:06 christos Exp $
+#      $NetBSD: Makefile,v 1.28 2021/10/12 17:24:36 nia Exp $
 
 .include <bsd.own.mk>
 
@@ -14,9 +14,18 @@
 SRCS+= hmac_sha1.c
 
 .if defined(HAVE_ARGON2)
+ARGON2DIR=     ${NETBSDSRCDIR}/external/apache2/argon2
+.PATH: ${ARGON2DIR}/dist/phc-winner-argon2/src \
+       ${ARGON2DIR}/dist/phc-winner-argon2/src/blake2 \
+       ${ARGON2DIR}/dist/phc-winner-argon2/include
+CPPFLAGS+=     -DHAVE_ARGON2 -DARGON2_NO_THREADS
+CPPFLAGS+=     -I${ARGON2DIR}/dist/phc-winner-argon2/include
 SRCS+=         crypt-argon2.c
-CFLAGS+=       -DHAVE_ARGON2 -I../../external/apache2/argon2/dist/phc-winner-argon2/include/
-LDADD+=                -largon2 
+# libargon2 sources
+.  for src in argon2.c core.c blake2b.c encoding.c ref.c
+SRCS+=         ${src}
+COPTS.${src}+= -Wno-error
+.  endfor
 .endif
 
 WARNS?=        5
diff -r 7d5b2f936ae2 -r e9c7c2649a90 tests/usr.bin/Makefile
--- a/tests/usr.bin/Makefile    Tue Oct 12 17:19:20 2021 +0000
+++ b/tests/usr.bin/Makefile    Tue Oct 12 17:24:36 2021 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.34 2020/11/01 22:28:32 christos Exp $
+#      $NetBSD: Makefile,v 1.35 2021/10/12 17:24:36 nia Exp $
 #
 
 .include <bsd.own.mk>
@@ -16,8 +16,4 @@
 TESTS_SUBDIRS+=        c++
 .endif
 
-.if (defined(MKARGON2) && ${MKARGON2} != "no")
-TESTS_SUBDIRS+=        argon2
-.endif
-
 .include <bsd.test.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 tests/usr.bin/argon2/Makefile
--- a/tests/usr.bin/argon2/Makefile     Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-# $NetBSD: Makefile,v 1.1 2019/10/14 03:47:20 jhigh Exp $
-
-.include <bsd.own.mk>
-
-TESTSDIR=      ${TESTSBASE}/usr.bin/argon2
-TESTS_SH=      t_argon2
-
-.include <bsd.test.mk>
diff -r 7d5b2f936ae2 -r e9c7c2649a90 tests/usr.bin/argon2/t_argon2.sh
--- a/tests/usr.bin/argon2/t_argon2.sh  Tue Oct 12 17:19:20 2021 +0000
+++ /dev/null   Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-atf_test_case argon2_argon2id 
-argon2_argon2id_head() {
-       atf_set "descr" "ATF test for argon2 argon2id variant"
-}
-
-argon2_argon2id_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$" -x \
-               'echo -n 'password' | argon2 somesalt -e -id'
-}
-
-atf_test_case argon2_argon2i
-argon2_argon2i_head() {
-       atf_set "descr" "ATF test for argon2 argon2i variant"
-}
-
-argon2_argon2i_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$" -x \
-               'echo -n 'password' | argon2 somesalt -e -i'
-}
-
-atf_test_case argon2_argon2d
-argon2_argon2d_head() {
-       atf_set "descr" "ATF test for argon2 argon2d variant"
-}
-
-argon2_argon2d_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$" -x \
-               'echo -n 'password' | argon2 somesalt -e -d'
-}
-
-atf_test_case argon2_argon2id_k2096_p2_t3
-argon2_argon2id_k2096_p2_head() {
-       atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=2,t=3 "
-}
-
-argon2_argon2id_k2096_p2_t3_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=19\\\$m=2096,t=3,p=2" -x \
-               'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 2 -t 3'
-}
-
-atf_test_case argon2_argon2i_k2096_p1_t4
-argon2_argon2i_k2096_p1_t4_head() {
-       atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,t=4 "
-}
-
-argon2_argon2i_k2096_p1_t4_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=19\\\$m=2096,t=4,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -t 4'
-}
-
-atf_test_case argon2_argon2d_k2096_p2_t4
-argon2_argon2d_k2096_p2_t4_head() {
-       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=2,t=4"
-}
-
-argon2_argon2d_k2096_p2_t4_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=19\\\$m=2096,t=4,p=2" -x \
-               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 2 -t 4'
-}
-
-atf_test_case argon2_argon2id_k2096_p1_v10
-argon2_argon2id_k2096_p1_v10_head() {
-       atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=1,v=10"
-}
-argon2_argon2id_k2096_p1_v10_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=16\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 1 -v 10'
-}
-
-atf_test_case argon2_argon2id_k2096_p1_v13
-argon2_argon2id_k2096_p1_v13_head() {
-       atf_set "descr" "ATF test for argon2 argon2id,k=2096,p=1,v=13"
-}
-argon2_argon2id_k2096_p1_v13_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2id\\\$v=19\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -id -k 2096 -p 1 -v 13'
-}
-
-atf_test_case argon2_argon2i_k2096_p1_v10
-argon2_argon2i_k2096_p1_v10_head() {
-       atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,v=10"
-}
-argon2_argon2i_k2096_p1_v10_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=16\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -v 10'
-}
-
-atf_test_case argon2_argon2i_k2096_p1_v13
-argon2_argon2i_k2096_p1_v13_head() {
-       atf_set "descr" "ATF test for argon2 argon2i,k=2096,p=1,v=13"
-}
-argon2_argon2i_k2096_p1_v13_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2i\\\$v=19\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -i -k 2096 -p 1 -v 13'
-}
-
-atf_test_case argon2_argon2d_k2096_p1_v10
-argon2_argon2d_k2096_p1_v10_head() {
-       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1,v=10"
-}
-argon2_argon2d_k2096_p1_v10_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=16\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 10'
-}
-
-atf_test_case argon2_argon2d_k2096_p1_v13
-argon2_argon2d_k2096_p1_v13_head() {
-       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1,v=13"
-}
-argon2_argon2d_k2096_p1_v13_body() {
-       atf_check -s exit:0 -o match:"^\\\$argon2d\\\$v=19\\\$m=2096,t=3,p=1" -x \
-               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 13'
-}
-
-atf_test_case argon2_argon2id_k2096_p1_v19_inver
-argon2_argon2id_k2096_p1_v19_inver_head() {
-       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 invalid version specification"
-}
-argon2_argon2id_k2096_p1_v19_inver_body() {
-       atf_check -s exit:1 -e match:"Error: invalid Argon2 version" -x \
-               'echo -n 'password' | argon2 somesalt -e -d -k 2096 -p 1 -v 19'
-}
-
-atf_test_case argon2_argon2id_k2096_p1_sts
-argon2_argon2id_k2096_p1_sts_head() {
-       atf_set "descr" "ATF test for argon2 argon2d,k=2096,p=1 salt too short"
-}
-argon2_argon2id_k2096_p1_sts_body() {
-       atf_check -s exit:1 -e match:"Error: Salt is too short" -x \
-               'echo -n 'password' | argon2 tshort -e -d -k 2096 -p 1'
-}
-
-atf_init_test_cases()
-{
-       atf_add_test_case argon2_argon2id
-       atf_add_test_case argon2_argon2i
-       atf_add_test_case argon2_argon2d
-       atf_add_test_case argon2_argon2id_k2096_p2_t3
-       atf_add_test_case argon2_argon2i_k2096_p1_t4
-       atf_add_test_case argon2_argon2d_k2096_p2_t4
-       atf_add_test_case argon2_argon2id_k2096_p1_v10
-       atf_add_test_case argon2_argon2id_k2096_p1_v13
-       atf_add_test_case argon2_argon2i_k2096_p1_v10
-       atf_add_test_case argon2_argon2i_k2096_p1_v13
-       atf_add_test_case argon2_argon2d_k2096_p1_v10
-       atf_add_test_case argon2_argon2d_k2096_p1_v13
-       atf_add_test_case argon2_argon2id_k2096_p1_v19_inver
-       atf_add_test_case argon2_argon2id_k2096_p1_sts
-}
diff -r 7d5b2f936ae2 -r e9c7c2649a90 usr.bin/pwhash/pwhash.1



Home | Main Index | Thread Index | Old Index