]> git.codecow.com Git - Monocypher.git/commit
More robust timing tests, based on ratios.
authorLoup Vaillant <loup@loup-vaillant.fr>
Wed, 20 Sep 2017 21:39:43 +0000 (23:39 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Wed, 20 Sep 2017 21:39:43 +0000 (23:39 +0200)
commit4bf07c4c146302051f213377145a9d982bb5200e
treea618b0615db230ccf22a312fa90d13d95fdaa73a
parente6be72f569b2b714fdd16e1a1558d76294918575
More robust timing tests, based on ratios.

Fixes #25

Note: I noticed something iffy about comparing against all zeroes: for
big buffers, the timings were way off (small buffers were okay).  This
suggest they were *not* constant time, which is worrying.

The generated assembly is too big for me to review.  I can't tell
whether there's a variable time optimisation in there.  Thankfully, we
rarely use crypto_memcmp() to compare big zeroed buffers in practice.
Instead, we compare small, pseudo random data such as hashes or
authentication tags.  So I used pseudo-random data for the tests.

While we should be good in practice, I'm a bit worried.  Someone may
want to check that compilers haven't become too clever.
tests/test.c