aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/crypt_path.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-05-15 10:16:05 -0400
committerNick Mathewson <nickm@torproject.org>2019-05-22 11:47:20 -0400
commit3835a3acf57426f692a787e7729de929b40dc62e (patch)
tree0da7f393f3c78d7b1985d5575b047bdeb59ccb3c /src/core/or/crypt_path.c
parent44265dd6716887b997bb03d2db1641efd7ae9c19 (diff)
downloadtor-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/crypt_path.c')
-rw-r--r--src/core/or/crypt_path.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/core/or/crypt_path.c b/src/core/or/crypt_path.c
index a4b7190e21..6d5245510f 100644
--- a/src/core/or/crypt_path.c
+++ b/src/core/or/crypt_path.c
@@ -204,15 +204,6 @@ cpath_set_cell_forward_digest(crypt_path_t *cpath, cell_t *cell)
/************ cpath sendme API ***************************/
-/** Keep the current inbound cell digest for the next SENDME digest. This part
- * is only done by the client as the circuit came back from the Exit. */
-void
-cpath_sendme_circuit_record_inbound_cell(crypt_path_t *cpath)
-{
- tor_assert(cpath);
- relay_crypto_record_sendme_digest(&cpath->pvt_crypto);
-}
-
/** Return the sendme_digest of this <b>cpath</b>. */
uint8_t *
cpath_get_sendme_digest(crypt_path_t *cpath)
@@ -220,6 +211,15 @@ cpath_get_sendme_digest(crypt_path_t *cpath)
return relay_crypto_get_sendme_digest(&cpath->pvt_crypto);
}
+/** Record the cell digest, indicated by is_foward_digest or not, as the
+ * SENDME cell digest. */
+void
+cpath_sendme_record_cell_digest(crypt_path_t *cpath, bool is_foward_digest)
+{
+ tor_assert(cpath);
+ relay_crypto_record_sendme_digest(&cpath->pvt_crypto, is_foward_digest);
+}
+
/************ other cpath functions ***************************/
/** Return the first non-open hop in cpath, or return NULL if all