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

Fix no_std and add CI check #1

Merged
merged 5 commits into from
Jun 20, 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
24 changes: 24 additions & 0 deletions .github/workflows/no_std.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
on:
workflow_dispatch:
push:
branches: [ master ]
pull_request:
branches: [ '**' ]

jobs:
build-nostd:
name: Build on no_std target (thumbv7em-none-eabi)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: thumbv7em-none-eabi
- uses: taiki-e/install-action@cargo-hack
# No default features build
- name: no_std / no feat
run: cargo build --target thumbv7em-none-eabi --release --no-default-features
# cargo hack ensures all no_std features all built-checked
- name: no_std / cargo hack features
run: cargo hack build --target thumbv7em-none-eabi --release --each-feature --exclude-features default,std,getrandom,wasm,benchmarking,kyber1024
19 changes: 9 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,20 @@ description = "Fork of pqc_kyber with some safety fixes"
keywords = ["kyber", "kem", "key-exchange", "kex", "post-quantum"]
readme = "readme.md"

resolver = "2"

[dependencies]
rand_core = { version = "0.6.4", default-features = false }
wasm-bindgen = { version = "0.2.84", optional = true }
getrandom = {version = "0.2.9", features = ["js"], optional = true }
zeroize = { version = "1.6.0", features = ["derive"], optional = true }
# Optional dev-deps, see https://github.com/rust-lang/cargo/issues/1596
# wasm needs rand - TODO: remove
rand = { version = "0.8", default-features = false, optional = true }
getrandom = {version = "0.2.9", default-features = false, optional = true }
criterion = { version = "0.4.0", features = ["html_reports"], optional = true }

[dependencies.rand]
version = "0.8.5"
default-features = false
features = ["getrandom"]
optional = true

[dev-dependencies]
rand = "0.8.5"
rand = { version = "0.8", default-features = false, features = ["std", "std_rng", "getrandom"] }
rand_core = { version = "0.6", default-features = false, features = ["getrandom"] }

[build-dependencies]

Expand All @@ -38,6 +36,7 @@ name = "api"
harness = false

[features]
default = []
### Security Levels ###
# Defaults to "kyber768" if none selected
# Will throw a compile-time error if more than one level is chosen
Expand All @@ -46,7 +45,7 @@ kyber768 = []
kyber1024 = []

# For compiling to wasm targets
wasm = ["wasm-bindgen", "getrandom", "rand"]
wasm = ["wasm-bindgen", "rand/getrandom", "rand_core/getrandom", "getrandom/js"]

# Enable std library support
std = []
Expand Down