Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial implementation of x-wing #62

Merged
merged 7 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@1.79
- uses: dtolnay/rust-toolchain@1.81
with:
components: clippy
- run: cargo clippy -- -D warnings
Expand Down
90 changes: 90 additions & 0 deletions .github/workflows/x-wing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: x-wing

on:
pull_request:
paths:
- ".github/workflows/x-wing.yml"
- "x-wing/**"
- "Cargo.*"
push:
branches: master

defaults:
run:
working-directory: x-wing

env:
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 0

jobs:
set-msrv:
uses: RustCrypto/actions/.github/workflows/set-msrv.yml@master
with:
msrv: 1.81.0

minimal-versions:
# temporarily disabled as requested by Tony (https://github.com/RustCrypto/KEMs/pull/15#pullrequestreview-2006378802)
if: false
uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
with:
working-directory: ${{ github.workflow }}

no_std:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
target:
- thumbv7em-none-eabi
- wasm32-unknown-unknown
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: cargo build --no-default-features --target ${{ matrix.target }}

test:
needs: set-msrv
runs-on: ubuntu-latest
strategy:
matrix:
rust:
- ${{needs.set-msrv.outputs.msrv}}
- stable
steps:
- uses: actions/checkout@v4
- uses: RustCrypto/actions/cargo-cache@master
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo build --benches
- run: cargo build --benches --all-features
- run: cargo test --no-default-features
- run: cargo test
- run: cargo test --all-features

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
32 changes: 32 additions & 0 deletions Cargo.lock

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

5 changes: 1 addition & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
[workspace]
resolver = "2"
members = [
"dhkem",
"ml-kem",
]
members = ["dhkem", "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 @@ -16,6 +16,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)](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)](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)](https://crates.io/crates/x-wing) | [![Documentation](https://docs.rs/x-wing/badge.svg)](https://docs.rs/x-wing) | Hybrid PQ KEM |

## License

Expand Down
51 changes: 51 additions & 0 deletions x-wing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[package]
name = "x-wing"
description = """
Pure Rust implementation of the X-Wing Key-Encapsulation Mechanism
"""
version = "0.1.0"
edition = "2021"
rust-version = "1.81"
license = "Apache-2.0 OR MIT"
readme = "README.md"
homepage = "https://github.com/RustCrypto/KEMs/tree/master/x-wing"
repository = "https://github.com/RustCrypto/KEMs/tree/master/x-wing"
categories = ["cryptography", "no-std"]
keywords = ["crypto", "x-wing", "xwing", "kem", "post-quantum"]
exclude = ["src/test-vectors.json"]

[features]
getrandom = ["rand_core/getrandom"]
zeroize = ["dep:zeroize", "ml-kem/zeroize", "x25519-dalek/zeroize"]

[lints.clippy]
pedantic = "warn" # Be pedantic by default
similar_names = { level = "allow", priority = 1 } # So we can use the names as in the RFC

[lints.rust]
missing_docs = "deny" # Require all public interfaces to be documented

[dependencies]
rand_core = { version = "0.6", default-features = false }
x25519-dalek = { version = "2.0", default-features = false, features = [
"static_secrets",
] }
ml-kem = { version = "0.2", default-features = false, features = [
"deterministic",
], path = "../ml-kem" }
sha3 = { version = "0.10", default-features = false }
kem = "0.3.0-pre.0"
zeroize = { version = "1.8.1", optional = true, default-features = true, features = [
"zeroize_derive",
] }

[dev-dependencies]
rand_core = { version = "0.6" }
hex = { version = "0.4", features = ["serde"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
rand = "0.8"

[package.metadata.docs.rs]
all-features = true
rustdoc-args = ["--cfg", "docsrs"]
Loading