Skip to content

Commit

Permalink
acvp: add ACVP test vectors
Browse files Browse the repository at this point in the history
Updates #2

Signed-off-by: Eric Lagergren <[email protected]>
  • Loading branch information
elagergren-spideroak committed Jan 23, 2025
1 parent 5904a1e commit e9f3a0c
Show file tree
Hide file tree
Showing 39 changed files with 19,792 additions and 167 deletions.
74 changes: 70 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 10 additions & 26 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,37 +34,21 @@ unwrap_used = "warn"
wildcard_imports = "warn"

[workspace.dependencies]
anyhow = { version = "1.0" }
byteorder = { version = "1", default-features = false }
anyhow = { version = "1.0", default-features = false }
cfg-if = { version = "1", default-features = false }
const_format = { version = "0.2", default-features = false }
heapless = { version = "0.8", default-features = false }
libc = { version = "0.2", default-features = false }
log = { version = "0.4", default-features = false }
postcard = { version = "1", default-features = false }
proptest = { version = "1.6", default-features = false, features = ["no_std", "alloc"] }
proptest-derive = { version = "0.5" }
rand = { version = "0.8", default-features = false }
rand_core = { version = "0.6", default-features = false }
rustix = { version = "0.38", default-features = false }
rustls = { version = "0.21.0", default-features = false }
serde = { version = "1.0.210", default-features = false }
spin = { version = "0.9.8", default-features = false }
test-log = { version = "0.2", default-features = false, features = ["trace"] }
thiserror = { version = "2", default-features = false }
tokio = { version = "1.41.1", default-features = false, features = ["macros"] }
tokio-util = { version = "0.7.8", default-features = false }
tracing = { version = "0.1", default-features = false, features = ["attributes"] }
tracing-subscriber = { version = "0.3.18", default-features = false }
serde = { version = ">= 1.0.184", default-features = false }

prettyplease = "0.2"
proc-macro2 = "1.0.80"
syn = "2.0.59"
quote = "1.0"
# [workspace.build-dependencies]
prettyplease = { version = "0.2" }
proc-macro2 = { version = "1.0.80" }
quote = { version = "1.0" }
syn = { version = "2.0.59" }

[profile.dev]
panic = "abort"
opt-level = 1
# Required for some of the tests to run in a reasonable amount of
# time.
opt-level = 2

[profile.dev-std]
inherits = "dev"
Expand Down
57 changes: 57 additions & 0 deletions crates/acvp/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[package]
name = "acvp"
description = "ACVP test vectors"
version = "0.1.0"
authors.workspace = true
edition.workspace = true
license = "BSD-3-Clause"
repository.workspace = true
rust-version.workspace = true

[lints]
workspace = true

[features]
default = ["all", "vectors"]

# Enable all algorithms.
all = [
"sha2",
"sha3",
]

# Selectively enable algorithms.
sha2 = []
sha3 = [
"dep:either",
]

# Enable `std`.
std = [
"anyhow/std",
"either?/use_std",
"hex/std",
"serde/std",
"serde_json/std",
]

# Enable vectors.
vectors = [
"dep:hex",
"dep:serde",
"dep:serde_json",
]

[dependencies]
anyhow = { workspace = true, default-features = false }
cfg-if = { workspace = true, default-features = false }
either = { version = "1.13", default-features = false, optional = true }
hex = { version = "0.4", default-features = false, features = ["alloc", "serde"], optional = true }
serde = { workspace = true, features = ["alloc", "derive"], optional = true }
serde_json = { version = "1", default-features = false, features = ["alloc"], optional = true }

[build-dependencies]
prettyplease = { workspace = true }
proc-macro2 = { workspace = true }
quote = { workspace = true }
syn = { workspace = true }
28 changes: 28 additions & 0 deletions crates/acvp/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
BSD 3-Clause License

Copyright (c) 2024, SpiderOak, Inc.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
11 changes: 11 additions & 0 deletions crates/acvp/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! Build script
//use std::{fs, path::Path};

fn main() {
// let path = Path::new("src")
// .join("vectors")
// .join("data");
// let data = fs::read(path);
// serde_json::from_slice(&data)
}
11 changes: 11 additions & 0 deletions crates/acvp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//! ACVP testing utilities.
#![cfg_attr(docsrs, feature(doc_cfg))]
#![cfg_attr(not(any(test, doctest, feature = "std")), no_std)]

extern crate alloc;

pub mod testing;
pub mod traits;
mod util;
pub mod vectors;
Loading

0 comments on commit e9f3a0c

Please sign in to comment.