Tor
0.4.7.0-alpha-dev
|
Header for relay_crypto.c. More...
Go to the source code of this file.
Functions | |
int | relay_crypto_init (relay_crypto_t *crypto, const char *key_data, size_t key_data_len, int reverse, int is_hs_v3) |
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) |
uint8_t * | relay_crypto_get_sendme_digest (relay_crypto_t *crypto) |
void | relay_crypto_record_sendme_digest (relay_crypto_t *crypto, bool is_foward_digest) |
void | relay_crypt_one_payload (crypto_cipher_t *cipher, uint8_t *in) |
void | relay_set_digest (crypto_digest_t *digest, cell_t *cell) |
Header for relay_crypto.c.
Definition in file relay_crypto.h.
void relay_crypt_one_payload | ( | crypto_cipher_t * | cipher, |
uint8_t * | in | ||
) |
Apply cipher to CELL_PAYLOAD_SIZE bytes of in (in place).
Note that we use the same operation for encrypting and for decrypting.
Definition at line 95 of file relay_crypto.c.
Referenced by cpath_crypt_cell().
void relay_crypto_assert_ok | ( | const relay_crypto_t * | crypto | ) |
Assert that crypto is valid and set.
Definition at line 367 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 265 of file relay_crypto.c.
Referenced by cpath_free().
uint8_t* relay_crypto_get_sendme_digest | ( | relay_crypto_t * | crypto | ) |
Return the sendme_digest within the crypto object.
Definition at line 102 of file relay_crypto.c.
Referenced by cpath_get_sendme_digest().
int relay_crypto_init | ( | relay_crypto_t * | crypto, |
const char * | key_data, | ||
size_t | key_data_len, | ||
int | reverse, | ||
int | is_hs_v3 | ||
) |
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 293 of file relay_crypto.c.
Referenced by cpath_init_circuit_crypto().
void relay_crypto_record_sendme_digest | ( | relay_crypto_t * | crypto, |
bool | is_foward_digest | ||
) |
Record the cell digest, indicated by is_foward_digest or not, as the SENDME cell digest.
Definition at line 111 of file relay_crypto.c.
Referenced by cpath_sendme_record_cell_digest().
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 145 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 248 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 219 of file relay_crypto.c.
void relay_set_digest | ( | crypto_digest_t * | digest, |
cell_t * | cell | ||
) |
Update digest from the payload of cell. Assign integrity part to cell.
Definition at line 31 of file relay_crypto.c.
Referenced by cpath_set_cell_forward_digest(), and relay_encrypt_cell_inbound().