Commit Graph

43 Commits

Author SHA1 Message Date
Jack Grigg 5f1607c9b5 group: Rename into_*(&self) -> to_*(&self)
Rust naming convention uses the into_ prefix for methods that consume
self, and the to_ prefix for methods that take an immutable reference.
2020-05-20 11:32:12 +12:00
Jack Grigg ceecd32ac4 group: Remove EncodedPoint::from_affine
The EncodedPoint trait is replaced by explicit bounds on the
CurveAffine::{Uncompressed, Compressed} associated types.
2020-05-20 11:32:12 +12:00
Jack Grigg b77f8dddda group: Remove EncodedPoint::{into_affine, into_affine_unchecked}
Replaced by explicit APIs on the CurveAffine trait.

GroupDecodingError has been moved into pairing::bls12_381::ec, as it is
no longer used by the group traits.
2020-05-20 11:32:12 +12:00
Jack Grigg b0a3713d7e group: Add mixed-addition scalar multiplication bounds to CurveAffine
Replaces the explicit CurveAffine::mul trait method.
2020-05-20 11:32:12 +12:00
Jack Grigg 0941dddc13 group: Return subtle::Choice from CurveAffine::is_identity 2020-05-20 11:32:12 +12:00
Jack Grigg b94d567076 group: Direct-to-affine CurveProjective::batch_normalize
Replaces the mutating CurveProjective::batch_normalization API, and
removes the need for CurveProjective::is_normalized.

The new temporary implementation in pairing::bls12_381::ec is adapted
from bls12_381::g1.
2020-05-20 11:32:12 +12:00
Jack Grigg 669f2b43eb group: Return subtle::Choice from Group::is_identity 2020-05-15 10:24:30 +12:00
Jack Grigg ec88778258 group: Add scalar multiplication bounds to Group
The Scalar associated type is moved from CurveProjective to Group.
2020-05-15 10:24:30 +12:00
Jack Grigg 0df950dc0d group: Add Group::Subgroup associated type
For prime-order groups, this may be Self.
2020-05-15 00:20:32 +12:00
Jack Grigg d2aa87f084 group: Move CurveProjective::double to Group 2020-05-15 00:20:32 +12:00
Jack Grigg e3d84280b9 group: Sum + for<'a> Sum<&'a Self> bounds for Group 2020-05-15 00:20:32 +12:00
Jack Grigg 5397d73e0b group: Define group operations on Group trait
The GroupOps trait represents the group operation (addition), and the
combination of the group operation with group inversion (subtraction).
Group inversion (negation) is constrained directly on the Group trait.
2020-05-15 00:20:32 +12:00
Jack Grigg 69f53febcf group: Introduce Group and PrimeGroup traits
Group represents a cryptographic group with a large prime-order subgroup
and a small cofactor. PrimeGroup further constrains the group to have a
cofactor of one.
2020-05-15 00:20:32 +12:00
Jack Grigg 7203a7a30a Remove Engine associated type from CurveAffine and CurveProjective
The type Curve*::Engine::Fr is equivalent to Curve*::Scalar, making
Engine a redundant associated type.
2020-05-15 00:20:32 +12:00
Jack Grigg 8add78a327 Make CurveProjective::double take &self and return Self 2020-05-15 00:20:32 +12:00
Jack Grigg 4f2220fbb1 group: Rename zero and one to identity and generator 2020-05-15 00:20:32 +12:00
Jack Grigg d7d49285d8 Remove explicit std::marker from Sized bound
Sized is always part of the prelude, and binding on std causes
compilation issues for no-std crates.
2020-05-15 00:20:32 +12:00
Jack Grigg c597db59a6 ff: Rename PrimeField::into_repr -> PrimeField::to_repr 2020-05-02 18:55:13 +12:00
Jack Grigg 1761ebfb35 ff: Remove SqrtField trait
The sqrt() function is now part of the Field trait. ff_derive returns an
error on fields for which it does not support generating a square root
function.

Note that Fq6 and Fq12 in pairing::bls12_381 leave the function
unimplemented. They will be dropped once the migration to the bls12_381
crate is complete. The equivalent structs in that crate are not exposed.
2020-05-02 16:07:48 +12:00
Jack Grigg 49f119fb03 ff: Remove PrimeFieldRepr trait
The ff::PrimeField::Repr associated type now has the minimal necessary
bounds, which can be satisfied by a newtype around a byte array.
2020-04-23 18:15:14 +12:00
Jack Grigg 69c60530d4 group: Rewrite wNAF to remove dependency on ff::PrimeFieldRepr
Adapted from Scalar::non_adjacent_form in curve25519-dalek.
2020-03-26 22:32:17 +13:00
Jack Grigg 6e53cf3c4c group: Take scalar by reference in CurveProjective::recommended_wnaf_for_scalar 2020-03-26 19:00:46 +13:00
Jack Grigg 2df2a2b2f2 Merge branch 'develop' 2020-03-14 10:36:58 +13:00
Sean Bowe 100878cd14
Version bump of all crates (except librustzcash) 2020-03-12 15:59:19 -06:00
Sean Bowe f3f8964001
Remove Sized for RngCore
Co-authored-by: Weiliang Li <to.be.impressive@gmail.com>
2020-03-12 15:32:44 -06:00
Jack Grigg 9c485cc97e Move from CurveProjective::add_assign_mixed to traits 2020-01-13 21:20:46 -05:00
Jack Grigg d822e34e63 Extract curve operations into default impl traits
This makes it possible to implement mixed addition using operator-backed
traits without running into type annotation problems.
2020-01-13 21:19:33 -05:00
Jack Grigg 1a8ec21c03 Move from Curve*::negate to Neg operator 2020-01-13 21:19:33 -05:00
Jack Grigg 8193324986 Move additive CurveProjective operators to traits 2020-01-13 21:19:33 -05:00
Jack Grigg 91c32f1c7c
Move from Field::negate to Neg operator 2019-12-12 22:52:17 +00:00
Jack Grigg aa37783c37
group 0.2.0 2019-10-08 17:43:33 +13:00
Jack Grigg 7f3036d2c8
Update READMEs 2019-09-24 14:23:55 +01:00
Jack Grigg d9a0b9c83f
CI: Check intra-doc links
Credit: https://twitter.com/tomaka17/status/1176017851410526208
2019-09-24 10:35:12 +01:00
Jack Grigg 1d02363752
Add READMEs to Cargo.toml files
This will cause crates.io to render each crate's README as its
information page.
2019-09-23 14:42:38 +01:00
Eirik Ogilvie-Wigley 76795a9014 cargo fmt 2019-08-20 22:22:03 -06:00
Eirik Ogilvie-Wigley 07c690cf73 cargo fix --edition-idioms for group 2019-08-20 22:08:10 -06:00
Eirik Ogilvie-Wigley 09882c6d08 Add edition = 2018 2019-08-20 18:31:20 -06:00
Eirik Ogilvie-Wigley fc3dd8198b cargo fix --edition for group 2019-08-20 16:45:10 -06:00
Jack Grigg 6f9083b5ab
Migrate to rand 0.7 2019-07-19 00:47:40 +02:00
Jack Grigg 83e1af104e
Migrate ff, group, pairing, and bellman to rand 0.6 2019-07-19 00:42:39 +02:00
Jack Grigg ce6e2a5825
Migrate group to rand 0.5 2019-07-19 00:35:06 +02:00
Jack Grigg 482bef87f0
Add ff and group crates to Cargo workspace 2019-01-06 09:50:07 +00:00
Jack Grigg b1ce3905d6 Add 'group/' from commit 'ef56fabf7ba3ed990a7886836c855298c9c5eefa'
git-subtree-dir: group
git-subtree-mainline: af9f9c17ee
git-subtree-split: ef56fabf7b
2019-01-06 09:38:21 +00:00