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

[tor-commits] [tor/master] Hiding crypt_path_t: Change code to use the privatization macro.



commit ea5f355fc96b6c61b40dafaea05f147f6d9ba57b
Author: George Kadianakis <desnacked@xxxxxxxxxx>
Date:   Fri Apr 26 14:20:26 2019 +0300

    Hiding crypt_path_t: Change code to use the privatization macro.
---
 src/core/or/crypt_path.c       | 14 +++++++-------
 src/test/test_circuitpadding.c |  2 +-
 src/test/test_hs_client.c      | 16 ++++++++--------
 src/test/test_hs_service.c     |  8 ++++----
 src/test/test_relaycrypt.c     |  2 +-
 5 files changed, 21 insertions(+), 21 deletions(-)

diff --git a/src/core/or/crypt_path.c b/src/core/or/crypt_path.c
index b7068fd67..e2234cc2a 100644
--- a/src/core/or/crypt_path.c
+++ b/src/core/or/crypt_path.c
@@ -112,7 +112,7 @@ cpath_assert_layer_ok(const crypt_path_t *cp)
   switch (cp->state)
     {
     case CPATH_STATE_OPEN:
-      relay_crypto_assert_ok(&cp->private->crypto);
+      relay_crypto_assert_ok(&cp->pvt_crypto);
       /* fall through */
     case CPATH_STATE_CLOSED:
       /*XXXX Assert that there's no handshake_state either. */
@@ -153,7 +153,7 @@ cpath_init_circuit_crypto(crypt_path_t *cpath,
 {
 
   tor_assert(cpath);
-  return relay_crypto_init(&cpath->private->crypto, key_data, key_data_len,
+  return relay_crypto_init(&cpath->pvt_crypto, key_data, key_data_len,
                            reverse, is_hs_v3);
 }
 
@@ -164,7 +164,7 @@ cpath_free(crypt_path_t *victim)
   if (!victim)
     return;
 
-  relay_crypto_clear(&victim->private->crypto);
+  relay_crypto_clear(&victim->pvt_crypto);
   onion_handshake_state_release(&victim->handshake_state);
   crypto_dh_free(victim->rend_dh_handshake_state);
   extend_info_free(victim->extend_info);
@@ -181,9 +181,9 @@ void
 cpath_crypt_cell(const crypt_path_t *cpath, uint8_t *payload, bool is_decrypt)
 {
   if (is_decrypt) {
-    relay_crypt_one_payload(cpath->private->crypto.b_crypto, payload);
+    relay_crypt_one_payload(cpath->pvt_crypto.b_crypto, payload);
   } else {
-    relay_crypt_one_payload(cpath->private->crypto.f_crypto, payload);
+    relay_crypt_one_payload(cpath->pvt_crypto.f_crypto, payload);
   }
 }
 
@@ -191,7 +191,7 @@ cpath_crypt_cell(const crypt_path_t *cpath, uint8_t *payload, bool is_decrypt)
 struct crypto_digest_t *
 cpath_get_incoming_digest(const crypt_path_t *cpath)
 {
-  return cpath->private->crypto.b_digest;
+  return cpath->pvt_crypto.b_digest;
 }
 
 /** Set the right integrity digest on the outgoing <b>cell</b> based on the
@@ -199,7 +199,7 @@ cpath_get_incoming_digest(const crypt_path_t *cpath)
 void
 cpath_set_cell_forward_digest(crypt_path_t *cpath, cell_t *cell)
 {
-  relay_set_digest(cpath->private->crypto.f_digest, cell);
+  relay_set_digest(cpath->pvt_crypto.f_digest, cell);
 }
 
 /************ other cpath functions ***************************/
diff --git a/src/test/test_circuitpadding.c b/src/test/test_circuitpadding.c
index 5550488d0..914bcb97d 100644
--- a/src/test/test_circuitpadding.c
+++ b/src/test/test_circuitpadding.c
@@ -150,7 +150,7 @@ new_fake_orcirc(channel_t *nchan, channel_t *pchan)
     log_warn(LD_BUG,"Circuit initialization failed");
     return NULL;
   }
-  orcirc->crypto = tmp_cpath.private->crypto;
+  orcirc->crypto = tmp_cpath.pvt_crypto;
 
   return orcirc;
 }
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 7f5f25507..6cf0b68e9 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -244,13 +244,13 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
 
   /* Check the digest algo */
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.f_digest),
             OP_EQ, DIGEST_SHA1);
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.b_digest),
             OP_EQ, DIGEST_SHA1);
-  tt_assert(or_circ->cpath->private->crypto.f_crypto);
-  tt_assert(or_circ->cpath->private->crypto.b_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.f_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.b_crypto);
 
   /* Ensure that circ purpose was changed */
   tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_C_REND_JOINED);
@@ -316,13 +316,13 @@ test_e2e_rend_circuit_setup(void *arg)
 
   /* Check that the crypt path has prop224 algorithm parameters */
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.f_digest),
             OP_EQ, DIGEST_SHA3_256);
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.b_digest),
             OP_EQ, DIGEST_SHA3_256);
-  tt_assert(or_circ->cpath->private->crypto.f_crypto);
-  tt_assert(or_circ->cpath->private->crypto.b_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.f_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.b_crypto);
 
   /* Ensure that circ purpose was changed */
   tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_C_REND_JOINED);
diff --git a/src/test/test_hs_service.c b/src/test/test_hs_service.c
index 8a22e4d59..2a6aa5c63 100644
--- a/src/test/test_hs_service.c
+++ b/src/test/test_hs_service.c
@@ -196,13 +196,13 @@ test_e2e_rend_circuit_setup(void *arg)
 
   /* Check the digest algo */
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.f_digest),
             OP_EQ, DIGEST_SHA3_256);
   tt_int_op(
-         crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
+         crypto_digest_get_algorithm(or_circ->cpath->pvt_crypto.b_digest),
             OP_EQ, DIGEST_SHA3_256);
-  tt_assert(or_circ->cpath->private->crypto.f_crypto);
-  tt_assert(or_circ->cpath->private->crypto.b_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.f_crypto);
+  tt_assert(or_circ->cpath->pvt_crypto.b_crypto);
 
   /* Ensure that circ purpose was changed */
   tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_S_REND_JOINED);
diff --git a/src/test/test_relaycrypt.c b/src/test/test_relaycrypt.c
index 5dc6b47d7..4bbf07c3e 100644
--- a/src/test/test_relaycrypt.c
+++ b/src/test/test_relaycrypt.c
@@ -51,7 +51,7 @@ testing_circuitset_setup(const struct testcase_t *testcase)
   cs->origin_circ->base_.purpose = CIRCUIT_PURPOSE_C_GENERAL;
   for (i=0; i<3; ++i) {
     crypt_path_t *hop = tor_malloc_zero(sizeof(*hop));
-    relay_crypto_init(&hop->private->crypto, KEY_MATERIAL[i],
+    relay_crypto_init(&hop->pvt_crypto, KEY_MATERIAL[i],
                       sizeof(KEY_MATERIAL[i]), 0, 0);
     hop->state = CPATH_STATE_OPEN;
     cpath_extend_linked_list(&cs->origin_circ->cpath, hop);



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