mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Hiding crypt_path_t: Fixup broken unittests.
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
#define TOR_TIMERS_PRIVATE
|
||||
#define CIRCUITPADDING_PRIVATE
|
||||
#define NETWORKSTATUS_PRIVATE
|
||||
#define CRYPT_PATH_PRIVATE
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "test.h"
|
||||
@@ -149,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.crypto;
|
||||
orcirc->crypto = tmp_cpath.private->crypto;
|
||||
|
||||
return orcirc;
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#define CIRCUITBUILD_PRIVATE
|
||||
#define CIRCUITLIST_PRIVATE
|
||||
#define CONNECTION_PRIVATE
|
||||
#define CRYPT_PATH_PRIVATE
|
||||
|
||||
#include "test/test.h"
|
||||
#include "test/test_helpers.h"
|
||||
@@ -241,12 +242,12 @@ test_e2e_rend_circuit_setup_legacy(void *arg)
|
||||
tt_int_op(retval, OP_EQ, 1);
|
||||
|
||||
/* Check the digest algo */
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.f_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
|
||||
OP_EQ, DIGEST_SHA1);
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.b_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
|
||||
OP_EQ, DIGEST_SHA1);
|
||||
tt_assert(or_circ->cpath->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->crypto.b_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.b_crypto);
|
||||
|
||||
/* Ensure that circ purpose was changed */
|
||||
tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_C_REND_JOINED);
|
||||
@@ -311,12 +312,12 @@ test_e2e_rend_circuit_setup(void *arg)
|
||||
tt_int_op(retval, OP_EQ, 1);
|
||||
|
||||
/* Check that the crypt path has prop224 algorithm parameters */
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.f_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
|
||||
OP_EQ, DIGEST_SHA3_256);
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.b_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
|
||||
OP_EQ, DIGEST_SHA3_256);
|
||||
tt_assert(or_circ->cpath->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->crypto.b_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.b_crypto);
|
||||
|
||||
/* Ensure that circ purpose was changed */
|
||||
tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_C_REND_JOINED);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define STATEFILE_PRIVATE
|
||||
#define TOR_CHANNEL_INTERNAL_
|
||||
#define HS_CLIENT_PRIVATE
|
||||
#define CRYPT_PATH_PRIVATE
|
||||
|
||||
#include "test/test.h"
|
||||
#include "test/test_helpers.h"
|
||||
@@ -193,12 +194,12 @@ test_e2e_rend_circuit_setup(void *arg)
|
||||
tt_int_op(retval, OP_EQ, 1);
|
||||
|
||||
/* Check the digest algo */
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.f_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.f_digest),
|
||||
OP_EQ, DIGEST_SHA3_256);
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->crypto.b_digest),
|
||||
tt_int_op(crypto_digest_get_algorithm(or_circ->cpath->private->crypto.b_digest),
|
||||
OP_EQ, DIGEST_SHA3_256);
|
||||
tt_assert(or_circ->cpath->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->crypto.b_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.f_crypto);
|
||||
tt_assert(or_circ->cpath->private->crypto.b_crypto);
|
||||
|
||||
/* Ensure that circ purpose was changed */
|
||||
tt_int_op(or_circ->base_.purpose, OP_EQ, CIRCUIT_PURPOSE_S_REND_JOINED);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
* Copyright (c) 2007-2019, The Tor Project, Inc. */
|
||||
/* See LICENSE for licensing information */
|
||||
|
||||
#define CRYPT_PATH_PRIVATE
|
||||
|
||||
#include "core/or/or.h"
|
||||
#include "core/or/circuitbuild.h"
|
||||
#define CIRCUITLIST_PRIVATE
|
||||
@@ -49,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->crypto, KEY_MATERIAL[i], sizeof(KEY_MATERIAL[i]),
|
||||
relay_crypto_init(&hop->private->crypto, KEY_MATERIAL[i], sizeof(KEY_MATERIAL[i]),
|
||||
0, 0);
|
||||
hop->state = CPATH_STATE_OPEN;
|
||||
onion_append_to_cpath(&cs->origin_circ->cpath, hop);
|
||||
|
||||
Reference in New Issue
Block a user