From c2750428558944954af5fe147b01a67711a65062 Mon Sep 17 00:00:00 2001 From: Austin Abell Date: Thu, 5 Dec 2024 18:50:00 -0500 Subject: [PATCH] remove dead code from bigint1 --- k256/src/arithmetic/projective.rs | 66 ------------------------------- 1 file changed, 66 deletions(-) diff --git a/k256/src/arithmetic/projective.rs b/k256/src/arithmetic/projective.rs index 9a387eba..07fb781d 100644 --- a/k256/src/arithmetic/projective.rs +++ b/k256/src/arithmetic/projective.rs @@ -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(); @@ -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(); @@ -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();