Commit Graph

24 Commits

Author SHA1 Message Date
Conrado Gouvea 96febcf7f0
refactor to use reddsa crate (#152) 2023-02-01 18:22:37 -05: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
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
Deirdre Connolly ad3d7fcd49 Split out parsing & validation of test VerificationKey from checking of signature
Also use fully secure ChaChaRng with a full seed, not just a u64.

Now that we always generate an extra proper VerificationKey for each
Tweak::ChangePubkey case, this /should/ never fail: it also helps split out the
actual verification of the signature from the parsing and validation of the key
itself.
2021-06-01 06:45:52 -04: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
Deirdre Connolly 2949f9a3f9 Upgrade rand, rand_core, and rand_chacha together 2021-04-03 10:16:21 -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 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
Jack Grigg baa3f4bb30 Fix binding_batch_verify test to actually test Binding signatures 2021-03-03 17:51:59 -05: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 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
Deirdre Connolly ba256655dd
Optimized batch verification (#36)
* Pulls in some traits and methods from curve25519-dalek around the
vartime multiscalar multiplication.

* Move scalar mul things we want to upstream to jubjub to their own crate

* Make Verify agnostic to the SigType

Co-authored-by: Henry de Valence <hdevalence@hdevalence.ca>
Co-authored-by: Jane Lusby <jlusby42@gmail.com>
2020-07-03 18:23:28 -04:00
Deirdre Connolly f27b9c3c77
Change terminology to signing, verification keys (#35)
Matches ed25519-zebra.

Resolves #33
2020-06-25 11:56:29 -07:00
Henry de Valence 5d3dfc0ff2 Add test that public keys of small order are rejected. 2020-01-17 10:13:51 -08:00
Henry de Valence c20139bbf7 Rename to just `redjubjub`. 2019-12-09 13:54:10 -08:00
Henry de Valence d8ad15059d Try to prevent ChangePubkey tweaks from becoming a no-op.
Since we expect the signature to fail if ChangePubkey is applied, we need to
make sure it actually changes the signature test case.
2019-12-09 12:15:11 -08:00
Henry de Valence 92cb99f966 Ensure SecretKey encoding is canonical. 2019-12-09 12:08:13 -08:00
Henry de Valence 87f09b87b5 Add Serialize, Deserialize for SecretKey. 2019-12-09 11:55:56 -08:00
Henry de Valence 2ca445ad23 Add Serialize, Deserialize to PublicKey. 2019-12-09 11:55:53 -08:00
Henry de Valence e58376fc47 Add Serialize, Deserialize for byte wrapper types. 2019-12-09 11:55:53 -08:00
Henry de Valence ead4727ded Implement randomization. 2019-12-04 17:00:55 -08:00
Henry de Valence e3e92af63b Add more signature tweaks to proptest. 2019-12-04 16:35:25 -08:00
Henry de Valence 8aeb2f14f8 Add test vectors from librustzcash.
The `SpendAuth` test vectors were generated using
`FixedGenerators::SpendingKeyGenerator`, and the `Binding` test vectors
were generated using `FixedGenerators::ValueCommitmentRandomness`.
2019-12-04 16:14:44 -08:00
Henry de Valence 7b979ddd65 Add property tests for signatures. 2019-12-04 16:14:44 -08:00