Tor 0.4.9.2-alpha-dev
|
Contains code to handle proof-of-work computations when a hidden service is defending against DoS attacks. More...
#include <stdio.h>
#include "core/or/or.h"
#include "app/config/config.h"
#include "ext/ht.h"
#include "ext/compat_blake2.h"
#include "core/or/circuitlist.h"
#include "core/or/origin_circuit_st.h"
#include "ext/equix/include/equix.h"
#include "feature/hs/hs_cache.h"
#include "feature/hs/hs_descriptor.h"
#include "feature/hs/hs_circuitmap.h"
#include "feature/hs/hs_client.h"
#include "feature/hs/hs_pow.h"
#include "lib/crypt_ops/crypto_rand.h"
#include "lib/crypt_ops/crypto_format.h"
#include "lib/arch/bytes.h"
#include "lib/cc/ctassert.h"
#include "core/mainloop/cpuworker.h"
#include "lib/evloop/workqueue.h"
#include "lib/time/compat_time.h"
Go to the source code of this file.
Data Structures | |
struct | nonce_cache_entry_t |
struct | pow_worker_job_t |
Functions | |
static int | nonce_cache_entries_eq_ (const struct nonce_cache_entry_t *entry1, const struct nonce_cache_entry_t *entry2) |
static unsigned | nonce_cache_entry_hash_ (const struct nonce_cache_entry_t *ent) |
static | HT_HEAD (HT_PROTOTYPE(nonce_cache_table_ht, HT_PROTOTYPE(nonce_cache_entry_t) |
static void | increment_and_set_nonce (uint8_t *nonce, uint8_t *challenge) |
static uint8_t * | build_equix_challenge (const ed25519_public_key_t *blinded_id, const uint8_t *seed, const uint8_t *nonce, const uint32_t effort) |
static bool | validate_equix_challenge (const uint8_t *challenge, const uint8_t *solution_bytes, const uint32_t effort) |
static void | pack_equix_solution (const equix_solution *sol_in, uint8_t *bytes_out) |
static void | unpack_equix_solution (const uint8_t *bytes_in, equix_solution *sol_out) |
static equix_ctx_flags | hs_pow_equix_option_flags (int CompiledProofOfWorkHash) |
int | hs_pow_solve (const hs_pow_solver_inputs_t *pow_inputs, hs_pow_solution_t *pow_solution_out) |
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) |
void | hs_pow_remove_seed_from_cache (const uint8_t *seed_head) |
void | hs_pow_free_service_state (hs_pow_service_state_t *state) |
static workqueue_reply_t | pow_worker_threadfn (void *state_, void *work_) |
static void | pow_worker_job_free (pow_worker_job_t *job) |
static void | pow_worker_replyfn (void *work_) |
int | hs_pow_queue_work (uint32_t intro_circ_identifier, const uint8_t *rend_circ_cookie, const hs_pow_solver_inputs_t *pow_inputs) |
Contains code to handle proof-of-work computations when a hidden service is defending against DoS attacks.
Definition in file hs_pow.c.
|
static |
|
static |
void hs_pow_free_service_state | ( | hs_pow_service_state_t * | state | ) |
int hs_pow_queue_work | ( | uint32_t | intro_circ_identifier, |
const uint8_t * | rend_circ_cookie, | ||
const hs_pow_solver_inputs_t * | pow_inputs | ||
) |
void hs_pow_remove_seed_from_cache | ( | const uint8_t * | seed_head | ) |
int hs_pow_solve | ( | const hs_pow_solver_inputs_t * | pow_inputs, |
hs_pow_solution_t * | pow_solution_out | ||
) |
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 |
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
|
static |
Helper: Convert equix_solution to a byte array in little-endian order
|
static |
|
static |
Worker function: This function runs in the main thread, and receives a pow_worker_job_t that the worker thread has already processed.
|
static |
Worker function. This function runs inside a worker thread and receives a pow_worker_job_t as its input.
|
static |
Helper: Build an equix_solution from its corresponding byte array.