Argon2: initialize ctx{.pwd,.pwdlen} in the verify function

Keep initializing the length for clarity;
Compilers know how to optimize this out.
This commit is contained in:
Frank Denis 2016-04-07 08:05:15 +02:00
parent 2e7247d8b1
commit 292969b3b5
2 changed files with 2 additions and 1 deletions

View File

@ -299,7 +299,6 @@ int decode_string(argon2_context *ctx, const char *str, argon2_type type) {
ctx->adlen = 0;
ctx->saltlen = 0;
ctx->outlen = 0;
ctx->pwdlen = 0;
if (type == Argon2_i) {
CC("$argon2i");
} else {

View File

@ -183,6 +183,8 @@ int argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen,
memset(&ctx, 0, sizeof ctx);
ctx.pwd = NULL;
ctx.pwdlen = 0;
ctx.secret = NULL;
ctx.secretlen = 0;