]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Merge remote branch fix_security_bug_021 into fix_security_bug_022
authorNick Mathewson <nickm@torproject.org>
Thu, 16 Dec 2010 03:47:28 +0000 (22:47 -0500)
committerNick Mathewson <nickm@torproject.org>
Thu, 16 Dec 2010 03:48:23 +0000 (22:48 -0500)
Conflicts:
src/common/memarea.c
src/or/or.h
src/or/rendclient.c

27 files changed:
1  2 
src/common/compat.c
src/common/compat.h
src/common/crypto.c
src/common/memarea.c
src/common/mempool.c
src/common/torint.h
src/common/util.c
src/or/buffers.c
src/or/circuitbuild.c
src/or/circuitbuild.h
src/or/command.c
src/or/connection_edge.c
src/or/connection_edge.h
src/or/connection_or.c
src/or/onion.c
src/or/onion.h
src/or/or.h
src/or/relay.c
src/or/relay.h
src/or/rendclient.c
src/or/rendclient.h
src/or/rendcommon.c
src/or/rendcommon.h
src/or/rendmid.c
src/or/rendmid.h
src/or/rendservice.c
src/or/rendservice.h

Simple merge
Simple merge
Simple merge
index 77579e63be52023972ca1d4dc20094cd99f4caf1,edd7bbe9ef549c4c2f5941f77a0aee2a1ef2871c..dac15434c033890351a3a91b4716572306e51f0c
@@@ -210,7 -183,7 +211,8 @@@ memarea_alloc(memarea_t *area, size_t s
    memarea_chunk_t *chunk = area->first;
    char *result;
    tor_assert(chunk);
 +  CHECK_SENTINEL(chunk);
+   tor_assert(sz < SIZE_T_CEILING);
    if (sz == 0)
      sz = 1;
    if (chunk->next_mem+sz > chunk->u.mem+chunk->mem_size) {
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
index 888bf9d255f167663feb9f15ca4e810d84225b63,0000000000000000000000000000000000000000..a85c41013307b12595672ed0741735532f1488fa
mode 100644,000000..100644
--- /dev/null
@@@ -1,125 -1,0 +1,125 @@@
-                              const char *reply);
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file circuitbuild.h
 + * \brief Header file for circuitbuild.c.
 + **/
 +
 +#ifndef _TOR_CIRCUITBUILD_H
 +#define _TOR_CIRCUITBUILD_H
 +
 +char *circuit_list_path(origin_circuit_t *circ, int verbose);
 +char *circuit_list_path_for_controller(origin_circuit_t *circ);
 +void circuit_log_path(int severity, unsigned int domain,
 +                      origin_circuit_t *circ);
 +void circuit_rep_hist_note_result(origin_circuit_t *circ);
 +origin_circuit_t *origin_circuit_init(uint8_t purpose, int flags);
 +origin_circuit_t *circuit_establish_circuit(uint8_t purpose,
 +                                            extend_info_t *exit,
 +                                            int flags);
 +int circuit_handle_first_hop(origin_circuit_t *circ);
 +void circuit_n_conn_done(or_connection_t *or_conn, int status);
 +int inform_testing_reachability(void);
 +int circuit_timeout_want_to_count_circ(origin_circuit_t *circ);
 +int circuit_send_next_onion_skin(origin_circuit_t *circ);
 +void circuit_note_clock_jumped(int seconds_elapsed);
 +int circuit_extend(cell_t *cell, circuit_t *circ);
 +int circuit_init_cpath_crypto(crypt_path_t *cpath, const char *key_data,
 +                              int reverse);
 +int circuit_finish_handshake(origin_circuit_t *circ, uint8_t cell_type,
++                             const uint8_t *reply);
 +int circuit_truncated(origin_circuit_t *circ, crypt_path_t *layer);
 +int onionskin_answer(or_circuit_t *circ, uint8_t cell_type,
 +                     const char *payload, const char *keys);
 +int circuit_all_predicted_ports_handled(time_t now, int *need_uptime,
 +                                        int *need_capacity);
 +
 +int circuit_append_new_exit(origin_circuit_t *circ, extend_info_t *info);
 +int circuit_extend_to_new_exit(origin_circuit_t *circ, extend_info_t *info);
 +void onion_append_to_cpath(crypt_path_t **head_ptr, crypt_path_t *new_hop);
 +extend_info_t *extend_info_alloc(const char *nickname, const char *digest,
 +                                 crypto_pk_env_t *onion_key,
 +                                 const tor_addr_t *addr, uint16_t port);
 +extend_info_t *extend_info_from_router(routerinfo_t *r);
 +extend_info_t *extend_info_dup(extend_info_t *info);
 +void extend_info_free(extend_info_t *info);
 +routerinfo_t *build_state_get_exit_router(cpath_build_state_t *state);
 +const char *build_state_get_exit_nickname(cpath_build_state_t *state);
 +
 +void entry_guards_compute_status(or_options_t *options, time_t now);
 +int entry_guard_register_connect_status(const char *digest, int succeeded,
 +                                        int mark_relay_status, time_t now);
 +void entry_nodes_should_be_added(void);
 +int entry_list_is_constrained(or_options_t *options);
 +routerinfo_t *choose_random_entry(cpath_build_state_t *state);
 +int entry_guards_parse_state(or_state_t *state, int set, char **msg);
 +void entry_guards_update_state(or_state_t *state);
 +int getinfo_helper_entry_guards(control_connection_t *conn,
 +                                const char *question, char **answer,
 +                                const char **errmsg);
 +
 +void clear_bridge_list(void);
 +int routerinfo_is_a_configured_bridge(routerinfo_t *ri);
 +void
 +learned_router_identity(tor_addr_t *addr, uint16_t port, const char *digest);
 +void bridge_add_from_config(const tor_addr_t *addr, uint16_t port,
 +                            char *digest);
 +void retry_bridge_descriptor_fetch_directly(const char *digest);
 +void fetch_bridge_descriptors(or_options_t *options, time_t now);
 +void learned_bridge_descriptor(routerinfo_t *ri, int from_cache);
 +int any_bridge_descriptors_known(void);
 +int any_pending_bridge_descriptor_fetches(void);
 +int entries_known_but_down(or_options_t *options);
 +void entries_retry_all(or_options_t *options);
 +
 +void entry_guards_free_all(void);
 +
 +extern circuit_build_times_t circ_times;
 +int circuit_build_times_enough_to_compute(circuit_build_times_t *cbt);
 +void circuit_build_times_update_state(circuit_build_times_t *cbt,
 +                                      or_state_t *state);
 +int circuit_build_times_parse_state(circuit_build_times_t *cbt,
 +                                    or_state_t *state);
 +void circuit_build_times_count_timeout(circuit_build_times_t *cbt,
 +                                       int did_onehop);
 +int circuit_build_times_count_close(circuit_build_times_t *cbt,
 +                                    int did_onehop, time_t start_time);
 +void circuit_build_times_set_timeout(circuit_build_times_t *cbt);
 +int circuit_build_times_add_time(circuit_build_times_t *cbt,
 +                                 build_time_t time);
 +int circuit_build_times_needs_circuits(circuit_build_times_t *cbt);
 +
 +int circuit_build_times_needs_circuits_now(circuit_build_times_t *cbt);
 +void circuit_build_times_init(circuit_build_times_t *cbt);
 +void circuit_build_times_new_consensus_params(circuit_build_times_t *cbt,
 +                                              networkstatus_t *ns);
 +double circuit_build_times_timeout_rate(const circuit_build_times_t *cbt);
 +double circuit_build_times_close_rate(const circuit_build_times_t *cbt);
 +
 +#ifdef CIRCUIT_PRIVATE
 +double circuit_build_times_calculate_timeout(circuit_build_times_t *cbt,
 +                                             double quantile);
 +build_time_t circuit_build_times_generate_sample(circuit_build_times_t *cbt,
 +                                                 double q_lo, double q_hi);
 +void circuit_build_times_initial_alpha(circuit_build_times_t *cbt,
 +                                       double quantile, double time_ms);
 +int circuit_build_times_update_alpha(circuit_build_times_t *cbt);
 +double circuit_build_times_cdf(circuit_build_times_t *cbt, double x);
 +void circuitbuild_running_unit_tests(void);
 +void circuit_build_times_reset(circuit_build_times_t *cbt);
 +
 +/* Network liveness functions */
 +int circuit_build_times_network_check_changed(circuit_build_times_t *cbt);
 +#endif
 +
 +/* Network liveness functions */
 +void circuit_build_times_network_is_live(circuit_build_times_t *cbt);
 +int circuit_build_times_network_check_live(circuit_build_times_t *cbt);
 +void circuit_build_times_network_circ_success(circuit_build_times_t *cbt);
 +
 +#endif
 +
Simple merge
Simple merge
index 762af5172eae25d2bf8fde6b790778874613c851,0000000000000000000000000000000000000000..cca82022c3b0bf777819998c856c06468d64cfef
mode 100644,000000..100644
--- /dev/null
@@@ -1,100 -1,0 +1,100 @@@
-                                             const char *answer,
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file connection_edge.h
 + * \brief Header file for connection_edge.c.
 + **/
 +
 +#ifndef _TOR_CONNECTION_EDGE_H
 +#define _TOR_CONNECTION_EDGE_H
 +
 +#define connection_mark_unattached_ap(conn, endreason) \
 +  _connection_mark_unattached_ap((conn), (endreason), __LINE__, _SHORT_FILE_)
 +
 +void _connection_mark_unattached_ap(edge_connection_t *conn, int endreason,
 +                                    int line, const char *file);
 +int connection_edge_reached_eof(edge_connection_t *conn);
 +int connection_edge_process_inbuf(edge_connection_t *conn,
 +                                  int package_partial);
 +int connection_edge_destroy(circid_t circ_id, edge_connection_t *conn);
 +int connection_edge_end(edge_connection_t *conn, uint8_t reason);
 +int connection_edge_end_errno(edge_connection_t *conn);
 +int connection_edge_finished_flushing(edge_connection_t *conn);
 +int connection_edge_finished_connecting(edge_connection_t *conn);
 +
 +int connection_ap_handshake_send_begin(edge_connection_t *ap_conn);
 +int connection_ap_handshake_send_resolve(edge_connection_t *ap_conn);
 +
 +edge_connection_t  *connection_ap_make_link(char *address, uint16_t port,
 +                                            const char *digest,
 +                                            int use_begindir, int want_onehop);
 +void connection_ap_handshake_socks_reply(edge_connection_t *conn, char *reply,
 +                                         size_t replylen,
 +                                         int endreason);
 +void connection_ap_handshake_socks_resolved(edge_connection_t *conn,
 +                                            int answer_type,
 +                                            size_t answer_len,
++                                            const uint8_t *answer,
 +                                            int ttl,
 +                                            time_t expires);
 +
 +int connection_exit_begin_conn(cell_t *cell, circuit_t *circ);
 +int connection_exit_begin_resolve(cell_t *cell, or_circuit_t *circ);
 +void connection_exit_connect(edge_connection_t *conn);
 +int connection_edge_is_rendezvous_stream(edge_connection_t *conn);
 +int connection_ap_can_use_exit(edge_connection_t *conn, routerinfo_t *exit,
 +                               int excluded_means_no);
 +void connection_ap_expire_beginning(void);
 +void connection_ap_attach_pending(void);
 +void connection_ap_fail_onehop(const char *failed_digest,
 +                               cpath_build_state_t *build_state);
 +void circuit_discard_optional_exit_enclaves(extend_info_t *info);
 +int connection_ap_detach_retriable(edge_connection_t *conn,
 +                                   origin_circuit_t *circ,
 +                                   int reason);
 +int connection_ap_process_transparent(edge_connection_t *conn);
 +
 +int address_is_invalid_destination(const char *address, int client);
 +
 +void addressmap_init(void);
 +void addressmap_clean(time_t now);
 +void addressmap_clear_configured(void);
 +void addressmap_clear_transient(void);
 +void addressmap_free_all(void);
 +int addressmap_rewrite(char *address, size_t maxlen, time_t *expires_out);
 +int addressmap_have_mapping(const char *address, int update_timeout);
 +
 +void addressmap_register(const char *address, char *new_address,
 +                         time_t expires, addressmap_entry_source_t source);
 +int parse_virtual_addr_network(const char *val, int validate_only,
 +                               char **msg);
 +int client_dns_incr_failures(const char *address);
 +void client_dns_clear_failures(const char *address);
 +void client_dns_set_addressmap(const char *address, uint32_t val,
 +                               const char *exitname, int ttl);
 +const char *addressmap_register_virtual_address(int type, char *new_address);
 +void addressmap_get_mappings(smartlist_t *sl, time_t min_expires,
 +                             time_t max_expires, int want_expiry);
 +int connection_ap_rewrite_and_attach_if_allowed(edge_connection_t *conn,
 +                                                origin_circuit_t *circ,
 +                                                crypt_path_t *cpath);
 +int connection_ap_handshake_rewrite_and_attach(edge_connection_t *conn,
 +                                               origin_circuit_t *circ,
 +                                               crypt_path_t *cpath);
 +
 +/** Possible return values for parse_extended_hostname. */
 +typedef enum hostname_type_t {
 +  NORMAL_HOSTNAME, ONION_HOSTNAME, EXIT_HOSTNAME, BAD_HOSTNAME
 +} hostname_type_t;
 +hostname_type_t parse_extended_hostname(char *address, int allowdotexit);
 +
 +#if defined(HAVE_NET_IF_H) && defined(HAVE_NET_PFVAR_H)
 +int get_pf_socket(void);
 +#endif
 +
 +#endif
 +
Simple merge
diff --cc src/or/onion.c
Simple merge
diff --cc src/or/onion.h
index e84dbb47bee63bdbf0b6a5be1e9dba05304e1d85,0000000000000000000000000000000000000000..e097dcdbb3abb2ac834733ab03108fa5fa473a2e
mode 100644,000000..100644
--- /dev/null
@@@ -1,48 -1,0 +1,48 @@@
- int fast_server_handshake(const char *key_in,
-                           char *handshake_reply_out,
-                           char *key_out,
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file onion.h
 + * \brief Header file for onion.c.
 + **/
 +
 +#ifndef _TOR_ONION_H
 +#define _TOR_ONION_H
 +
 +int onion_pending_add(or_circuit_t *circ, char *onionskin);
 +or_circuit_t *onion_next_task(char **onionskin_out);
 +void onion_pending_remove(or_circuit_t *circ);
 +
 +int onion_skin_create(crypto_pk_env_t *router_key,
 +                      crypto_dh_env_t **handshake_state_out,
 +                      char *onion_skin_out);
 +
 +int onion_skin_server_handshake(const char *onion_skin,
 +                                crypto_pk_env_t *private_key,
 +                                crypto_pk_env_t *prev_private_key,
 +                                char *handshake_reply_out,
 +                                char *key_out,
 +                                size_t key_out_len);
 +
 +int onion_skin_client_handshake(crypto_dh_env_t *handshake_state,
 +                                const char *handshake_reply,
 +                                char *key_out,
 +                                size_t key_out_len);
 +
- int fast_client_handshake(const char *handshake_state,
-                           const char *handshake_reply_out,
-                           char *key_out,
++int fast_server_handshake(const uint8_t *key_in,
++                          uint8_t *handshake_reply_out,
++                          uint8_t *key_out,
 +                          size_t key_out_len);
 +
++int fast_client_handshake(const uint8_t *handshake_state,
++                          const uint8_t *handshake_reply_out,
++                          uint8_t *key_out,
 +                          size_t key_out_len);
 +
 +void clear_pending_onions(void);
 +
 +#endif
 +
diff --cc src/or/or.h
Simple merge
diff --cc src/or/relay.c
index a65280e2a365b30e6241494bbf5df8394b89db41,02671473e6b47c64f642341809d0f1be8ffaf222..c951cab5603a056a99d5dab085ed3ad9e2ca68f0
@@@ -2512,28 -1944,9 +2510,28 @@@ decode_address_from_payload(tor_addr_t 
      tor_addr_make_unspec(addr_out);
      break;
    }
-   return payload + 2 + (uint8_t)payload[1];
+   return payload + 2 + payload[1];
  }
  
 +/** Remove all the cells queued on <b>circ</b> for <b>orconn</b>. */
 +void
 +circuit_clear_cell_queue(circuit_t *circ, or_connection_t *orconn)
 +{
 +  cell_queue_t *queue;
 +  if (circ->n_conn == orconn) {
 +    queue = &circ->n_conn_cells;
 +  } else {
 +    or_circuit_t *orcirc = TO_OR_CIRCUIT(circ);
 +    tor_assert(orcirc->p_conn == orconn);
 +    queue = &orcirc->p_conn_cells;
 +  }
 +
 +  if (queue->n)
 +    make_circuit_inactive_on_conn(circ,orconn);
 +
 +  cell_queue_clear(queue);
 +}
 +
  /** Fail with an assert if the active circuits ring on <b>orconn</b> is
   * corrupt.  */
  void
diff --cc src/or/relay.h
index 08a1ffe7891a1d170cfb4aa8488dd86df2f3f7e6,0000000000000000000000000000000000000000..8ccf0e2b303aa1a8485bd3c26542e2904d52ece2
mode 100644,000000..100644
--- /dev/null
@@@ -1,68 -1,0 +1,68 @@@
- void relay_header_pack(char *dest, const relay_header_t *src);
- void relay_header_unpack(relay_header_t *dest, const char *src);
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file relay.h
 + * \brief Header file for relay.c.
 + **/
 +
 +#ifndef _TOR_RELAY_H
 +#define _TOR_RELAY_H
 +
 +extern uint64_t stats_n_relay_cells_relayed;
 +extern uint64_t stats_n_relay_cells_delivered;
 +
 +int circuit_receive_relay_cell(cell_t *cell, circuit_t *circ,
 +                               cell_direction_t cell_direction);
 +
- int append_address_to_payload(char *payload_out, const tor_addr_t *addr);
- const char *decode_address_from_payload(tor_addr_t *addr_out,
-                                         const char *payload,
++void relay_header_pack(uint8_t *dest, const relay_header_t *src);
++void relay_header_unpack(relay_header_t *dest, const uint8_t *src);
 +int relay_send_command_from_edge(streamid_t stream_id, circuit_t *circ,
 +                               uint8_t relay_command, const char *payload,
 +                               size_t payload_len, crypt_path_t *cpath_layer);
 +int connection_edge_send_command(edge_connection_t *fromconn,
 +                                 uint8_t relay_command, const char *payload,
 +                                 size_t payload_len);
 +int connection_edge_package_raw_inbuf(edge_connection_t *conn,
 +                                      int package_partial,
 +                                      int *max_cells);
 +void connection_edge_consider_sending_sendme(edge_connection_t *conn);
 +
 +extern uint64_t stats_n_data_cells_packaged;
 +extern uint64_t stats_n_data_bytes_packaged;
 +extern uint64_t stats_n_data_cells_received;
 +extern uint64_t stats_n_data_bytes_received;
 +
 +void init_cell_pool(void);
 +void free_cell_pool(void);
 +void clean_cell_pool(void);
 +void dump_cell_pool_usage(int severity);
 +
 +void cell_queue_clear(cell_queue_t *queue);
 +void cell_queue_append(cell_queue_t *queue, packed_cell_t *cell);
 +void cell_queue_append_packed_copy(cell_queue_t *queue, const cell_t *cell);
 +
 +void append_cell_to_circuit_queue(circuit_t *circ, or_connection_t *orconn,
 +                                  cell_t *cell, cell_direction_t direction,
 +                                  streamid_t fromstream);
 +void connection_or_unlink_all_active_circs(or_connection_t *conn);
 +int connection_or_flush_from_first_active_circuit(or_connection_t *conn,
 +                                                  int max, time_t now);
 +void assert_active_circuits_ok(or_connection_t *orconn);
 +void make_circuit_inactive_on_conn(circuit_t *circ, or_connection_t *conn);
 +void make_circuit_active_on_conn(circuit_t *circ, or_connection_t *conn);
 +
++int append_address_to_payload(uint8_t *payload_out, const tor_addr_t *addr);
++const uint8_t *decode_address_from_payload(tor_addr_t *addr_out,
++                                        const uint8_t *payload,
 +                                        int payload_len);
 +unsigned cell_ewma_get_tick(void);
 +void cell_ewma_set_scale_factor(or_options_t *options,
 +                                networkstatus_t *consensus);
 +void circuit_clear_cell_queue(circuit_t *circ, or_connection_t *orconn);
 +
 +#endif
 +
index 3e1083f69498fa907c241c5003b13f359335d4b6,feecf237c41841b95dd12965249e796ffa7ae1bd..ab968078e8868dd06bb51660ee2ac33c3bcd5268
@@@ -637,9 -682,9 +637,10 @@@ rend_client_receive_rendezvous(origin_c
    tor_assert(circ->build_state->pending_final_cpath);
    hop = circ->build_state->pending_final_cpath;
    tor_assert(hop->dh_handshake_state);
-   if (crypto_dh_compute_secret(LOG_PROTOCOL_WARN, hop->dh_handshake_state,
-                                request, DH_KEY_LEN, keys,
-                                DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
 -  if (crypto_dh_compute_secret(hop->dh_handshake_state, (char*)request,
++  if (crypto_dh_compute_secret(LOG_PROTOCOL_WARN,
++                               hop->dh_handshake_state, (char*)request,
+                                DH_KEY_LEN,
+                                keys, DIGEST_LEN+CPATH_KEY_MATERIAL_LEN)<0) {
      log_warn(LD_GENERAL, "Couldn't complete DH handshake.");
      goto err;
    }
index 842fe0b8ce856110c87b881ce5fc04784dfa079b,0000000000000000000000000000000000000000..79d37b2a581f756b042a1ab466242fb6919d38f0
mode 100644,000000..100644
--- /dev/null
@@@ -1,40 -1,0 +1,43 @@@
- int rend_client_introduction_acked(origin_circuit_t *circ, const char *request,
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file rendclient.h
 + * \brief Header file for rendclient.c.
 + **/
 +
 +#ifndef _TOR_RENDCLIENT_H
 +#define _TOR_RENDCLIENT_H
 +
 +void rend_client_introcirc_has_opened(origin_circuit_t *circ);
 +void rend_client_rendcirc_has_opened(origin_circuit_t *circ);
- int rend_client_rendezvous_acked(origin_circuit_t *circ, const char *request,
++int rend_client_introduction_acked(origin_circuit_t *circ,
++                                   const uint8_t *request,
 +                                   size_t request_len);
 +void rend_client_refetch_v2_renddesc(const rend_data_t *rend_query);
 +int rend_client_remove_intro_point(extend_info_t *failed_intro,
 +                                   const rend_data_t *rend_query);
- int rend_client_receive_rendezvous(origin_circuit_t *circ, const char *request,
++int rend_client_rendezvous_acked(origin_circuit_t *circ,
++                                 const uint8_t *request,
 +                                 size_t request_len);
++int rend_client_receive_rendezvous(origin_circuit_t *circ,
++                                   const uint8_t *request,
 +                                   size_t request_len);
 +void rend_client_desc_trynow(const char *query);
 +
 +extend_info_t *rend_client_get_random_intro(const rend_data_t *rend_query);
 +
 +int rend_client_send_introduction(origin_circuit_t *introcirc,
 +                                  origin_circuit_t *rendcirc);
 +int rend_parse_service_authorization(or_options_t *options,
 +                                     int validate_only);
 +rend_service_authorization_t *rend_client_lookup_service_authorization(
 +                                                const char *onion_address);
 +void rend_service_authorization_free_all(void);
 +rend_data_t *rend_data_dup(const rend_data_t *request);
 +
 +#endif
 +
Simple merge
index 00705022a2fcfb15dfc043af8a46fd646ba031c4,0000000000000000000000000000000000000000..d3313faf5a7863dcaccd7deb19acc27fec18d319
mode 100644,000000..100644
--- /dev/null
@@@ -1,64 -1,0 +1,65 @@@
-                              int command, size_t length, const char *payload);
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file rendcommon.h
 + * \brief Header file for rendcommon.c.
 + **/
 +
 +#ifndef _TOR_RENDCOMMON_H
 +#define _TOR_RENDCOMMON_H
 +
 +/** Free all storage associated with <b>data</b> */
 +static INLINE void
 +rend_data_free(rend_data_t *data)
 +{
 +  tor_free(data);
 +}
 +
 +int rend_cmp_service_ids(const char *one, const char *two);
 +
 +void rend_process_relay_cell(circuit_t *circ, const crypt_path_t *layer_hint,
++                             int command, size_t length,
++                             const uint8_t *payload);
 +
 +void rend_service_descriptor_free(rend_service_descriptor_t *desc);
 +rend_service_descriptor_t *rend_parse_service_descriptor(const char *str,
 +                                                         size_t len);
 +int rend_get_service_id(crypto_pk_env_t *pk, char *out);
 +void rend_encoded_v2_service_descriptor_free(
 +                               rend_encoded_v2_service_descriptor_t *desc);
 +void rend_intro_point_free(rend_intro_point_t *intro);
 +
 +void rend_cache_init(void);
 +void rend_cache_clean(void);
 +void rend_cache_clean_v2_descs_as_dir(void);
 +void rend_cache_free_all(void);
 +int rend_valid_service_id(const char *query);
 +int rend_cache_lookup_desc(const char *query, int version, const char **desc,
 +                           size_t *desc_len);
 +int rend_cache_lookup_entry(const char *query, int version,
 +                            rend_cache_entry_t **entry_out);
 +int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc);
 +int rend_cache_store(const char *desc, size_t desc_len, int published);
 +int rend_cache_store_v2_desc_as_client(const char *desc,
 +                                       const rend_data_t *rend_query);
 +int rend_cache_store_v2_desc_as_dir(const char *desc);
 +int rend_cache_size(void);
 +int rend_encode_v2_descriptors(smartlist_t *descs_out,
 +                               rend_service_descriptor_t *desc, time_t now,
 +                               uint8_t period, rend_auth_type_t auth_type,
 +                               crypto_pk_env_t *client_key,
 +                               smartlist_t *client_cookies);
 +int rend_compute_v2_desc_id(char *desc_id_out, const char *service_id,
 +                            const char *descriptor_cookie,
 +                            time_t now, uint8_t replica);
 +int rend_id_is_in_interval(const char *a, const char *b, const char *c);
 +void rend_get_descriptor_id_bytes(char *descriptor_id_out,
 +                                  const char *service_id,
 +                                  const char *secret_id_part);
 +
 +#endif
 +
Simple merge
index 4d08d4c8b91a5bacb3f9c90854841dba3bb37548,0000000000000000000000000000000000000000..f06dd3d85e7dc40f111b62d922ee893e33b8cd45
mode 100644,000000..100644
--- /dev/null
@@@ -1,25 -1,0 +1,25 @@@
- int rend_mid_establish_intro(or_circuit_t *circ, const char *request,
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file rendmid.h
 + * \brief Header file for rendmid.c.
 + **/
 +
 +#ifndef _TOR_RENDMID_H
 +#define _TOR_RENDMID_H
 +
- int rend_mid_introduce(or_circuit_t *circ, const char *request,
++int rend_mid_establish_intro(or_circuit_t *circ, const uint8_t *request,
 +                             size_t request_len);
- int rend_mid_establish_rendezvous(or_circuit_t *circ, const char *request,
++int rend_mid_introduce(or_circuit_t *circ, const uint8_t *request,
 +                       size_t request_len);
- int rend_mid_rendezvous(or_circuit_t *circ, const char *request,
++int rend_mid_establish_rendezvous(or_circuit_t *circ, const uint8_t *request,
 +                                  size_t request_len);
++int rend_mid_rendezvous(or_circuit_t *circ, const uint8_t *request,
 +                        size_t request_len);
 +
 +#endif
 +
Simple merge
index 1767714c6057052246f88c642b7d15fbeb108314,0000000000000000000000000000000000000000..722cec1561f638f1636fe43100500d783c2fb15e
mode 100644,000000..100644
--- /dev/null
@@@ -1,37 -1,0 +1,37 @@@
-                                    const char *request,
 +/* Copyright (c) 2001 Matej Pfajfar.
 + * Copyright (c) 2001-2004, Roger Dingledine.
 + * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
 + * Copyright (c) 2007-2010, The Tor Project, Inc. */
 +/* See LICENSE for licensing information */
 +
 +/**
 + * \file rendservice.h
 + * \brief Header file for rendservice.c.
 + **/
 +
 +#ifndef _TOR_RENDSERVICE_H
 +#define _TOR_RENDSERVICE_H
 +
 +int num_rend_services(void);
 +int rend_config_services(or_options_t *options, int validate_only);
 +int rend_service_load_keys(void);
 +void rend_services_introduce(void);
 +void rend_consider_services_upload(time_t now);
 +void rend_hsdir_routers_changed(void);
 +void rend_consider_descriptor_republication(void);
 +
 +void rend_service_intro_has_opened(origin_circuit_t *circuit);
 +int rend_service_intro_established(origin_circuit_t *circuit,
- int rend_service_introduce(origin_circuit_t *circuit, const char *request,
++                                   const uint8_t *request,
 +                                   size_t request_len);
 +void rend_service_rendezvous_has_opened(origin_circuit_t *circuit);
++int rend_service_introduce(origin_circuit_t *circuit, const uint8_t *request,
 +                           size_t request_len);
 +void rend_service_relaunch_rendezvous(origin_circuit_t *oldcirc);
 +int rend_service_set_connection_addr_port(edge_connection_t *conn,
 +                                          origin_circuit_t *circ);
 +void rend_service_dump_stats(int severity);
 +void rend_service_free_all(void);
 +
 +#endif
 +