diff --git a/.github/workflows/crypto_box.yml b/.github/workflows/crypto_box.yml index eae7498..23e9a4a 100644 --- a/.github/workflows/crypto_box.yml +++ b/.github/workflows/crypto_box.yml @@ -36,8 +36,8 @@ jobs: toolchain: ${{ matrix.rust }} target: ${{ matrix.target }} override: true - - run: cargo build --target ${{ matrix.target }} --release --no-default-features - - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features heapless + - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features u32_backend + - run: cargo build --target ${{ matrix.target }} --release --no-default-features --features u32_backend,heapless test: runs-on: ubuntu-latest @@ -53,9 +53,9 @@ jobs: profile: minimal toolchain: ${{ matrix.rust }} override: true - - run: cargo test --release --no-default-features - - run: cargo test --release - - run: cargo test --release --all-features + - run: cargo test --release --features std + - run: cargo test --release --features std,heapless + - run: cargo test --release --features std,serde cross: strategy: @@ -78,4 +78,4 @@ jobs: target: ${{ matrix.target }} override: true - run: cargo install cross - - run: cross test --release --target ${{ matrix.target }} --all-features + - run: cross test --release --target ${{ matrix.target }} --features std,serde diff --git a/crypto_box/Cargo.toml b/crypto_box/Cargo.toml index d277d18..403c7c8 100644 --- a/crypto_box/Cargo.toml +++ b/crypto_box/Cargo.toml @@ -22,32 +22,29 @@ aead = { version = "0.5.1", default-features = false } chacha20 = "0.9" chacha20poly1305 = { version = "0.10.1", default-features = false, features = ["rand_core"] } salsa20 = "0.10" +x25519-dalek = { version = "1", default-features = false } xsalsa20poly1305 = { version = "0.9", default-features = false, features = ["rand_core"] } zeroize = { version = "1", default-features = false } # optional dependencies serdect = { version = "0.1", optional = true, default-features = false } -[target.'cfg(target_pointer_width = "32")'.dependencies] -x25519-dalek = { version = "1", default-features = false, features = ["u32_backend"] } - -[target.'cfg(target_pointer_width = "64")'.dependencies] -x25519-dalek = { version = "1", default-features = false, features = ["u64_backend"] } - [dev-dependencies] bincode = "1" rand = "0.8" rmp-serde = "1" [features] -default = ["alloc", "getrandom"] +default = ["alloc", "getrandom", "u64_backend"] std = ["aead/std"] +serde = ["serdect"] alloc = ["aead/alloc"] getrandom = ["aead/getrandom", "rand_core"] heapless = ["aead/heapless"] rand_core = ["aead/rand_core"] -serde = ["serdect"] +u32_backend = ["x25519-dalek/u32_backend"] +u64_backend = ["x25519-dalek/u64_backend"] [package.metadata.docs.rs] -all-features = true +features = ["serde"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/crypto_box/src/lib.rs b/crypto_box/src/lib.rs index f9f8d76..fab5200 100644 --- a/crypto_box/src/lib.rs +++ b/crypto_box/src/lib.rs @@ -164,9 +164,6 @@ //! [ECIES]: https://en.wikipedia.org/wiki/Integrated_Encryption_Scheme //! [`heapless::Vec`]: https://docs.rs/heapless/latest/heapless/struct.Vec.html -#[cfg(not(any(target_pointer_width = "32", target_pointer_width = "64")))] -compile_error!("`crypto-box` requires either a 32-bit or 64-bit target"); - pub use aead::{self, rand_core}; pub use xsalsa20poly1305::Nonce;