Commit Graph

87 Commits

Author SHA1 Message Date
Conrado Gouvea 311baf8865
frost: move Randomizer out of round2 module for consistency (#110) 2024-02-16 16:36:27 +00:00
Conrado Gouvea 29162a7898
Test and refactor EvenY (renamed from PositiveY) (#94)
* rename PositiveY into EvenY; refactor it

change reexposed FROST functions to already ensure even Y keys

* add comment
2023-11-28 17:56:48 -03:00
Conrado Gouvea 397f5018cf
update to frost-rerandomized 1.0.0-rc.0 (#92)
* update to frost-rerandomized close to 1.0.0-rc.0

* point to 1.0.0-rc.0
2023-11-22 14:20:05 -03:00
Conrado Gouvea ac524000e1
frost: incorporate recent fixes; add into_positive_y() to redpallas (#68)
* expose dkg module

* fix dkg compiling issues

* incorporate frost repo fixes; add into_positive_y() for RedPallas

* don't use all features in MSRV test

* remove unneeded frost-rerandomized import in dev-dependencies

* bump frost-rerandomized rev

* update to frost-rerandomized 0.7.0

* commit lockfile; update CI test to match
2023-10-03 21:12:01 +01:00
Conrado Gouvea b1bbad7bac
update FROST (#67) 2023-07-11 12:34:21 -03:00
Marek 4f8ce48cd5
change: Refactor & optimize the NAF (#63)
* Make the NAF function generic

* Use the `jubjub` prefix for Jubjub types in tests

* Add tests for the NAF for Jubjub & Pallas scalars

* Use Rust's TryInto for [u8; 32]

Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>

* Simplify the scalar conversion

* Revert "Simplify the scalar conversion"

This reverts commit f50ff9dd8a.

* Revert "Use Rust's TryInto for [u8; 32]"

This reverts commit 282c3b16ac.

---------

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>
2023-04-25 14:51:13 -03:00
Conrado Gouvea dca09a3897 fix batch equation 2023-04-21 19:46:46 -04:00
Marek cc558d4f79
feat: Add tests for vartime multiscalar multiplication (#57)
* Move Pallas tests to their own file

* Add tests for multiplication on Pallas

* Add tests for multiplication on Jubjub

* Use `assert_eq` instead of `assert`

* Apply suggestions from code review

Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>

* Refactor Pallas tests

* Refactor Jubjub tests

* Use `product` instead of `res`

---------

Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>
2023-04-21 20:24:11 -03:00
Conrado Gouvea f8ad8ea992
update to frost-rerandomized 0.2.0; change keygen_with_dealer to return HashMap (#59) 2023-04-20 22:00:17 +02:00
Conrado Gouvea 3ac90e2e0a
fix calls to renamed DKG functions; move dkg code to its own file (#49) 2023-03-09 16:03:55 -03:00
str4d eadc48879a
Migrate to `group` 0.13, `jubjub` 0.10, `pasta_curves` 0.5 (#44) 2023-02-28 14:59:05 -03:00
Conrado Gouvea 08bb408846
add Pallas and Jubjub ciphersuites and FROST support (#33)
* clippy fixes; remove old FROST code

* add RedPallas ciphersuite and FROST support

* organized code

* simplified version

* remove randomized_frost; point to frost-randomized crate

* move rerandomized test to frost-rerandomized; clean up dependencies; add 'frost' feature

* remove stale comment

* add Jubjub support

* add torsion and identity checks where needed; tests

* Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>

* Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>

* change Jubjub serialize() to use to_bytes(); add comment to Pallas serialize()

* update frost-rerandomized version

* unpin nightly Rust in coverage.yaml

* fix conditional hex dependency

* move FROST code inside frost folder

* Apply suggestions from code review

Co-authored-by: Marek <mail@marek.onl>

---------

Co-authored-by: Marek <mail@marek.onl>
Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
2023-02-28 00:01:50 +01:00
Conrado Gouvea 805ef4b5c0
port improvements from Zebra (#40)
* simplify fmt::Debug impls with new hex_if_possible()

* Update src/signature.rs authors

Co-authored-by: Deirdre Connolly <deirdre@zfnd.org>
2023-01-30 16:16:53 -05:00
Conrado Gouvea 6f0dffc12e clippy fixes; remove old FROST code 2023-01-02 19:20:08 -05:00
Taylor Hornby ff9a4ddd64
Label Zcash consensus rules in reddsa (#27) 2022-09-12 16:47:24 -03:00
Tomas Krnak ed11f440ce
Add `no-std` support (#11)
* Add no_std support

* Update CHANGELOG

* Remove unused alloc feature flag

* Remove a forgotten comment

Co-authored-by: str4d <thestr4d@gmail.com>

* Make zeroize dependency optional

* Add alloc feature flag

* Clean the code by outer attributes

* use 2021 edition

Co-authored-by: str4d <thestr4d@gmail.com>
Co-authored-by: Conrado Gouvea <conradoplg@gmail.com>
2022-05-06 11:57:45 -03:00
Dimitris Apostolou c95eed9509
Fix typo (#13) 2022-01-20 11:24:06 -03:00
Deirdre Connolly 093087eb1d
Update the include_str support to fix CI on nightly (#12)
* Update the include_str support to fix CI on nightly

* Upgrade coverage.yaml to use cargo-llvm-cov

* Show CodeCov comment on PRs
2022-01-19 17:42:12 -05:00
Jack Grigg 7b1229a692 reddsa 0.1.0 2021-11-19 23:09:00 +00:00
Jack Grigg d99a256b6f Set MSRV to 1.51
The `doc(include)` logic is placed back behind the `nightly` feature
flag, as it requires 1.54.
2021-11-19 23:06:53 +00:00
Jack Grigg b91559345c Fix trait ambiguity in SealedScalar trait impl
The FieldExt and SealedScalar traits have a method with the same name,
and the latter's is implemented for pallas::Scalar as a call to the
former's implementation. However, FieldExt was not in scope. In debug
mode, Rust was calling SealedScalar's method recursively, causing a
stack overflow. However in release mode, Rust was able to find the
FieldExt method fine (and does not appear to just be optimizing out the
code, as the result is valid). To ensure this does not occur, we now
explicitly use the FieldExt method implementation.
2021-11-18 21:16:07 +00:00
Jack Grigg 0627048eba Add Orchard signature types for RedPallas 2021-11-18 21:16:07 +00:00
Jack Grigg 878dd1351b Introduce SpendAuth: SigType and Binding: SigType traits
The prior `SpendAuth` and `Binding` enums have been renamed to
`sapling::{SpendAuth, Binding}`. These might subsequently be removed
from the crate entirely (moving into a wrapping `redjubjub` crate).

The code assumes that scalar and point representations are [u8; 32],
which will be the case for all curves we instantiate RedDSA with for
Zcash.
2021-11-18 21:15:03 +00:00
Jack Grigg 7e80588550 Rename crate to reddsa 2021-11-18 21:14:08 +00:00
str4d a32ae3fc87
Don't reject small-order verification keys (#137)
* Don't reject small-order verification keys

Fixes ZcashFoundation/redjubjub#127.

* Added missing changelog entries
2021-11-18 15:53:35 -03:00
Deirdre Connolly 3db05e29f7 Remove extra module-level doc to allow doc = include_str to work 2021-06-22 16:37:36 -04:00
Alfredo Garcia 751af8a76b remove external_docs 2021-06-22 16:37:36 -04:00
Alfredo Garcia ced2819690 another try 2021-06-22 16:37:36 -04:00
Alfredo Garcia 79b8b52baa try to fix the docs build 2021-06-22 16:37:36 -04:00
Alfredo Garcia fa3c602698
Implement the messages spec (#114)
* start messages and validation

* add missing docs to constants

* change validation to matches, fix constant doc

Co-authored-by: teor <teor@riseup.net>

* fix the build

* validate share_commitment

* add new constants and validations

* fix validation

* derive serde Serialize and Deserialize in all messages structs

* update created structs

Co-authored-by: teor <teor@riseup.net>

* fix build

* define and use a new MAX_SIGNERS constant

* change group_public type

* add some test cases

* add validation and serialization tests for SigningCommitments

* add validation and serialization test to SigningPackage

* change some fields order matching the spec

* fix field order in tests according to last updates to the spec

* implement serialize and deserialize for ParticipantId

* move serde-json to dev-dependencies section

* change to pub(crate)

* fix serialize of VerificationKey

* add assert to serialize

* add note, fix typo

* improve some code in tests

* test serialization of individual fields

* start messages and validation

* add missing docs to constants

* change validation to matches, fix constant doc

Co-authored-by: teor <teor@riseup.net>

* fix the build

* validate share_commitment

* add new constants and validations

* fix validation

* define and use a new MAX_SIGNERS constant

* change group_public type

* change some fields order matching the spec

* change message fields to new spec

* remove some non needed conversions

* use a BTreeMap to guarantee the order

* remove some calls to `clone()` by implementing `Copy`

* change message type in frost and add validate_signatureshare test

* change `share_commitment` to BTreeMap

* add `serialize_signatureshare` test

* add aggregatesignature tests

* add some test header messages utility functions

* add a setup utility

* move the general serialization checks into an utility function

* fi some typos

* add and use a `generate_share_commitment` utility

* add create_signing_commitments utility function

* improve the serialization tests

* make room for prop tests

* add arbitrary tests for serialization

* remove allow dead code from messages

* fix some imports

* make signature module public only to the crate

* simplify a bit the frost tests

* improve the generated docs

* add a `prop_filter` to Header arbitrary

* (ab)use proptest_derive

* improve validation for Message

* improve some utility functions

* change frost to serialization id conversion

* add a quick btreemap test

* change the `MsgType` to `u32`

* add no leftover bytes checks

* add a full_setup utility

* add map len checks

Co-authored-by: teor <teor@riseup.net>
2021-06-16 16:13:23 -03:00
Alfredo Garcia e2940a465d
Change the type of the identifiers from u8 to u64 (#110)
* Change the type of the identifiers from u8 to u64

* add a TODO

Co-authored-by: Marek <mail@marek.onl>
2021-05-28 09:06:51 -03:00
Alfredo Garcia 0c7a10522d
Add `SignatureResponse` type (#107)
* add a new `FrostSignature` type

* change name to SignatureResponse
2021-05-26 14:49:03 -03:00
Alfredo Garcia c2c581b397 change GroupCommitment to use AffinePoint 2021-05-25 13:00:23 -04:00
Alfredo Garcia 2db8e5908d change Commitment to use AffinePoint 2021-05-25 13:00:23 -04:00
Alfredo Garcia b6a27d3747 allow dead code in `KeyPackage` struct 2021-05-20 16:23:02 -04:00
teor f7c153575b
Put variable-length fields last (#103)
This helps prevent parsing issues in other implementations.
2021-05-19 08:43:02 -03:00
Alfredo Garcia b77b090afb
fix typo in a comment (#97) 2021-05-17 14:47:12 +02:00
Alfredo Garcia ace14ebae7 Fix a small typo 2021-05-05 14:53:28 -04:00
Jack Grigg 3571be2184 Migrate to jubjub 0.6 2021-04-03 09:48:53 -04:00
Marek d7a9ddc6b7 Derive Debug, PartialEq 2021-04-01 15:06:07 -04:00
Marek 7cf6eeb9e4 Add comments 2021-04-01 15:05:24 -04:00
Marek ba4b89c80a Restrict the maximum number of participants to 255 by using u8 2021-04-01 15:05:24 -04:00
Deirdre Connolly 84d0fb60e2
Link to FROST security audit from module doc (#73) 2021-03-31 17:45:34 -04:00
Chelsea H. Komlo 76ba4ef1cb add additional documentation for aggregator threat model 2021-03-23 11:47:22 -04:00
Marek 6481d0af91 Add comments to the checks 2021-03-23 11:46:41 -04:00
Marek 3e28bf6c07 Avoid null nonces 2021-03-23 11:46:41 -04:00
Deirdre Connolly 5feb6b29c7
Fix some FROST nits (#63)
* Impl DefaultIsZeros for every type that uses jubjub::Fr/Scalar

This requires Copy and Clone along with Default. If we do not want to include those, we can impl Zeroize and Drop directly.

* Hash signature message with HStar before deriving the binding factor

To avoid a collision, we should hash our input message, our 'standard' hash is HStar, which uses a domain separator already, and is the same one that generates the binding factor.

* Add a comment about why we hash the signature message before generating the binding factor

* Add comments on how we Zeroize

* Consume nonces with sign()

We want to make sure that the nonces we use when signing are Drop'd
(and thus Zeroize'd) when they go out of scope, so we must move participant_nonces into sign()
2021-03-23 11:46:17 -04:00
Deirdre Connolly 2ebc08f910
Frost keygen with dealer (#47)
Implements FROST (Flexible Round Optimized Schnorr Threshold Signatures, https://eprint.iacr.org/2020/852) where key generation is performed by a trusted dealer. 

Future work will include implementing distributed key generation and re-randomizability. 

Co-authored-by: Chelsea Komlo <me@chelseakomlo.com>
Co-authored-by: Isis Lovecruft <isis@patternsinthevoid.net>
2021-02-25 09:06:54 -07:00
Henry de Valence 233294d701 Bump version to 0.2.2 2020-07-15 12:42:14 -07:00
Henry de Valence 7424cababb
Add batch::Item::verify_single and Item: Clone + Debug. (#39)
This closes a gap in the API where it was impossible to retry items in a failed
batch, because the opaque Item type could not be verified individually.
2020-07-15 12:38:43 -07:00