pub struct ProjectivePoint { /* private fields */ }Expand description
A point on the SM2 curve in projective coordinates (X:Y:Z).
The point at infinity is represented as (0:1:0).
Implementations§
Source§impl ProjectivePoint
impl ProjectivePoint
Sourcepub fn is_identity(&self) -> Choice
pub fn is_identity(&self) -> Choice
Whether this is the point at infinity (Z = 0). Constant-time.
Sourcepub fn add(&self, other: &Self) -> Self
pub fn add(&self, other: &Self) -> Self
Add two points using RCB Algorithm 4 (a=-3 specialized, complete).
Transcribed from eprint 2015/1060 Algorithm 4.
Sourcepub fn double(&self) -> Self
pub fn double(&self) -> Self
Double a point using RCB Algorithm 6 (a=-3 specialized). Cost: 3S + 5M + a few additions.
Transcribed from eprint 2015/1060 Algorithm 6.
Sourcepub fn to_affine(&self) -> Option<(Fp, Fp)>
pub fn to_affine(&self) -> Option<(Fp, Fp)>
Convert to affine (x, y) coordinates. Returns None for the identity
point (where Z = 0).
§Constant-time caveat
The Z-inverse goes through crypto-bigint = 0.7.3’s
ConstMontyForm::invert (safegcd / Bernstein-Yang). v0.1.0 shipped
on crypto-bigint = 0.6 where direct measurement on the dudect
harness showed |tau| ≈ 0.70 between different inputs — a
nonce-dependent timing side-channel for callers passing
secret-derived Z. Main (post-publish, on 0.7.3) measures
|tau| ≈ 0.006 directly via the W0 ct_fp_invert target at 100K
samples — two orders of magnitude under the 0.20 gate. The v0.2
Fermat-invert workstream is dropped; pow_bounded_exp remains a
fallback if a future crypto-bigint release regresses.
See SECURITY.md for the full posture.
Trait Implementations§
Source§impl Clone for ProjectivePoint
impl Clone for ProjectivePoint
Source§fn clone(&self) -> ProjectivePoint
fn clone(&self) -> ProjectivePoint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ConditionallySelectable for ProjectivePoint
impl ConditionallySelectable for ProjectivePoint
Source§fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
fn conditional_select(a: &Self, b: &Self, choice: Choice) -> Self
Source§fn conditional_assign(&mut self, other: &Self, choice: Choice)
fn conditional_assign(&mut self, other: &Self, choice: Choice)
Source§fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
fn conditional_swap(a: &mut Self, b: &mut Self, choice: Choice)
self and other if choice == 1; otherwise,
reassign both unto themselves. Read more