Skip to content

Commit

Permalink
Merge pull request #1 from pinkforest/ci/add-no_std
Browse files Browse the repository at this point in the history
Fix `no_std` and add CI check
  • Loading branch information
bwesterb authored Jun 20, 2024
2 parents 315bb8a + 7697936 commit c9de5e3
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 10 deletions.
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

0 comments on commit c9de5e3

Please sign in to comment.