Commit graph

263 commits

Author SHA1 Message Date
pinkforest
40cf5aff99
Workspace curve25519 under curve25519-dalek 2023-06-27 04:00:12 +00:00
pinkforest(she/her)
2e3212b8cc
chore: Release 4.0.0-rc.3 (#535) 2023-06-23 17:13:20 -04:00
pinkforest(she/her)
e429bde88d
Clean up backend features and vendor curve25519_dalek_derive (#531)
* Vendor import unsafe_target_features as curve25519-dalek-derive

Co-authored-by: Jan Bujak <jan@parity.io>

* Remove feature gates from avx2/ifma

* Add buildtime compile diagnostics about backend selection

* Add build script tests

* Documentation changes

* Disable simd related features unless simd was determined via build

* Add note and test about the override warning when unsuccesful

* Reduce complexity in build gating via compile_error

---------

Co-authored-by: Jan Bujak <jan@parity.io>
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-22 01:46:27 -04:00
Jan Bujak
502897109c Pin the version of unsafe_target_feature 2023-06-05 16:40:31 +09:00
Jan Bujak
0db8783be8
Runtime backend autodetection 2023-04-11 20:13:20 +09:00
Koute
4583c472f5
Support SIMD on Rust stable (#520)
* 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
2023-03-30 02:16:18 -04:00
Michael Rosenberg
f460ae149b
Make scalars always reduced (#519)
* Removed Scalar::{from_bits, from_bytes_clamped}; all constructible scalars are now reduced mod l

* Made Scalar::reduce() not pub; fixed test warning

* Added benches for scalar add/sub/mul

* Docs

* Added EdwardsPoint::mul_base_clamped and gated Scalar::from_bits behind legacy_compatibility

* Added unit test for Mul impl on unreduced Scalars

* Added Montgomery::mul_base_clamped

* Added BasepointTable::mul_base_clamped

* Removed invalid scalar arithmetic test; this functionality is no longer supported

* Made clamp_integer() const

* Updated readme and changelog

* Added BasepointTable::mul_base_clamped to tests

* Added proper deprecation notice to Scalar::from_bits; added legacy_compatibility to Makefile and docsrs flags
2023-03-28 18:12:24 -04:00
pinkforest(she/her)
c982811d11
chore: Release 4.0.0-rc.2 (#522) 2023-03-26 02:49:20 -04:00
Michael Rosenberg
b2d0f0ecd7
Bump to rc.1 2023-02-02 17:21:56 -05:00
Michael Rosenberg
1a388f7135
Bump version to 4.0-rc.0 (#501) 2023-01-27 14:14:58 -05:00
Michael Rosenberg
3effd73307
Feature-gated more precomputed tables (#500)
Feature-gates `AFFINE_ODD_MULTIPLES_OF_BASEPOINT`

Feature-gated tables out of vector vartime aA + bB procedure
2023-01-20 10:55:32 -07:00
Tony Arcieri
8d1bc31805
Rename basepoint-tables to precomputed-tables (#499)
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.
2023-01-19 14:04:22 -05:00
Tony Arcieri
83f6b149d3
Add basepoint-tables crate feature (#489)
* 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>
2023-01-08 03:51:51 -05:00
Tony Arcieri
0ffcb84625
Don't set html_root_url (#483)
The recommendation to set this has been removed from the Rust API
guidelines:

https://github.com/rust-lang/api-guidelines/pull/230

It used to be used by docs.rs, but docs.rs now unconditionally sets the
`--extern-html-root-url` parameter of rustdoc which overrides it, making
it no longer needed and superfluous.
2022-12-27 05:14:34 -05:00
Tony Arcieri
7227c6fa9b
Remove Travis CI configuration (#484)
The migration to GitHub Actions occurred quite awhile ago and Travis CI
is no longer used
2022-12-27 05:13:13 -05:00
Tony Arcieri
7d53206366
Weakly activate zeroize?/alloc; MSRV 1.60 (#485)
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).
2022-12-27 05:12:55 -05:00
Tony Arcieri
39dbaea6f9
Make zeroize an optional dependency (#481)
* 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>
2022-12-26 16:19:55 -05:00
pinkforest
39053b1c5d Fix docs release pre.5 2022-12-14 11:28:52 +11:00
Michael Rosenberg
b0b22def50
Bumped prerelease version 2022-12-13 17:17:34 -05:00
Michael Rosenberg
91c2305328
Fixed docsrs flags in Cargo.toml 2022-12-13 08:48:03 -05:00
Michael Rosenberg
dbe599532f
Bumped prerelease version 2022-12-13 02:32:48 -05:00
Michael Rosenberg
d7140146f2
Add rust-version to cargo
Co-authored-by: str4d <thestr4d@gmail.com>
2022-12-12 17:50:58 -05:00
Tony Arcieri
274f4a7bec
Change Scalar::from_canonical_bytes to return CtOption (#472)
This is helpful for implementing `ff::PrimeField::from_repr`.
Also changes `Scalar::is_canonical` to return `Choice`.
2022-12-12 17:38:04 -05:00
Tony Arcieri
fa45d21b76
Use CryptoRngCore trait (#469)
This is a convenience/marker trait for types which impl `CryptoRng` +
`RngCore` which makes the type signatures a little more readable.

It was introduced in `rand_core` v0.6.4 (now pinned as the minimum
version)
2022-12-11 15:11:15 -05:00
pinkforest(she/her)
cb42e87096
Fixes curve25519_dalek_bits defaults for cross and wasm (#465)
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.
2022-12-09 21:09:24 -05:00
Tony Arcieri
cc304c29ff
Use --cfg curve25519_dalek_backend to select backend (#455)
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
2022-12-09 03:42:52 -05:00
Michael Rosenberg
f5dada3834
Updates to README (#453)
* 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>
2022-12-09 03:30:44 -05:00
Tony Arcieri
1013560fe4
Remove std feature (#459)
All of the existing usages of `std` can be replaced with `alloc`.

They are legacy usages from before when liballoc was stabilized.
2022-12-08 15:05:59 -05:00
pinkforest(she/her)
6b56edf776
Make digest optional (#446)
As proposed in #442 this makes `digest` an
optional feature that is not covered by the
SemVer public API stability guarantees.

Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2022-12-08 13:59:28 -05:00
pinkforest(she/her)
47a0c3eacc
Make rand_core optional (#447)
As proposed in #442 this makes `rand_core` an
optional feature that is not covered by the
SemVer public API stability guarantees.

Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2022-12-08 13:50:17 -05:00
pinkforest(she/her)
29466f1b45
Minor documentation fixes (#444)
* Docs unlink from dalek.rs

* Link katex assets to jsdelivr

Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2022-12-07 05:36:07 -05:00
Michael Rosenberg
3e1643a99d Fixed features to tell docs.rs to use 2022-11-26 05:55:48 -05:00
pinkforest
ad7c755f49 Documentation migrate to docs.rs hosted
This change migrates all the documentation from dalek.rs
to docs.rs hosted and fixed the backend documentation
generation that was broken.
2022-11-26 11:26:25 +11:00
Tony Arcieri
081f632d91
Implement simplified backend selection (#428)
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.
2022-11-13 12:17:42 -05:00
pinkforest(she/her)
977eb0d3b7
Bump criterion to 0.4.0 (#432) 2022-11-13 01:36:46 -05:00
Hugo Tunius
c000957bae
Remove byteorder (#418)
Instead of having a dependency on `byteorder`, use methods from the
standard library(`{to,from}_le_bytes`).
2022-10-22 03:42:23 -04:00
Michael Rosenberg
5758b8cce1
Updated to edition 2021 (#413) 2022-10-18 13:45:59 -04:00
Michael Rosenberg
51572dae8d
Relax zeroize dependency and bump MSRV (#412) 2022-10-17 15:08:34 -04:00
Isis Lovecruft
c3ed99bf93
Bump curve25519-dalek version to 4.0.0-pre.2. 2022-02-16 21:26:01 +00:00
Isis Lovecruft
f78215308a
Merge branch 'develop' into release/4.0 2022-02-16 20:57:44 +00:00
Isis Lovecruft
f7381ac64c
Pin zeroize dependency to >=1, <1.4 to relax bounds for downstreams.
As suggested by @tarcieri in #362. See also commit b6a7406.
2022-02-16 20:52:33 +00:00
Isis Lovecruft
f9f0384aee
Bump sha2 and digest dependencies to 0.10. 2022-02-01 23:48:11 +00:00
Isis Lovecruft
b6a7406c73
Pin zeroize dependency to =1.3.0 to maintain MSRV 1.41. 2022-02-01 23:29:41 +00:00
Isis Lovecruft
b131092c9b
Merge branch 'develop' into release/4.0 2022-02-01 23:28:22 +00:00
Isis Lovecruft
df4e2fa129
Bump alpha curve25519-dalek version to 4.0.0-pre.1. 2021-08-17 00:40:38 +00:00
Isis Lovecruft
62e38cd050
Merge branch 'develop' into release/4.0 2021-08-17 00:31:01 +00:00
Isis Lovecruft
076cf347ba
Fix non-unique benchmark IDs for newer criterion versions. 2021-08-17 00:22:26 +00:00
Isis Lovecruft
396d26e463
Merge branch 'develop' into release/4.0 2021-08-03 23:06:58 +00:00
Isis Lovecruft
a7f4f0ec14
Merge branch 'develop' into release/3.2 2021-08-03 23:04:34 +00:00
Isis Lovecruft
49146274db
Fix a typo in Cargo.toml documentation. 2021-07-20 02:56:28 +00:00