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

ml-kem: add initial CI configuration #3

Merged
merged 5 commits into from
Mar 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
97 changes: 97 additions & 0 deletions .github/workflows/ml-kem.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
name: ml-kem

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

defaults:
run:
working-directory: ml-kem

env:
RUSTFLAGS: "-Dwarnings"
CARGO_INCREMENTAL: 0

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

# TODO
# 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 }}

# TODO
# minimal-versions:
# uses: RustCrypto/actions/.github/workflows/minimal-versions.yml@master
# with:
# working-directory: ${{ github.workflow }}

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 --all-features
# TODO(tarcieri): remove cargo build, run cargo test
#- run: cargo test --no-default-features
#- run: cargo test
#- run: cargo test --all-features

# TODO(tarcieri): miri
# miri:
# runs-on: ubuntu-latest
# env:
# MIRIFLAGS: "-Zmiri-symbolic-alignment-check -Zmiri-strict-provenance"
# strategy:
# matrix:
# target:
# - x86_64-unknown-linux-gnu
# - s390x-unknown-linux-gnu
# steps:
# - uses: actions/checkout@v4
# - uses: RustCrypto/actions/cargo-cache@master
# - uses: dtolnay/rust-toolchain@master
# with:
# toolchain: nightly
# - name: Install Miri
# run: |
# rustup component add miri
# cargo miri setup
# - name: Test with Miri
# run: |
# cargo miri test --target ${{ matrix.target }} --no-default-features
# cargo miri test --target ${{ matrix.target }}
# cargo miri test --target ${{ matrix.target }} --all-features
44 changes: 44 additions & 0 deletions .github/workflows/workspace.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Workspace

on:
pull_request:
paths-ignore:
- README.md
push:
branches:
- master
paths-ignore:
- README.md

env:
CARGO_INCREMENTAL: 0
RUSTFLAGS: "-Dwarnings"
RUSTDOCFLAGS: "-Dwarnings"

jobs:
clippy:
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
- uses: dtolnay/[email protected]
with:
components: clippy
- run: cargo clippy -- -D warnings
# TODO: - run: cargo clippy --all-features --all-targets -- -D warnings

doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo doc --workspace --all-features --document-private-items

rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- run: cargo fmt --all -- --check
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ resolver = "2"
members = [
"ml-kem",
]

[profile.bench]
debug = true
4 changes: 1 addition & 3 deletions ml-kem/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name = "ml-kem"
version = "0.1.0"
edition = "2021"
rust-version = "1.74"

[features]
default = []
Expand All @@ -20,9 +21,6 @@ hex = "0.4.3"
hex-literal = "0.4.1"
rand = "0.8.5"

[profile.bench]
debug = true

[[bench]]
name = "mlkem"
harness = false
2 changes: 1 addition & 1 deletion ml-kem/src/kem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ where
&self,
m: &B32,
) -> Result<(EncodedCiphertext<P>, SharedKey), Self::Error> {
Ok(self.encapsulate_deterministic_inner(&m))
Ok(self.encapsulate_deterministic_inner(m))
}
}

Expand Down
6 changes: 5 additions & 1 deletion ml-kem/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ pub trait EncapsulateDeterministic<EK, SS> {
/// Encapsulation error
type Error: Debug;

/// Encapsulates a fresh shared secret
/// Encapsulates a fresh shared secret.
///
/// # Errors
///
/// Will vary depending on the underlying implementation.
fn encapsulate_deterministic(&self, m: &B32) -> Result<(EK, SS), Self::Error>;
}

Expand Down
Loading