Skip to content

Commit 01742ba

Browse files
committed
ec/suite_b: Minimize scope of CommonOps members.
Callers outside of `ops` use `Modulus` members instead of using `CommonOps` directly.
1 parent aca068c commit 01742ba

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/ec/suite_b/ecdsa/signing.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ impl EcdsaKeyPair {
273273
n.add_assign(&mut e_plus_dr, &e);
274274
scalar_ops.scalar_product(&k_inv, &e_plus_dr, cpu)
275275
};
276-
if cops.is_zero(&s) {
276+
if n.is_zero(&s) {
277277
continue;
278278
}
279279

src/ec/suite_b/ops.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ impl Modulus<Q> {
154154

155155
impl CommonOps {
156156
#[inline]
157-
pub fn is_zero<M, E: Encoding>(&self, a: &elem::Elem<M, E>) -> bool {
157+
fn is_zero<M, E: Encoding>(&self, a: &elem::Elem<M, E>) -> bool {
158158
let num_limbs = self.num_limbs.into();
159159
limbs_are_zero_constant_time(&a.limbs[..num_limbs]).leak()
160160
}
@@ -242,7 +242,7 @@ impl Modulus<Q> {
242242
}
243243

244244
impl CommonOps {
245-
pub(super) fn point_sum(&self, a: &Point, b: &Point, _cpu: cpu::Features) -> Point {
245+
fn point_sum(&self, a: &Point, b: &Point, _cpu: cpu::Features) -> Point {
246246
let mut r = Point::new_at_infinity();
247247
unsafe {
248248
(self.point_add_jacobian_impl)(r.xyz.as_mut_ptr(), a.xyz.as_ptr(), b.xyz.as_ptr())
@@ -635,7 +635,7 @@ mod tests {
635635
let q = &cops.elem_modulus(cpu::features());
636636
let mut x = Elem::from(&ops.q_minus_n);
637637
q.add_assign(&mut x, &Elem::from(&cops.n));
638-
assert!(cops.is_zero(&x));
638+
assert!(q.is_zero(&x));
639639
}
640640

641641
#[test]

0 commit comments

Comments
 (0)