diff options
author | George Kadianakis <desnacked@riseup.net> | 2020-01-27 17:03:38 +0200 |
---|---|---|
committer | George Kadianakis <desnacked@riseup.net> | 2020-01-28 01:07:51 +0200 |
commit | 0133169481edd4094ec422da09bb68547bca4b50 (patch) | |
tree | c34f3b0330a29e63d10ca62bc031a5c3a6cb1d43 /src/test/test_hs_ob.c | |
parent | c731988cb2ba2164d7557a95e3410c2e12f85bb8 (diff) | |
download | tor-0133169481edd4094ec422da09bb68547bca4b50.tar.gz tor-0133169481edd4094ec422da09bb68547bca4b50.zip |
Allow clients to connect to the instance even with OB enabled.
We do this by including the instance's subcredentials to the list of
subcredentials that are used during INTRO2 decryption.
Diffstat (limited to 'src/test/test_hs_ob.c')
-rw-r--r-- | src/test/test_hs_ob.c | 27 |
1 files changed, 24 insertions, 3 deletions
diff --git a/src/test/test_hs_ob.c b/src/test/test_hs_ob.c index c2d62e354a..c4d9d239d2 100644 --- a/src/test/test_hs_ob.c +++ b/src/test/test_hs_ob.c @@ -191,16 +191,34 @@ test_get_subcredentials(void *arg) ed25519_keypair_generate(&onion_addr_kp_1, 0); smartlist_add(config.ob_master_pubkeys, &onion_addr_kp_1.pubkey); + /* Set up an instance */ + hs_service_t *service = tor_malloc_zero(sizeof(hs_service_t)); + service->config = config; + service->desc_current = service_descriptor_new(); + service->desc_next = service_descriptor_new(); + + /* Set up the instance subcredentials */ + char current_subcred[SUBCRED_LEN]; + char next_subcred[SUBCRED_LEN]; + memset(current_subcred, 'C', SUBCRED_LEN); + memset(next_subcred, 'N', SUBCRED_LEN); + memcpy(service->desc_current->desc->subcredential.subcred, current_subcred, + SUBCRED_LEN); + memcpy(service->desc_next->desc->subcredential.subcred, next_subcred, + SUBCRED_LEN); + hs_subcredential_t *subcreds = NULL; - size_t num = compute_subcredentials(&config, &subcreds); - tt_uint_op(num, OP_EQ, 3); + size_t num = compute_subcredentials(service, &subcreds); + /* 5 subcredentials: 3 for the frontend, 2 for the instance */ + tt_uint_op(num, OP_EQ, 5); /* Validate the subcredentials we just got. We'll build them oursevles with * the right time period steps and compare. */ const uint64_t tp = hs_get_time_period_num(0); const int steps[3] = {0, -1, 1}; - for (unsigned int i = 0; i < num; i++) { + unsigned int i; + for (i = 0; i < 3; i++) { hs_subcredential_t subcredential; ed25519_public_key_t blinded_pubkey; hs_build_blinded_pubkey(&onion_addr_kp_1.pubkey, NULL, 0, tp + steps[i], @@ -211,6 +229,9 @@ test_get_subcredentials(void *arg) SUBCRED_LEN); } + tt_mem_op(subcreds[i++].subcred, OP_EQ, current_subcred, SUBCRED_LEN); + tt_mem_op(subcreds[i++].subcred, OP_EQ, next_subcred, SUBCRED_LEN); + done: tor_free(subcreds); smartlist_free(config.ob_master_pubkeys); |