12#ifndef TOR_RELAY_CRYPTO_CGO_H
13#define TOR_RELAY_CRYPTO_CGO_H
26 CGO_MODE_CLIENT_FORWARD,
27 CGO_MODE_CLIENT_BACKWARD,
28 CGO_MODE_RELAY_FORWARD,
29 CGO_MODE_RELAY_BACKWARD,
43 const uint8_t *keys,
size_t keylen);
45#define cgo_crypt_free(cgo) \
46 FREE_AND_NULL(cgo_crypt_t, cgo_crypt_free_, (cgo))
49 const uint8_t **recognized_tag_out);
52 const uint8_t **tag_out);
55 const uint8_t **tag_out);
57 const uint8_t **recognized_tag_out);
59#ifdef RELAY_CRYPTO_CGO_PRIVATE
74typedef struct cgo_et_t {
87typedef struct cgo_prf_t {
106typedef struct cgo_uiv_t {
120 uint8_t uiv_keys_[32 * 2 + 16 * 2];
126#define ET_TWEAK_LEN_H 16
130#define ET_TWEAK_LEN_X_R 493
135typedef struct uiv_tweak_t {
150typedef struct et_tweak_t {
162#define PRF_INPUT_LEN 16
164#define PRF_T0_DATA_LEN 493
167#define UIV_BLOCK_LEN 509
186 uint8_t *buf,
size_t n);
STATIC int cgo_et_init(cgo_et_t *et, int aesbits, bool encrypt, const uint8_t *key)
STATIC int cgo_uiv_init(cgo_uiv_t *uiv, int aesbits, bool encrypt, const uint8_t *key)
STATIC void cgo_prf_xor_t0(cgo_prf_t *prf, const uint8_t *input, uint8_t *data)
STATIC void cgo_uiv_clear(cgo_uiv_t *uiv)
STATIC void cgo_et_decrypt(cgo_et_t *et, const et_tweak_t tweak, uint8_t *block)
STATIC void cgo_et_set_key(cgo_et_t *et, int aesbits, bool encrypt, const uint8_t *key)
STATIC void cgo_uiv_encrypt(cgo_uiv_t *uiv, const uiv_tweak_t tweak, uint8_t *cell_body)
STATIC void cgo_et_clear(cgo_et_t *et)
STATIC int cgo_prf_init(cgo_prf_t *prf, int aesbits, const uint8_t *key)
STATIC void cgo_prf_clear(cgo_prf_t *prf)
STATIC void cgo_uiv_update(cgo_uiv_t *uiv, int aesbits, bool encrypt, uint8_t *nonce)
STATIC void cgo_prf_set_key(cgo_prf_t *prf, int aesbits, const uint8_t *key)
STATIC void cgo_prf_gen_t1(cgo_prf_t *prf, const uint8_t *input, uint8_t *buf, size_t n)
STATIC void cgo_et_encrypt(cgo_et_t *et, const et_tweak_t tweak, uint8_t *block)
STATIC void cgo_uiv_decrypt(cgo_uiv_t *uiv, const uiv_tweak_t tweak, uint8_t *cell_body)
void cgo_crypt_client_backward(cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **recognized_tag_out)
void cgo_crypt_client_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)
size_t cgo_key_material_len(int aesbits)
void cgo_crypt_relay_forward(cgo_crypt_t *cgo, struct cell_t *cell, const uint8_t **recognized_tag_out)
struct cgo_crypt_t cgo_crypt_t
void cgo_crypt_free_(cgo_crypt_t *cgo)
cgo_crypt_t * cgo_crypt_new(cgo_mode_t mode, int aesbits, const uint8_t *keys, size_t keylen)
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)
Macros to implement mocking and selective exposure for the test code.