From c77de13ab255e8fc48a88bbdda11fed4d7325639 Mon Sep 17 00:00:00 2001 From: Nicolas Stalder Date: Thu, 6 Jul 2023 13:25:26 +0200 Subject: [PATCH] Slight reorg of wycheproof crates --- CHANGELOG.md | 2 ++ Cargo.toml | 16 ++++++++++++---- Makefile | 4 ++-- c-api/Cargo.toml | 2 +- wycheproof/macros/Cargo.toml | 14 +++++++------- wycheproof/macros/src/lib.rs | 8 ++++---- wycheproof/{ => parser}/Cargo.toml | 14 +++++++------- wycheproof/{ => parser}/src/lib.rs | 0 wycheproof/types/Cargo.toml | 4 ++-- 9 files changed, 37 insertions(+), 27 deletions(-) rename wycheproof/{ => parser}/Cargo.toml (50%) rename wycheproof/{ => parser}/src/lib.rs (100%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b12770..1f882e7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,3 +13,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - make dependency on RustCrypto/ed25519 a feature - run wycheproof on signing, not just verification (#28) - check more in ci.yml +- ZeroizeOnDrop secrets (#26) +- reorganize wycheproof diff --git a/Cargo.toml b/Cargo.toml index a070cdf..87d91b3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ members = [ ".", "c-api", "qemu-tests", - "wycheproof", + "wycheproof/parser", "wycheproof/macros", "wycheproof/types", ] @@ -31,17 +31,25 @@ repository.workspace = true [workspace.dependencies] salty = { path = "." } -wycheproof = { path = "wycheproof" } wycheproof-macros = { path = "wycheproof/macros" } +wycheproof-parser = { path = "wycheproof/parser" } wycheproof-types = { path = "wycheproof/types" } -cosey = { version = "0.3.0" } +cosey = { version = "0.3" } ed25519 = { version = "2.2", default-features = false } hex = "0.4" hex-literal = "0.4" -subtle = { version = "2.4.0", default-features = false } +hex-serde = "0.1" +panic-halt = "0.2" +proc-macro2 = "1" +quote = "1" +serde = { version = "1", features = ["derive"] } +serde_json = "1" +syn = { version = "2", features = ["full"] } +subtle = { version = "2.4", default-features = false } zeroize = { version = "1.6", default-features = false, features = ["zeroize_derive"] } + [dependencies] subtle.workspace = true zeroize.workspace = true diff --git a/Makefile b/Makefile index 3d3e8ae..a602cf7 100644 --- a/Makefile +++ b/Makefile @@ -20,8 +20,8 @@ check: cargo check -p salty cargo check -p salty-c-api --target thumbv7em-none-eabi cargo check -p qemu-tests - cargo check -p wycheproof cargo check -p wycheproof-macros + cargo check -p wycheproof-parser cargo check -p wycheproof-types # used in CI @@ -31,8 +31,8 @@ lint: cargo clippy -p salty cargo clippy -p salty-c-api --target thumbv7em-none-eabi cargo clippy -p qemu-tests - cargo clippy -p wycheproof cargo clippy -p wycheproof-macros + cargo clippy -p wycheproof-parser cargo clippy -p wycheproof-types local-docs: diff --git a/c-api/Cargo.toml b/c-api/Cargo.toml index 39efa57..6304528 100644 --- a/c-api/Cargo.toml +++ b/c-api/Cargo.toml @@ -14,7 +14,7 @@ crate-type = ["staticlib"] [dependencies] salty.workspace = true -panic-halt = "0.2" +panic-halt.workspace = true [features] slow-motion = ["salty/slow-motion"] diff --git a/wycheproof/macros/Cargo.toml b/wycheproof/macros/Cargo.toml index 2e832d9..13cd7da 100644 --- a/wycheproof/macros/Cargo.toml +++ b/wycheproof/macros/Cargo.toml @@ -1,18 +1,18 @@ [package] name = "wycheproof-macros" authors = ["Enrik Berkhan "] -description = "Project Wycheproof tests for salty: generator." +description = "Project Wycheproof tests for salty: macros." edition.workspace = true license.workspace = true -version = "0.1.0" +version.workspace = true [lib] proc-macro = true [dependencies] -wycheproof.workspace = true +wycheproof-parser.workspace = true -quote = "1" -proc-macro2 = "1" -serde_json = "1" -syn = { version = "2", features=["full"] } +proc-macro2.workspace = true +quote.workspace = true +serde_json.workspace = true +syn.workspace = true diff --git a/wycheproof/macros/src/lib.rs b/wycheproof/macros/src/lib.rs index 153ecb7..7de18aa 100644 --- a/wycheproof/macros/src/lib.rs +++ b/wycheproof/macros/src/lib.rs @@ -25,7 +25,7 @@ pub fn generate_data(input: TokenStream) -> TokenStream { let input = parse_macro_input!(input as TestDataArgs); let testdata = std::fs::read_to_string(&input.fname).unwrap(); - let test: wycheproof::WycheproofTest = serde_json::from_str(&testdata).unwrap(); + let test: wycheproof_parser::WycheproofTest = serde_json::from_str(&testdata).unwrap(); if !input.schema.ends_with(&test.schema) { dbg!(&test.schema); @@ -44,7 +44,7 @@ pub fn test_wycheproof(args: TokenStream, func: TokenStream) -> TokenStream { let TestDataArgs { fname, schema } = parse_macro_input!(args as TestDataArgs); let testdata = std::fs::read_to_string(&fname).unwrap(); - let testdata: wycheproof::WycheproofTest = serde_json::from_str(&testdata).unwrap(); + let testdata: wycheproof_parser::WycheproofTest = serde_json::from_str(&testdata).unwrap(); if !schema.ends_with(&testdata.schema) { panic!("JSON schemas do not match!"); @@ -56,7 +56,7 @@ pub fn test_wycheproof(args: TokenStream, func: TokenStream) -> TokenStream { for testgroup in &testdata.test_groups { match testgroup { - wycheproof::TestGroup::EddsaVerify { key, tests } => { + wycheproof_parser::TestGroup::EddsaVerify { key, tests } => { for testcase in tests { let test_name = format!("{}_{}", func_ident, testcase.tc_id); let test_ident = @@ -72,7 +72,7 @@ pub fn test_wycheproof(args: TokenStream, func: TokenStream) -> TokenStream { } } - wycheproof::TestGroup::XdhComp { curve, tests } => { + wycheproof_parser::TestGroup::XdhComp { curve, tests } => { for testcase in tests { let test_name = format!("{}_{}", func_ident, testcase.tc_id); let test_ident = diff --git a/wycheproof/Cargo.toml b/wycheproof/parser/Cargo.toml similarity index 50% rename from wycheproof/Cargo.toml rename to wycheproof/parser/Cargo.toml index 95d4ce1..8f1bceb 100644 --- a/wycheproof/Cargo.toml +++ b/wycheproof/parser/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "wycheproof" +name = "wycheproof-parser" authors = ["Enrik Berkhan "] description = "Project Wycheproof tests for salty: JSON parser." edition.workspace = true license.workspace = true -version = "0.1.0" +version.workspace = true [dependencies] -hex-serde = { version = "0.1.0" } -proc-macro2 = "1" -quote = "1" -serde = { version = "1", features = ["derive"] } -serde_json = { version = "1" } +hex-serde.workspace = true +proc-macro2.workspace = true +quote.workspace = true +serde.workspace = true +serde_json.workspace = true diff --git a/wycheproof/src/lib.rs b/wycheproof/parser/src/lib.rs similarity index 100% rename from wycheproof/src/lib.rs rename to wycheproof/parser/src/lib.rs diff --git a/wycheproof/types/Cargo.toml b/wycheproof/types/Cargo.toml index e4806c4..d3bb684 100644 --- a/wycheproof/types/Cargo.toml +++ b/wycheproof/types/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "wycheproof-types" authors = ["Enrik Berkhan "] -description = "Project Wycheproof no-std types for salty." +description = "Project Wycheproof tests for salty: no-std types." edition.workspace = true license.workspace = true -version = "0.1.0" +version.workspace = true