From 1b5c3224f57b16da116ca04840584a3958935128 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Mon, 9 Dec 2024 14:07:27 -0800 Subject: [PATCH] ec/suite_b: Rename `elem_less_than` to `elem_less_than_vartime`. Make it clearer that it is a variable-time operation. --- src/ec/suite_b/ecdsa/verification.rs | 2 +- src/ec/suite_b/ops.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ec/suite_b/ecdsa/verification.rs b/src/ec/suite_b/ecdsa/verification.rs index 81fffbf2f9..6d9ecb1024 100644 --- a/src/ec/suite_b/ecdsa/verification.rs +++ b/src/ec/suite_b/ecdsa/verification.rs @@ -158,7 +158,7 @@ impl EcdsaVerificationAlgorithm { if sig_r_equals_x(self.ops, &r, &x, &z2) { return Ok(()); } - if self.ops.elem_less_than(&r, &self.ops.q_minus_n) { + if self.ops.elem_less_than_vartime(&r, &self.ops.q_minus_n) { let n = Elem::from(self.ops.n()); self.ops.scalar_ops.common.elem_add(&mut r, &n); if sig_r_equals_x(self.ops, &r, &x, &z2) { diff --git a/src/ec/suite_b/ops.rs b/src/ec/suite_b/ops.rs index e11703ac58..a9a6366d0a 100644 --- a/src/ec/suite_b/ops.rs +++ b/src/ec/suite_b/ops.rs @@ -328,7 +328,7 @@ impl PublicScalarOps { a.limbs[..num_limbs] == b.limbs[..num_limbs] } - pub fn elem_less_than(&self, a: &Elem, b: &PublicElem) -> bool { + pub fn elem_less_than_vartime(&self, a: &Elem, b: &PublicElem) -> bool { let num_limbs = self.public_key_ops.common.num_limbs.into(); limbs_less_than_limbs_vartime(&a.limbs[..num_limbs], &b.limbs[..num_limbs]) }