aboutsummaryrefslogtreecommitdiffstats
path: root/argon2/test_supported.c
diff options
context:
space:
mode:
authorMattias Andrée <m@maandree.se>2026-07-01 21:37:09 +0200
committerMattias Andrée <m@maandree.se>2026-07-01 21:37:09 +0200
commit1323b81cd2679bb61a480524a0e4cd008d3d0bee (patch)
treed7fc0c3417b6ae7a1688cddd8ce3a9607ec53dd7 /argon2/test_supported.c
parentAdd test and fix a bug (diff)
downloadlibrecrypt-1323b81cd2679bb61a480524a0e4cd008d3d0bee.tar.gz
librecrypt-1323b81cd2679bb61a480524a0e4cd008d3d0bee.tar.bz2
librecrypt-1323b81cd2679bb61a480524a0e4cd008d3d0bee.tar.xz
Add support for the reference implementation of Argon2HEAD1.1.1master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'argon2/test_supported.c')
-rw-r--r--argon2/test_supported.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/argon2/test_supported.c b/argon2/test_supported.c
index cad7794..32aa5fd 100644
--- a/argon2/test_supported.c
+++ b/argon2/test_supported.c
@@ -2,8 +2,6 @@
#include "../common.h"
#ifndef TEST
-#include <libar2.h>
-
#define RANGE(MIN, MAX) (uintmax_t)(MIN), (uintmax_t)(MAX)
#define BASE64 librecrypt_common_rfc4848s4_decoding_lut_, argon2__PAD, argon2__STRICT_PAD
@@ -12,6 +10,7 @@
int
librecrypt__argon2__test_supported(const char *phrase, size_t len, int text, const char *settings, size_t prefix, size_t *len_out)
{
+ const char *version;
uintmax_t hashlen;
int r;
@@ -21,8 +20,8 @@ librecrypt__argon2__test_supported(const char *phrase, size_t len, int text, con
/* Validate string format and parameters */
r = librecrypt_scan_settings(settings, prefix,
- "$%*$%sm=%p,t=%p,p=%p$%b$%^h",
- "v=16$", "v=19$", "", NULL,
+ "$%*$%^sm=%p,t=%p,p=%p$%b$%^h",
+ &version, "v=16$", "v=19$", "", NULL,
RANGE(LIBAR2_MIN_M_COST, LIBAR2_MAX_M_COST),
RANGE(LIBAR2_MIN_T_COST, LIBAR2_MAX_T_COST),
RANGE(LIBAR2_MIN_LANES, LIBAR2_MAX_LANES),
@@ -31,6 +30,12 @@ librecrypt__argon2__test_supported(const char *phrase, size_t len, int text, con
if (!r)
return 0;
+ /* Check compatibility with library support */
+#if !defined(SUPPORT_ARGON2_V1_3)
+ if (!strcmp(version, "v=19$"))
+ return 0;
+#endif
+
/* Return hash size */
if (!hashlen)
hashlen = argon2__HASH_SIZE;