summaryrefslogtreecommitdiff
path: root/src/or/hs_circuit.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2017-09-19 09:07:42 -0400
committerDavid Goulet <dgoulet@torproject.org>2017-09-19 09:13:28 -0400
commita3f5a246693cca2f6a51e418e6edf8fae2fe75b5 (patch)
tree1ffc0876ea4983534f09de041de9a41ce4e6bc78 /src/or/hs_circuit.c
parent1f602e86433cc132981e8f9727266353ea2c3b0e (diff)
downloadtor-a3f5a246693cca2f6a51e418e6edf8fae2fe75b5.tar.gz
tor-a3f5a246693cca2f6a51e418e6edf8fae2fe75b5.zip
hs: Pad RENDEZVOUS1 v3 cell to match length of v2
RENDEZVOUS1 cell is 84 bytes long in v3 and 168 bytes long in v2 so this commit pads with random bytes the v3 cells up to 168 bytes so they all look alike at the rendezvous point. Closes #23420 Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/or/hs_circuit.c')
-rw-r--r--src/or/hs_circuit.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/or/hs_circuit.c b/src/or/hs_circuit.c
index 2bfeac747c..01e987c402 100644
--- a/src/or/hs_circuit.c
+++ b/src/or/hs_circuit.c
@@ -820,6 +820,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,