Tor
0.4.7.0-alpha-dev
|
Implement Onion Balance specific code. More...
#include "feature/hs/hs_service.h"
#include "feature/nodelist/networkstatus.h"
#include "feature/nodelist/networkstatus_st.h"
#include "lib/confmgt/confmgt.h"
#include "lib/encoding/confline.h"
#include "feature/hs/hs_ob.h"
Go to the source code of this file.
Macros | |
#define | HS_OB_PRIVATE |
#define | OB_OPTIONS_MAGIC 0x631DE7EA |
#define | VAR(varname, conftype, member, initvalue) CONFIG_VAR_ETYPE(ob_options_t, varname, conftype, member, 0, initvalue) |
#define | V(member, conftype, initvalue) VAR(#member, conftype, member, initvalue) |
#define | ob_option_free(val) FREE_AND_NULL(ob_options_t, ob_option_free_, (val)) |
Functions | |
DUMMY_TYPECHECK_INSTANCE (ob_options_t) | |
static const config_mgr_t * | get_config_options_mgr (void) |
static void | ob_option_free_ (ob_options_t *opts) |
static ob_options_t * | ob_option_new (void) |
static bool | get_onion_public_key (const char *value, ed25519_public_key_t *pkey_out) |
static int | ob_option_parse (hs_service_config_t *config, const ob_options_t *opts) |
static void | build_subcredential (const ed25519_public_key_t *pkey, uint64_t tp, hs_subcredential_t *subcredential) |
bool | hs_ob_service_is_instance (const hs_service_t *service) |
int | hs_ob_parse_config_file (hs_service_config_t *config) |
STATIC size_t | compute_subcredentials (const hs_service_t *service, hs_subcredential_t **subcredentials_out) |
void | hs_ob_refresh_keys (hs_service_t *service) |
void | hs_ob_free_all (void) |
Variables | |
static const config_var_t | config_vars [] |
static const struct_member_t | config_extra_vars |
static const config_format_t | config_format |
static config_mgr_t * | config_options_mgr = NULL |
Implement Onion Balance specific code.
Definition in file hs_ob.c.
|
static |
STATIC size_t compute_subcredentials | ( | const hs_service_t * | service, |
hs_subcredential_t ** | subcredentials_out | ||
) |
Compute all possible subcredentials for every onion master key in the given service config object. subcredentials_out is allocated and set as an continuous array containing all possible values.
On success, return the number of subcredential put in the array which will correspond to an array of size: n * DIGEST256_LEN where DIGEST256_LEN is the length of a single subcredential.
If the given configuration object has no OB master keys configured, 0 is returned and subcredentials_out is set to NULL.
Otherwise, this can't fail.
Definition at line 278 of file hs_ob.c.
Referenced by hs_ob_refresh_keys().
|
static |
void hs_ob_free_all | ( | void | ) |
Free any memory allocated by the onionblance subsystem.
Definition at line 406 of file hs_ob.c.
Referenced by hs_free_all().
int hs_ob_parse_config_file | ( | hs_service_config_t * | config | ) |
Read and parse the config file at fname on disk. The service config object is populated with the options if any.
Return 1 on success else 0. This is to follow the "ok" convention in hs_config.c.
void hs_ob_refresh_keys | ( | hs_service_t * | service | ) |
If we are an Onionbalance instance, refresh our keys.
If we are not an Onionbalance instance or we are not ready to do so, this is a NOP.
This function is called every time we build a new descriptor. That's because we want our Onionbalance keys to always use up-to-date subcredentials both for the instance (ourselves) and for the onionbalance frontend.
bool hs_ob_service_is_instance | ( | const hs_service_t * | service | ) |
Return true iff the given service is configured as an onion balance instance. To satisfy that condition, there must at least be one master ed25519 public key configured.
Definition at line 201 of file hs_ob.c.
Referenced by get_subcredential_for_handling_intro2_cell(), and hs_ob_refresh_keys().
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |