Commit 777e828e authored by Nick Mathewson's avatar Nick Mathewson 🥔
Browse files

Merge remote-tracking branch 'asn/ticket23420_032_01'

parents a1f31c06 03b3f548
Loading
Loading
Loading
Loading

changes/ticket23420

0 → 100644
+4 −0
Original line number Diff line number Diff line
  o Minor bugfixes (hidden service v3):
    - Pad RENDEZVOUS cell up to the size of the legacy cell which is much
      bigger so the rendezvous point can't distinguish which hidden service
      protocol is being used. Fixes ticket 23420.; bugfix on 0.3.2.1-alpha.
+13 −2
Original line number Diff line number Diff line
@@ -5,6 +5,8 @@
 * \file hs_circuit.c
 **/

#define HS_CIRCUIT_PRIVATE

#include "or.h"
#include "circpathbias.h"
#include "circuitbuild.h"
@@ -18,10 +20,10 @@
#include "router.h"

#include "hs_cell.h"
#include "hs_circuit.h"
#include "hs_ident.h"
#include "hs_ntor.h"
#include "hs_service.h"
#include "hs_circuit.h"

/* Trunnel. */
#include "ed25519_cert.h"
@@ -235,7 +237,7 @@ count_opened_desc_intro_point_circuits(const hs_service_t *service,

/* From a given service, rendezvous cookie and handshake info, create a
 * rendezvous point circuit identifier. This can't fail. */
static hs_ident_circuit_t *
STATIC hs_ident_circuit_t *
create_rp_circuit_identifier(const hs_service_t *service,
                             const uint8_t *rendezvous_cookie,
                             const curve25519_public_key_t *server_pk,
@@ -820,6 +822,15 @@ hs_circ_service_rp_has_opened(const hs_service_t *service,
                        sizeof(circ->hs_ident->rendezvous_handshake_info),
                        payload);

  /* Pad the payload with random bytes so it matches the size of a legacy cell
   * which is normally always bigger. Also, the size of a legacy cell is
   * always smaller than the RELAY_PAYLOAD_SIZE so this is safe. */
  if (payload_len < HS_LEGACY_RENDEZVOUS_CELL_SIZE) {
    crypto_rand((char *) payload + payload_len,
                HS_LEGACY_RENDEZVOUS_CELL_SIZE - payload_len);
    payload_len = HS_LEGACY_RENDEZVOUS_CELL_SIZE;
  }

  if (relay_send_command_from_edge(CONTROL_CELL_ID, TO_CIRCUIT(circ),
                                   RELAY_COMMAND_RENDEZVOUS1,
                                   (const char *) payload, payload_len,
+10 −0
Original line number Diff line number Diff line
@@ -59,5 +59,15 @@ int hs_circuit_setup_e2e_rend_circ(origin_circuit_t *circ,
int hs_circuit_setup_e2e_rend_circ_legacy_client(origin_circuit_t *circ,
                                          const uint8_t *rend_cell_body);

#ifdef HS_CIRCUIT_PRIVATE

STATIC hs_ident_circuit_t *
create_rp_circuit_identifier(const hs_service_t *service,
                             const uint8_t *rendezvous_cookie,
                             const curve25519_public_key_t *server_pk,
                             const hs_ntor_rend_cell_keys_t *keys);

#endif

#endif /* !defined(TOR_HS_CIRCUIT_H) */
+1 −1
Original line number Diff line number Diff line
@@ -845,7 +845,7 @@ handle_introduce_ack(origin_circuit_t *circ, const uint8_t *payload,
/* Called when we get a RENDEZVOUS2 cell on the rendezvous circuit circ. The
 * encoded cell is in payload of length payload_len. Return 0 on success or a
 * negative value on error. On error, the circuit is marked for close. */
static int
STATIC int
handle_rendezvous2(origin_circuit_t *circ, const uint8_t *payload,
                   size_t payload_len)
{
+3 −0
Original line number Diff line number Diff line
@@ -77,6 +77,9 @@ client_get_random_intro(const ed25519_public_key_t *service_pk);
STATIC extend_info_t *
desc_intro_point_to_extend_info(const hs_desc_intro_point_t *ip);

STATIC int handle_rendezvous2(origin_circuit_t *circ, const uint8_t *payload,
                              size_t payload_len);

#endif /* defined(HS_CLIENT_PRIVATE) */

#endif /* !defined(TOR_HS_CLIENT_H) */
Loading