From 5660c556a06916c2f1e004f7f8d5e368b3a88e25 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Thu, 14 May 2026 19:46:14 +0200 Subject: Clean up MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- argon2/hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'argon2/hash.c') 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, ¶ms, &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))); } } -- cgit v1.2.3-70-g09d2