[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor] 74/77: hs_pow: swap out some comments



This is an automated email from the git hooks/post-receive script.

dgoulet pushed a commit to branch main
in repository tor.

commit cba1ffb43a3ffff133a9dd6b4973e6ce3618daf9
Author: Micah Elizabeth Scott <beth@xxxxxxxxxxxxxx>
AuthorDate: Tue Apr 11 16:45:21 2023 -0700

    hs_pow: swap out some comments
    
    i think we're done with these?
    and swap in a nonfatal assert to replace one of the comments.
    
    Signed-off-by: Micah Elizabeth Scott <beth@xxxxxxxxxxxxxx>
---
 src/feature/hs/hs_pow.h                | 11 +++++++++--
 src/feature/hs/hs_service.c            |  7 +++----
 src/trunnel/hs/cell_introduce1.trunnel |  2 +-
 3 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/feature/hs/hs_pow.h b/src/feature/hs/hs_pow.h
index 23c05419a6..481c293cc5 100644
--- a/src/feature/hs/hs_pow.h
+++ b/src/feature/hs/hs_pow.h
@@ -14,8 +14,15 @@
 #include "lib/evloop/token_bucket.h"
 #include "lib/smartlist_core/smartlist_core.h"
 
-/* Service updates the suggested effort every HS_UPDATE_PERIOD seconds. */
-#define HS_UPDATE_PERIOD 300 // HRPR TODO Should be consensus
+/* Service updates the suggested effort every HS_UPDATE_PERIOD seconds.
+ * This parameter controls how often we can change hs descriptor data to
+ * update suggested_effort, but it also controls the frequency of our
+ * opportunities to increase or decrease effort. Lower values react to
+ * attacks faster, higher values may be more stable.
+ * Can this move to torrc? (Or the consensus?) The hs_cache timings are
+ * related, and they're also hardcoded.
+*/
+#define HS_UPDATE_PERIOD 300
 
 /** Length of random nonce (N) used in the PoW scheme. */
 #define HS_POW_NONCE_LEN 16
diff --git a/src/feature/hs/hs_service.c b/src/feature/hs/hs_service.c
index b2af881597..a7e4e40a71 100644
--- a/src/feature/hs/hs_service.c
+++ b/src/feature/hs/hs_service.c
@@ -2421,7 +2421,6 @@ update_all_descriptors_intro_points(time_t now)
   } FOR_EACH_SERVICE_END;
 }
 
-/* XXX: Need to check with mikeperry. */
 /** Update or initialise PoW parameters in the descriptors if they do not
  * reflect the current state of the PoW defenses. If the defenses have been
  * disabled then remove the PoW parameters from the descriptors. */
@@ -2465,9 +2464,9 @@ update_all_descriptors_pow_params(time_t now)
         encrypted->pow_params = tor_malloc_zero(sizeof(hs_pow_desc_params_t));
       }
 
-      /* Update the descriptor if it doesn't reflect the current pow_state, for
-       * example if the defenses have just been enabled or refreshed due to a
-       * SIGHUP. HRPR TODO: Don't check using expiration time? */
+      /* Update the descriptor any time the seed rotates, using expiration
+       * time as a proxy for parameters not including the suggested_effort,
+       * which gets special treatment below. */
       if (encrypted->pow_params->expiration_time !=
           pow_state->expiration_time) {
         encrypted->pow_params->type = 0; /* use first version in the list */
diff --git a/src/trunnel/hs/cell_introduce1.trunnel b/src/trunnel/hs/cell_introduce1.trunnel
index cf8a291c26..ed01bd6a7d 100644
--- a/src/trunnel/hs/cell_introduce1.trunnel
+++ b/src/trunnel/hs/cell_introduce1.trunnel
@@ -84,7 +84,7 @@ const TRUNNEL_EXT_TYPE_CC_REQUEST = 0x01;
 const TRUNNEL_EXT_TYPE_POW = 0x02;
 
 /*
- * HRPR: PoW Solution Extension. Proposal 327.
+ * PoW Solution Extension. Proposal 327.
  */
 
 const TRUNNEL_POW_NONCE_LEN = 16;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits