Tor  0.4.7.0-alpha-dev
Data Structures | Macros | Functions
onion.h File Reference

Header file for onion.c. More...

#include "lib/crypt_ops/crypto_ed25519.h"

Go to the source code of this file.

Data Structures

struct  create_cell_t
 
struct  created_cell_t
 
struct  extend_cell_t
 
struct  extended_cell_t
 

Macros

#define MAX_ONIONSKIN_CHALLENGE_LEN   255
 
#define MAX_ONIONSKIN_REPLY_LEN   255
 

Functions

void create_cell_init (create_cell_t *cell_out, uint8_t cell_type, uint16_t handshake_type, uint16_t handshake_len, const uint8_t *onionskin)
 
int create_cell_parse (create_cell_t *cell_out, const cell_t *cell_in)
 
int created_cell_parse (created_cell_t *cell_out, const cell_t *cell_in)
 
int extend_cell_parse (extend_cell_t *cell_out, const uint8_t command, const uint8_t *payload_in, size_t payload_len)
 
int extended_cell_parse (extended_cell_t *cell_out, const uint8_t command, const uint8_t *payload_in, size_t payload_len)
 
int create_cell_format (cell_t *cell_out, const create_cell_t *cell_in)
 
int create_cell_format_relayed (cell_t *cell_out, const create_cell_t *cell_in)
 
int created_cell_format (cell_t *cell_out, const created_cell_t *cell_in)
 
int extend_cell_format (uint8_t *command_out, uint16_t *len_out, uint8_t *payload_out, const extend_cell_t *cell_in)
 
int extended_cell_format (uint8_t *command_out, uint16_t *len_out, uint8_t *payload_out, const extended_cell_t *cell_in)
 

Detailed Description

Header file for onion.c.

Definition in file onion.h.

Function Documentation

◆ create_cell_init()

void create_cell_init ( create_cell_t cell_out,
uint8_t  cell_type,
uint16_t  handshake_type,
uint16_t  handshake_len,
const uint8_t *  onionskin 
)

Write the various parameters into the create cell. Separate from create_cell_parse() to make unit testing easier.

Definition at line 103 of file onion.c.

◆ create_cell_parse()

int create_cell_parse ( create_cell_t cell_out,
const cell_t cell_in 
)

Parse a CREATE, CREATE_FAST, or CREATE2 cell from cell_in into cell_out. Return 0 on success, -1 on failure. (We reject some syntactically valid CREATE2 cells that we can't generate or react to.)

Definition at line 155 of file onion.c.

◆ created_cell_format()

int created_cell_format ( cell_t cell_out,
const created_cell_t cell_in 
)

Fill cell_out with a correctly formatted version of the CREATED{,_FAST,2} cell in cell_in. Return 0 on success, -1 on failure.

Definition at line 563 of file onion.c.

◆ created_cell_parse()

int created_cell_parse ( created_cell_t cell_out,
const cell_t cell_in 
)

Parse a CREATED, CREATED_FAST, or CREATED2 cell from cell_in into cell_out. Return 0 on success, -1 on failure.

Definition at line 209 of file onion.c.

◆ extend_cell_format()

int extend_cell_format ( uint8_t *  command_out,
uint16_t *  len_out,
uint8_t *  payload_out,
const extend_cell_t cell_in 
)

Format the EXTEND{,2} cell in cell_in, storing its relay payload in payload_out, the number of bytes used in *len_out, and the relay command in *command_out. The payload_out must have RELAY_PAYLOAD_SIZE bytes available. Return 0 on success, -1 on failure.

Definition at line 608 of file onion.c.

◆ extend_cell_parse()

int extend_cell_parse ( extend_cell_t cell_out,
const uint8_t  command,
const uint8_t *  payload,
size_t  payload_length 
)

Parse an EXTEND or EXTEND2 cell (according to command) from the payload_length bytes of payload into cell_out. Return 0 on success, -1 on failure.

Definition at line 396 of file onion.c.

◆ extended_cell_format()

int extended_cell_format ( uint8_t *  command_out,
uint16_t *  len_out,
uint8_t *  payload_out,
const extended_cell_t cell_in 
)

Format the EXTENDED{,2} cell in cell_in, storing its relay payload in payload_out, the number of bytes used in *len_out, and the relay command in *command_out. The payload_out must have RELAY_PAYLOAD_SIZE bytes available. Return 0 on success, -1 on failure.

Definition at line 714 of file onion.c.

◆ extended_cell_parse()

int extended_cell_parse ( extended_cell_t cell_out,
const uint8_t  command,
const uint8_t *  payload,
size_t  payload_len 
)

Parse an EXTENDED or EXTENDED2 cell (according to command) from the payload_length bytes of payload into cell_out. Return 0 on success, -1 on failure.

Definition at line 465 of file onion.c.