diff options
author | David Goulet <dgoulet@torproject.org> | 2019-05-15 10:16:05 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2019-05-22 11:47:20 -0400 |
commit | 3835a3acf57426f692a787e7729de929b40dc62e (patch) | |
tree | 0da7f393f3c78d7b1985d5575b047bdeb59ccb3c /src/core/or/relay.c | |
parent | 44265dd6716887b997bb03d2db1641efd7ae9c19 (diff) | |
download | tor-3835a3acf57426f692a787e7729de929b40dc62e.tar.gz tor-3835a3acf57426f692a787e7729de929b40dc62e.zip |
sendme: Properly record SENDMEs on both edges
Turns out that we were only recording the "b_digest" but to have
bidirectionnal authenticated SENDMEs, we need to use the "f_digest" in the
forward cell situation.
Because of the cpath refactoring, this commit plays with the crypt_path_ and
relay_crypto_t API a little bit in order to respect the abstractions.
Previously, we would record the cell digest as the SENDME digest in the
decrypt cell function but to avoid code duplication (both directions needs to
record), we now do that right after iff the cell is recognized (at the edge).
It is now done in circuit_receive_relay_cell() instead.
We now also record the cell digest as the SENDME digest in both relay cell
encryption functions since they are split depending on the direction.
relay_encrypt_cell_outbound() and relay_encrypt_cell_inbound() need to
consider recording the cell digest depending on their direction (f vs b
digest).
Fixes #30428
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/relay.c')
-rw-r--r-- | src/core/or/relay.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/or/relay.c b/src/core/or/relay.c index 91236e5fec..beff225af4 100644 --- a/src/core/or/relay.c +++ b/src/core/or/relay.c @@ -247,6 +247,10 @@ circuit_receive_relay_cell(cell_t *cell, circuit_t *circ, if (recognized) { edge_connection_t *conn = NULL; + /* Recognized cell, the cell digest has been updated, we'll record it for + * the SENDME if need be. */ + sendme_record_received_cell_digest(circ, layer_hint); + if (circ->purpose == CIRCUIT_PURPOSE_PATH_BIAS_TESTING) { if (pathbias_check_probe_response(circ, cell) == -1) { pathbias_count_valid_cells(circ, cell); |