]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Hiding crypt_path_t: Move some more init funcs in crypt_path.c.
authorGeorge Kadianakis <desnacked@riseup.net>
Mon, 8 Apr 2019 12:32:23 +0000 (15:32 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Fri, 3 May 2019 15:15:11 +0000 (18:15 +0300)
Everything is moved, but the argument of the function is edited to access
->private->crypto.

src/core/or/circuitbuild.c
src/core/or/circuitbuild.h
src/core/or/crypt_path.c
src/core/or/crypt_path.h

index 7216b813bdeac01a35c611b33f8e26dfb676c730..1ceb77c4ad179333861438dff3b942d316ae28fe 100644 (file)
@@ -1360,34 +1360,6 @@ circuit_extend(cell_t *cell, circuit_t *circ)
   return 0;
 }
 
-/** Initialize cpath-\>{f|b}_{crypto|digest} from the key material in key_data.
- *
- * If <b>is_hs_v3</b> is set, this cpath will be used for next gen hidden
- * service circuits and <b>key_data</b> must be at least
- * HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN bytes in length.
- *
- * If <b>is_hs_v3</b> is not set, key_data must contain CPATH_KEY_MATERIAL_LEN
- * bytes, which are used as follows:
- *   - 20 to initialize f_digest
- *   - 20 to initialize b_digest
- *   - 16 to key f_crypto
- *   - 16 to key b_crypto
- *
- * (If 'reverse' is true, then f_XX and b_XX are swapped.)
- *
- * Return 0 if init was successful, else -1 if it failed.
- */
-int
-circuit_init_cpath_crypto(crypt_path_t *cpath,
-                          const char *key_data, size_t key_data_len,
-                          int reverse, int is_hs_v3)
-{
-
-  tor_assert(cpath);
-  return relay_crypto_init(&cpath->crypto, key_data, key_data_len, reverse,
-                           is_hs_v3);
-}
-
 /** A "created" cell <b>reply</b> came back to us on circuit <b>circ</b>.
  * (The body of <b>reply</b> varies depending on what sort of handshake
  * this is.)
index e6f4f4b496281613215da5da022c5fb2301b63c8..f6403955bac8e15937f4557e645f73c6e2e905d9 100644 (file)
@@ -34,9 +34,6 @@ int circuit_timeout_want_to_count_circ(const origin_circuit_t *circ);
 int circuit_send_next_onion_skin(origin_circuit_t *circ);
 void circuit_note_clock_jumped(int64_t seconds_elapsed, bool was_idle);
 int circuit_extend(cell_t *cell, circuit_t *circ);
-int circuit_init_cpath_crypto(crypt_path_t *cpath,
-                              const char *key_data, size_t key_data_len,
-                              int reverse, int is_hs_v3);
 struct created_cell_t;
 int circuit_finish_handshake(origin_circuit_t *circ,
                              const struct created_cell_t *created_cell);
index 9fc3e013b2656f6345fe87953e1fa54ba64876fa..77f129eff32e5f63a710819c1af2dea543939b84 100644 (file)
@@ -114,6 +114,36 @@ assert_cpath_layer_ok(const crypt_path_t *cp)
   tor_assert(cp->deliver_window >= 0);
 }
 
+/** Initialize cpath-\>{f|b}_{crypto|digest} from the key material in key_data.
+ *
+ * If <b>is_hs_v3</b> is set, this cpath will be used for next gen hidden
+ * service circuits and <b>key_data</b> must be at least
+ * HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN bytes in length.
+ *
+ * If <b>is_hs_v3</b> is not set, key_data must contain CPATH_KEY_MATERIAL_LEN
+ * bytes, which are used as follows:
+ *   - 20 to initialize f_digest
+ *   - 20 to initialize b_digest
+ *   - 16 to key f_crypto
+ *   - 16 to key b_crypto
+ *
+ * (If 'reverse' is true, then f_XX and b_XX are swapped.)
+ *
+ * Return 0 if init was successful, else -1 if it failed.
+ */
+int
+circuit_init_cpath_crypto(crypt_path_t *cpath,
+                          const char *key_data, size_t key_data_len,
+                          int reverse, int is_hs_v3)
+{
+
+  tor_assert(cpath);
+  return relay_crypto_init(&cpath->private->crypto, key_data, key_data_len, reverse,
+                           is_hs_v3);
+}
+
+
+
 /********************** cpath crypto API *******************************/
 
 /** Encrypt or decrypt <b>payload</b> using the crypto of <b>cpath</b>. Actual
index fe25d85cfe84dfde6631187a0b535aca8eeee4cb..a7ebe604f5fed5a1b998817752d953120535accc 100644 (file)
@@ -12,6 +12,10 @@ void assert_cpath_ok(const crypt_path_t *cp);
 /* rename */
 int onion_append_hop(crypt_path_t **head_ptr, extend_info_t *choice);
 
+int circuit_init_cpath_crypto(crypt_path_t *cpath,
+                              const char *key_data, size_t key_data_len,
+                              int reverse, int is_hs_v3);
+
 /* rename */
 void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop);