Skip to content

Commit

Permalink
Initial implementation of x-wing
Browse files Browse the repository at this point in the history
  • Loading branch information
Christiaan676 committed Sep 17, 2024
1 parent 41ae1d6 commit 9e6b32c
Show file tree
Hide file tree
Showing 12 changed files with 867 additions and 5 deletions.
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: ml-kem

on:
pull_request:
paths:
- ".github/workflows/x-wing.yml"
- "ml-kem/**"
- "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
44 changes: 44 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
35 changes: 35 additions & 0 deletions x-wing/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[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/ml-kem"
repository = "https://github.com/RustCrypto/KEMs"
categories = ["cryptography", "no-std"]
keywords = ["crypto", "x-wing", "xwing", "kem", "post-quantum"]

[dependencies]
rand_core = { version = "0.6.4", default-features = false }
x25519-dalek = { version = "2.0", features = [
"static_secrets",
"reusable_secrets",
] }
ml-kem = { version = "*", features = ["deterministic"] }
sha3 = { version = "0.10", default-features = false }

[dev-dependencies]
rand_core = { version = "0.6.4" }
hex-literal = "0.4"
hex = { version = "0.4.3", 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

0 comments on commit 9e6b32c

Please sign in to comment.