mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 14:40:51 +01:00
Make check-spaces happy :)
Signed-off-by: David Goulet <dgoulet@torproject.org> Signed-off-by: George Kadianakis <desnacked@riseup.net>
This commit is contained in:
parent
a8efd087bd
commit
d795ed5871
14 changed files with 45 additions and 36 deletions
|
@ -2350,10 +2350,10 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|||
conn->identity_digest, \
|
||||
reason) )
|
||||
#define SEND_HS_DESC_FAILED_CONTENT() ( \
|
||||
control_event_hs_descriptor_content(rend_data_get_address(conn->rend_data), \
|
||||
conn->requested_resource, \
|
||||
conn->identity_digest, \
|
||||
NULL) )
|
||||
control_event_hs_descriptor_content(rend_data_get_address(conn->rend_data), \
|
||||
conn->requested_resource, \
|
||||
conn->identity_digest, \
|
||||
NULL) )
|
||||
tor_assert(conn->rend_data);
|
||||
log_info(LD_REND,"Received rendezvous descriptor (size %d, status %d "
|
||||
"(%s))",
|
||||
|
|
|
@ -81,7 +81,7 @@ cache_dir_desc_new(const char *desc)
|
|||
dir_desc->created_ts = time(NULL);
|
||||
return dir_desc;
|
||||
|
||||
err:
|
||||
err:
|
||||
cache_dir_desc_free(dir_desc);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -173,7 +173,7 @@ cache_lookup_v3_as_dir(const char *query, char **desc_out)
|
|||
|
||||
return found;
|
||||
|
||||
err:
|
||||
err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -365,3 +365,4 @@ hs_cache_init(void)
|
|||
tor_assert(!hs_cache_v3_dir);
|
||||
hs_cache_v3_dir = digest256map_new();
|
||||
}
|
||||
|
||||
|
|
|
@ -57,3 +57,4 @@ STATIC size_t cache_clean_v3_as_dir(time_t now, time_t global_cutoff);
|
|||
#endif /* HS_CACHE_PRIVATE */
|
||||
|
||||
#endif /* TOR_HS_CACHE_H */
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ compute_desc_id(rend_data_t *rend_data)
|
|||
tor_assert(0);
|
||||
}
|
||||
|
||||
end:
|
||||
end:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -262,3 +262,4 @@ rend_data_get_pk_digest(const rend_data_t *rend_data, size_t *len_out)
|
|||
tor_assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -34,3 +34,4 @@ const uint8_t *rend_data_get_pk_digest(const rend_data_t *rend_data,
|
|||
size_t *len_out);
|
||||
|
||||
#endif /* TOR_HS_COMMON_H */
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ encode_cert(const tor_cert_t *cert, char **cert_str_out)
|
|||
/* Success! */
|
||||
ret = 0;
|
||||
|
||||
err:
|
||||
err:
|
||||
tor_free(ed_cert_b64);
|
||||
return ret;
|
||||
}
|
||||
|
@ -821,7 +821,7 @@ desc_encode_v3(const hs_descriptor_t *desc, char **encoded_out)
|
|||
/* Success! */
|
||||
ret = 0;
|
||||
|
||||
err:
|
||||
err:
|
||||
SMARTLIST_FOREACH(lines, char *, l, tor_free(l));
|
||||
smartlist_free(lines);
|
||||
return ret;
|
||||
|
@ -1177,14 +1177,14 @@ desc_decrypt_data_v3(const hs_descriptor_t *desc, char **decrypted_out)
|
|||
*decrypted_out = (char *) decrypted;
|
||||
goto done;
|
||||
|
||||
err:
|
||||
err:
|
||||
if (decrypted) {
|
||||
tor_free(decrypted);
|
||||
}
|
||||
*decrypted_out = NULL;
|
||||
result_len = 0;
|
||||
|
||||
done:
|
||||
done:
|
||||
memwipe(secret_key, 0, sizeof(secret_key));
|
||||
memwipe(secret_iv, 0, sizeof(secret_iv));
|
||||
return result_len;
|
||||
|
@ -1326,9 +1326,9 @@ decode_introduction_point(const hs_descriptor_t *desc, const char *start)
|
|||
return ip;
|
||||
}
|
||||
|
||||
/* Given a descriptor string at <b>data</b>, decode all possible introduction points
|
||||
* that we can find. Add the introduction point object to desc_enc as we find
|
||||
* them. Return 0 on success.
|
||||
/* Given a descriptor string at <b>data</b>, decode all possible introduction
|
||||
* points that we can find. Add the introduction point object to desc_enc as we
|
||||
* find them. Return 0 on success.
|
||||
*
|
||||
* On error, a negative value is returned. It is possible that some intro
|
||||
* point object have been added to the desc_enc, they should be considered
|
||||
|
@ -1455,7 +1455,7 @@ desc_sig_is_valid(const char *b64_sig, const ed25519_keypair_t *signing_kp,
|
|||
/* Valid signature! All is good. */
|
||||
ret = 1;
|
||||
|
||||
err:
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1557,7 +1557,8 @@ desc_decode_plaintext_v3(smartlist_t *tokens,
|
|||
}
|
||||
|
||||
return 0;
|
||||
err:
|
||||
|
||||
err:
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1778,7 +1779,7 @@ hs_desc_decode_plaintext(const char *encoded,
|
|||
/* Success. Descriptor has been populated with the data. */
|
||||
ret = 0;
|
||||
|
||||
err:
|
||||
err:
|
||||
if (tokens) {
|
||||
SMARTLIST_FOREACH(tokens, directory_token_t *, t, token_clear(t));
|
||||
smartlist_free(tokens);
|
||||
|
@ -1885,7 +1886,7 @@ hs_desc_encode_descriptor(const hs_descriptor_t *desc, char **encoded_out)
|
|||
|
||||
return 0;
|
||||
|
||||
err:
|
||||
err:
|
||||
*encoded_out = NULL;
|
||||
return ret;
|
||||
}
|
||||
|
@ -1930,3 +1931,4 @@ hs_desc_plaintext_obj_size(const hs_desc_plaintext_data_t *data)
|
|||
return (sizeof(*data) + sizeof(*data->signing_key_cert) +
|
||||
data->encrypted_blob_size);
|
||||
}
|
||||
|
||||
|
|
|
@ -235,3 +235,4 @@ STATIC int desc_sig_is_valid(const char *b64_sig,
|
|||
#endif /* HS_DESCRIPTOR_PRIVATE */
|
||||
|
||||
#endif /* TOR_HS_DESCRIPTOR_H */
|
||||
|
||||
|
|
|
@ -146,7 +146,6 @@ tokenize_string(memarea_t *area,
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/** Helper: parse space-separated arguments from the string <b>s</b> ending at
|
||||
* <b>eol</b>, and store them in the args field of <b>tok</b>. Store the
|
||||
* number of parsed elements into the n_args field of <b>tok</b>. Allocate
|
||||
|
@ -243,8 +242,6 @@ token_check_object(memarea_t *area, const char *kwd,
|
|||
return tok;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/** Helper function: read the next token from *s, advance *s to the end of the
|
||||
* token, and return the parsed token. Parse *<b>s</b> according to the list
|
||||
* of tokens in <b>table</b>.
|
||||
|
@ -408,7 +405,6 @@ get_next_token(memarea_t *area,
|
|||
#undef STRNDUP
|
||||
}
|
||||
|
||||
|
||||
/** Find the first token in <b>s</b> whose keyword is <b>keyword</b>; fail
|
||||
* with an assert if no such keyword is found.
|
||||
*/
|
||||
|
@ -451,3 +447,4 @@ find_all_by_keyword(smartlist_t *s, directory_keyword k)
|
|||
});
|
||||
return out;
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,6 @@
|
|||
* \brief Header file for parsecommon.c
|
||||
**/
|
||||
|
||||
|
||||
#ifndef TOR_PARSECOMMON_H
|
||||
#define TOR_PARSECOMMON_H
|
||||
|
||||
|
@ -304,3 +303,4 @@ directory_token_t *find_opt_by_keyword(smartlist_t *s,
|
|||
smartlist_t * find_all_by_keyword(smartlist_t *s, directory_keyword k);
|
||||
|
||||
#endif /* TOR_PARSECOMMON_H */
|
||||
|
||||
|
|
|
@ -151,7 +151,7 @@ rend_client_send_introduction(origin_circuit_t *introcirc,
|
|||
tor_assert(introcirc->rend_data);
|
||||
tor_assert(rendcirc->rend_data);
|
||||
tor_assert(!rend_cmp_service_ids(rend_data_get_address(introcirc->rend_data),
|
||||
rend_data_get_address(rendcirc->rend_data)));
|
||||
rend_data_get_address(rendcirc->rend_data)));
|
||||
#ifndef NON_ANONYMOUS_MODE_ENABLED
|
||||
tor_assert(!(introcirc->build_state->onehop_tunnel));
|
||||
tor_assert(!(rendcirc->build_state->onehop_tunnel));
|
||||
|
|
|
@ -978,3 +978,4 @@ rend_circuit_pk_digest_eq(const origin_circuit_t *ocirc,
|
|||
match:
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,8 @@ test_hs_rend_data(void *arg)
|
|||
tt_str_op(client_dup_v2->onion_address, OP_EQ, client_v2->onion_address);
|
||||
tt_mem_op(client_dup_v2->desc_id_fetch, OP_EQ, client_v2->desc_id_fetch,
|
||||
sizeof(client_dup_v2->desc_id_fetch));
|
||||
tt_mem_op(client_dup_v2->descriptor_cookie, OP_EQ, client_v2->descriptor_cookie,
|
||||
tt_mem_op(client_dup_v2->descriptor_cookie, OP_EQ,
|
||||
client_v2->descriptor_cookie,
|
||||
sizeof(client_dup_v2->descriptor_cookie));
|
||||
|
||||
tt_assert(client_dup->hsdirs_fp);
|
||||
|
|
|
@ -58,7 +58,7 @@ helper_build_intro_point(const ed25519_keypair_t *blinded_kp,
|
|||
tt_int_op(ret, ==, 0);
|
||||
ip->enc_key_type = HS_DESC_KEY_TYPE_CURVE25519;
|
||||
intro_point = ip;
|
||||
done:
|
||||
done:
|
||||
return intro_point;
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ helper_build_hs_desc(uint64_t revision_counter, uint32_t lifetime,
|
|||
"1.2.3.4"));
|
||||
|
||||
descp = desc;
|
||||
done:
|
||||
done:
|
||||
return descp;
|
||||
}
|
||||
|
||||
|
@ -257,8 +257,8 @@ test_clean_as_dir(void *arg)
|
|||
tt_assert(desc1);
|
||||
ret = hs_desc_encode_descriptor(desc1, &desc1_str);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
ret = hs_cache_store_as_dir(desc1_str);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
ret = hs_cache_store_as_dir(desc1_str);
|
||||
tt_int_op(ret, OP_EQ, 0);
|
||||
|
||||
/* With the lifetime being 3 hours, a cleanup shouldn't remove it. */
|
||||
ret = cache_clean_v3_as_dir(now, 0);
|
||||
|
|
|
@ -29,7 +29,8 @@ helper_build_intro_point(const ed25519_keypair_t *blinded_kp, time_t now,
|
|||
hs_desc_link_specifier_t *ls = tor_malloc_zero(sizeof(*ls));
|
||||
if (legacy) {
|
||||
ls->type = LS_LEGACY_ID;
|
||||
memcpy(ls->u.legacy_id, "0299F268FCA9D55CD157976D39AE92B4B455B3A8", DIGEST_LEN);
|
||||
memcpy(ls->u.legacy_id, "0299F268FCA9D55CD157976D39AE92B4B455B3A8",
|
||||
DIGEST_LEN);
|
||||
} else {
|
||||
ls->u.ap.port = 9001;
|
||||
int family = tor_addr_parse(&ls->u.ap.addr, addr);
|
||||
|
@ -106,16 +107,16 @@ helper_build_hs_desc(unsigned int no_ip)
|
|||
if (!no_ip) {
|
||||
/* Add four intro points. */
|
||||
smartlist_add(desc->encrypted_data.intro_points,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
"1.2.3.4", 0));
|
||||
smartlist_add(desc->encrypted_data.intro_points,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
"[2600::1]", 0));
|
||||
smartlist_add(desc->encrypted_data.intro_points,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
"3.2.1.4", 1));
|
||||
smartlist_add(desc->encrypted_data.intro_points,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
helper_build_intro_point(&desc->plaintext_data.blinded_kp, now,
|
||||
"", 1));
|
||||
}
|
||||
|
||||
|
@ -171,7 +172,7 @@ helper_compare_hs_desc(const hs_descriptor_t *desc1,
|
|||
tt_assert(desc2->encrypted_data.intro_points);
|
||||
tt_int_op(smartlist_len(desc1->encrypted_data.intro_points), ==,
|
||||
smartlist_len(desc2->encrypted_data.intro_points));
|
||||
for (int i = 0; i < smartlist_len(desc1->encrypted_data.intro_points); i++) {
|
||||
for (int i=0; i < smartlist_len(desc1->encrypted_data.intro_points); i++) {
|
||||
hs_desc_intro_point_t *ip1 = smartlist_get(desc1->encrypted_data
|
||||
.intro_points, i),
|
||||
*ip2 = smartlist_get(desc2->encrypted_data
|
||||
|
@ -948,7 +949,8 @@ test_decode_plaintext(void *arg)
|
|||
"-----BEGIN %s-----\n" \
|
||||
"UNICORN\n" \
|
||||
"-----END MESSAGE-----\n" \
|
||||
"signature m20WJH5agqvwhq7QeuEZ1mYyPWQDO+eJOZUjLhAiKu8DbL17DsDfJE6kXbWyHimbNj2we0enV3cCOOAsmPOaAw\n"
|
||||
"signature m20WJH5agqvwhq7QeuEZ1mYyPWQDO+eJOZUjLhAiKu8DbL17DsDfJE6kXbWy" \
|
||||
"HimbNj2we0enV3cCOOAsmPOaAw\n"
|
||||
|
||||
/* Invalid version. */
|
||||
{
|
||||
|
@ -1125,3 +1127,4 @@ struct testcase_t hs_descriptor[] = {
|
|||
|
||||
END_OF_TESTCASES
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue