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

[tor-commits] [tor/master] hs: Remove last artefact of HSv2 in the code



commit 8577243cd2d06a8a784fea97df00f7cc7363967f
Author: David Goulet <dgoulet@xxxxxxxxxxxxxx>
Date:   Tue Feb 16 11:02:58 2021 -0500

    hs: Remove last artefact of HSv2 in the code
    
    Closes #40266
    
    Signed-off-by: David Goulet <dgoulet@xxxxxxxxxxxxxx>
---
 src/core/or/circuituse.h          |  1 -
 src/core/or/or.h                  |  4 +++-
 src/feature/control/control_cmd.h |  2 --
 src/feature/hs/hs_client.c        | 10 ----------
 src/feature/hs/hs_common.c        | 21 ++++++++-------------
 src/feature/hs/hs_common.h        |  2 +-
 6 files changed, 12 insertions(+), 28 deletions(-)

diff --git a/src/core/or/circuituse.h b/src/core/or/circuituse.h
index 028fe4aa48..28e11b9859 100644
--- a/src/core/or/circuituse.h
+++ b/src/core/or/circuituse.h
@@ -76,7 +76,6 @@ bool circuit_purpose_is_hs_client(const uint8_t purpose);
 bool circuit_purpose_is_hs_service(const uint8_t purpose);
 bool circuit_purpose_is_hs_vanguards(const uint8_t purpose);
 
-bool circuit_is_hs_v2(const circuit_t *circ);
 bool circuit_is_hs_v3(const circuit_t *circ);
 
 int circuit_should_use_vanguards(uint8_t);
diff --git a/src/core/or/or.h b/src/core/or/or.h
index 294cff6603..6a15afb03a 100644
--- a/src/core/or/or.h
+++ b/src/core/or/or.h
@@ -328,7 +328,9 @@ struct curve25519_public_key_t;
  * passed through from a destroy or truncate cell. */
 #define END_CIRC_REASON_FLAG_REMOTE     512
 
-/** Length of v2 descriptor ID (32 base32 chars = 160 bits). */
+/** Length of v2 descriptor ID (32 base32 chars = 160 bits).
+ *
+ * XXX: It is still used by v3 code but should be renamed or maybe removed. */
 #define REND_DESC_ID_V2_LEN_BASE32 BASE32_DIGEST_LEN
 
 /** Maximum length of authorized client names for a hidden service. */
diff --git a/src/feature/control/control_cmd.h b/src/feature/control/control_cmd.h
index f21dc65edd..4aa3381d1a 100644
--- a/src/feature/control/control_cmd.h
+++ b/src/feature/control/control_cmd.h
@@ -82,8 +82,6 @@ typedef struct control_cmd_syntax_t {
  * multiple versions so this union stores the key and passes it to the HS
  * subsystem depending on the requested version. */
 typedef union add_onion_secret_key_t {
-  /* Hidden service v2 secret key. */
-  crypto_pk_t *v2;
   /* Hidden service v3 secret key. */
   ed25519_secret_key_t *v3;
 } add_onion_secret_key_t;
diff --git a/src/feature/hs/hs_client.c b/src/feature/hs/hs_client.c
index f1c17f4f90..8e15b09ba8 100644
--- a/src/feature/hs/hs_client.c
+++ b/src/feature/hs/hs_client.c
@@ -359,16 +359,6 @@ note_connection_attempt_succeeded(const hs_ident_edge_conn_t *hs_conn_ident)
   /* Remove from the hid serv cache all requests for that service so we can
    * query the HSDir again later on for various reasons. */
   purge_hid_serv_request(&hs_conn_ident->identity_pk);
-
-  /* The v2 subsystem cleans up the intro point time out flag at this stage.
-   * We don't try to do it here because we still need to keep intact the intro
-   * point state for future connections. Even though we are able to connect to
-   * the service, doesn't mean we should reset the timed out intro points.
-   *
-   * It is not possible to have successfully connected to an intro point
-   * present in our cache that was on error or timed out. Every entry in that
-   * cache have a 2 minutes lifetime so ultimately the intro point(s) state
-   * will be reset and thus possible to be retried. */
 }
 
 /** Given the pubkey of a hidden service in <b>onion_identity_pk</b>, fetch its
diff --git a/src/feature/hs/hs_common.c b/src/feature/hs/hs_common.c
index ae4a9cd970..f48d956bb2 100644
--- a/src/feature/hs/hs_common.c
+++ b/src/feature/hs/hs_common.c
@@ -5,8 +5,6 @@
  * \file hs_common.c
  * \brief Contains code shared between different HS protocol version as well
  *        as useful data structures and accessors used by other subsystems.
- *        The rendcommon.c should only contains code relating to the v2
- *        protocol.
  **/
 
 #define HS_COMMON_PRIVATE
@@ -638,7 +636,6 @@ hs_set_conn_addr_port(const smartlist_t *ports, edge_connection_t *conn)
   chosen_port = smartlist_choose(matching_ports);
   smartlist_free(matching_ports);
   if (chosen_port) {
-    /* Remember, v2 doesn't use an hs_ident. */
     if (conn->hs_ident) {
       /* There is always a connection identifier at this point. Regardless of a
        * Unix or TCP port, note the virtual port. */
@@ -1350,8 +1347,8 @@ hs_hsdir_requery_period(const or_options_t *options)
 
 /** Tracks requests for fetching hidden service descriptors. It's used by
  *  hidden service clients, to avoid querying HSDirs that have already failed
- *  giving back a descriptor. The same data structure is used to track both v2
- *  and v3 HS descriptor requests.
+ *  giving back a descriptor. The same data structure is used to track v3 HS
+ *  descriptor requests.
  *
  * The string map is a key/value store that contains the last request times to
  * hidden service directories for certain queries. Specifically:
@@ -1360,8 +1357,7 @@ hs_hsdir_requery_period(const or_options_t *options)
  *   value = time_t of last request for that hs_identity to that HSDir
  *
  * where 'hsdir_identity' is the identity digest of the HSDir node, and
- * 'hs_identity' is the descriptor ID of the HS in the v2 case, or the ed25519
- * blinded public key of the HS in the v3 case. */
+ * 'hs_identity' is the ed25519 blinded public key of the HS for v3. */
 static strmap_t *last_hid_serv_requests_ = NULL;
 
 /** Returns last_hid_serv_requests_, initializing it to a new strmap if
@@ -1375,10 +1371,10 @@ get_last_hid_serv_requests(void)
 }
 
 /** Look up the last request time to hidden service directory <b>hs_dir</b>
- * for descriptor request key <b>req_key_str</b> which is the descriptor ID
- * for a v2 service or the blinded key for v3. If <b>set</b> is non-zero,
- * assign the current time <b>now</b> and return that.  Otherwise, return the
- * most recent request time, or 0 if no such request has been sent before. */
+ * for descriptor request key <b>req_key_str</b> which is the blinded key for
+ * v3. If <b>set</b> is non-zero, assign the current time <b>now</b> and
+ * return that. Otherwise, return the most recent request time, or 0 if no
+ * such request has been sent before. */
 time_t
 hs_lookup_last_hid_serv_request(routerstatus_t *hs_dir,
                                 const char *req_key_str,
@@ -1460,8 +1456,7 @@ hs_purge_hid_serv_from_last_hid_serv_requests(const char *req_key_str)
      * check on the strings we are about to compare. The key is variable sized
      * since it's composed as follows:
      *   key = base32(hsdir_identity) + base32(req_key_str)
-     * where 'req_key_str' is the descriptor ID of the HS in the v2 case, or
-     * the ed25519 blinded public key of the HS in the v3 case. */
+     * where 'req_key_str' is the ed25519 blinded public key of the HS v3. */
     if (strlen(key) < REND_DESC_ID_V2_LEN_BASE32 + strlen(req_key_str)) {
       iter = strmap_iter_next(last_hid_serv_requests, iter);
       continue;
diff --git a/src/feature/hs/hs_common.h b/src/feature/hs/hs_common.h
index 5ddc6fd2d8..5eea800cb4 100644
--- a/src/feature/hs/hs_common.h
+++ b/src/feature/hs/hs_common.h
@@ -135,7 +135,7 @@ typedef enum {
 } hs_auth_key_type_t;
 
 /** Return value when adding an ephemeral service through the ADD_ONION
- * control port command. Both v2 and v3 share these. */
+ * control port command. */
 typedef enum {
   RSAE_BADAUTH     = -5, /**< Invalid auth_type/auth_clients */
   RSAE_BADVIRTPORT = -4, /**< Invalid VIRTPORT/TARGET(s) */



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits