diff options
author | Nick Mathewson <nickm@torproject.org> | 2021-09-14 15:15:30 -0400 |
---|---|---|
committer | Mike Perry <mikeperry-git@torproject.org> | 2022-02-22 19:28:33 +0000 |
commit | 244444e8b1ac36bf9148aa656e4eb9e293daa5b4 (patch) | |
tree | a4a05af33221374e7b6e254c216bcad08699bbcc /src/core/crypto | |
parent | 358ce9a19d522d1e1cf9a119850e924ca106fec5 (diff) | |
download | tor-244444e8b1ac36bf9148aa656e4eb9e293daa5b4.tar.gz tor-244444e8b1ac36bf9148aa656e4eb9e293daa5b4.zip |
Add an exported struct to onion handshakes for circuits params
THis will eventually hold the congestion control parameters that we
negotiated, plus whatever else is relevant.
Diffstat (limited to 'src/core/crypto')
-rw-r--r-- | src/core/crypto/onion_crypto.c | 7 | ||||
-rw-r--r-- | src/core/crypto/onion_crypto.h | 14 |
2 files changed, 19 insertions, 2 deletions
diff --git a/src/core/crypto/onion_crypto.c b/src/core/crypto/onion_crypto.c index 66c21bf655..f93c2c8c58 100644 --- a/src/core/crypto/onion_crypto.c +++ b/src/core/crypto/onion_crypto.c @@ -183,9 +183,11 @@ onion_skin_server_handshake(int type, uint8_t *reply_out, size_t reply_out_maxlen, uint8_t *keys_out, size_t keys_out_len, - uint8_t *rend_nonce_out) + uint8_t *rend_nonce_out, + circuit_params_t *params_out) { int r = -1; + memset(params_out, 0, sizeof(*params_out)); // TODO: actually set. switch (type) { case ONION_HANDSHAKE_TYPE_TAP: @@ -262,11 +264,14 @@ onion_skin_client_handshake(int type, const uint8_t *reply, size_t reply_len, uint8_t *keys_out, size_t keys_out_len, uint8_t *rend_authenticator_out, + circuit_params_t *params_out, const char **msg_out) { if (handshake_state->tag != type) return -1; + memset(params_out, 0, sizeof(*params_out)); // TODO: actually set. + switch (type) { case ONION_HANDSHAKE_TYPE_TAP: if (reply_len != TAP_ONIONSKIN_REPLY_LEN) { diff --git a/src/core/crypto/onion_crypto.h b/src/core/crypto/onion_crypto.h index bf25552b83..af8dd1f03f 100644 --- a/src/core/crypto/onion_crypto.h +++ b/src/core/crypto/onion_crypto.h @@ -22,6 +22,16 @@ typedef struct server_onion_keys_t { void onion_handshake_state_release(onion_handshake_state_t *state); +/** + * Parameters negotiated as part of a circuit handshake. + */ +typedef struct circuit_params_t { + /* placeholder field for congestion control algorithm. Right now this + * is always set to zero */ + int cc_algorithm; + int cc_window; +} circuit_params_t; + int onion_skin_create(int type, const extend_info_t *node, onion_handshake_state_t *state_out, @@ -33,12 +43,14 @@ int onion_skin_server_handshake(int type, uint8_t *reply_out, size_t reply_out_maxlen, uint8_t *keys_out, size_t key_out_len, - uint8_t *rend_nonce_out); + uint8_t *rend_nonce_out, + circuit_params_t *negotiated_params_out); int onion_skin_client_handshake(int type, const onion_handshake_state_t *handshake_state, const uint8_t *reply, size_t reply_len, uint8_t *keys_out, size_t key_out_len, uint8_t *rend_authenticator_out, + circuit_params_t *negotiated_params_out, const char **msg_out); server_onion_keys_t *server_onion_keys_new(void); |