/* balloon-test.c
Copyright (C) 2022 Zoltan Fridrich
+ Copyright (C) 2022 Red Hat, Inc.
This file is part of GNU Nettle.
unsigned s_cost, unsigned t_cost,
const struct tstring *expected)
{
- int fail = 0;
void *ctx = xalloc(alg->context_size);
uint8_t *buf = xalloc(balloon_itch(alg->digest_size, s_cost));
fprintf(stderr, "\nExpected:");
tstring_print_hex(expected);
fprintf(stderr, "\n");
- fail = 1;
+ FAIL();
}
free(ctx);
free(buf);
-
- if (fail)
- FAIL();
}
static void
unsigned s_cost, unsigned t_cost,
const struct tstring *expected)
{
- int fail = 0;
uint8_t *buf = xalloc(balloon_itch(alg->digest_size, s_cost));
if (alg == &nettle_sha1)
else
{
fprintf(stderr, "test_balloon_sha: bad test\n");
- fail = 1;
+ FAIL();
}
- if (!fail && !MEMEQ(alg->digest_size, buf, expected->data))
+ if (!MEMEQ(alg->digest_size, buf, expected->data))
{
fprintf(stderr, "test_balloon_sha: result doesn't match the expectation:");
fprintf(stderr, "\nOutput: ");
fprintf(stderr, "\nExpected:");
tstring_print_hex(expected);
fprintf(stderr, "\n");
- fail = 1;
+ FAIL();
}
free(buf);
-
- if (fail)
- FAIL();
}
/* Test vectors are taken from: