diff --git a/src/rustapi/pqc-sys/src/build.rs b/src/rustapi/pqc-sys/src/build.rs index fac38c78..3a2e86f6 100644 --- a/src/rustapi/pqc-sys/src/build.rs +++ b/src/rustapi/pqc-sys/src/build.rs @@ -4,7 +4,7 @@ extern crate bindgen; fn main() { let dst = Config::new("../../../") - .profile("Release") + .profile("Debug") .very_verbose(true) .build(); diff --git a/test/katrunner/src/main.rs b/test/katrunner/src/main.rs index 2a864af6..253d91b4 100644 --- a/test/katrunner/src/main.rs +++ b/test/katrunner/src/main.rs @@ -5,6 +5,18 @@ use std::env; use std::path::Path; use threadpool::ThreadPool; +// Used for signature algorithm registration +macro_rules! REG_SIGN { + ($ID:expr,$F:expr) => { + Register{ + kat:Kat{ + scheme_type: AlgType::AlgSignature, + scheme_id: $ID, + kat_file: $F}, + execfn: signature_scheme} + } +} + const KAT_DIR : &'static str= "."; type ExecFn = fn(&TestVector); struct Register { @@ -32,14 +44,49 @@ fn signature_scheme(el: &TestVector) { } // KAT test register -const REG: [Register; 1] = [ - Register{kat:Kat{scheme_type: AlgType::AlgSignature, scheme_id: DILITHIUM2, kat_file: "round3/dilithium/dilithium2/PQCsignKAT_2544.rsp"}, execfn: signature_scheme}, +const KATS: &'static[Register] = &[ + REG_SIGN!(DILITHIUM2, "round3/dilithium/dilithium2/PQCsignKAT_2544.rsp"), + REG_SIGN!(DILITHIUM3, "round3/dilithium/dilithium3/PQCsignKAT_4016.rsp"), + REG_SIGN!(DILITHIUM5, "round3/dilithium/dilithium5/PQCsignKAT_4880.rsp"), + //REG_SIGN!(FALCON512, "round3/falcon/falcon512-KAT.rsp"), + //REG_SIGN!(FALCON1024, "round3/falcon/falcon1024-KAT.rsp"), + //REG_SIGN!(RAINBOWVCLASSIC), + //REG_SIGN!(RAINBOWICLASSIC), + //REG_SIGN!(RAINBOWIIICLASSIC), + + // Some implementations of sphincs are for round3 + REG_SIGN!(SPHINCSSHA256192FSIMPLE,"round3/sphincs/sphincs-sha256-192f-simple/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHA256192FROBUST,"round3/sphincs/sphincs-sha256-192f-robust/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHA256256SSIMPLE,"round3/sphincs/sphincs-sha256-256s-simple/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHA256256SROBUST,"round3/sphincs/sphincs-sha256-256s-robust/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHAKE256192FROBUST,"round3/sphincs/sphincs-shake256-192f-robust/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHAKE256192FSIMPLE,"round3/sphincs/sphincs-shake256-192f-simple/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHAKE256256SSIMPLE,"round3/sphincs/sphincs-shake256-256s-simple/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHAKE256256SROBUST,"round3/sphincs/sphincs-shake256-256s-robust/PQCsignKAT_128.rsp"), + + // And some for round 2 + REG_SIGN!(SPHINCSSHA256128SSIMPLE,"round2/sphincs/sphincs-sha256-128s-simple/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHA256128SROBUST,"round2/sphincs/sphincs-sha256-128s-robust/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHA256128FSIMPLE,"round2/sphincs/sphincs-sha256-128f-simple/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHA256128FROBUST,"round2/sphincs/sphincs-sha256-128f-robust/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHA256192SSIMPLE,"round2/sphincs/sphincs-sha256-192s-simple/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHA256192SROBUST,"round2/sphincs/sphincs-sha256-192s-robust/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHA256256FROBUST,"round2/sphincs/sphincs-sha256-256f-robust/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHA256256FSIMPLE,"round2/sphincs/sphincs-sha256-256f-simple/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHAKE256128FSIMPLE,"round2/sphincs/sphincs-shake256-128f-simple/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHAKE256128SSIMPLE,"round2/sphincs/sphincs-shake256-128s-simple/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHAKE256128FROBUST,"round2/sphincs/sphincs-shake256-128f-robust/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHAKE256128SROBUST,"round2/sphincs/sphincs-shake256-128s-robust/PQCsignKAT_64.rsp"), + REG_SIGN!(SPHINCSSHAKE256192SSIMPLE,"round2/sphincs/sphincs-shake256-192s-simple/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHAKE256192SROBUST,"round2/sphincs/sphincs-shake256-192s-robust/PQCsignKAT_96.rsp"), + REG_SIGN!(SPHINCSSHAKE256256FROBUST,"round2/sphincs/sphincs-shake256-256f-robust/PQCsignKAT_128.rsp"), + REG_SIGN!(SPHINCSSHAKE256256FSIMPLE,"round2/sphincs/sphincs-shake256-256f-simple/PQCsignKAT_128.rsp"), ]; fn execute(kat_dir: String) { // Can't do multi-threads as DRBG context is global let pool = ThreadPool::new(1); - for k in REG.iter() { + for k in KATS.iter() { let tmp = kat_dir.clone(); pool.execute(move || { let f = Path::new(&tmp.to_string()).join(k.kat.kat_file);