Commit Graph

122 Commits

Author SHA1 Message Date
bmerge
affead11a5 Auto merge of #67 - ebfull:static-engine, r=ebfull
Engine should always be 'static, for flexibility in downstream code.
2017-11-21 06:47:28 +00:00
Sean Bowe
4a1ac94799
Implement Clone for Bls12. 2017-11-20 23:53:58 -07:00
Sean Bowe
4b366a143d
Ensure Engine's are always Clone. 2017-11-20 23:20:11 -07:00
bmerge
36ad8b672c Auto merge of #66 - ebfull:scalar-assoc, r=ebfull
Enforce that Fr of Engine is the scalar for curve points

In bellman, I want to write:

```rust
pub struct Point<C: CurveProjective>(pub C);

impl<C: CurveProjective> Copy for Point<C> { }

impl<C: CurveProjective> Clone for Point<C> {
    fn clone(&self) -> Point<C> {
        *self
    }
}

impl<C: CurveProjective> Group<C::Engine> for Point<C> {
    fn group_zero() -> Self {
        Point(C::zero())
    }
    fn group_mul_assign(&mut self, by: &C::Scalar) {
        self.0.mul_assign(by.into_repr());
    }
    fn group_add_assign(&mut self, other: &Self) {
        self.0.add_assign(&other.0);
    }
    fn group_sub_assign(&mut self, other: &Self) {
        self.0.sub_assign(&other.0);
    }
}
```

However, this doesn't typecheck because the compiler cannot know that the `Engine`'s `Fr` type (as dictated by the `Group` trait) is the same as the `Scalar` type of the `CurveProjective` point. This can be solved with a where bound over the trait (for now), but it is generally a good idea for this to be constrained in `pairing`.
2017-11-20 19:26:16 +00:00
Sean Bowe
f32cb40929
Engine should always be 'static, for flexibility in downstream code. 2017-11-20 12:22:51 -07:00
Sean Bowe
471db6ab27
Enforce that Fr of Engine is the scalar for curve points, for simpler downstream abstractions. 2017-11-12 16:19:08 -07:00
bmerge
5d9f77f5bf Auto merge of #65 - ebfull:byteorder-version, r=ebfull
Use 1 for the byteorder crate's version.
2017-10-12 17:48:25 +00:00
Sean Bowe
342b94c76b
Use "1" for the byteorder crate's version. 2017-10-12 11:20:57 -06:00
bmerge
48044a853f Auto merge of #64 - ebfull:bump-13, r=ebfull
Bump version to 0.13.0

After #58 and #63 are merged.
2017-10-12 17:20:04 +00:00
bmerge
364796d88c Auto merge of #58 - ebfull:derive-clone, r=ebfull
Derive `Clone` for G1/G2 encodings.

AFAIK this will finally work on stable when the next version of Rust is released.

Closes #55
2017-10-12 16:45:21 +00:00
bmerge
30ae5d6313 Auto merge of #63 - ebfull:rand-unknown-exponent, r=ebfull
G1/G2 rand() should produce elements of unknown exponent.

Closes #60.
2017-10-12 16:16:52 +00:00
Sean Bowe
39c25cd506
Bump version to 0.13.0 2017-10-10 01:54:53 -06:00
Sean Bowe
12b9606b9c
G1/G2 rand() should produce elements of unknown exponent. 2017-10-10 01:13:35 -06:00
bmerge
044256c2f7 Auto merge of #62 - mmaker:feature/scale_by_cofactor, r=ebfull
Add "scale_by_cofactor".

Add a function for Affine types that multiplies point by the cofactor of the
group. If the points are in the group, they'll thus end up in the
correct subgroup.

note: this patch is already being tested with previous unittests.
note: this patch raises warning for unused functions and consts.
2017-10-09 23:15:59 +00:00
Sean Bowe
65e50a9e5a
Allow scale_by_cofactor to be dead code temporarily. 2017-10-09 17:14:36 -06:00
Michele Orrù
e5607bb528 Add "scale_by_cofactor".
Add a function for Affine types that multiplies point by the cofactor of the
group.
2017-10-09 10:04:22 +02:00
bmerge
dfb836170b Auto merge of #61 - ebfull:minor-changes, r=ebfull
Minor changes
2017-10-05 18:36:27 +00:00
Sean Bowe
dbac57c27b
Further refactoring of get_point_from_x() 2017-10-05 12:35:04 -06:00
Sean Bowe
683f21a4d5
Remove spurious newline. 2017-10-04 14:53:42 -06:00
Sean Bowe
85b95750e2
Fix comment about u128-support. 2017-10-04 14:09:40 -06:00
Sean Bowe
931257599d
Refactor code for finding affine points from x-coordinates. 2017-10-04 11:43:42 -06:00
bmerge
f9d4c8b6aa Auto merge of #57 - ebfull:relic-interop, r=ebfull
RELIC interop

Closes #2

RELIC has changed the G2 generator to match ours: 25aafecbec

RELIC will not have the same serialization as us.

One last difference is that RELIC conjugates the pairing result to account for the negative curve parameter. It doesn't matter for BLS curves but it's strictly more correct.
2017-10-04 15:51:28 +00:00
Sean Bowe
60887521b6
Derive Clone for {G1|G2}{Uncompressed|Compressed}. 2017-10-03 14:35:00 -06:00
Sean Bowe
18c75f11ab
Account for negative curve parameter to be compatible with RELIC. 2017-10-03 14:27:01 -06:00
bmerge
a8bf8362da Auto merge of #54 - ebfull:version-bump-0.12.0, r=ebfull
Bump version to 0.12.0.
2017-09-28 23:39:17 +00:00
Sean Bowe
67f5fbc94c
More modifications to satisfy clippy. 2017-09-28 17:37:54 -06:00
Sean Bowe
05339414cc
Update clippy and compensate for new lints. 2017-09-28 17:10:06 -06:00
Sean Bowe
927febe4e8
Bump version to 0.12.0. 2017-09-28 16:52:12 -06:00
bmerge
3e1562445a Auto merge of #53 - ebfull:assoc-consts, r=ebfull
Use associated constants for simple constants like these.

Closes #39.
2017-09-28 22:10:55 +00:00
Sean Bowe
4fe3e1d6e3
Use associated constants for simple constants like these. (Closes #39.) 2017-09-28 16:08:56 -06:00
ebfull
abd48980ee Merge pull request #52 from ebfull/fix-copyright
Fix copyright/license information
2017-09-28 15:53:53 -06:00
Sean Bowe
8dbee41977
Add COPYRIGHT file to inform of conditions for contributing and license information. 2017-09-28 15:39:29 -06:00
Sean Bowe
35bf7f63ea
Modify the LICENSE-APACHE and LICENSE-MIT files.
This modifies the files so that they are exactly the same as the
Rust project's license files. This does not change the wording of
the license.
2017-09-28 15:29:58 -06:00
Sean Bowe
ce875c902b
LICENSE-MIT: Remove inaccurate (misattributed) copyright notice
LICENSE-MIT contains the line "Copyright (c) 2017 Sean Bowe", which
implies that an entity called "Sean Bowe" holds copyrights in the
pairing Rust library. Pairing library contributors retain their
copyrights, and do not assign them to anyone by contributing.
Remove the inaccurate notice.
2017-09-28 15:24:31 -06:00
bmerge
5bb8e3a841 Auto merge of #51 - ebfull:several-fixups, r=ebfull
Several fixups

Closes #50
Closes #48
Closes #46

Also, CI changes this PR will test:

Closes #43
Closes #44
2017-09-28 20:12:59 +00:00
Sean Bowe
4aa51bd3d4
Add security warnings and some instructions to README.md. 2017-09-28 13:32:34 -06:00
Sean Bowe
93e2a132b5
Mask rather than divn, closes #50. 2017-09-28 13:15:29 -06:00
Sean Bowe
291fa71914
This coercion doesn't take place on stable yet. 2017-09-28 13:03:01 -06:00
Sean Bowe
636a037bb1
Make u128-support feature opt-in rather than default. 2017-09-28 12:52:14 -06:00
bmerge
2540ab30fb Auto merge of #47 - ebfull:stable-wnaf, r=ebfull
Introduce a more typesafe wNAF API, and remove the unstable-wnaf feature

Closes #27.
2017-09-28 17:58:18 +00:00
Sean Bowe
6708878f4c
Elide these lifetimes. 2017-09-28 11:39:53 -06:00
bmerge
68b57b2ce4 Auto merge of #49 - ebfull:simplify-bench, r=ebfull
Simplify `pairing_benches`.
2017-09-28 17:33:23 +00:00
Sean Bowe
c38cb324f6
Simplify pairing_benches. 2017-09-28 11:31:46 -06:00
Sean Bowe
bda22db9d5
Always recommend a window table size. 2017-09-28 08:38:13 -06:00
Sean Bowe
894b44d034
These structures are no longer exported outside the crate, and these assertions are unnecessary now that the external API can enforce them. 2017-09-28 08:12:37 -06:00
Sean Bowe
06f6334679
Change to docs for satisfying clippy. 2017-09-27 20:06:51 -06:00
Sean Bowe
d230603190
Introduce a more typesafe wNAF API, and remove the unstable-wnaf feature. 2017-09-27 19:09:59 -06:00
bmerge
1398a32b3a Auto merge of #42 - str4d:36-tests-on-stable, r=ebfull
Move benchmarks under benches/ so tests compile on stable

Closes #36.
2017-09-27 17:04:05 +00:00
str4d
3ef34b750c
Move benchmarks under benches/ so tests compile on stable
Closes #36.
2017-09-27 17:45:24 +01:00
bmerge
9b6fb37533 Auto merge of #41 - str4d:23-debug-trait, r=ebfull
Force public structures to implement Debug

Closes #23.
2017-09-27 06:04:17 +00:00