Skip to content

Commit

Permalink
remove dead code from bigint1
Browse files Browse the repository at this point in the history
  • Loading branch information
austinabell committed Dec 5, 2024
1 parent f6fdfd4 commit c275042
Showing 1 changed file with 0 additions and 66 deletions.
66 changes: 0 additions & 66 deletions k256/src/arithmetic/projective.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,30 +144,6 @@ impl ProjectivePoint {
let yz_pairs = ((self.y + &self.z) * &(other.y + &other.z)) + &n_yy_zz;
let xz_pairs = ((self.x + &self.z) * &(other.x + &other.z)) + &n_xx_zz;

if cfg!(all(target_os = "zkvm", target_arch = "riscv32")) {
// Same as below, but using mul_single instead of repeated addition to get small
// multiplications and normalize_weak is removed.
let bzz3 = zz.mul_single(CURVE_EQUATION_B_SINGLE * 3);

let yy_m_bzz3 = yy + &bzz3.negate(1);
let yy_p_bzz3 = yy + &bzz3;

let byz3 = &yz_pairs.mul_single(CURVE_EQUATION_B_SINGLE * 3);

let xx3 = xx.mul_single(3);
let bxx9 = xx3.mul_single(CURVE_EQUATION_B_SINGLE * 3);

let new_x = (xy_pairs * &yy_m_bzz3) + &(byz3 * &xz_pairs).negate(1); // m1
let new_y = (yy_p_bzz3 * &yy_m_bzz3) + &(bxx9 * &xz_pairs);
let new_z = (yz_pairs * &yy_p_bzz3) + &(xx3 * &xy_pairs);

return ProjectivePoint {
x: new_x,
y: new_y,
z: new_z,
};
}

let bzz = zz.mul_single(CURVE_EQUATION_B_SINGLE);
let bzz3 = (bzz.double() + &bzz).normalize_weak();

Expand Down Expand Up @@ -208,29 +184,6 @@ impl ProjectivePoint {
let yz_pairs = (other.y * &self.z) + &self.y;
let xz_pairs = (other.x * &self.z) + &self.x;

if cfg!(all(target_os = "zkvm", target_arch = "riscv32")) {
// Same as below, but using mul_single instead of repeated addition to get small
// multiplications and normalize_weak is removed.
let bzz3 = self.z.mul_single(CURVE_EQUATION_B_SINGLE * 3);

let yy_m_bzz3 = yy + &bzz3.negate(1);
let yy_p_bzz3 = yy + &bzz3;

let n_byz3 =
&yz_pairs.mul(&FieldElement::from_i64(CURVE_EQUATION_B_SINGLE as i64 * -3));

let xx3 = xx.mul_single(3);
let bxx9 = xx3.mul_single(CURVE_EQUATION_B_SINGLE * 3);

let mut ret = ProjectivePoint {
x: (xy_pairs * &yy_m_bzz3) + &(n_byz3 * &xz_pairs),
y: (yy_p_bzz3 * &yy_m_bzz3) + &(bxx9 * &xz_pairs),
z: (yz_pairs * &yy_p_bzz3) + &(xx3 * &xy_pairs),
};
ret.conditional_assign(self, other.is_identity());
return ret;
}

let bzz = &self.z.mul_single(CURVE_EQUATION_B_SINGLE);
let bzz3 = (bzz.double() + bzz).normalize_weak();

Expand Down Expand Up @@ -268,25 +221,6 @@ impl ProjectivePoint {
let zz = self.z.square();
let xy2 = (self.x * &self.y).double();

if cfg!(all(target_os = "zkvm", target_arch = "riscv32")) {
// Same as below, but using mul_single instead of repeated addition to get small
// multiplications and normalize_weak is removed.
let bzz3 = zz.mul_single(CURVE_EQUATION_B_SINGLE * 3);
let n_bzz9 = zz.mul(&FieldElement::from_i64(CURVE_EQUATION_B_SINGLE as i64 * -9));

let yy_m_bzz9 = yy + &n_bzz9;
let yy_p_bzz3 = yy + &bzz3;

let yy_zz = yy * &zz;
let t = yy_zz.mul_single(CURVE_EQUATION_B_SINGLE * 24);

return ProjectivePoint {
x: xy2 * &yy_m_bzz9,
y: ((yy_m_bzz9 * &yy_p_bzz3) + &t),
z: ((yy * &self.y) * &self.z).mul_single(8),
};
}

let bzz = &zz.mul_single(CURVE_EQUATION_B_SINGLE);
let bzz3 = (bzz.double() + bzz).normalize_weak();
let bzz9 = (bzz3.double() + &bzz3).normalize_weak();
Expand Down

0 comments on commit c275042

Please sign in to comment.