aboutsummaryrefslogtreecommitdiff
path: root/src/core/or/sendme.c
diff options
context:
space:
mode:
authorDavid Goulet <dgoulet@torproject.org>2019-04-24 11:57:20 -0400
committerDavid Goulet <dgoulet@torproject.org>2019-04-29 12:17:57 -0400
commit805c81efed9bc2c474d3f10675846ee445a908d5 (patch)
tree68386fd897a1dd2fc05e86eb7cf97de4feb646f0 /src/core/or/sendme.c
parent7c8e519b3452ce3eb3d3c854d80be5b7e49164b4 (diff)
downloadtor-805c81efed9bc2c474d3f10675846ee445a908d5.tar.gz
tor-805c81efed9bc2c474d3f10675846ee445a908d5.zip
sendme: Add helper to note the cell digest
Signed-off-by: David Goulet <dgoulet@torproject.org>
Diffstat (limited to 'src/core/or/sendme.c')
-rw-r--r--src/core/or/sendme.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/core/or/sendme.c b/src/core/or/sendme.c
index c66e947bc4..b384a19164 100644
--- a/src/core/or/sendme.c
+++ b/src/core/or/sendme.c
@@ -286,10 +286,37 @@ send_circuit_level_sendme(circuit_t *circ, crypt_path_t *layer_hint,
return 0;
}
+/* Put the crypto.b_digest in the sendme_digest. */
+static void
+note_cell_digest(const relay_crypto_t *crypto)
+{
+ tor_assert(crypto);
+ crypto_digest_get_digest(crypto->b_digest, (char *) crypto->sendme_digest,
+ sizeof(crypto->sendme_digest));
+}
+
/*
* Public 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
+sendme_circuit_note_outbound_cell(or_circuit_t *or_circ)
+{
+ tor_assert(or_circ);
+ note_cell_digest(&or_circ->crypto);
+}
+
+/** 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
+sendme_circuit_note_inbound_cell(crypt_path_t *cpath)
+{
+ tor_assert(cpath);
+ note_cell_digest(&cpath->crypto);
+}
+
/** Return true iff the next cell for the given cell window is expected to be
* a SENDME.
*