group: Extract compressed encodings from CurveAffine trait
This commit is contained in:
parent
f490cdc674
commit
9397e78789
|
@ -2,7 +2,7 @@
|
|||
//!
|
||||
//! [Groth16]: https://eprint.iacr.org/2016/260
|
||||
|
||||
use group::{CurveAffine, UncompressedEncoding};
|
||||
use group::{CurveAffine, GroupEncoding, UncompressedEncoding};
|
||||
use pairing::{Engine, MultiMillerLoop};
|
||||
|
||||
use crate::SynthesisError;
|
||||
|
@ -47,7 +47,7 @@ impl<E: Engine> Proof<E> {
|
|||
|
||||
pub fn read<R: Read>(mut reader: R) -> io::Result<Self> {
|
||||
let read_g1 = |reader: &mut R| -> io::Result<E::G1Affine> {
|
||||
let mut g1_repr = <E::G1Affine as CurveAffine>::Compressed::default();
|
||||
let mut g1_repr = <E::G1Affine as GroupEncoding>::Compressed::default();
|
||||
reader.read_exact(g1_repr.as_mut())?;
|
||||
|
||||
let affine = E::G1Affine::from_compressed(&g1_repr);
|
||||
|
@ -70,7 +70,7 @@ impl<E: Engine> Proof<E> {
|
|||
};
|
||||
|
||||
let read_g2 = |reader: &mut R| -> io::Result<E::G2Affine> {
|
||||
let mut g2_repr = <E::G2Affine as CurveAffine>::Compressed::default();
|
||||
let mut g2_repr = <E::G2Affine as GroupEncoding>::Compressed::default();
|
||||
reader.read_exact(g2_repr.as_mut())?;
|
||||
|
||||
let affine = E::G2Affine::from_compressed(&g2_repr);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use ff::{Field, PrimeField};
|
||||
use group::{CurveAffine, CurveProjective, Group, PrimeGroup, UncompressedEncoding};
|
||||
use group::{CurveAffine, CurveProjective, Group, GroupEncoding, PrimeGroup, UncompressedEncoding};
|
||||
use pairing::{Engine, MillerLoopResult, MultiMillerLoop, PairingCurveAffine};
|
||||
|
||||
use rand_core::RngCore;
|
||||
|
@ -425,7 +425,6 @@ impl AsRef<[u8]> for FakePoint {
|
|||
}
|
||||
|
||||
impl CurveAffine for Fr {
|
||||
type Compressed = FakePoint;
|
||||
type Projective = Fr;
|
||||
type Scalar = Fr;
|
||||
|
||||
|
@ -444,6 +443,10 @@ impl CurveAffine for Fr {
|
|||
fn to_projective(&self) -> Self::Projective {
|
||||
*self
|
||||
}
|
||||
}
|
||||
|
||||
impl GroupEncoding for Fr {
|
||||
type Compressed = FakePoint;
|
||||
|
||||
fn from_compressed(_bytes: &Self::Compressed) -> CtOption<Self> {
|
||||
unimplemented!()
|
||||
|
|
Loading…
Reference in New Issue