* Remove dependency on `packed_simd`
* Support SIMD on stable Rust
* Move `packed_simd.rs` to `vector` module
* Add comment header to `packed_simd.rs`
* Initialize SIMD registers using intrinsics instead of `transmute`
* Use a splat inside of `unpack_pair`
* Update README: the AVX2 backend now works on stable Rust
* Add a CI job to also build the AVX2 SIMD backend on Rust stable
* Added SIMD MSRV test
This is the name we adopted for a similar feature in @RustCrypto.
It's a bit less jargony and also leaves the door open in the future to
other types of precomputed tables.
* Add `basepoint-tables` crate feature
Feature-gates the inclusion of basepoint tables under a
`basepoint-tables` feature, with the goal of reducing code size for e.g.
embedded applications.
* Add `mul_base` method to `EdwardsPoint` and `RistrettoPoint`
Provides fixed-base scalar multiplication which optionally uses
precomputed basepoint tables when the `basepoint-tables` feature is
enabled, providing 4X better performance.
Falls back on variable-base scalar multiplication in the event the
feature is disabled.
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
We currently don't have any checks that this crate builds on a `no_std`
target.
While `curve25519-dalek` itself doesn't link `std`, it uses dependencies
which could potentially link `std`, so it's important to have a job to
check that the crate builds on a `no_std` target to ensure feature
activation doesn't accidentally flip on the `std` feature of one of
those dependencies unintentionally.
This adds a job which checks the crate builds on a `thumbv7em-none-eabi`
target which has no `std` implementation.
Previously `alloc` implicitly activated `zeroize` via `zeroize/alloc`.
This commit switches to weak feature activation as added in Rust 1.60,
only activating `zeroize/alloc` if the `zeroize` dependency is
explicitly activated (which it is by default).
* Make `zeroize` an optional dependency
The `zeroize` crate provides a defense against memory read oracles which
typically arise from memory unsafety.
Pure Rust programs may not benefit from `zeroize`, and in certain cases
the unsafe code used by `zeroize` may be more concerning.
This commit makes `zeroize` into an optional feature so users may elect
to disable it if they so desire.
* Added zeroize feature flag to README
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
build.rs was using cfg(target) but it has to evaluate this from env TARGET
as build.rs cfg(target) in build context is the builder host and not the target.
This change fixes curve25519_dalek_bits lottery to determine the correct
automatic curve25119_dalek_bits with the help of platforms crate.
As discussed in #456 this also prepares for well known defaults for wasm and
arm serial backend via cfg(curve25519_dalek_bits = "64")
If the wasm32 or armv7 are going to be u64 serial by default these will be
followed up on later.
Crate features are intended to be additive, whereas only 1-of-N possible
backends can be selected.
Features can also be activated by transitive dependencies, which leads
to a problem of different dependences selecting conflicting backends.
Using `--cfg` instead moves all backend selection control to the
toplevel executable.
This commit switches to the following RUSTFLAGS to enable backends:
- `--cfg curve25519_dalek_backend="fiat"`: uses `fiat-crypto`
- `--cfg curve25519_dalek_backend="simd"`: uses nightly-only SIMD
* Restructure README and CHANGELOG
* Explain semver policy
* Specify feature flags and backends more explicitly
* Remove nightly from the CI bc that didn't belong there
* Add @pinkforest to thankyou list
Co-authored-by: pinkforest <36498018+pinkforest@users.noreply.github.com>
Previously `cargo test --no-default-features` would succeed but with
warnings. This commit fixes all of those warnings and tests
`--no-default-features` in CI to ensure that in perpetuity.
As suggested in #453 it is sometimes feasible to
select the backend bits via an override.
This change provides `cfg(curve25519_dalek_bits)`
to override the bits used in serial or fiat target backend.
The `RUSTFLAGS` were getting applied to build scripts, which caused them
to crash with SIGILL.
According to this issue, RUSTFLAGS won't be applied to build scripts
when cross-compiling by passing the `--target` attribute:
https://github.com/rust-lang/cargo/issues/4423
This attempts to work around the problem by explicitly passing:
--target x86_64-unknown-linux-gnu
As proposed in #414, this commit changes the backend selection approach,
introspecting `target_pointer_width` to select `u32_backend` vs
`u64_backend` (or `fiat_u32_backend`/`fiat_u64_backend` if the
`fiat_backend` feature is enabled).
This helps eliminate the use of non-additive features, and also the
rather confusing errors that happen if multiple backends are selected
(i.e. thousands of lines of rustc errors).
The selection logic checks if `target_pointer_width = "64"` and uses the
64-bit backend, or falls back to the 32-bit backend otherwise. This
means the crate will always have a valid backend regardless of the
pointer width, although there may be odd edge cases for exotic platforms
which would optimally use the 64-bit backend but have a non-"64" target
pointer width for whatever reason. We can handle those cases as they
come up.
This replaces the Travis CI workflows.
(cherry picked from commit d66a5a81f87dae29d0bb1a41bec26c57e6909c28)
Signed-off-by: Isis Lovecruft <isis@patternsinthevoid.net>
I discarded the portion of the original commit which removed TravisCI.