Skip to content

Commit

Permalink
add frodo-kem
Browse files Browse the repository at this point in the history
  • Loading branch information
mikelodder7 committed Oct 29, 2024
1 parent 7f490c6 commit 46b10c3
Show file tree
Hide file tree
Showing 15 changed files with 3,982 additions and 1 deletion.
134 changes: 134 additions & 0 deletions .github/workflows/frodo-kem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: frodo-kem

on:
pull_request:
paths:
- "frodo-kem/**"
- "Cargo.*"
paths-ignore:
- README.md
- SECURITY.md
- LICENSE-Apache
- LICENSE-MIT
push:
branches: master
- "frodo-kem/**"
- "Cargo.*"
paths-ignore:
- README.md
- SECURITY.md
- LICENSE-Apache
- LICENSE-MIT

env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUST_LOG_STYLE: always
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"

defaults:
run:
working-directory: frodo-kem
shell: bash

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo build


test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo build --all-features --benches --release --keep-going
- run: cargo test --all-features --release

careful:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-careful
- run: cargo careful test

clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: clippy
- run: cargo clippy --all --all-features -- -D warnings

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
- run: cargo fmt -- --check

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- run: cargo doc --all-features

deps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-udeps
- run: cargo udeps --all-targets --all-features

outdated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-outdated
- run: cargo outdated --root-deps-only --exit-code 1

pants:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- run: cargo install cargo-pants
- run: cargo pants --loud

cross:
needs: set-msrv
strategy:
matrix:
include:
- target: powerpc-unknown-linux-gnu
rust: ${{needs.set-msrv.outputs.msrv}}
- target: powerpc-unknown-linux-gnu
rust: stable
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- uses: RustCrypto/actions/cross-install@master
- run: cross test --release --target ${{ matrix.target }} --all-features
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "2"
members = ["dhkem", "ml-kem", "x-wing"]
members = ["dhkem", "frodo-kem", "ml-kem", "x-wing"]

[profile.bench]
debug = true
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ commonly used in transport encryption protocols (e.g. [TLS]) and hybrid cryptosy
| [`dhkem`](./dhkem) | [![crates.io](https://img.shields.io/crates/v/dhkem.svg?logo=rust)](https://crates.io/crates/dhkem) | [![Documentation](https://docs.rs/dhkem/badge.svg)](https://docs.rs/dhkem) | Diffie-Hellman KEM |
| [`ml-kem`](./ml-kem) | [![crates.io](https://img.shields.io/crates/v/ml-kem.svg?logo=rust)](https://crates.io/crates/ml-kem) | [![Documentation](https://docs.rs/ml-kem/badge.svg)](https://docs.rs/ml-kem) | Module Lattice KEM |
| [`x-wing`](./x-wing) | [![crates.io](https://img.shields.io/crates/v/x-wing.svg?logo=rust)](https://crates.io/crates/x-wing) | [![Documentation](https://docs.rs/x-wing/badge.svg)](https://docs.rs/x-wing) | Hybrid PQ KEM |
| [`frodo-kem`](./frodo-kem) | [![crates.io](https://img.shields.io/crates/v/frodo-kem-rs.svg?logo=rust)](https://crates.io/crates/frodo-kem-rs) | [![Documentation](https://docs.rs/frodo-kem-rs/badge.svg)](https://docs.rs/frodo-kem-rs) | Frodo KEM |

## License

Expand Down
27 changes: 27 additions & 0 deletions frodo-kem/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Generated by Cargo
# will have compiled files and executables
debug/
target/

# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html
Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

# MSVC Windows builds of rustc generate these, which store debugging information
*.pdb

# RustRover
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

.vscode/

# Added by cargo

/target
59 changes: 59 additions & 0 deletions frodo-kem/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
[package]
authors = ["Michael Lodder <[email protected]>"]
categories = ["cryptography"]
description = "A pure rust implementation of FrodoKEM that also includes some experimental features for Zero-Knowledge Proof of Encrypted Correctness"
documentation = "https://docs.rs/frodo-kem-rs"
edition = "2021"
homepage = "https://github.com/mikelodder7/frodoKem"
keywords = ["quantum", "post", "zero", "knowledge", "encryption"]
license = "Apache-2.0 OR MIT"
name = "frodo-kem-rs"
readme = "README.md"
repository = "https://github.com/mikelodder7/frodoKem"
version = "0.1.0"

[features]
default = ["frodo640aes", "frodo640shake", "frodo976aes", "frodo976shake", "frodo1344aes", "frodo1344shake", "serde"]
hazmat = []
experimental = []
frodo640aes = ["aes"]
frodo640shake = []
frodo976aes = ["aes"]
frodo976shake = []
frodo1344aes = ["aes"]
frodo1344shake = []
serde = ["hex", "dep:serde"]

[dependencies]
aes = { version = "0.8", optional = true }
hex = { version = "0.4", optional = true }
rand_core = { version = "0.6", features = ["std"] }
serde = { version = "1.0", features = ["derive"], optional = true }
subtle = "2.6"
sha3 = { version = "0.10" }
thiserror = "1.0"
zeroize = "1"

[dev-dependencies]
bincode = "1.3"
criterion = "0.5"
rand_chacha = "0.3"
rstest = "0.23"
safe-oqs = { version = "0.10", default-features = false, features = ["frodokem"] }
postcard = { version = "1.0", features = ["use-std"] }
serde_bare = "0.5"
serde_cbor = "0.11"
serde_json = "1.0"
serde_yaml = "0.9"
toml = "0.8"

[package.metadata.docs.rs]
features = ["frodo640aes", "frodo640shake", "frodo976aes", "frodo976shake", "frodo1344aes", "frodo1344shake", "serde"]
rustdoc-args = ["--cfg", "docsrs"]

[[bench]]
name = "safe-oqs"
harness = false
path = "bench/safe_oqs.rs"
required-features = ["frodo640aes", "frodo640shake", "frodo976aes", "frodo976shake", "frodo1344aes", "frodo1344shake"]

Loading

0 comments on commit 46b10c3

Please sign in to comment.