Commit graph

1999 commits

Author SHA1 Message Date
pinkforest
52742e7864
Merge remote-tracking branch 'ed/main' into monorepo-t1 2023-06-27 04:01:16 +00:00
pinkforest
40cf5aff99
Workspace curve25519 under curve25519-dalek 2023-06-27 04:00:12 +00:00
pinkforest(she/her)
58a967f6fb
chore: Release 2.0.0-rc.3 (#307)
* chore: Release 2.0.0-rc.3

* cargo update -p curve25519-dalek

* Removed some old backend selection prose and env vars

---------

Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-23 23:53:10 -04: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
Michael Rosenberg
9b166b75e0
Update to new Scalar API (#293)
* Updated to new curve25519 scalar API

* Made ExpandedSecretKey.scalar_bytes unclamped; clamping occurs in all scalar-point multiplication

* Added legacy compat deprecation notice

* Removed deprecation notice on check_scalar

* Removed unnecessary unwraps
2023-06-12 00:06:00 -04:00
Michael Rosenberg
e111b5d913
Merge pull request #523 from koute/main_runtime_simd
Runtime backend autodetection
2023-06-10 22:01:03 -04:00
Jan Bujak
50aa63532b
Fix the doc comment in packed_simd.rs 2023-06-05 16:42:45 +09:00
Jan Bujak
502897109c Pin the version of unsafe_target_feature 2023-06-05 16:40:31 +09:00
Jan Bujak
94247a79d1
Revert "(work-in-progress) Partially remove unsafe_target_feature"
This reverts commit c67e430cfd.
2023-06-05 16:38:58 +09:00
Tony Arcieri
618c5081f1
Replace unwrap_u8 with into (#528)
* Replace `unwrap_u8` with `into`

Leverages the `From<Choice>` impl for `bool` where applicable instead,
which results in clearer logic which more closely matches `bool`.
2023-05-30 21:49:13 -04:00
Marek
6c2233bc45
Fix the upper bound in the description of mods (#525) 2023-05-29 15:24:45 -06:00
Tony Arcieri
267961b7ee
README.md: use buildstats.info crate badge (#526)
Includes both version and download count
2023-05-20 13:26:05 -06:00
Jan Bujak
c67e430cfd
(work-in-progress) Partially remove unsafe_target_feature 2023-05-17 14:39:09 +09:00
Jan Bujak
a7df9c7918
Remove Selfs which don't compile anymore 2023-05-17 13:22:11 +09:00
Michael Rosenberg
4afbf09e1c
Add hazmat module with ExpandedSecretKey, raw_sign, raw_sign_prehashed (#299)
* Added raw_sign() and raw_sign_prehashed() functions

* Renamed `nonce` to `hash_prefix` in signing because it's really not a nonce

* Moved raw signing to hazmat module

* impl From<EdwardsPoint> for VerifyingKey

* Brought back ExpandedSecretKey; made raw_* functions take it as input

* Added remaining features to docs.rs feature set

* Removed redundant ExpandedSecretKey def; made raw signing use a generic CtxDigest

* Implemented raw_verify with generic CtxDigest

* Implemented raw_verify_prehashed with generic MsgDigest and CtxDigest

* Wrote hazmat tests; fixed errors; switched ordering of MsgDigest and CtxDigest

* Updated changelog

* ExpandedSecretKey::from_bytes takes an array and is now infallible

* Add TODO comment for split_array_ref

* Added from_slice and TryFrom<&[u8]> for ExpandedSecretKey

---------

Co-authored-by: Tony Arcieri <bascule@gmail.com>
2023-05-15 00:50:38 -04:00
Damir Jelić
90f10ed096
Fix a typo (#300) 2023-04-11 11:19:36 -06:00
Jan Bujak
738cfee020
Get rid of the unused_unsafe warning on old versions of Rust. 2023-04-11 21:01:55 +09:00
Jan Bujak
996b1e9077
Make cargodoc happy 2023-04-11 20:49:06 +09:00
Jan Bujak
1b6fee354d
Make clippy happy 2023-04-11 20:44:37 +09:00
Jan Bujak
219995dbc9
rustfmt src/backend/vector/scalar_mul (no changes besides formatting) 2023-04-11 20:13:31 +09:00
Jan Bujak
0db8783be8
Runtime backend autodetection 2023-04-11 20:13:20 +09:00
Jan Bujak
91e839aae5
Add extra #[inline]; this speeds up the avx2 backend slightly 2023-04-11 20:09:21 +09:00
Michael Rosenberg
80aac08c1c
Fixed repoerted speedup/slowdown percentages in README benchmarks (#297) 2023-03-30 15:00:52 -04:00
Tony Arcieri
c8c9f29989
Add Scalar and MontgomeryPoint conversions (#296)
* Add `Scalar` and `MontgomeryPoint` conversions

- Adds `SigningKey::to_scalar` to extract the private scalar
- Adds `VerifyingKey::to_montgomery` to map the verifying key's
  `EdwardsPoint` to a `MontgomeryPoint`
- Also adds corresponding `From<&T>` impls which call the inherent
  methods.

This is useful for systems which are keyed using Ed25519 keys which
would like to use X25519 for D-H. Having inherent methods means it's
possible to call these methods without having to import `Scalar` and
`MontgomeryPoint` from `curve25519-dalek`.

This is of course a bit circuitous: we could just multiply `Scalar` by
`EdwardsPoint` and use the resulting `EdwardsPoint` as the D-H shared
secret, however it seems many protocols have adopted this approach of
mapping to `MontgomeryPoint` and using that for the shared secret, since
X25519 is traditionally used for ECDH with Curve25519.

* Add reference to eprint 2021/509

* Basic X25519 Diffie-Hellman test
2023-03-30 13:29:36 -04: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)
5014c91270
chore: Release 2.0.0-rc.2 (#295)
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-03-26 11:23:14 -04:00
Rob Ede
7901b21e06
Improve diagnostics when key being deserializing is too long (#294) 2023-03-26 04:11:23 -04:00
pinkforest(she/her)
c982811d11
chore: Release 4.0.0-rc.2 (#522) 2023-03-26 02:49:20 -04:00
ryan
2931c688eb
Fix serde / no_std incompatibility
Co-authored-by: ryan kurte <ryan@kurte.nz>
Co-authored-by: Vlad Semenov <semenov.vlad.by@gmail.com>
2023-03-21 13:45:33 -06:00
pinkforest(she/her)
9577d1e322
Add no_std to CI (#289)
* Add no_std to CI

* Add serde to no_std feature test

* Try out cargo hack

* No serde - expect success

* Add build for no-default-features

* Exclude default
2023-03-21 01:46:43 -04:00
Samuel Moelius
7dc1bbd855
Remove two unnecessary into_iter (#290) 2023-03-18 09:22:15 -06:00
pinkforest(she/her)
99c0520aa7
Fixes cfg with target from env (#516)
* Fixes cfg with target from env

* Derive cleanup

* Default to curve25519_dalek_bits="32" on unknown target

* Give out warning (thanks @jcape)

Co-authored-by: ryan <ryankurte@users.noreply.github.com>
Co-authored-by: James Cape <james@mobilecoin.com>
2023-03-18 04:34:47 -04:00
Jordan Rose
a63e14f4de
Use ok_or_else instead of ok_or in serde decoding (#382)
Serde errors are not simple enums; they format a full error string
from their arguments. It's worth not doing that up front.
2023-03-13 21:42:01 -06:00
pinkforest(she/her)
67b8c2e40c
Fix error for custom targets (#510) 2023-03-10 13:21:20 -05:00
Dirk Stolle
64b26ad074
Fix a few typos (#281) 2023-03-07 02:54:30 -05:00
Dirk Stolle
c33b49bf5a
Update actions/checkout in GitHub Actions workflow to v3 (#282) 2023-03-07 02:44:55 -05:00
Dirk Stolle
3efde345b6
Remove invalid input fields from CI action for Rust setup (#283)
Neither `override` nor `profile` are valid inputs for the
`dtolnay/rust-toolchain` action. It always uses the minimal
profile anyways.
2023-03-07 02:35:10 -05:00
Tony Arcieri
e0e02cfcf4
Bump ed25519 to v2.2; pkcs8 to v0.10 (#285)
The `ed25519` v2.2.0 crate bumps the `pkcs8` dependency to v0.10.

This updates `ed25519` to the latest version and updates the PKCS#8
support to use the new API.
2023-03-07 02:20:09 -05:00
Tony Arcieri
4686ade1b5
Use named fields for struct VerifyingKey (#284)
Previously it was a 2-tuple containing a `CompressedEdwardsY`
serialization and a decompressed `EdwardsPoint`, however using
`.0` and `.1` for these respectively makes the code hard to read.

This commit changes them to `compressed` and `point`, which as it were
are the names of the local variables used when constructing a
`VerifyingKey`, which improves clarity.
2023-03-07 02:16:19 -05:00
Michael Rosenberg
619ef68d73
Merge pull request #279 from rozbb/main
Bump curve25519 dep to rc.1
2023-02-04 10:06:05 -05:00
Michael Rosenberg
0b04124175
Fixed MSRV build 2023-02-04 03:24:09 -05:00
Michael Rosenberg
b77fa51569
Bump curve25519-dalek dep to rc.1 2023-02-04 03:21:36 -05:00
Michael Rosenberg
ce3eed873c
Merge pull request #278 from dalek-cryptography/release/2.0
Merge `release/2.0` into `main`
2023-02-02 18:12:59 -05:00
Michael Rosenberg
b2d0f0ecd7
Bump to rc.1 2023-02-02 17:21:56 -05:00
Michael Rosenberg
57a8add0fd
Removed vestigial nightly feature from docsrs instructions 2023-02-02 17:18:47 -05:00
Michael Rosenberg
783b6e81c4
README changes for 2.0 (#275)
* Added items to changelog for 2.0 release

* Removed unnecessary uses of std in doctests

* Gated `Context` behind `digest`

* Fixed noncompiling doctest when only `digest` is enabled

* README feature flag list mostly done

* Copied changelog to readme

* Redid the malleability section in README

* Added CONTRIBUTING.md

* Bumped version number to 2.0.0-pre.0; small changes to README

* Updated changelog for #277

* Added pem feature description

Co-authored-by: pinkforest(she/her) <36498018+pinkforest@users.noreply.github.com>
2023-02-02 17:07:56 -05:00
Michael Rosenberg
3b71630d9f
Fix docsrs build (#505)
* Add docsrs build to CI

* Put cfg flags in both RUSTFLAGS and RUSTDOCFLAGS
2023-02-02 04:06:14 -05:00
Michael Rosenberg
5190ad6df8
Impl VerifyingKey::is_weak (#277)
* Implemented VerifyingKey::is_weak

* Added unit test for VerifyingKey::is_weak
2023-01-31 16:23:38 -05:00