From fe3d0269d19f5a888d98fc7610b554d5f0217944 Mon Sep 17 00:00:00 2001 From: Kris Nuttycombe Date: Fri, 26 May 2023 10:12:21 -0600 Subject: [PATCH] Add comments detailing the checks required prior to calling `check_note_validity` --- components/zcash_note_encryption/src/lib.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/zcash_note_encryption/src/lib.rs b/components/zcash_note_encryption/src/lib.rs index 6ad10c9877..fb8049d40c 100644 --- a/components/zcash_note_encryption/src/lib.rs +++ b/components/zcash_note_encryption/src/lib.rs @@ -513,6 +513,8 @@ fn check_note_validity( cmstar_bytes: &D::ExtractedCommitmentBytes, ) -> NoteValidity { if &D::ExtractedCommitmentBytes::from(&D::cmstar(note)) == cmstar_bytes { + // In the case corresponding to specification section 4.19.3, we check that `esk` is equal + // to `D::derive_esk(note)` prior to calling this method. if let Some(derived_esk) = D::derive_esk(note) { if D::epk_bytes(&D::ka_derive_public(note, &derived_esk)) .ct_eq(ephemeral_key) @@ -654,8 +656,9 @@ pub fn try_output_recovery_with_ock