aboutsummaryrefslogtreecommitdiffstats
path: root/argon2/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'argon2/hash.c')
-rw-r--r--argon2/hash.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/argon2/hash.c b/argon2/hash.c
index 313eea0..fd4609a 100644
--- a/argon2/hash.c
+++ b/argon2/hash.c
@@ -125,7 +125,7 @@ librecrypt__argon2__hash(char *restrict out_buffer, size_t size, const char *phr
if (libar2_hash(scratch ? scratch : out_buffer, REMOVE_CONST(phrase), len, &params, &ctx))
goto fail;
if (scratch && out_buffer)
- memcpy(out_buffer, scratch, params.hashlen < size ? params.hashlen : size);
+ memcpy(out_buffer, scratch, MIN(params.hashlen, size));
/* same rationale as for `ctx.autoerase_salt = 1;` */
if (scratch) {
@@ -190,7 +190,7 @@ check(const char *phrase, const char *settings, const char *hash, size_t hashlen
for (i = 1u; i <= hashlen * 2u; i++) {
memset(buf, 0, sizeof(buf));
EXPECT(librecrypt__argon2__hash(buf, i, phrase, len, settings, prefix, NULL) == 0);
- EXPECT(!memcmp(expected, buf, i < hashlen ? i : hashlen));
+ EXPECT(!memcmp(expected, buf, MIN(i, hashlen)));
}
}