aboutsummaryrefslogtreecommitdiffstats
path: root/librecrypt_get_pepper_.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_get_pepper_.c
parentAdd test and fix a bug (diff)
downloadlibrecrypt-3b7ce5adbb2373f3fcd80d5e3593a4900efa7125.tar.gz
librecrypt-3b7ce5adbb2373f3fcd80d5e3593a4900efa7125.tar.bz2
librecrypt-3b7ce5adbb2373f3fcd80d5e3593a4900efa7125.tar.xz
Add support for the reference implementation of Argon2HEAD1.1.1master
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'librecrypt_get_pepper_.c')
-rw-r--r--librecrypt_get_pepper_.c56
1 files changed, 32 insertions, 24 deletions
diff --git a/librecrypt_get_pepper_.c b/librecrypt_get_pepper_.c
index df2a82d..2d306dd 100644
--- a/librecrypt_get_pepper_.c
+++ b/librecrypt_get_pepper_.c
@@ -14,22 +14,14 @@ librecrypt_get_pepper_(LIBRECRYPT_CONTEXT *ctx, enum librecrypt_hash_algorithm a
switch (algo) {
#if defined(SUPPORT_ARGON2I) || defined(SUPPORT_ARGON2D) || defined(SUPPORT_ARGON2ID) || defined(SUPPORT_ARGON2DS)
-# if defined(SUPPORT_ARGON2I)
- case LIBRECRYPT_ARGON2I_V1_0:
- case LIBRECRYPT_ARGON2I_V1_3:
-# endif
-# if defined(SUPPORT_ARGON2D)
- case LIBRECRYPT_ARGON2D_V1_0:
- case LIBRECRYPT_ARGON2D_V1_3:
-# endif
-# if defined(SUPPORT_ARGON2ID)
- case LIBRECRYPT_ARGON2ID_V1_0:
- case LIBRECRYPT_ARGON2ID_V1_3:
-# endif
-# if defined(SUPPORT_ARGON2DS)
- case LIBRECRYPT_ARGON2DS_V1_0:
- case LIBRECRYPT_ARGON2DS_V1_3:
-# endif
+ IF__argon2i_v1_0__SUPPORTED(case LIBRECRYPT_ARGON2I_V1_0:)
+ IF__argon2i_v1_3__SUPPORTED(case LIBRECRYPT_ARGON2I_V1_3:)
+ IF__argon2d_v1_0__SUPPORTED(case LIBRECRYPT_ARGON2D_V1_0:)
+ IF__argon2d_v1_3__SUPPORTED(case LIBRECRYPT_ARGON2D_V1_3:)
+ IF__argon2id_v1_0__SUPPORTED(case LIBRECRYPT_ARGON2ID_V1_0:)
+ IF__argon2id_v1_3__SUPPORTED(case LIBRECRYPT_ARGON2ID_V1_3:)
+ IF__argon2ds_v1_0__SUPPORTED(case LIBRECRYPT_ARGON2DS_V1_0:)
+ IF__argon2ds_v1_3__SUPPORTED(case LIBRECRYPT_ARGON2DS_V1_3:)
# if SIZE_MAX > UINT32_MAX /* LIBAR2_MAX_KEYLEN is just UINT32_MAX cast to size_t; keep it simple: don't include <libar2.h> */
if (len > UINT32_MAX) {
errno = EINVAL;
@@ -106,35 +98,51 @@ main(void)
ctx = librecrypt_create_context();
assert(ctx != NULL);
-#if defined(SUPPORT_ARGON2I)
+#if defined(SUPPORT_ARGON2I) && defined(SUPPORT_ARGON2_V1_0)
CHECK_ARGON2(LIBRECRYPT_ARGON2I_V1_0);
- CHECK_ARGON2(LIBRECRYPT_ARGON2I_V1_3);
#else
CHECK_DISABLED(LIBRECRYPT_ARGON2I_V1_0);
+#endif
+
+#if defined(SUPPORT_ARGON2I) && defined(SUPPORT_ARGON2_V1_3)
+ CHECK_ARGON2(LIBRECRYPT_ARGON2I_V1_3);
+#else
CHECK_DISABLED(LIBRECRYPT_ARGON2I_V1_3);
#endif
-#if defined(SUPPORT_ARGON2D)
+#if defined(SUPPORT_ARGON2D) && defined(SUPPORT_ARGON2_V1_0)
CHECK_ARGON2(LIBRECRYPT_ARGON2D_V1_0);
- CHECK_ARGON2(LIBRECRYPT_ARGON2D_V1_3);
#else
CHECK_DISABLED(LIBRECRYPT_ARGON2D_V1_0);
+#endif
+
+#if defined(SUPPORT_ARGON2D) && defined(SUPPORT_ARGON2_V1_3)
+ CHECK_ARGON2(LIBRECRYPT_ARGON2D_V1_3);
+#else
CHECK_DISABLED(LIBRECRYPT_ARGON2D_V1_3);
#endif
-#if defined(SUPPORT_ARGON2ID)
+#if defined(SUPPORT_ARGON2ID) && defined(SUPPORT_ARGON2_V1_0)
CHECK_ARGON2(LIBRECRYPT_ARGON2ID_V1_0);
- CHECK_ARGON2(LIBRECRYPT_ARGON2ID_V1_3);
#else
CHECK_DISABLED(LIBRECRYPT_ARGON2ID_V1_0);
+#endif
+
+#if defined(SUPPORT_ARGON2ID) && defined(SUPPORT_ARGON2_V1_3)
+ CHECK_ARGON2(LIBRECRYPT_ARGON2ID_V1_3);
+#else
CHECK_DISABLED(LIBRECRYPT_ARGON2ID_V1_3);
#endif
-#if defined(SUPPORT_ARGON2DS)
+#if defined(SUPPORT_ARGON2DS) && defined(SUPPORT_ARGON2_V1_0)
CHECK_ARGON2(LIBRECRYPT_ARGON2DS_V1_0);
- CHECK_ARGON2(LIBRECRYPT_ARGON2DS_V1_3);
#else
CHECK_DISABLED(LIBRECRYPT_ARGON2DS_V1_0);
+#endif
+
+#if defined(SUPPORT_ARGON2DS) && defined(SUPPORT_ARGON2_V1_3)
+ CHECK_ARGON2(LIBRECRYPT_ARGON2DS_V1_3);
+#else
CHECK_DISABLED(LIBRECRYPT_ARGON2DS_V1_3);
#endif