Skip to content

Commit

Permalink
core: Check both secret and public key in ViewKey ct_eq()
Browse files Browse the repository at this point in the history
  • Loading branch information
xevisalle committed Sep 24, 2024
1 parent c6dd5c6 commit a0e3662
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
5 changes: 2 additions & 3 deletions core/src/keys/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

Expand Down

0 comments on commit a0e3662

Please sign in to comment.