diff options
| author | Mattias Andrée <m@maandree.se> | 2026-05-14 19:46:14 +0200 |
|---|---|---|
| committer | Mattias Andrée <m@maandree.se> | 2026-05-14 19:46:14 +0200 |
| commit | 5660c556a06916c2f1e004f7f8d5e368b3a88e25 (patch) | |
| tree | 562217dbfa5f33ee7a73f6bdfc3b67dc9245b4d9 /argon2/hash.c | |
| parent | Fix test bug only found with musl+clang (diff) | |
| download | librecrypt-5660c556a06916c2f1e004f7f8d5e368b3a88e25.tar.gz librecrypt-5660c556a06916c2f1e004f7f8d5e368b3a88e25.tar.bz2 librecrypt-5660c556a06916c2f1e004f7f8d5e368b3a88e25.tar.xz | |
Clean up
Signed-off-by: Mattias Andrée <m@maandree.se>
Diffstat (limited to 'argon2/hash.c')
| -rw-r--r-- | argon2/hash.c | 4 |
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, ¶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))); } } |
