فهرست منبع

kdf_sapling(): add comment about non-constant function call edge case.

zero 2 سال پیش
والد
کامیت
36a36b1728
1فایلهای تغییر یافته به همراه3 افزوده شده و 0 حذف شده
  1. 3 0
      src/sdk/src/crypto/diffie_hellman.rs

+ 3 - 0
src/sdk/src/crypto/diffie_hellman.rs

@@ -36,6 +36,9 @@ pub fn sapling_ka_agree(esk: &SecretKey, pk_d: &PublicKey) -> PublicKey {
 
 /// Sapling KDF for note encryption.
 pub fn kdf_sapling(dhsecret: &PublicKey, epk: &PublicKey) -> Blake2bHash {
+    // The P.to_bytes() for P ∈ ℙₚ function used on affine curves it not perfectly constant time,
+    // but it's close enough. The function returns 0 when P = ∞ is the identity which is the
+    // edge case but almost never occurs.
     Blake2bParams::new()
         .hash_length(32)
         .personal(KDF_SAPLING_PERSONALIZATION)