diff --git a/src/libsodium/crypto_pwhash/argon2/argon2.c b/src/libsodium/crypto_pwhash/argon2/argon2.c index 630cb1eb..573148dd 100644 --- a/src/libsodium/crypto_pwhash/argon2/argon2.c +++ b/src/libsodium/crypto_pwhash/argon2/argon2.c @@ -223,14 +223,12 @@ int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen, free(ctx.salt); if (ret != ARGON2_OK || sodium_memcmp(out, ctx.out, ctx.outlen) != 0) { - free(out); - free(ctx.out); - return ARGON2_DECODING_FAIL; + ret = ARGON2_VERIFY_MISMATCH; } free(out); free(ctx.out); - return ARGON2_OK; + return ret; } int argon2i_verify(const char *encoded, const void *pwd, const size_t pwdlen) { diff --git a/src/libsodium/crypto_pwhash/argon2/argon2.h b/src/libsodium/crypto_pwhash/argon2/argon2.h index 6fad2302..2efa754a 100644 --- a/src/libsodium/crypto_pwhash/argon2/argon2.h +++ b/src/libsodium/crypto_pwhash/argon2/argon2.h @@ -123,6 +123,12 @@ typedef enum Argon2_ErrorCodes { ARGON2_DECODING_FAIL = 32, + ARGON2_THREAD_FAIL = 33, + + ARGON2_DECODING_LENGTH_FAIL = 34, + + ARGON2_VERIFY_MISMATCH = 35, + ARGON2_ERROR_CODES_LENGTH /* Do NOT remove; Do NOT add error codes after this error code */