]> git.codecow.com Git - Monocypher.git/commitdiff
Corrected bogus EdDSA coverage test (stack smashing undefined behaviour)
authorLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Sep 2017 13:19:03 +0000 (15:19 +0200)
committerLoup Vaillant <loup@loup-vaillant.fr>
Sun, 24 Sep 2017 13:19:03 +0000 (15:19 +0200)
tests/test.c

index f2f9b0631ab66cf27e35cdab7cf1cb0fa88f1cb6..cf70cd7233d21ccc59ba665ec101af68e1895eb3 100644 (file)
@@ -619,12 +619,12 @@ static int p_eddsa_overlap()
     FOR(i, 0, MESSAGE_SIZE + 64) {
 #undef INPUT_SIZE
 #define INPUT_SIZE (MESSAGE_SIZE + (2 * 64)) // total input size
-        u8 sk       [32];          p_random(sk, 32);
-        u8 pk       [32];          crypto_sign_public_key(pk, sk);
-        u8 input    [INPUT_SIZE];  p_random(input, INPUT_SIZE);
+        RANDOM_INPUT(input, INPUT_SIZE);
+        RANDOM_INPUT(sk   , 32        );
+        u8 pk       [32];  crypto_sign_public_key(pk, sk);
         u8 signature[64];
-        crypto_sign(signature, sk, pk, input + 64, SHA_512_BLOCK_SIZE);
-        crypto_sign(input+i  , sk, pk, input + 64, SHA_512_BLOCK_SIZE);
+        crypto_sign(signature, sk, pk, input + 64, MESSAGE_SIZE);
+        crypto_sign(input+i  , sk, pk, input + 64, MESSAGE_SIZE);
         status |= crypto_memcmp(signature, input + i, 64);
     }
     printf("%s: EdDSA (overlap)\n", status != 0 ? "FAILED" : "OK");