Skip to content

Commit

Permalink
Slight reorg of wycheproof crates
Browse files Browse the repository at this point in the history
  • Loading branch information
nickray committed Jul 6, 2023
1 parent 2efa31c commit c77de13
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 12 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ members = [
".",
"c-api",
"qemu-tests",
"wycheproof",
"wycheproof/parser",
"wycheproof/macros",
"wycheproof/types",
]
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion c-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
14 changes: 7 additions & 7 deletions wycheproof/macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[package]
name = "wycheproof-macros"
authors = ["Enrik Berkhan <Enrik.Berkhan@inka.de>"]
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
8 changes: 4 additions & 4 deletions wycheproof/macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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!");
Expand All @@ -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 =
Expand All @@ -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 =
Expand Down
14 changes: 7 additions & 7 deletions wycheproof/Cargo.toml → wycheproof/parser/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "wycheproof"
name = "wycheproof-parser"
authors = ["Enrik Berkhan <Enrik.Berkhan@inka.de>"]
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
File renamed without changes.
4 changes: 2 additions & 2 deletions wycheproof/types/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "wycheproof-types"
authors = ["Enrik Berkhan <Enrik.Berkhan@inka.de>"]
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

0 comments on commit c77de13

Please sign in to comment.