Macros | Typedefs | Functions
onion_ntor.h File Reference

Header for onion_ntor.c. More...

#include "lib/cc/torint.h"

Go to the source code of this file.


#define NTOR_REPLY_LEN   64
#define ntor_handshake_state_free(state)    FREE_AND_NULL(ntor_handshake_state_t, ntor_handshake_state_free_, (state))


typedef struct ntor_handshake_state_t ntor_handshake_state_t


void ntor_handshake_state_free_ (ntor_handshake_state_t *state)
int onion_skin_ntor_create (const uint8_t *router_id, const struct curve25519_public_key_t *router_key, ntor_handshake_state_t **handshake_state_out, uint8_t *onion_skin_out)
int onion_skin_ntor_server_handshake (const uint8_t *onion_skin, const struct di_digest256_map_t *private_keys, const struct curve25519_keypair_t *junk_keypair, const uint8_t *my_node_id, uint8_t *handshake_reply_out, uint8_t *key_out, size_t key_out_len)
int onion_skin_ntor_client_handshake (const ntor_handshake_state_t *handshake_state, const uint8_t *handshake_reply, uint8_t *key_out, size_t key_out_len, const char **msg_out)

Detailed Description

Header for onion_ntor.c.

Definition in file onion_ntor.h.

Macro Definition Documentation

◆ ntor_handshake_state_free

#define ntor_handshake_state_free (   state)     FREE_AND_NULL(ntor_handshake_state_t, ntor_handshake_state_free_, (state))

Definition at line 28 of file onion_ntor.h.



Length of an ntor onionskin, as sent from the client to server.

Definition at line 23 of file onion_ntor.h.


#define NTOR_REPLY_LEN   64

Length of an ntor reply, as sent from server to client.

Definition at line 25 of file onion_ntor.h.

Typedef Documentation

◆ ntor_handshake_state_t

State to be maintained by a client between sending an ntor onionskin and receiving a reply.

Definition at line 20 of file onion_ntor.h.

Function Documentation

◆ ntor_handshake_state_free_()

void ntor_handshake_state_free_ ( ntor_handshake_state_t state)

Free storage held in an ntor handshake state.

Definition at line 38 of file onion_ntor.c.

◆ onion_skin_ntor_client_handshake()

int onion_skin_ntor_client_handshake ( const ntor_handshake_state_t handshake_state,
const uint8_t *  handshake_reply,
uint8_t *  key_out,
size_t  key_out_len,
const char **  msg_out 

Perform the final client side of the ntor handshake, using the state in handshake_state and the server's NTOR_REPLY_LEN-byte reply in handshake_reply. Generate key_out_len bytes of key material in key_out. Return 0 on success, -1 on failure.

Definition at line 254 of file onion_ntor.c.