[Cryptech-Commits] [sw/libhal] 05/07: fix time calculation in test-ecdsa

git at cryptech.is git at cryptech.is
Sun Nov 1 04:03:26 UTC 2015


This is an automated email from the git hooks/post-receive script.

paul at psgd.org pushed a commit to branch master
in repository sw/libhal.

commit 274f905d985565c68d4133bed39b626b636e2512
Author: Paul Selkirk <paul at psgd.org>
Date:   Sat Oct 31 22:46:17 2015 -0400

    fix time calculation in test-ecdsa
---
 tests/test-ecdsa.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/tests/test-ecdsa.c b/tests/test-ecdsa.c
index 23d9720..cbb2450 100644
--- a/tests/test-ecdsa.c
+++ b/tests/test-ecdsa.c
@@ -282,7 +282,7 @@ static void _time_check(const struct timeval t0, const int ok)
   struct timeval t;
   gettimeofday(&t, NULL);
   t.tv_sec -= t0.tv_sec;
-  t.tv_usec = t0.tv_usec;
+  t.tv_usec -= t0.tv_usec;
   if (t.tv_usec < 0) {
     t.tv_usec += 1000000;
     t.tv_sec  -= 1;
@@ -322,11 +322,13 @@ int main(int argc, char *argv[])
 
   int ok = 1;
 
+#if HAL_ECDSA_DEBUG_ONLY_STATIC_TEST_VECTOR_RANDOM
   /*
    * Test vectors (where we have them).
    */
   for (int i = 0; i < sizeof(ecdsa_tc)/sizeof(*ecdsa_tc); i++)
     time_check(test_against_static_vectors(&ecdsa_tc[i]));
+#endif
 
   /*
    * Generate/sign/verify test for each curve.



More information about the Commits mailing list