From 146f5b72e69971029ebd51736bf9a9ebda5e252e Mon Sep 17 00:00:00 2001 From: Viktor Dukhovni Date: Wed, 16 Oct 2013 23:33:25 -0400 Subject: [PATCH] Link test_rand with math library. Also deal with size_t to int casts for test_rand printf output. --- lib/hcrypto/Makefile.am | 1 + lib/hcrypto/test_rand.c | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/hcrypto/Makefile.am b/lib/hcrypto/Makefile.am index 8df84fdd1..d47cf92f8 100644 --- a/lib/hcrypto/Makefile.am +++ b/lib/hcrypto/Makefile.am @@ -86,6 +86,7 @@ check_SCRIPTS = $(SCRIPT_TESTS) TESTS = $(PROGRAM_TESTS) $(SCRIPT_TESTS) LDADD = $(lib_LTLIBRARIES) $(LIB_roken) +test_rand_LDADD = $(LDADD) -lm libhcrypto_la_SOURCES = \ $(ltmsources) \ diff --git a/lib/hcrypto/test_rand.c b/lib/hcrypto/test_rand.c index da055868a..fc43cfa4d 100644 --- a/lib/hcrypto/test_rand.c +++ b/lib/hcrypto/test_rand.c @@ -185,8 +185,8 @@ main(int argc, char **argv) res = slen * fabs(1.0 - 2 * (double)bits[bit] / len); if (res > 5) errx(1, "head%d vs tail%d: %.1f-sigma (%d of %d)", - bit, bit, res, bits[bit], len); - printf("head vs tails bit%d: %f-sigma\n", bit, res); + (int)bit, (int)bit, res, bits[bit], len); + printf("head vs tails bit%d: %f-sigma\n", (int)bit, res); } /* @@ -202,8 +202,8 @@ main(int argc, char **argv) res = (slen / 16) * fabs(1.0 - 256 * (double)bytes[i] / len); if (res > 5) errx(1, "byte %d: %.1f-sigma (%d of %d)", - i, res, bytes[i], len); - printf("byte %d: %f-sigma\n", i, res); + (int) i, res, bytes[i], len); + printf("byte %d: %f-sigma\n", (int)i, res); } }