Tor 0.4.9.0-alpha-dev
Data Structures | Macros | Enumerations | Functions
hs_pow.h File Reference

Header file containing PoW denial of service defenses for the HS subsystem for all versions. More...

#include "lib/evloop/compat_libevent.h"
#include "lib/evloop/token_bucket.h"
#include "lib/smartlist_core/smartlist_core.h"
#include "lib/crypt_ops/crypto_ed25519.h"

Go to the source code of this file.

Data Structures

struct  hs_pow_desc_params_t
 
struct  hs_pow_solver_inputs_t
 
struct  hs_pow_service_state_t
 
struct  hs_pow_solution_t
 

Macros

#define HS_UPDATE_PERIOD   300
 
#define HS_POW_NONCE_LEN   16
 
#define HS_POW_EQX_SOL_LEN   16
 
#define HS_POW_HASH_LEN   4
 
#define HS_POW_PSTRING_LEN   16
 
#define HS_POW_PSTRING   "Tor hs intro v1\0"
 
#define HS_POW_ID_LEN   32
 
#define HS_POW_SEED_LEN   32
 
#define HS_POW_SEED_HEAD_LEN   4
 
#define HS_POW_EFFORT_LEN   sizeof(uint32_t)
 
#define HS_POW_NONCE_OFFSET    (HS_POW_PSTRING_LEN + HS_POW_ID_LEN + HS_POW_SEED_LEN)
 
#define HS_POW_CHALLENGE_LEN
 
#define have_module_pow()   (0)
 

Enumerations

enum  hs_pow_desc_type_t { HS_POW_DESC_V1 = 1 }
 

Functions

static int hs_pow_solve (const hs_pow_solver_inputs_t *pow_inputs, hs_pow_solution_t *pow_solution_out)
 
static int hs_pow_verify (const ed25519_public_key_t *service_blinded_id, const hs_pow_service_state_t *pow_state, const hs_pow_solution_t *pow_solution)
 
static void hs_pow_remove_seed_from_cache (const uint8_t *seed_head)
 
static void hs_pow_free_service_state (hs_pow_service_state_t *state)
 
static int hs_pow_queue_work (uint32_t intro_circ_identifier, const uint8_t *rend_circ_cookie, const hs_pow_solver_inputs_t *pow_inputs)
 

Detailed Description

Header file containing PoW denial of service defenses for the HS subsystem for all versions.

Definition in file hs_pow.h.

Macro Definition Documentation

◆ have_module_pow

#define have_module_pow ( )    (0)

Definition at line 181 of file hs_pow.h.

◆ HS_POW_CHALLENGE_LEN

#define HS_POW_CHALLENGE_LEN
Value:
HS_POW_SEED_LEN + HS_POW_NONCE_LEN + HS_POW_EFFORT_LEN)
#define HS_POW_EFFORT_LEN
Definition: hs_pow.h:45
#define HS_POW_NONCE_LEN
Definition: hs_pow.h:29
#define HS_POW_ID_LEN
Definition: hs_pow.h:39
#define HS_POW_PSTRING_LEN
Definition: hs_pow.h:35

Length of a PoW challenge. Construction as per prop327 is: (P || ID || C || N || INT_32(E))

Definition at line 52 of file hs_pow.h.

◆ HS_POW_EFFORT_LEN

#define HS_POW_EFFORT_LEN   sizeof(uint32_t)

Length of an effort value

Definition at line 45 of file hs_pow.h.

◆ HS_POW_EQX_SOL_LEN

#define HS_POW_EQX_SOL_LEN   16

Length of an E-quiX solution (S) in bytes.

Definition at line 31 of file hs_pow.h.

◆ HS_POW_HASH_LEN

#define HS_POW_HASH_LEN   4

Length of blake2b hash result (R) used in the PoW scheme.

Definition at line 33 of file hs_pow.h.

◆ HS_POW_ID_LEN

#define HS_POW_ID_LEN   32

Length of the blinded public ID for the onion service (ID)

Definition at line 39 of file hs_pow.h.

◆ HS_POW_NONCE_LEN

#define HS_POW_NONCE_LEN   16

Length of random nonce (N) used in the PoW scheme.

Definition at line 29 of file hs_pow.h.

◆ HS_POW_NONCE_OFFSET

#define HS_POW_NONCE_OFFSET    (HS_POW_PSTRING_LEN + HS_POW_ID_LEN + HS_POW_SEED_LEN)

Offset of the nonce value within the challenge string

Definition at line 47 of file hs_pow.h.

◆ HS_POW_PSTRING

#define HS_POW_PSTRING   "Tor hs intro v1\0"

Algorithm personalization string (P)

Definition at line 37 of file hs_pow.h.

◆ HS_POW_PSTRING_LEN

#define HS_POW_PSTRING_LEN   16

Length of algorithm personalization string (P) used in the PoW scheme

Definition at line 35 of file hs_pow.h.

◆ HS_POW_SEED_HEAD_LEN

#define HS_POW_SEED_HEAD_LEN   4

Length of seed identification heading in the PoW scheme.

Definition at line 43 of file hs_pow.h.

◆ HS_POW_SEED_LEN

#define HS_POW_SEED_LEN   32

Length of random seed used in the PoW scheme.

Definition at line 41 of file hs_pow.h.

◆ HS_UPDATE_PERIOD

#define HS_UPDATE_PERIOD   300

Definition at line 26 of file hs_pow.h.

Enumeration Type Documentation

◆ hs_pow_desc_type_t

Type of PoW in the descriptor.

Definition at line 57 of file hs_pow.h.

Function Documentation

◆ hs_pow_free_service_state()

static void hs_pow_free_service_state ( hs_pow_service_state_t state)
inlinestatic

Definition at line 210 of file hs_pow.h.

◆ hs_pow_queue_work()

static int hs_pow_queue_work ( uint32_t  intro_circ_identifier,
const uint8_t *  rend_circ_cookie,
const hs_pow_solver_inputs_t pow_inputs 
)
inlinestatic

Definition at line 216 of file hs_pow.h.

◆ hs_pow_remove_seed_from_cache()

static void hs_pow_remove_seed_from_cache ( const uint8_t *  seed_head)
inlinestatic

Definition at line 204 of file hs_pow.h.

◆ hs_pow_solve()

static int hs_pow_solve ( const hs_pow_solver_inputs_t pow_inputs,
hs_pow_solution_t pow_solution_out 
)
inlinestatic

Definition at line 184 of file hs_pow.h.

◆ hs_pow_verify()

static int hs_pow_verify ( const ed25519_public_key_t service_blinded_id,
const hs_pow_service_state_t pow_state,
const hs_pow_solution_t pow_solution 
)
inlinestatic

Definition at line 193 of file hs_pow.h.