Commit Graph

2346 Commits

Author SHA1 Message Date
Jordan Rose
7c6d347563 bench: Don't depend on FieldElement and elligator_ristretto_flavor
Some checks failed
All / Check formatting (push) Has been cancelled
All / Check docs (push) Has been cancelled
Cross / Test (stable, aarch64-unknown-linux-gnu) (push) Has been cancelled
Cross / Test (stable, armv7-unknown-linux-gnueabihf) (push) Has been cancelled
Cross / Test (stable, powerpc-unknown-linux-gnu) (push) Has been cancelled
curve25519 Rust / Test fiat backend (sudo apt update && sudo apt install gcc-multilib, i686-unknown-linux-gnu) (push) Has been cancelled
curve25519 Rust / Test fiat backend (x86_64-unknown-linux-gnu) (push) Has been cancelled
curve25519 Rust / Build fiat on no_std target (thumbv7em-none-eabi) (curve25519-dalek) (push) Has been cancelled
All / Check that clippy is happy (push) Has been cancelled
curve25519 Rust / Test serial backend (sudo apt update && sudo apt install gcc-multilib, i686-unknown-linux-gnu) (push) Has been cancelled
curve25519 Rust / Test serial backend (x86_64-unknown-linux-gnu) (push) Has been cancelled
curve25519 Rust / Test Build Script (push) Has been cancelled
curve25519 Rust / Test simd backend (nightly) (push) Has been cancelled
curve25519 Rust / Test simd backend (stable) (push) Has been cancelled
curve25519 Rust / Current MSRV is 1.60.0 (push) Has been cancelled
All / Test 32/64 bit stable (sudo apt update && sudo apt install gcc-multilib, i686-unknown-linux-gnu) (push) Has been cancelled
All / Test 32/64 bit stable (x86_64-unknown-linux-gnu) (push) Has been cancelled
All / Test Nightly (push) Has been cancelled
All / Check that benchmarks compile (push) Has been cancelled
All / Build serial on no_std target (thumbv7em-none-eabi) (curve25519-dalek) (push) Has been cancelled
All / Build serial on no_std target (thumbv7em-none-eabi) (ed25519-dalek) (push) Has been cancelled
All / Build serial on no_std target (thumbv7em-none-eabi) (x25519-dalek) (push) Has been cancelled
An Elligator benchmark was added for the "lizard" extensions, and it
made sure it was only measuring the Elligator part of the work by
expanding a set of bytes into a FieldElement ahead of time. However,
this requires the FieldElement alias to be pub, and depends on the
elligator_ristretto_flavor helper function being pub as well. Changing
it to test the lizard-based entry point means we're diverging less
from upstream, and it's more realistic anyway.
2024-06-18 15:18:14 -07:00
Jordan Rose
fa03398012 Merge upstream tag 'curve25519-4.1.3' 2024-06-18 15:17:10 -07:00
Michael Rosenberg
5312a0311e
curve: Bump version to 4.1.3 (#660)
* Bumped to v4.1.3

* Added recent PRs to changelog
2024-06-18 21:18:51 +02:00
Tony Arcieri
b4f9e4df92
SECURITY: fix timing variability in backend/serial/u32/scalar.rs (#661)
Similar security fix to #659, but for the 32-bit backend. See that PR
for more information about the problem. Relevant compiler outputs (thanks to @tarcieri):

Without fix
https://godbolt.org/z/zvaWxzvqv
Notice the `jns` ("jump if not sign") instruction on line 106.

With fix
https://godbolt.org/z/jc9j7eb8E
2024-06-18 21:02:37 +02:00
Michael Rosenberg
415892acf1
SECURITY: fix timing variability in backend/serial/u64/scalar.rs (#659)
Timing variability of any kind is problematic when working with
potentially secret values such as elliptic curve scalars, and such
issues can potentially leak private keys and other secrets. Such a
problem was recently discovered in `curve25519-dalek`.

The `Scalar52::sub` function contained usage of a mask value inside of a
loop where LLVM saw an opportunity to insert a branch instruction
(`jns` on x86) to conditionally bypass this code section when the mask
value is set to zero, as can be seen in godbolt:

https://godbolt.org/z/PczYj7Pda

A similar problem was recently discovered in the Kyber reference
implementation:

https://groups.google.com/a/list.nist.gov/g/pqc-forum/c/hqbtIGFKIpU/m/cnE3pbueBgAJ

As discussed on that thread, one portable solution, which is also used
in this PR, is to introduce a volatile read as an optimization barrier,
which prevents the compiler from optimizing it away.

The fix can be validated in godbolt here:

https://godbolt.org/z/x8d46Yfah

The problem was discovered and the solution independently verified by
Alexander Wagner <alexander.wagner@aisec.fraunhofer.de> and
Lea Themint <lea.thiemt@tum.de> using their DATA tool:

https://github.com/Fraunhofer-AISEC/DATA

Co-authored-by: Tony Arcieri <bascule@gmail.com>
2024-06-18 19:49:31 +02:00
Isaiah Becker-Mayer
56bf398d0c
Updates license field to valid SPDX format (#647) 2024-06-03 14:30:13 -06:00
pinkforest(she/her)
9252fa5c0d
Mitigate check-cfg until MSRV 1.77 (#652) 2024-05-09 07:24:16 -06:00
Hiroki Kobayashi
1efe6a93b1
Fix a minor typo in signing.rs (#649)
an -> a
2024-04-13 19:37:33 -06:00
Boyd Kane
cc3421a22f
Indicate that the rand_core feature is required (#641) 2024-03-16 07:43:25 -06:00
pinkforest(she/her)
858c4ca8ae
Address new nightly clippy unnecessary qualifications (#639) 2024-03-07 16:58:20 -07:00
pinkforest(she/her)
31ccb67050
Remove platforms in favor using CARGO_CFG_TARGET_POINTER_WIDTH (#636) 2024-03-01 07:35:23 -07:00
pinkforest(she/her)
19c7f4a5d5
Fix new nightly redundant import lint warns (#638) 2024-02-29 18:56:52 -07:00
Flori
a62e4a5c57
Fix minor spelling mistakes (#629) 2024-02-14 12:01:05 -07:00
Jack Lloyd
17eab3d6c1
ed: Make it possible to convert between VerifyingKey and EdwardsPoint (#624)
Adds VerifyingKey::to_edwards and a From conversion

See #623
2024-02-12 14:36:43 -05:00
Tony Arcieri
50401ab430
curve: mark ValidityCheck trait as allow(dead_code) (#625)
Recent nightlies have started emitting a dead code lint
2024-02-12 11:56:06 -05:00
Michael Rosenberg
4ac84dd066
curve,ed,x: Bump patch version to reflect fix to nightly SIMD build (#621) 2024-02-06 20:09:18 -05:00
Jimmy Chen
ff1c309b23
Fix nightly build (#619)
* Fix nightly build

* Add nightly feature constraint so AVX-512 requires either x86 or x86_64

Co-authored-by: Tony Arcieri <bascule@gmail.com>

* fmt

---------

Co-authored-by: Michael Rosenberg <micro@fastmail.com>
Co-authored-by: Tony Arcieri <bascule@gmail.com>
Co-authored-by: Michael Rosenberg <michael@mrosenberg.pub>
2024-02-06 15:09:29 -05:00
Ford
ba737a3790
Update README.md (#613) 2024-01-21 08:27:47 -07:00
Pioua
0b45e00ad5
chore: typo fix (#608) 2023-12-13 08:10:05 -07:00
Alex Konradi
a12ab4e584
Update to upstream v4.1.1 2023-12-06 13:07:48 -05:00
Alex Konradi
7051bd8dcf Merge upstream tag 'curve25519-4.1.1' 2023-12-06 09:41:54 -05:00
Wiktor Kwapisiewicz
ba7a073487
doc: Fix markdown PR reference (#605) 2023-11-22 06:21:20 -07:00
Bram Westerbaan
a2ff6ba9e4
{Signing,Verifying}KeyVisitor: visit_borrowed_bytes -> visit_bytes (#602) 2023-11-17 02:44:28 -05:00
Michael Rosenberg
f08bbb7f57
ed: Prep to release v2.1.0 (#600) 2023-11-14 15:35:42 -05:00
Michael Rosenberg
04f811ad21
ed: Add back SigningKey::to_scalar_bytes (#599)
* Brought back SigningKey::to_scalar_bytes; added regression test

* Updated SigningKey::to_scalar docs and tests
2023-11-14 13:23:48 -05:00
Tony Arcieri
ac51ef6ecf
ed25519: loosen signature crate dependency again (#598)
Like #582, there is a new release of `signature` (v2.2.0) which contains
no breaking changes from ed25519-dalek's perspective. The main notable
one is it bumps MSRV to 1.60, which so also happens to also be
ed25519-dalek's MSRV.

This commit loosens the version requirement to allow `>=2.0, <2.3` to
allow the `signature` 2.2 series.
2023-11-14 00:09:16 -05:00
Tony Arcieri
89aabac235
README.md: remove broken image (#595)
This image duplicates the `curve25519-dalek` table entry below.

It also doesn't actually link to anything, making README.md look broken.
2023-11-01 13:33:43 -04:00
Michael Rosenberg
72761ca6b4
derive: Bump version to 0.1.1 (#594)
* derive: Bump version to 0.1.1

* Added changelog
2023-10-31 13:40:12 -04:00
Tony Arcieri
3c85f778b3
CI: fix minimal-versions resolution (#593)
To avoid nightly regressions breaking the build, the CI configuration
has been updated to *only* use nightly for resolving Cargo.lock by using
`cargo update -Z minimal-versions`.

Previously, it was running `cargo check` which would attempt to compile
all of the dependencies and the code, which is why the diagnostic bug
was triggered. By avoiding any kind of code compilation using nightly we
can avoid such regressions in the future.

Additionally, the clippy job has been changed to run on the latest
stable release (1.73.0) rather than nightly, which will prevent future
clippy lints from breaking the build. Instead, they can be addressed
when clippy is updated.
2023-10-31 12:04:34 -04:00
Tony Arcieri
78a86f1c49
ed25519-dalek: hide secret in SigningKey's Debug impl (#592)
Uses `finish_non_exhaustive` in lieu of printing the `secret_key`
component of a `SigningKey`, only showing the corresponding
`verifying_key` field which can be used to identify the public key.

Closes #591
2023-10-31 12:01:09 -04:00
Michael Rosenberg
f4cd43f606
Merge pull request #590 from dalek-cryptography/derive-license
Fix licensing on -derive repo
2023-10-31 11:35:38 -04:00
Michael Rosenberg
81d0756bdc
Made unnecessarily pub contents of field.rs pub(crate) 2023-10-29 22:06:47 -04:00
Michael Rosenberg
cd9378e6fd
Removed unnecessary 'pub use' 2023-10-29 21:53:08 -04:00
Michael Rosenberg
8a41a29939
Forgot the license files 2023-10-29 10:50:17 -04:00
Michael Rosenberg
b92421916d
Copy licensing from previous repo 2023-10-29 10:47:45 -04:00
Tony Arcieri
598695c400
ed25519: loosen signature crate dependency (#582)
The `signature` crate contains unstable, minor version-gated
functionality.

The v2.1 release did not change any of that, and only added new
functionality. So it's safe to relax the requirement for `signature` to
`>=2.0, <2.2`.
2023-10-27 00:29:56 -04:00
Victor Graf
e6675c67ce
add cfg statements to only build doctest on x86 (#585) 2023-10-03 12:51:05 -06:00
Michael Rosenberg
0cd099a9fb
curve: Bump version to 4.1.1 (#584) 2023-09-20 17:42:22 -05:00
Luke Parker
76a8b2a081
Add PrimeFieldBits support to Scalar (#579)
Co-authored-by: Michael Rosenberg <micro@fastmail.com>
Co-authored-by: pinkforest(she/her) <36498018+pinkforest@users.noreply.github.com>
2023-09-19 23:21:43 -04:00
pinkforest(she/her)
533b53a0ec
Deprecate BASEPOINT_ORDER from pub API consts (#581)
* Mark constants::BASEPOINT_ORDER_PRIVATE deprecated from pub API

* Move all BASEPOINT_ORDER use private internally

Co-authored-by: Tony Arcieri <bascule@gmail.com>

* Fix CHANGELOG for 4.1.1

---------

Co-authored-by: Tony Arcieri <bascule@gmail.com>
2023-09-17 23:59:05 -04:00
Luke Parker
c157a1ed6d
Add group to documented features (#578) 2023-09-12 07:41:15 -06:00
Michael Rosenberg
e94a5fe5ab
curve: README typos 2023-09-06 00:53:30 -04:00
pinkforest(she/her)
9db51a6bf7
curve: Release 4.1.0 (#574)
Co-authored-by: Rob Ede <robjtede@icloud.com>
2023-09-06 00:51:15 -04:00
Michael Rosenberg
8ed1666b97
ed,x: updated repo links 2023-09-06 00:49:26 -04:00
Tony Arcieri
1ec4a36a80
curve: update repository in Cargo.toml (#575)
Point to the subdirectory which contains the crate
2023-09-06 00:08:06 -04:00
David Cook
a3a08b01ab
Adapt to new types introduced in fiat-crypto 0.2 (#566) 2023-09-05 10:07:49 -06:00
Wiktor Kwapisiewicz
135476c9f5
Fix variable names in the invariant description (#573)
Previously the variable names referred to `public` and `secret` which do
not exist. Update them to `verifying_key` and `secret_key`.
2023-09-05 08:50:10 -06:00
pinkforest(she/her)
5c5a32057c
curve: Fix no_std for fiat backend and add test for it (#572) 2023-09-04 13:49:58 -06:00
Rob Ede
c8d1d400f1
curve,ed: chore: update dev deps (#569) 2023-08-28 09:46:38 -04:00
Tony Arcieri
60dd3100c0
curve: add doc(hidden) to serial backend modules (#568)
We have a lot of backend types leaking via the public API, including
e.g. `FieldElement51`:

https://docs.rs/curve25519-dalek/latest/curve25519_dalek/backend/serial/u64/field/struct.FieldElement51.html

At the very least, these types shouldn't be visible in the rustdoc.

This PR hides them from the docs, but ideally we would hide them
completely from the public API (which might technically be considered a
breaking change, but IMO leaking them at all is a bug).
2023-08-28 02:38:11 -04:00