diff --git a/src/core/or/circuitbuild.c b/src/core/or/circuitbuild.c
index 7216b813bd..1ceb77c4ad 100644
--- a/src/core/or/circuitbuild.c
+++ b/src/core/or/circuitbuild.c
@@ -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 is_hs_v3 is set, this cpath will be used for next gen hidden
- * service circuits and key_data must be at least
- * HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN bytes in length.
- *
- * If is_hs_v3 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 reply came back to us on circuit circ.
* (The body of reply varies depending on what sort of handshake
* this is.)
diff --git a/src/core/or/circuitbuild.h b/src/core/or/circuitbuild.h
index e6f4f4b496..f6403955ba 100644
--- a/src/core/or/circuitbuild.h
+++ b/src/core/or/circuitbuild.h
@@ -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);
diff --git a/src/core/or/crypt_path.c b/src/core/or/crypt_path.c
index 9fc3e013b2..77f129eff3 100644
--- a/src/core/or/crypt_path.c
+++ b/src/core/or/crypt_path.c
@@ -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 is_hs_v3 is set, this cpath will be used for next gen hidden
+ * service circuits and key_data must be at least
+ * HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN bytes in length.
+ *
+ * If is_hs_v3 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 payload using the crypto of cpath. Actual
diff --git a/src/core/or/crypt_path.h b/src/core/or/crypt_path.h
index fe25d85cfe..a7ebe604f5 100644
--- a/src/core/or/crypt_path.h
+++ b/src/core/or/crypt_path.h
@@ -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);