mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-27 22:03:31 +01:00
sendme: Do not poke at crypto.sendme_digest directly
As per review from nickm, keep as much as we can the relay_crypto_t object opaque. Part of #26288 Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
0d8b9b56c5
commit
0f2ff267c5
@ -91,6 +91,14 @@ relay_crypt_one_payload(crypto_cipher_t *cipher, uint8_t *in)
|
||||
crypto_cipher_crypt_inplace(cipher, (char*) in, CELL_PAYLOAD_SIZE);
|
||||
}
|
||||
|
||||
/** Return the sendme_digest within the <b>crypto</b> object. */
|
||||
uint8_t *
|
||||
relay_crypto_get_sendme_digest(relay_crypto_t *crypto)
|
||||
{
|
||||
tor_assert(crypto);
|
||||
return crypto->sendme_digest;
|
||||
}
|
||||
|
||||
/** Record the b_digest from <b>crypto</b> and put it in the sendme_digest. */
|
||||
void
|
||||
relay_crypto_record_sendme_digest(relay_crypto_t *crypto)
|
||||
|
@ -27,6 +27,7 @@ void relay_crypto_clear(relay_crypto_t *crypto);
|
||||
|
||||
void relay_crypto_assert_ok(const relay_crypto_t *crypto);
|
||||
|
||||
uint8_t *relay_crypto_get_sendme_digest(relay_crypto_t *crypto);
|
||||
void relay_crypto_record_sendme_digest(relay_crypto_t *crypto);
|
||||
|
||||
#endif /* !defined(TOR_RELAY_CRYPTO_H) */
|
||||
|
@ -388,10 +388,10 @@ sendme_circuit_consider_sending(circuit_t *circ, crypt_path_t *layer_hint)
|
||||
log_debug(LD_CIRC,"Queuing circuit sendme.");
|
||||
if (layer_hint) {
|
||||
layer_hint->deliver_window += CIRCWINDOW_INCREMENT;
|
||||
digest = layer_hint->crypto.sendme_digest;
|
||||
digest = relay_crypto_get_sendme_digest(&layer_hint->crypto);
|
||||
} else {
|
||||
circ->deliver_window += CIRCWINDOW_INCREMENT;
|
||||
digest = TO_OR_CIRCUIT(circ)->crypto.sendme_digest;
|
||||
digest = relay_crypto_get_sendme_digest(&TO_OR_CIRCUIT(circ)->crypto);
|
||||
}
|
||||
if (send_circuit_level_sendme(circ, layer_hint, digest) < 0) {
|
||||
return; /* The circuit's closed, don't continue */
|
||||
@ -597,7 +597,7 @@ sendme_record_cell_digest(circuit_t *circ)
|
||||
}
|
||||
|
||||
/* Add the digest to the last seen list in the circuit. */
|
||||
digest = TO_OR_CIRCUIT(circ)->crypto.sendme_digest;
|
||||
digest = relay_crypto_get_sendme_digest(&TO_OR_CIRCUIT(circ)->crypto);
|
||||
if (circ->sendme_last_digests == NULL) {
|
||||
circ->sendme_last_digests = smartlist_new();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user