Skip to content

Commit 2aae3df

Browse files
committed
Implement Argon2 backend (all flavours) and tests.
1 parent f052cca commit 2aae3df

25 files changed

+2293
-258
lines changed

.github/workflows/config-matrix.yml

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ jobs:
5151

5252
# Configurations with only one hash enabled. These exist to
5353
# detect build failures due to incorrect ifdeffage.
54+
- "--disable-obsolete-api --enable-hashes=argon2d"
55+
- "--disable-obsolete-api --enable-hashes=argon2i"
56+
- "--disable-obsolete-api --enable-hashes=argon2id"
5457
- "--disable-obsolete-api --enable-hashes=bcrypt"
5558
- "--disable-obsolete-api --enable-hashes=bcrypt_a"
5659
- "--disable-obsolete-api --enable-hashes=bcrypt_x"

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
/libcrypt.map
4848
/libcrypt.map.stamp
4949
gen-des-tables
50+
test/alg-argon2
5051
test/alg-blake2b
5152
test/alg-des
5253
test/alg-gost3411-2012
@@ -90,6 +91,9 @@ test/gensalt-nthash
9091
test/gensalt-extradata
9192
test/getrandom-fallbacks
9293
test/getrandom-interface
94+
test/ka-argon2d
95+
test/ka-argon2i
96+
test/ka-argon2id
9397
test/ka-bcrypt
9498
test/ka-bcrypt-a
9599
test/ka-bcrypt-x

Makefile.am

+34
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ nodist_noinst_HEADERS = \
6868
crypt-hashes.h \
6969
crypt-symbol-vers.h
7070
noinst_HEADERS = \
71+
lib/alg-argon2.h \
72+
lib/alg-argon2-blamka.h \
73+
lib/alg-argon2-core.h \
74+
lib/alg-argon2-encoding.h \
75+
lib/alg-argon2-renames.h \
76+
lib/alg-argon2-thread.h \
7177
lib/alg-blake2b.h \
7278
lib/alg-des.h \
7379
lib/alg-gost3411-2012-const.h \
@@ -101,6 +107,11 @@ lib_LTLIBRARIES = \
101107
libcrypt.la
102108

103109
libcrypt_la_SOURCES = \
110+
lib/alg-argon2.c \
111+
lib/alg-argon2-core.c \
112+
lib/alg-argon2-encoding.c \
113+
lib/alg-argon2-ref.c \
114+
lib/alg-argon2-thread.c \
104115
lib/alg-blake2b.c \
105116
lib/alg-des-tables.c \
106117
lib/alg-des.c \
@@ -116,6 +127,7 @@ libcrypt_la_SOURCES = \
116127
lib/alg-sm3-hmac.c \
117128
lib/alg-yescrypt-common.c \
118129
lib/alg-yescrypt-opt.c \
130+
lib/crypt-argon2.c \
119131
lib/crypt-bcrypt.c \
120132
lib/crypt-des.c \
121133
lib/crypt-gensalt-static.c \
@@ -349,6 +361,9 @@ endif
349361
# The list should otherwise be kept in alphabetical order.
350362

351363
check_PROGRAMS = \
364+
test/ka-argon2d \
365+
test/ka-argon2i \
366+
test/ka-argon2id \
352367
test/ka-bcrypt \
353368
test/ka-bcrypt-a \
354369
test/ka-bcrypt-x \
@@ -367,6 +382,7 @@ check_PROGRAMS = \
367382
test/ka-sm3-yescrypt \
368383
test/ka-sunmd5 \
369384
test/ka-yescrypt \
385+
test/alg-argon2 \
370386
test/alg-blake2b \
371387
test/alg-des \
372388
test/alg-gost3411-2012 \
@@ -401,6 +417,9 @@ check_PROGRAMS = \
401417

402418
# All of the known-answer tests are compiled from the same source file,
403419
# with different macros defined.
420+
test_ka_argon2d_SOURCES = test/ka-tester.c
421+
test_ka_argon2i_SOURCES = test/ka-tester.c
422+
test_ka_argon2id_SOURCES = test/ka-tester.c
404423
test_ka_bcrypt_SOURCES = test/ka-tester.c
405424
test_ka_bcrypt_a_SOURCES = test/ka-tester.c
406425
test_ka_bcrypt_x_SOURCES = test/ka-tester.c
@@ -420,6 +439,9 @@ test_ka_sm3_yescrypt_SOURCES = test/ka-tester.c
420439
test_ka_sunmd5_SOURCES = test/ka-tester.c
421440
test_ka_yescrypt_SOURCES = test/ka-tester.c
422441

442+
test_ka_argon2d_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_argon2d
443+
test_ka_argon2i_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_argon2i
444+
test_ka_argon2id_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_argon2id
423445
test_ka_bcrypt_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_bcrypt
424446
test_ka_bcrypt_a_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_bcrypt_a
425447
test_ka_bcrypt_x_CPPFLAGS = $(AM_CPPFLAGS) -DTEST_bcrypt_x
@@ -510,6 +532,9 @@ test_short_outbuf_LDADD = $(COMMON_TEST_OBJECTS)
510532
test_preferred_method_LDADD = $(COMMON_TEST_OBJECTS)
511533
test_special_char_salt_LDADD = $(COMMON_TEST_OBJECTS)
512534

535+
test_ka_argon2d_LDADD = $(COMMON_TEST_OBJECTS)
536+
test_ka_argon2i_LDADD = $(COMMON_TEST_OBJECTS)
537+
test_ka_argon2id_LDADD = $(COMMON_TEST_OBJECTS)
513538
test_ka_bcrypt_LDADD = $(COMMON_TEST_OBJECTS)
514539
test_ka_bcrypt_a_LDADD = $(COMMON_TEST_OBJECTS)
515540
test_ka_bcrypt_x_LDADD = $(COMMON_TEST_OBJECTS)
@@ -537,6 +562,15 @@ test_ka_yescrypt_LDADD = $(COMMON_TEST_OBJECTS)
537562
test_gensalt_LDADD = \
538563
lib/libcrypt_la-util-xstrcpy.lo \
539564
$(COMMON_TEST_OBJECTS)
565+
test_alg_argon2_LDADD = \
566+
lib/libcrypt_la-alg-argon2.lo \
567+
lib/libcrypt_la-alg-argon2-core.lo \
568+
lib/libcrypt_la-alg-argon2-encoding.lo \
569+
lib/libcrypt_la-alg-argon2-ref.lo \
570+
lib/libcrypt_la-alg-argon2-thread.lo \
571+
lib/libcrypt_la-alg-blake2b.lo \
572+
lib/libcrypt_la-util-xbzero.lo
573+
# $(COMMON_TEST_OBJECTS)
540574
test_alg_blake2b_LDADD = \
541575
lib/libcrypt_la-alg-blake2b.lo \
542576
lib/libcrypt_la-util-xbzero.lo \

0 commit comments

Comments
 (0)