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

Header file for onion_fast.c. More...

Go to the source code of this file.

Data Structures

struct  fast_handshake_state_t
 

Macros

#define CREATE_FAST_LEN   DIGEST_LEN
 
#define CREATED_FAST_LEN   (DIGEST_LEN*2)
 
#define fast_handshake_state_free(st)    FREE_AND_NULL(fast_handshake_state_t, fast_handshake_state_free_, (st))
 

Functions

void fast_handshake_state_free_ (fast_handshake_state_t *victim)
 
int fast_onionskin_create (fast_handshake_state_t **handshake_state_out, uint8_t *handshake_out)
 
int fast_server_handshake (const uint8_t *message_in, uint8_t *handshake_reply_out, uint8_t *key_out, size_t key_out_len)
 
int fast_client_handshake (const fast_handshake_state_t *handshake_state, const uint8_t *handshake_reply_out, uint8_t *key_out, size_t key_out_len, const char **msg_out)
 

Detailed Description

Header file for onion_fast.c.

Definition in file onion_fast.h.

Macro Definition Documentation

◆ CREATE_FAST_LEN

#define CREATE_FAST_LEN   DIGEST_LEN

Definition at line 15 of file onion_fast.h.

◆ CREATED_FAST_LEN

#define CREATED_FAST_LEN   (DIGEST_LEN*2)

Definition at line 16 of file onion_fast.h.

◆ fast_handshake_state_free

#define fast_handshake_state_free (   st)     FREE_AND_NULL(fast_handshake_state_t, fast_handshake_state_free_, (st))

Definition at line 23 of file onion_fast.h.

Function Documentation

◆ fast_client_handshake()

int fast_client_handshake ( const fast_handshake_state_t handshake_state,
const uint8_t *  handshake_reply_out,
uint8_t *  key_out,
size_t  key_out_len,
const char **  msg_out 
)

Implement the second half of the client side of the CREATE_FAST handshake. We sent the server handshake_state ("x") already, and the server told us handshake_reply_out (y|H(x|y)). Make sure that the hash is correct, and generate key material in key_out. Return 0 on success, true on failure.

NOTE: The "CREATE_FAST" handshake path is distinguishable from regular "onionskin" handshakes, and is not secure if an adversary can see or modify the messages. Therefore, it should only be used by clients, and only as the first hop of a circuit (since the first hop is already authenticated and protected by TLS).

Definition at line 109 of file onion_fast.c.

◆ fast_handshake_state_free_()

void fast_handshake_state_free_ ( fast_handshake_state_t victim)

Release all state held in victim.

Definition at line 38 of file onion_fast.c.

◆ fast_onionskin_create()

int fast_onionskin_create ( fast_handshake_state_t **  handshake_state_out,
uint8_t *  handshake_out 
)

Create the state needed to perform a CREATE_FAST handshake. Return 0 on success, -1 on failure.

Definition at line 49 of file onion_fast.c.

◆ fast_server_handshake()

int fast_server_handshake ( const uint8_t *  key_in,
uint8_t *  handshake_reply_out,
uint8_t *  key_out,
size_t  key_out_len 
)

Implement the server side of the CREATE_FAST abbreviated handshake. The client has provided DIGEST_LEN key bytes in key_in ("x"). We generate a reply of DIGEST_LEN*2 bytes in key_out, consisting of a new random "y", followed by H(x|y) to check for correctness. We set key_out_len bytes of key material in key_out. Return 0 on success, <0 on failure.

Definition at line 67 of file onion_fast.c.