From 19d177efb3cea70d9a30fb8e12fb269b15852426 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Fri, 5 Apr 2019 10:22:52 -0400 Subject: [PATCH 1/2] Use 5 iteractions for functional tests and test vectors --- crypto_kem/frodokem640shake/META.yml | 2 +- crypto_kem/kyber768/META.yml | 2 +- test/crypto_kem/functest.c | 2 +- test/crypto_kem/testvectors.c | 2 +- test/crypto_sign/functest.c | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/crypto_kem/frodokem640shake/META.yml b/crypto_kem/frodokem640shake/META.yml index 87c37449..192b4cbc 100644 --- a/crypto_kem/frodokem640shake/META.yml +++ b/crypto_kem/frodokem640shake/META.yml @@ -3,7 +3,7 @@ type: kem claimed-nist-level: 1 length-public-key: 9616 length-ciphertext: 9720 -testvectors-sha256: 521ff891de20efe74e6584d09612dae989427ac76261a41630c4e4d6a4fc78a4 +testvectors-sha256: 8f922de02d41005fcc3c4164b2ab74c4c7b588ed69e34e22607d1ae4ab13d2c5 principal-submitter: Douglas Stebila, University of Waterloo auxiliary-submitters: - Erdem Alkim diff --git a/crypto_kem/kyber768/META.yml b/crypto_kem/kyber768/META.yml index 62d8903e..6bcf2c2c 100644 --- a/crypto_kem/kyber768/META.yml +++ b/crypto_kem/kyber768/META.yml @@ -3,7 +3,7 @@ type: kem claimed-nist-level: 3 length-public-key: 1088 length-ciphertext: 1152 -testvectors-sha256: 0e002ee528febdab1709f100df79ceb00b31a809e03a4fb84e3a72c39235d372 +testvectors-sha256: 2f5cf9937959eb4a3bc910f71e830e9e0de029b28093c6192d2c3e915913016f principal-submitter: Peter Schwabe auxiliary-submitters: - Roberto Avanzi diff --git a/test/crypto_kem/functest.c b/test/crypto_kem/functest.c index 7f50608b..9e04e4a0 100644 --- a/test/crypto_kem/functest.c +++ b/test/crypto_kem/functest.c @@ -5,7 +5,7 @@ #include "api.h" #include "randombytes.h" -#define NTESTS 10 +#define NTESTS 5 const uint8_t canary[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xAB, 0xCD, 0xEF diff --git a/test/crypto_kem/testvectors.c b/test/crypto_kem/testvectors.c index 516b5886..fb0a6f7c 100644 --- a/test/crypto_kem/testvectors.c +++ b/test/crypto_kem/testvectors.c @@ -6,7 +6,7 @@ #include "api.h" #include "randombytes.h" -#define NTESTS 100 +#define NTESTS 5 static void printbytes(const uint8_t *x, size_t xlen) { size_t i; diff --git a/test/crypto_sign/functest.c b/test/crypto_sign/functest.c index 9fb3a1b9..d49a77ee 100644 --- a/test/crypto_sign/functest.c +++ b/test/crypto_sign/functest.c @@ -6,7 +6,7 @@ #include "api.h" #include "randombytes.h" -#define NTESTS 15 +#define NTESTS 5 #define MLEN 32 const uint8_t canary[8] = { From f355e77407826d5e40b412b50b3380f9407959e1 Mon Sep 17 00:00:00 2001 From: Joost Rijneveld Date: Fri, 5 Apr 2019 16:26:27 +0200 Subject: [PATCH 2/2] Clarify and reduce iterations for sig testvectors This is actually different from signature functests, which only tests mlen=32. Can be fixed later as that does not impact the testvectors. --- crypto_sign/dilithium-iii/META.yml | 2 +- test/crypto_sign/testvectors.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crypto_sign/dilithium-iii/META.yml b/crypto_sign/dilithium-iii/META.yml index 4f207176..13afcb1a 100644 --- a/crypto_sign/dilithium-iii/META.yml +++ b/crypto_sign/dilithium-iii/META.yml @@ -3,7 +3,7 @@ type: signature claimed-nist-level: 3 length-public-key: 1472 length-signature: 2701 -testvectors-sha256: e1852a975842c44a683c914ed131d95bee9b786c36c41e47bb77d7dd3c0c07be +testvectors-sha256: 0d9d7a41b24ab8b250c352fdb50318193f2f66c6c582d7721b785b1a4618b493 principal-submitter: Vadim Lyubashevsky auxiliary-submitters: - Léo Ducas diff --git a/test/crypto_sign/testvectors.c b/test/crypto_sign/testvectors.c index 7cf87cf3..8d35d426 100644 --- a/test/crypto_sign/testvectors.c +++ b/test/crypto_sign/testvectors.c @@ -6,7 +6,6 @@ #include "api.h" #include "randombytes.h" -#define NTESTS 100 #define MAXMLEN 2048 static void printbytes(const uint8_t *x, size_t xlen) { @@ -43,7 +42,8 @@ int main(void) { int r; size_t i, k; - for (i = 0; i < MAXMLEN; i = (i == 0) ? i + 1 : i << 1) { + /* i = 0, 1, 4, 16, 64, 256, 1024 */ + for (i = 0; i < MAXMLEN; i = (i == 0) ? i + 1 : i << 2) { randombytes(mi, i); crypto_sign_keypair(pk, sk);