1
mirror of https://github.com/jedisct1/libsodium.git synced 2024-12-31 22:42:57 -07:00

The occasional absence of braces is disturbing.

This commit is contained in:
Frank Denis 2016-01-15 21:12:34 +01:00
parent 08d3b8a19c
commit 18cc1b5682

View File

@ -293,10 +293,11 @@ int decode_string(argon2_context *ctx, const char *str, argon2_type type) {
ctx->adlen = 0;
ctx->saltlen = 0;
ctx->outlen = 0;
if (type == Argon2_i)
if (type == Argon2_i) {
CC("$argon2i");
else
} else {
return 0;
}
CC("$m=");
DECIMAL(ctx->m_cost);
CC(",t=");
@ -384,11 +385,11 @@ int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
dst_len -= sb_len; \
} while ((void)0, 0)
if (type == Argon2_i)
if (type == Argon2_i) {
SS("$argon2i$m=");
else
} else {
return 0;
}
if (validate_inputs(ctx) != ARGON2_OK) {
return 0;
}
@ -403,15 +404,15 @@ int encode_string(char *dst, size_t dst_len, argon2_context *ctx,
SB(ctx->ad, ctx->adlen);
}
if (ctx->saltlen == 0)
if (ctx->saltlen == 0) {
return 1;
}
SS("$");
SB(ctx->salt, ctx->saltlen);
if (ctx->outlen == 0)
if (ctx->outlen == 0) {
return 1;
}
SS("$");
SB(ctx->out, ctx->outlen);
return 1;