]> git.codecow.com Git - Monocypher.git/commitdiff
Test many combinations of input lengths for blake2b
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 18 Apr 2021 14:54:19 +0000 (16:54 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 18 Apr 2021 14:54:19 +0000 (16:54 +0200)
tests/gen/blake2b.c

index f16192d5a817c91432ff21ba4b60946bffdc5d47..a192133f5bd76c2dd53e14b7256a9de4e083be3f 100644 (file)
@@ -71,9 +71,13 @@ int main(void)
     SODIUM_INIT;
     // Official test vectors test for all message sizes, so no need to
     // repeat ourselves here. However they only test keys and hashes of size 64.
-    // Here we're testing all possible key and hash sizes.
-    FOR(key_size , 0,  64) { test(  0 , key_size, 64       ); }
-    FOR(key_size , 0,  64) { test(128 , key_size, 64       ); }
-    FOR(hash_size, 1,  64) { test(128 , 0       , hash_size); }
+    // Here we're testing many possible key and hash sizes.
+    for (size_t key_size = 0; key_size < 64; key_size += 16) {
+        for (size_t hash_size = 0; hash_size < 64; hash_size += 16) {
+            for (size_t input_size = 0; input_size < 256; input_size += 16) {
+                test(input_size, key_size, hash_size);
+            }
+        }
+    }
     return 0;
 }