| Tor 0.4.9.3-alpha-dev
    | 
Header file for onion_crypto.c. More...
Go to the source code of this file.
| Data Structures | |
| struct | server_onion_keys_t | 
| struct | circuit_params_t | 
| Macros | |
| #define | server_onion_keys_free(keys) FREE_AND_NULL(server_onion_keys_t, server_onion_keys_free_, (keys)) | 
| Functions | |
| void | onion_handshake_state_release (onion_handshake_state_t *state) | 
| int | onion_skin_create (int type, const extend_info_t *node, onion_handshake_state_t *state_out, uint8_t *onion_skin_out, size_t onion_skin_out_maxlen) | 
| int | onion_skin_server_handshake (int type, const uint8_t *onion_skin, size_t onionskin_len, const server_onion_keys_t *keys, const circuit_params_t *ns_params, uint8_t *reply_out, size_t reply_out_maxlen, uint8_t *keys_out, size_t *keys_len_out, uint8_t *rend_nonce_out, circuit_params_t *negotiated_params_out) | 
| int | onion_skin_client_handshake (int type, const onion_handshake_state_t *handshake_state, const uint8_t *reply, size_t reply_len, uint8_t *keys_out, size_t *keys_out_len, uint8_t *rend_authenticator_out, circuit_params_t *negotiated_params_out, const char **msg_out) | 
| server_onion_keys_t * | server_onion_keys_new (void) | 
| void | server_onion_keys_free_ (server_onion_keys_t *keys) | 
| const struct trn_extension_field_st * | trn_extension_find (const struct trn_extension_st *ext, uint8_t ext_type) | 
Header file for onion_crypto.c.
Definition in file onion_crypto.h.
| #define server_onion_keys_free | ( | keys | ) | FREE_AND_NULL(server_onion_keys_t, server_onion_keys_free_, (keys)) | 
Definition at line 69 of file onion_crypto.h.
| void onion_handshake_state_release | ( | onion_handshake_state_t * | state | ) | 
Release whatever storage is held in state, depending on its type, and clear its pointer.
Definition at line 113 of file onion_crypto.c.
Referenced by circuit_finish_handshake(), and cpath_free().
| int onion_skin_client_handshake | ( | int | type, | 
| const onion_handshake_state_t * | handshake_state, | ||
| const uint8_t * | reply, | ||
| size_t | reply_len, | ||
| uint8_t * | keys_out, | ||
| size_t * | keys_len_out, | ||
| uint8_t * | rend_authenticator_out, | ||
| circuit_params_t * | params_out, | ||
| const char ** | msg_out | ||
| ) | 
Perform the final (client-side) step of a circuit-creation handshake of type type, using our state in handshake_state and the server's response in reply. On success, generate an appropriate amount of key material in keys_out, set keys_out_len to the amount generated, set rend_authenticator_out to the "KH" field that can be used to establish introduction points at this hop, and return 0. On failure, return -1, and set *msg_out to an error message if this is worth complaining to the user about.
Requires that *keys_len_out of bytes are allocated at keys_out; adjusts *keys_out_len to the number of bytes actually genarated.
Definition at line 590 of file onion_crypto.c.
Referenced by circuit_finish_handshake().
| int onion_skin_create | ( | int | type, | 
| const extend_info_t * | node, | ||
| onion_handshake_state_t * | state_out, | ||
| uint8_t * | onion_skin_out, | ||
| size_t | onion_skin_out_maxlen | ||
| ) | 
Perform the first step of a circuit-creation handshake of type type (one of ONION_HANDSHAKE_TYPE_*): generate the initial "onion skin" in onion_skin_out with length of up to onion_skin_out_maxlen, and store any state information in state_out. Return -1 on failure, and the length of the onionskin on acceptance.
Definition at line 146 of file onion_crypto.c.
Referenced by circuit_send_first_onion_skin(), and circuit_send_intermediate_onion_skin().
| int onion_skin_server_handshake | ( | int | type, | 
| const uint8_t * | onion_skin, | ||
| size_t | onionskin_len, | ||
| const server_onion_keys_t * | keys, | ||
| const circuit_params_t * | our_ns_params, | ||
| uint8_t * | reply_out, | ||
| size_t | reply_out_maxlen, | ||
| uint8_t * | keys_out, | ||
| size_t * | keys_len_out, | ||
| uint8_t * | rend_nonce_out, | ||
| circuit_params_t * | params_out | ||
| ) | 
Perform the second (server-side) step of a circuit-creation handshake of type type, responding to the client request in onion_skin using the keys in keys. On success, write our response into reply_out, generate keys_out_len bytes worth of key material in keys_out_len, a hidden service nonce to rend_nonce_out, and return the length of the reply. On failure, return -1.
Requires that *keys_len_out of bytes are allocated at keys_out; adjusts *keys_out_len to the number of bytes actually genarated.
Definition at line 380 of file onion_crypto.c.
Referenced by command_process_create_cell(), and cpuworker_onion_handshake_threadfn().
| void server_onion_keys_free_ | ( | server_onion_keys_t * | keys | ) | 
Release all storage held in keys.
Definition at line 97 of file onion_crypto.c.
| server_onion_keys_t * server_onion_keys_new | ( | void | ) | 
Return a new server_onion_keys_t object with all of the keys and other info we might need to do onion handshakes. (We make a copy of our keys for each cpuworker to avoid race conditions with the main thread, and to avoid locking)
Definition at line 81 of file onion_crypto.c.