Commit Graph

24 Commits

Author SHA1 Message Date
Jack Grigg
1a40cfd39c zcash_primitives: Make jubjub::Fs::invert constant time 2020-04-23 16:23:24 +12:00
Jack Grigg
08500ee712 ff: PrimeField: BitAnd<u64, Output = u64> + Shr<u32, Output = Self> 2020-04-23 16:23:24 +12:00
Jack Grigg
1fdca393bb ff: PrimeField::{is_even, is_odd} 2020-04-23 16:23:24 +12:00
Jack Grigg
232f0a50b8 ff: Rework BitIterator to work with both u8 and u64 limb sizes
This enables BitIterator to be used with both the byte encoding and limb
representation of scalars.
2020-04-23 16:23:24 +12:00
Jack Grigg
fd79de5408 ff: Add PrimeField: From<u64> constraint 2020-04-23 16:23:24 +12:00
Jack Grigg
b6457a905b ff: Move pow_vartime into a trait that is generic over the limb size
The trait is implemented by default for u8 and u64, allowing pow_vartime
to be used with both the byte encoding and limb representation of field
elements.
2020-03-28 00:27:59 +13:00
Jack Grigg
2df2a2b2f2 Merge branch 'develop' 2020-03-14 10:36:58 +13:00
Sean Bowe
b52e4aac3a Fix Field::random method declarations. 2020-03-03 17:47:29 -07:00
Jack Grigg
ec2c304efd no_std support for ff crate 2019-12-14 12:55:34 +00:00
Jack Grigg
1c9f5742fa Improve Field::pow API and impl
Renamed to Field::pow_vartime to indicate it is still variable time with
respect to the exponent.
2019-12-14 12:27:48 +00:00
Jack Grigg
3d2acf48ce Constant-time field square root
WARNING: THIS IS NOT FULLY CONSTANT TIME YET!

This will be fixed once we migrate to the jubjub and bls12_381 crates.
2019-12-13 20:13:30 +00:00
Jack Grigg
40749da9a7 Constant-time field inversion
WARNING: THIS IS NOT ACTUALLY CONSTANT TIME YET!

The jubjub and bls12_381 crates will replace our constant-time usages,
but we NEED to fix ff_derive because other users will expect it to
implement the Field trait correctly.
2019-12-13 19:46:04 +00:00
Jack Grigg
662be3551f impl ConditionallySelectable for Field 2019-12-12 23:15:48 +00:00
Jack Grigg
cded08b0c5 Make Field::square take &self and return Self 2019-12-12 23:09:28 +00:00
Jack Grigg
9dac748224 Make Field::double take &self and return Self 2019-12-12 22:59:18 +00:00
Jack Grigg
91c32f1c7c Move from Field::negate to Neg operator 2019-12-12 22:52:17 +00:00
Jack Grigg
27c8f34601 Move Field operations to operator-backed traits
The ff_derive, pairing, zcash_primitives::jubjub, and bellman dummy_engine
changes are minimally implemented on top of the existing *_assign()
functions.
2019-12-12 21:19:46 +00:00
Jack Grigg
3a8efd9e67 Address various clippy warnings/errors in zcash_primitives 2019-08-24 00:39:49 +01:00
Eirik Ogilvie-Wigley
d63fa334ff Remove unnecessary raw marker
Co-Authored-By: str4d <thestr4d@gmail.com>
2019-08-21 16:14:28 -06:00
Eirik Ogilvie-Wigley
c28ae31c71 cargo fix --edition-idioms for zcash_primitives 2019-08-20 22:20:22 -06:00
Eirik Ogilvie-Wigley
b35a819a09 Replace try! macro 2019-08-20 18:24:47 -06:00
Eirik Ogilvie-Wigley
b0d8747697 cargo fix --edition for zcash_primitives 2019-08-20 17:15:07 -06:00
Eirik Ogilvie-Wigley
81c58172c3 cargo fmt zcash_primitives 2019-08-15 10:39:55 -06:00
Jack Grigg
5fb9b86ba0 Move Jubjub, Pedersen hash and primitives into zcash_primitives 2019-08-14 10:47:22 +01:00