mirror da
https://github.com/henrydcase/pqc.git
synced 2024-11-22 07:35:38 +00:00
WIP
This commit is contained in:
parent
a8bb139ea6
commit
ec4f21b2de
@ -4,7 +4,7 @@ extern crate bindgen;
|
||||
|
||||
fn main() {
|
||||
let dst = Config::new("../../../")
|
||||
.profile("Release")
|
||||
.profile("Debug")
|
||||
.very_verbose(true)
|
||||
.build();
|
||||
|
||||
|
@ -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);
|
||||
|
Caricamento…
Fai riferimento in un nuovo problema
Block a user