Keyboard shortcuts

Press or to navigate between chapters

Press ? to show this help

Press Esc to hide this help

ec_safe_add_g2

G2 Ops for BLS12-381. Adds two elliptic curve points on a given curve twist.

Assumptions

  • The curve equation is of the form y^2 = x^3 + b Fp2 (i.e. a = 0) for the given curve index.
  • The curve index should be either 0 (BN254) or 1 (BLS12_381). Behavior is undefined otherwise.
  • The points are on the curve (can be the point at infinity as well).

Returns

  • Point at infinity if the points have the same x coordinate and opposite y coordinates.
  • The result of the addition otherwise.

Fully qualified path: garaga::ec::ec_ops_g2::ec_safe_add_g2

pub fn ec_safe_add_g2(p: G2Point, q: G2Point, curve_index: u32) -> G2Point