Tor 0.4.9.2-alpha-dev
|
Header for relay_crypto.c. More...
Go to the source code of this file.
Macros | |
#define | MAX_RELAY_KEY_MATERIAL_LEN 224 |
Enumerations | |
enum | relay_crypto_alg_t { RELAY_CRYPTO_ALG_TOR1 , RELAY_CRYPTO_ALG_TOR1_HSC , RELAY_CRYPTO_ALG_TOR1_HSS , RELAY_CRYPTO_ALG_CGO_CLIENT , RELAY_CRYPTO_ALG_CGO_RELAY } |
Functions | |
ssize_t | relay_crypto_key_material_len (relay_crypto_alg_t alg) |
int | relay_crypto_init (relay_crypto_alg_t alg, relay_crypto_t *crypto, const char *key_data, size_t key_data_len) |
int | relay_decrypt_cell (circuit_t *circ, cell_t *cell, cell_direction_t cell_direction, crypt_path_t **layer_hint, char *recognized) |
void | relay_encrypt_cell_outbound (cell_t *cell, origin_circuit_t *or_circ, crypt_path_t *layer_hint) |
void | relay_encrypt_cell_inbound (cell_t *cell, or_circuit_t *or_circ) |
void | relay_crypto_clear (relay_crypto_t *crypto) |
void | relay_crypto_assert_ok (const relay_crypto_t *crypto) |
const uint8_t * | relay_crypto_get_sendme_tag (relay_crypto_t *crypto, size_t *len_out) |
size_t | relay_crypto_sendme_tag_len (const relay_crypto_t *crypto) |
Header for relay_crypto.c.
Definition in file relay_crypto.h.
#define MAX_RELAY_KEY_MATERIAL_LEN 224 |
Largest possible return value for relay_crypto_key_material_len.
Definition at line 36 of file relay_crypto.h.
enum relay_crypto_alg_t |
Enumeration to identify which relay crypto algorithm is in use.
Definition at line 16 of file relay_crypto.h.
void relay_crypto_assert_ok | ( | const relay_crypto_t * | crypto | ) |
Assert that crypto is valid and set.
Definition at line 402 of file relay_crypto.c.
void relay_crypto_clear | ( | relay_crypto_t * | crypto | ) |
Release all storage held inside crypto, but do not free crypto itself: it lives inside another object.
Definition at line 290 of file relay_crypto.c.
Referenced by cpath_free().
const uint8_t * relay_crypto_get_sendme_tag | ( | relay_crypto_t * | crypto, |
size_t * | len_out | ||
) |
Return the sendme tag within the crypto object, along with its length.
This is the digest from the most recent cell that we originated or recognized, in either direction. Calls to any encryption function on crypto
may invalidate this digest.
Definition at line 39 of file relay_crypto.c.
Referenced by cpath_get_sendme_tag().
int relay_crypto_init | ( | relay_crypto_alg_t | alg, |
relay_crypto_t * | crypto, | ||
const char * | key_data, | ||
size_t | key_data_len | ||
) |
Initialize crypto from the key material in key_data.
If is_hs_v3 is set, this cpath will be used for next gen hidden service circuits and key_data must be at least HS_NTOR_KEY_EXPANSION_KDF_OUT_LEN bytes in length.
If is_hs_v3 is not set, key_data must contain CPATH_KEY_MATERIAL_LEN bytes, which are used as follows:
(If 'reverse' is true, then f_XX and b_XX are swapped.)
Return 0 if init was successful, else -1 if it failed.
Definition at line 349 of file relay_crypto.c.
Referenced by cpath_init_circuit_crypto().
ssize_t relay_crypto_key_material_len | ( | relay_crypto_alg_t | alg | ) |
Return the amount of key material we need to initialize the given relay crypto algorithm.
Return -1 if the algorithm is unrecognized.
Definition at line 385 of file relay_crypto.c.
size_t relay_crypto_sendme_tag_len | ( | const relay_crypto_t * | crypto | ) |
Return the length of SENDME tags generated by crypto
.
Definition at line 56 of file relay_crypto.c.
int relay_decrypt_cell | ( | circuit_t * | circ, |
cell_t * | cell, | ||
cell_direction_t | cell_direction, | ||
crypt_path_t ** | layer_hint, | ||
char * | recognized | ||
) |
Do the appropriate en/decryptions for cell arriving on circ in direction cell_direction.
If cell_direction == CELL_DIRECTION_IN:
If cell_direction == CELL_DIRECTION_OUT:
If cell is recognized, set *recognized to 1, and set *layer_hint to the hop that recognized it.
Return -1 to indicate that we should mark the circuit for close, else return 0.
Definition at line 151 of file relay_crypto.c.
Referenced by circuit_receive_relay_cell().
void relay_encrypt_cell_inbound | ( | cell_t * | cell, |
or_circuit_t * | or_circ | ||
) |
Encrypt a cell cell that we are creating, and sending on circuit to the origin.
The integrity field and recognized field of cell's relay headers must be set to zero.
Definition at line 267 of file relay_crypto.c.
void relay_encrypt_cell_outbound | ( | cell_t * | cell, |
origin_circuit_t * | circ, | ||
crypt_path_t * | layer_hint | ||
) |
Encrypt a cell cell that we are creating, and sending outbound on circ until the hop corresponding to layer_hint.
The integrity field and recognized field of cell's relay headers must be set to zero.
Definition at line 244 of file relay_crypto.c.