-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial implementation of x-wing (#62)
Implementation of the X-WING KEM. Following the RFC version 04: https://datatracker.ietf.org/doc/html/draft-connolly-cfrg-xwing-kem
- Loading branch information
1 parent
f335a41
commit c57e7ad
Showing
12 changed files
with
908 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
Oops, something went wrong.