diff options
Diffstat (limited to 'src/test/bench.c')
-rw-r--r-- | src/test/bench.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/test/bench.c b/src/test/bench.c index 3594059057..959d4374b1 100644 --- a/src/test/bench.c +++ b/src/test/bench.c @@ -473,18 +473,19 @@ bench_digest(void) for (int i = 0; lens[i] > 0; ++i) { reset_perftime(); start = perftime(); + int failures = 0; for (int j = 0; j < N; ++j) { switch (alg) { case DIGEST_SHA1: - crypto_digest(out, buf, lens[i]); + failures += crypto_digest(out, buf, lens[i]) < 0; break; case DIGEST_SHA256: case DIGEST_SHA3_256: - crypto_digest256(out, buf, lens[i], alg); + failures += crypto_digest256(out, buf, lens[i], alg) < 0; break; case DIGEST_SHA512: case DIGEST_SHA3_512: - crypto_digest512(out, buf, lens[i], alg); + failures += crypto_digest512(out, buf, lens[i], alg) < 0; break; default: tor_assert(0); @@ -494,6 +495,8 @@ bench_digest(void) printf("%s(%d): %.2f ns per call\n", crypto_digest_algorithm_get_name(alg), lens[i], NANOCOUNT(start,end,N)); + if (failures) + printf("ERROR: crypto_digest failed %d times.\n", failures); } } } |