2259 Commits

Author SHA1 Message Date
pinkforest
bf8b21c439
Add new workspace README and CONTRIBUTING
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-28 09:40:52 +00:00
pinkforest
7db9981a7f
Re-work CI around workspace
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-28 09:38:56 +00:00
pinkforest
6e422d96d7
Re-organize Cargo manifests to workspace 2023-06-28 09:38:06 +00:00
pinkforest
2cc52c216e
Move CI & assets into workspace
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-28 08:59:51 +00:00
pinkforest
bf0e37d3ed
Workspace x25519 under x25519-dalek 2023-06-27 04:09:32 +00:00
pinkforest
e7ecb74ed0
Merge remote-tracking branch 'x/main' into monorepo-t1 2023-06-27 04:06:50 +00:00
pinkforest
d62def9c22
Workspace ed25519 under ed25519-dalek 2023-06-27 04:04:09 +00:00
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)
8613b5a809
chore: Release 2.0.0-rc.3 (#128)
* chore: Release 2.0.0-rc.3

* cargo update -p curve25519-dalek

* Added note about backends

* Fixed docs broken link

---------

Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2023-06-23 23:54:38 -04: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 c67e430cfdf9699cf9b90226ab08a3b48cadacc6.
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
Tony Arcieri
f683cf4d50
Merge pull request #125 from eaon/crypto_box_url
Update `crypto_box` URL
2023-05-09 07:05:03 -06:00
eaon
d828434d60
Update crypto_box URL 2023-05-08 18:56:43 -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
25fa593df2
Update to new Scalar API (#120)
* Updated to new curve25519 scalar API

* Removed clamping from constructors; clamping is always done during scalar-point multiplication

* Updated test to reflect new functionality

* Updated changelog
2023-03-31 16:58:35 -04:00
pinkforest(she/her)
cccf389467
chore: Release 2.0.0-rc.2 (#123) 2023-03-31 13:53:51 -04:00
pinkforest(she/her)
84158337af
Make static_secrets optional (#122)
* Make `static_secrets` optional

* Added more feature combinations to CI
2023-03-31 13:34:03 -04: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
pinkforest(she/her)
02a5ce20ca
Add getrandom (#118)
* Add getrandom to bring convenience random init functions

* Fix doc name

* Rename new to random_from_rng

* Deprecate new() in favor of random_from_rng()

* Simplify constructors documentation

Co-authored-by: Ciprian Dorin Craciun <ciprian@volution.ro>
2023-03-21 01:40:51 -04:00
Tony Arcieri
6aabb9bf08
Merge pull request #119 from pinkforest/fix-no_std
Fix `no std` by moving `get_random` feat dev-deps
2023-03-20 19:05:42 -06:00
Michael Rosenberg
0e73cb82bc
Merge pull request #117 from dalek-cryptography/release/2.0
Merge `release/2.0` into `main`
2023-03-20 14:24:42 -04:00
Michael Rosenberg
d6c3cbf97d
Merge branch 'main' into release/2.0 2023-03-20 14:19:38 -04:00
Samuel Moelius
7dc1bbd855
Remove two unnecessary into_iter (#290) 2023-03-18 09:22:15 -06:00