]> git.codecow.com Git - Monocypher.git/commitdiff
Faster crypto_verify*() tests
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 17 Jun 2018 17:47:46 +0000 (19:47 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 17 Jun 2018 17:47:46 +0000 (19:47 +0200)
There was no need to test every possible value to catch the errors the
tests caugth.  Cutting them down makes the test 64000 times faster,
which matters quite a lot when we run the TIS interpreter.

The new tests catch just as many errors as the old ones.

tests/test.c

index 9397ea1b377b700b4f07e0a2b8a559824700f15e..8722e6eb7704927188dad372162d6daa63826023 100644 (file)
@@ -247,8 +247,8 @@ static int p_verify(size_t size, int (*compare)(const u8*, const u8*))
     int status = 0;
     u8 a[64]; // size <= 64
     u8 b[64]; // size <= 64
-    FOR (i, 0, 256) {
-        FOR (j, 0, 256) {
+    FOR (i, 0, 2) {
+        FOR (j, 0, 2) {
             // Set every byte to the chosen value, then compare
             FOR (k, 0, size) {
                 a[k] = i;