Argon2: issue different error codes for VERIFY_MISMATCH and DECODING_FAIL
Only used internally, not exposed in the Sodium API
This commit is contained in:
parent
80d24c00cc
commit
ecdcfba07e
@ -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) {
|
||||
|
@ -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 */
|
||||
|
Loading…
Reference in New Issue
Block a user