mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
prop224: Make INTRODUCE2 min/max a consensus param
Introduction point are rotated either if we get X amounts of INTRODUCE2 cells on it or a time based expiration. This commit adds two consensus parameters which are the min and max value bounding the random value X. Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
feed375f19
commit
670cecaf66
@ -203,6 +203,30 @@ service_clear_config(hs_service_config_t *config)
|
|||||||
memset(config, 0, sizeof(*config));
|
memset(config, 0, sizeof(*config));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return the number of minimum INTRODUCE2 cell defined by a consensus
|
||||||
|
* parameter or the default value. */
|
||||||
|
static int32_t
|
||||||
|
get_intro_point_min_introduce2(void)
|
||||||
|
{
|
||||||
|
/* The [0, 2147483647] range is quite large to accomodate anything we decide
|
||||||
|
* in the future. */
|
||||||
|
return networkstatus_get_param(NULL, "hs_intro_min_introduce2",
|
||||||
|
INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS,
|
||||||
|
0, INT32_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Return the number of maximum INTRODUCE2 cell defined by a consensus
|
||||||
|
* parameter or the default value. */
|
||||||
|
static int32_t
|
||||||
|
get_intro_point_max_introduce2(void)
|
||||||
|
{
|
||||||
|
/* The [0, 2147483647] range is quite large to accomodate anything we decide
|
||||||
|
* in the future. */
|
||||||
|
return networkstatus_get_param(NULL, "hs_intro_max_introduce2",
|
||||||
|
INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS,
|
||||||
|
0, INT32_MAX);
|
||||||
|
}
|
||||||
|
|
||||||
/* Helper: Function that needs to return 1 for the HT for each loop which
|
/* Helper: Function that needs to return 1 for the HT for each loop which
|
||||||
* frees every service in an hash map. */
|
* frees every service in an hash map. */
|
||||||
static int
|
static int
|
||||||
@ -274,10 +298,10 @@ service_intro_point_new(const extend_info_t *ei, unsigned int is_legacy)
|
|||||||
* term keys. */
|
* term keys. */
|
||||||
ed25519_keypair_generate(&ip->auth_key_kp, 0);
|
ed25519_keypair_generate(&ip->auth_key_kp, 0);
|
||||||
|
|
||||||
/* XXX: These will be controlled by consensus params. (#20961) */
|
|
||||||
ip->introduce2_max =
|
ip->introduce2_max =
|
||||||
crypto_rand_int_range(INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS,
|
crypto_rand_int_range(get_intro_point_min_introduce2(),
|
||||||
INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS);
|
get_intro_point_max_introduce2());
|
||||||
|
/* XXX: These will be controlled by consensus params. (#20961) */
|
||||||
ip->time_to_expire = time(NULL) +
|
ip->time_to_expire = time(NULL) +
|
||||||
crypto_rand_int_range(INTRO_POINT_LIFETIME_MIN_SECONDS,
|
crypto_rand_int_range(INTRO_POINT_LIFETIME_MIN_SECONDS,
|
||||||
INTRO_POINT_LIFETIME_MAX_SECONDS);
|
INTRO_POINT_LIFETIME_MAX_SECONDS);
|
||||||
|
Loading…
Reference in New Issue
Block a user