aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_is_enabled.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 /librecrypt_is_enabled.c
parentAdd test and fix a bug (diff)
downloadlibrecrypt-1.1.1.tar.gz
librecrypt-1.1.1.tar.bz2
librecrypt-1.1.1.tar.xz
Add support for the reference implementation of Argon2HEAD1.1.1master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to '')
-rw-r--r--librecrypt_is_enabled.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/librecrypt_is_enabled.c b/librecrypt_is_enabled.c
index 7921075..4b2c40b 100644
--- a/librecrypt_is_enabled.c
+++ b/librecrypt_is_enabled.c
@@ -6,14 +6,14 @@
#define INCLUDE(ALGO, VAL) IF__##ALGO##__SUPPORTED((UINT64_C(1) << (VAL)) |)
static const uint64_t enabled =
- INCLUDE(argon2i, LIBRECRYPT_ARGON2I_V1_0)
- INCLUDE(argon2i, LIBRECRYPT_ARGON2I_V1_3)
- INCLUDE(argon2d, LIBRECRYPT_ARGON2D_V1_0)
- INCLUDE(argon2d, LIBRECRYPT_ARGON2D_V1_3)
- INCLUDE(argon2id, LIBRECRYPT_ARGON2ID_V1_0)
- INCLUDE(argon2id, LIBRECRYPT_ARGON2ID_V1_3)
- INCLUDE(argon2ds, LIBRECRYPT_ARGON2DS_V1_0)
- INCLUDE(argon2ds, LIBRECRYPT_ARGON2DS_V1_3)
+ INCLUDE(argon2i_v1_0, LIBRECRYPT_ARGON2I_V1_0)
+ INCLUDE(argon2i_v1_3, LIBRECRYPT_ARGON2I_V1_3)
+ INCLUDE(argon2d_v1_0, LIBRECRYPT_ARGON2D_V1_0)
+ INCLUDE(argon2d_v1_3, LIBRECRYPT_ARGON2D_V1_3)
+ INCLUDE(argon2id_v1_0, LIBRECRYPT_ARGON2ID_V1_0)
+ INCLUDE(argon2id_v1_3, LIBRECRYPT_ARGON2ID_V1_3)
+ INCLUDE(argon2ds_v1_0, LIBRECRYPT_ARGON2DS_V1_0)
+ INCLUDE(argon2ds_v1_3, LIBRECRYPT_ARGON2DS_V1_3)
UINT64_C(0);
@@ -34,7 +34,11 @@ librecrypt_is_enabled(enum librecrypt_hash_algorithm algo)
/* Version 1.0 and 1.3 of Argon2 are supported in all
* versions of libar2, so there is no need to check
- * libar2_latest_argon2_version*/
+ * libar2_latest_argon2_version. For the reference
+ * implementation of Argon2, the it's algorithms marked
+ * as supported depend on which version of the reference
+ * implementation is used (unfortunately the reference
+ * implementation isn't properly designed as a library). */
return (int)(enabled >> (unsigned)algo) & 1;
}
@@ -66,14 +70,14 @@ main(void)
INIT_RESOURCE_TEST();
CHECK((enum librecrypt_hash_algorithm)-1, 0);
- CHECK(LIBRECRYPT_ARGON2I_V1_0, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2I_V1_3, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2D_V1_0, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2D_V1_3, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2ID_V1_0, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2ID_V1_3, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2DS_V1_0, IF__argon2i__SUPPORTED(1 + ) 0);
- CHECK(LIBRECRYPT_ARGON2DS_V1_3, IF__argon2i__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2I_V1_0, IF__argon2i_v1_0__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2I_V1_3, IF__argon2i_v1_3__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2D_V1_0, IF__argon2d_v1_0__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2D_V1_3, IF__argon2d_v1_3__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2ID_V1_0, IF__argon2id_v1_0__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2ID_V1_3, IF__argon2id_v1_3__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2DS_V1_0, IF__argon2ds_v1_0__SUPPORTED(1 + ) 0);
+ CHECK(LIBRECRYPT_ARGON2DS_V1_3, IF__argon2ds_v1_3__SUPPORTED(1 + ) 0);
assert((enum librecrypt_hash_algorithm)(highest + 1) == LIBRECRYPT_HASH_ALGORITHM_END);
for (i = 0; i < 1024 && highest != INT_MAX; i++)