summaryrefslogtreecommitdiff
path: root/src/or/hs_client.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-09-01 16:18:50 -0400
committerGeorge Kadianakis <desnacked@riseup.net>2017-09-07 18:16:07 +0300
commit72c7f81459e087e2a0485361eb34db1023d12155 (patch)
treed8f01ee1d12860ac5cff8f90fcaa93df7359265f /src/or/hs_client.c
parentf117da3ea006fbdda3f5e921d5f8da2ae3d3bdfd (diff)
downloadtor-72c7f81459e087e2a0485361eb34db1023d12155.tar.gz
tor-72c7f81459e087e2a0485361eb34db1023d12155.zip
prop224: When computing hsdir index and time period, use valid_after time
Use the valid_after time from the consensus to get the time period number else we might get out of sync with the overlap period that uses valid_after. Make it an optional feature since some functions require passing a specific time (like hs_get_start_time_of_next_time_period()). Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_client.c')
-rw-r--r--src/or/hs_client.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/or/hs_client.c b/src/or/hs_client.c
index 0e8fc6c24b..9f4dba04d4 100644
--- a/src/or/hs_client.c
+++ b/src/or/hs_client.c
@@ -29,6 +29,7 @@
#include "connection.h"
#include "hs_ntor.h"
#include "circuitbuild.h"
+#include "networkstatus.h"
/* Get all connections that are waiting on a circuit and flag them back to
* waiting for a hidden service descriptor for the given service key
@@ -110,7 +111,7 @@ static int
directory_launch_v3_desc_fetch(const ed25519_public_key_t *onion_identity_pk,
const routerstatus_t *hsdir)
{
- uint64_t current_time_period = hs_get_time_period_num(approx_time());
+ uint64_t current_time_period = hs_get_time_period_num(0);
ed25519_public_key_t blinded_pubkey;
char base64_blinded_pubkey[ED25519_BASE64_LEN + 1];
hs_ident_dir_conn_t hs_conn_dir_ident;
@@ -162,7 +163,7 @@ pick_hsdir_v3(const ed25519_public_key_t *onion_identity_pk)
{
int retval;
char base64_blinded_pubkey[ED25519_BASE64_LEN + 1];
- uint64_t current_time_period = hs_get_time_period_num(approx_time());
+ uint64_t current_time_period = hs_get_time_period_num(0);
smartlist_t *responsible_hsdirs;
ed25519_public_key_t blinded_pubkey;
routerstatus_t *hsdir_rs = NULL;
@@ -906,7 +907,7 @@ hs_client_decode_descriptor(const char *desc_str,
/* Create subcredential for this HS so that we can decrypt */
{
- uint64_t current_time_period = hs_get_time_period_num(approx_time());
+ uint64_t current_time_period = hs_get_time_period_num(0);
hs_build_blinded_pubkey(service_identity_pk, NULL, 0, current_time_period,
&blinded_pubkey);
hs_get_subcredential(service_identity_pk, &blinded_pubkey, subcredential);