From a0e3662f0b2f7c67623b7f5886d81f9bb62d1ef2 Mon Sep 17 00:00:00 2001 From: xevisalle Date: Tue, 24 Sep 2024 11:44:31 +0200 Subject: [PATCH] core: Check both secret and public key in ViewKey ct_eq() --- core/CHANGELOG.md | 1 + core/src/keys/view.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index 58b07e8..278b461 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed - Call `gen_note_sk` in `SecretKey::owns` to avoid code duplication [#246] +- `ViewKey` now checks both `a` and `B` in `ct_eq()` ## [0.32.0] - 2024-08-14 diff --git a/core/src/keys/view.rs b/core/src/keys/view.rs index 73f57d7..f252eeb 100644 --- a/core/src/keys/view.rs +++ b/core/src/keys/view.rs @@ -32,14 +32,13 @@ pub struct ViewKey { impl ConstantTimeEq for ViewKey { fn ct_eq(&self, other: &Self) -> Choice { - // TODO - Why self.a is not checked? - self.B.ct_eq(&other.B) + self.a.ct_eq(&other.a) & self.B.ct_eq(&other.B) } } impl PartialEq for ViewKey { fn eq(&self, other: &Self) -> bool { - self.a == other.a && self.ct_eq(other).into() + self.ct_eq(other).into() } }