Tor 0.4.9.2-alpha-dev
|
Header file for relay_crypto_cgo.c. More...
#include "lib/testsupport/testsupport.h"
Go to the source code of this file.
Macros | |
#define | CGO_TAG_LEN 16 |
#define | cgo_crypt_free(cgo) FREE_AND_NULL(cgo_crypt_t, cgo_crypt_free_, (cgo)) |
Typedefs | |
typedef struct cgo_crypt_t | cgo_crypt_t |
Enumerations | |
enum | cgo_mode_t { CGO_MODE_CLIENT_FORWARD , CGO_MODE_CLIENT_BACKWARD , CGO_MODE_RELAY_FORWARD , CGO_MODE_RELAY_BACKWARD } |
Functions | |
size_t | cgo_key_material_len (int aesbits) |
cgo_crypt_t * | cgo_crypt_new (cgo_mode_t mode, int aesbits, const uint8_t *keys, size_t keylen) |
void | cgo_crypt_free_ (cgo_crypt_t *cgo) |
void | cgo_crypt_relay_forward (cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **recognized_tag_out) |
void | cgo_crypt_relay_backward (cgo_crypt_t *cgo, struct cell_t *cell) |
void | cgo_crypt_relay_originate (cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **tag_out) |
void | cgo_crypt_client_forward (cgo_crypt_t *cgo, struct cell_t *cell) |
void | cgo_crypt_client_originate (cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **tag_out) |
void | cgo_crypt_client_backward (cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **recognized_tag_out) |
Header file for relay_crypto_cgo.c.
Definition in file relay_crypto_cgo.h.
#define cgo_crypt_free | ( | cgo | ) | FREE_AND_NULL(cgo_crypt_t, cgo_crypt_free_, (cgo)) |
Definition at line 45 of file relay_crypto_cgo.h.
#define CGO_TAG_LEN 16 |
Length of a CGO cell tag.
This is the value used for authenticated SENDMES.
Definition at line 37 of file relay_crypto_cgo.h.
typedef struct cgo_crypt_t cgo_crypt_t |
State to implement forward or reverse crypto between a client and a single hop on a circuit.
(There needs to be one of these for each direction.
Definition at line 23 of file relay_crypto_cgo.h.
enum cgo_mode_t |
Definition at line 25 of file relay_crypto_cgo.h.
void cgo_crypt_client_backward | ( | cgo_crypt_t * | cgo, |
cell_t * | cell, | ||
const uint8_t ** | recognized_tag_out | ||
) |
Backward CGO encryption operation at a rclient. process an inbound cell from a relay.
If the cell originated from this this relay, set *'recognized_tag_out' to point to a CGO_TAG_LEN value that should be used if we want to acknowledge this cell with an authenticated SENDME.
The value of 'recognized_tag_out' will become invalid as soon as any change is made to this 'cgo' object, or to the cell; if you need it, you should copy it immediately.
If the cell is not from this relay, set *'recognized_tag_out' to NULL.
Definition at line 560 of file relay_crypto_cgo.c.
void cgo_crypt_client_forward | ( | cgo_crypt_t * | cgo, |
cell_t * | cell | ||
) |
Forward CGO encryption at a client: process a cell for a non-destination hop.
Definition at line 509 of file relay_crypto_cgo.c.
Referenced by cgo_crypt_client_originate().
void cgo_crypt_client_originate | ( | cgo_crypt_t * | cgo, |
cell_t * | cell, | ||
const uint8_t ** | tag_out | ||
) |
Forward CGO encryption at a client: originate a cell for a given target hop.
The provided cell must have its command value set, and should have the first CGO_TAG_LEN bytes of its payload unused.
Set '*tag_out' to a value that we should expect if we want an authenticated SENDME for this cell.
The value of 'recognized_tag_out' will become invalid as soon as any change is made to this 'cgo' object, or to the cell; if you need it, you should copy it immediately.
Definition at line 536 of file relay_crypto_cgo.c.
void cgo_crypt_free_ | ( | cgo_crypt_t * | cgo | ) |
Clean up 'cgo' and free it.
Definition at line 403 of file relay_crypto_cgo.c.
cgo_crypt_t * cgo_crypt_new | ( | cgo_mode_t | mode, |
int | aesbits, | ||
const uint8_t * | keys, | ||
size_t | keylen | ||
) |
Instantiate a CGO authenticated encryption object from the provided 'keylen' bytes in 'keys'.
'keylen' must equal 'cgo_key_material_len(aesbits)'.
The client and relay must have two cgo_crypt_t objects each: one for the forward direction, and one for the reverse direction.
Definition at line 377 of file relay_crypto_cgo.c.
void cgo_crypt_relay_backward | ( | cgo_crypt_t * | cgo, |
cell_t * | cell | ||
) |
Backward CGO encryption operation at a relay: process an inbound cell from another relay, for the client.
Definition at line 461 of file relay_crypto_cgo.c.
void cgo_crypt_relay_forward | ( | cgo_crypt_t * | cgo, |
cell_t * | cell, | ||
const uint8_t ** | recognized_tag_out | ||
) |
Forward CGO encryption operation at a relay: process an outbound cell from the client.
If the cell is for this relay, set *'recognized_tag_out' to point to a CGO_TAG_LEN value that should be used if we want to acknowledge this cell with an authenticated SENDME.
The value of 'recognized_tag_out' will become invalid as soon as any change is made to this 'cgo' object, or to the cell; if you need it, you should copy it immediately.
If the cell is not for this relay, set *'recognized_tag_out' to NULL.
Definition at line 438 of file relay_crypto_cgo.c.
void cgo_crypt_relay_originate | ( | cgo_crypt_t * | cgo, |
cell_t * | cell, | ||
const uint8_t ** | tag_out | ||
) |
Backward CGO encryption operation at a relay: encrypt an inbound message that we are originating, for the client.
The provided cell must have its command value set, and should have the first CGO_TAG_LEN bytes of its payload unused.
Set '*tag_out' to a value that we should expect if we want an authenticated SENDME for this cell.
The value of 'recognized_tag_out' will become invalid as soon as any change is made to this 'cgo' object, or to the cell; if you need it, you should copy it immediately.
Definition at line 486 of file relay_crypto_cgo.c.
size_t cgo_key_material_len | ( | int | aesbits | ) |
Return the total number of bytes needed to initialize a cgo_crypt_t.
Definition at line 361 of file relay_crypto_cgo.c.
Referenced by cgo_crypt_new().