Argon2: fail self tests on context errors

Count argon2_ctx errors as test failures. Previously, failed calls skipped the hash comparison without increasing the failure count.
This commit is contained in:
Mounir IDRASSI committed 2026-10-05 09:27:21 +09:00
1 parent 4f76ff7132
commit ff355d111f
1 file changed
+3 -3
+3 -3
View File
@@ -96,13 +96,13 @@ static int argon2_selftest_ctx (void)
/* Test execution for Argon2d, Argon2i, Argon2id */ /* Test execution for Argon2d, Argon2i, Argon2id */
if (argon2_ctx (&context, Argon2_d) == ARGON2_OK && if (argon2_ctx (&context, Argon2_d) != ARGON2_OK ||
memcmp (hash, ref0d, 32) != 0) err++; memcmp (hash, ref0d, 32) != 0) err++;
if (argon2_ctx (&context, Argon2_i) == ARGON2_OK && if (argon2_ctx (&context, Argon2_i) != ARGON2_OK ||
memcmp (hash, ref0i, 32) != 0) err++; memcmp (hash, ref0i, 32) != 0) err++;
if (argon2_ctx (&context, Argon2_id) == ARGON2_OK && if (argon2_ctx (&context, Argon2_id) != ARGON2_OK ||
memcmp (hash, ref0id, 32) != 0) err++; memcmp (hash, ref0id, 32) != 0) err++;
return err; return err;