Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Relax the visibility for G2 ell coeffs and related algorithms #817

Merged
merged 2 commits into from
Apr 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,12 @@
- [\#736](https://github.com/arkworks-rs/algebra/pull/736) (`ark-ff`) Deprecate `divn()`, and use `core::ops::{Shr, ShrAssign}` instead.
- [\#739](https://github.com/arkworks-rs/algebra/pull/739) (`ark-ff`) Deprecate `muln()`, and use `core::ops::{Shl, ShlAssign}` instead.
- [\#771](https://github.com/arkworks-rs/algebra/pull/771) (`ark-ec`) Omit expensive scalar multiplication in `is_in_correct_subgroup_assuming_on_curve()` for short Weierstrass curves of cofactor one.
- [\#817](https://github.com/arkworks-rs/algebra/pull/817) (`ark-ec`) Relax the visibility for G2 ell coeffs and related algorithms.

### Bugfixes

- [\#747](https://github.com/arkworks-rs/algebra/pull/747) (`ark-ff-macros`) Fix fetching attributes in `MontConfig` macro
- [\#803](https://github.com/arkworks-rs/algebra/pull/803) (`ark-ec`, `ark-test-template`) Fix incorrect decomposition in GLV
- [\#747](https://github.com/arkworks-rs/algebra/pull/747) (`ark-ff-macros`) Fix fetching attributes in `MontConfig` macro.
- [\#803](https://github.com/arkworks-rs/algebra/pull/803) (`ark-ec`, `ark-test-template`) Fix incorrect decomposition in GLV.

## v0.4.2

Expand Down
4 changes: 2 additions & 2 deletions ec/src/models/bls12/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ pub struct G2Prepared<P: Bls12Config> {
pub infinity: bool,
}

pub(crate) type EllCoeff<P> = (
pub type EllCoeff<P> = (
Fp2<<P as Bls12Config>::Fp2Config>,
Fp2<<P as Bls12Config>::Fp2Config>,
Fp2<<P as Bls12Config>::Fp2Config>,
Expand All @@ -39,7 +39,7 @@ pub(crate) type EllCoeff<P> = (
Copy(bound = "P: Bls12Config"),
Debug(bound = "P: Bls12Config")
)]
struct G2HomProjective<P: Bls12Config> {
pub struct G2HomProjective<P: Bls12Config> {
x: Fp2<P::Fp2Config>,
y: Fp2<P::Fp2Config>,
z: Fp2<P::Fp2Config>,
Expand Down
8 changes: 4 additions & 4 deletions ec/src/models/bn/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub struct G2Prepared<P: BnConfig> {
pub infinity: bool,
}

pub(crate) type EllCoeff<P> = (
pub type EllCoeff<P> = (
Fp2<<P as BnConfig>::Fp2Config>,
Fp2<<P as BnConfig>::Fp2Config>,
Fp2<<P as BnConfig>::Fp2Config>,
Expand All @@ -43,14 +43,14 @@ pub(crate) type EllCoeff<P> = (
Copy(bound = "P: BnConfig"),
Debug(bound = "P: BnConfig")
)]
struct G2HomProjective<P: BnConfig> {
pub struct G2HomProjective<P: BnConfig> {
x: Fp2<P::Fp2Config>,
y: Fp2<P::Fp2Config>,
z: Fp2<P::Fp2Config>,
}

impl<P: BnConfig> G2HomProjective<P> {
fn double_in_place(&mut self, two_inv: &P::Fp) -> EllCoeff<P> {
pub fn double_in_place(&mut self, two_inv: &P::Fp) -> EllCoeff<P> {
// Formula for line function when working with
// homogeneous projective coordinates.

Expand All @@ -76,7 +76,7 @@ impl<P: BnConfig> G2HomProjective<P> {
}
}

fn add_in_place(&mut self, q: &G2Affine<P>) -> EllCoeff<P> {
pub fn add_in_place(&mut self, q: &G2Affine<P>) -> EllCoeff<P> {
// Formula for line function when working with
// homogeneous projective coordinates.
let theta = self.y - &(q.y * &self.z);
Expand Down
6 changes: 3 additions & 3 deletions ec/src/models/bw6/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ pub struct G2Prepared<P: BW6Config> {
Copy(bound = "P: BW6Config"),
Debug(bound = "P: BW6Config")
)]
struct G2HomProjective<P: BW6Config> {
pub struct G2HomProjective<P: BW6Config> {
x: P::Fp,
y: P::Fp,
z: P::Fp,
Expand Down Expand Up @@ -147,7 +147,7 @@ impl<P: BW6Config> G2Prepared<P> {
}

impl<P: BW6Config> G2HomProjective<P> {
fn double_in_place(&mut self) -> (P::Fp, P::Fp, P::Fp) {
pub fn double_in_place(&mut self) -> (P::Fp, P::Fp, P::Fp) {
// Formula for line function when working with
// homogeneous projective coordinates, as described in
// <https://eprint.iacr.org/2013/722.pdf>.
Expand All @@ -173,7 +173,7 @@ impl<P: BW6Config> G2HomProjective<P> {
}
}

fn add_in_place(&mut self, q: &G2Affine<P>) -> (P::Fp, P::Fp, P::Fp) {
pub fn add_in_place(&mut self, q: &G2Affine<P>) -> (P::Fp, P::Fp, P::Fp) {
// Formula for line function when working with
// homogeneous projective coordinates, as described in https://eprint.iacr.org/2013/722.pdf.
let theta = self.y - &(q.y * &self.z);
Expand Down
10 changes: 5 additions & 5 deletions ec/src/models/mnt4/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ impl<'a, P: MNT4Config> From<&'a G2Projective<P>> for G2Prepared<P> {
}
}

pub(super) struct G2ProjectiveExtended<P: MNT4Config> {
pub(crate) x: Fp2<P::Fp2Config>,
pub(crate) y: Fp2<P::Fp2Config>,
pub(crate) z: Fp2<P::Fp2Config>,
pub(crate) t: Fp2<P::Fp2Config>,
pub struct G2ProjectiveExtended<P: MNT4Config> {
pub x: Fp2<P::Fp2Config>,
pub y: Fp2<P::Fp2Config>,
pub z: Fp2<P::Fp2Config>,
pub t: Fp2<P::Fp2Config>,
}

#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
Expand Down
10 changes: 5 additions & 5 deletions ec/src/models/mnt6/g2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ impl<'a, P: MNT6Config> From<&'a G2Projective<P>> for G2Prepared<P> {
}
}

pub(super) struct G2ProjectiveExtended<P: MNT6Config> {
pub(crate) x: Fp3<P::Fp3Config>,
pub(crate) y: Fp3<P::Fp3Config>,
pub(crate) z: Fp3<P::Fp3Config>,
pub(crate) t: Fp3<P::Fp3Config>,
pub struct G2ProjectiveExtended<P: MNT6Config> {
pub x: Fp3<P::Fp3Config>,
pub y: Fp3<P::Fp3Config>,
pub z: Fp3<P::Fp3Config>,
pub t: Fp3<P::Fp3Config>,
}

#[derive(Derivative, CanonicalSerialize, CanonicalDeserialize)]
Expand Down
Loading