mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-25 15:10:48 +01:00
sendme: Add helper to note the cell digest
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
7c8e519b34
commit
805c81efed
2 changed files with 29 additions and 0 deletions
|
@ -286,10 +286,37 @@ send_circuit_level_sendme(circuit_t *circ, crypt_path_t *layer_hint,
|
||||||
return 0;
|
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
|
* 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
|
/** Return true iff the next cell for the given cell window is expected to be
|
||||||
* a SENDME.
|
* a SENDME.
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,6 +36,8 @@ int sendme_note_stream_data_packaged(edge_connection_t *conn);
|
||||||
|
|
||||||
/* Track cell digest. */
|
/* Track cell digest. */
|
||||||
void sendme_note_cell_digest(circuit_t *circ);
|
void sendme_note_cell_digest(circuit_t *circ);
|
||||||
|
void sendme_circuit_note_inbound_cell(crypt_path_t *cpath);
|
||||||
|
void sendme_circuit_note_outbound_cell(or_circuit_t *or_circ);
|
||||||
|
|
||||||
/* Circuit level information. */
|
/* Circuit level information. */
|
||||||
bool sendme_circuit_is_next_cell(int window);
|
bool sendme_circuit_is_next_cell(int window);
|
||||||
|
|
Loading…
Add table
Reference in a new issue