|
@@ -100,12 +100,22 @@ relay_crypto_get_sendme_digest(relay_crypto_t *crypto)
|
|
|
return crypto->sendme_digest;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+
|
|
|
+ * SENDME cell digest. */
|
|
|
void
|
|
|
-relay_crypto_record_sendme_digest(relay_crypto_t *crypto)
|
|
|
+relay_crypto_record_sendme_digest(relay_crypto_t *crypto,
|
|
|
+ bool is_foward_digest)
|
|
|
{
|
|
|
+ struct crypto_digest_t *digest;
|
|
|
+
|
|
|
tor_assert(crypto);
|
|
|
- crypto_digest_get_digest(crypto->b_digest, (char *) crypto->sendme_digest,
|
|
|
+
|
|
|
+ digest = crypto->b_digest;
|
|
|
+ if (is_foward_digest) {
|
|
|
+ digest = crypto->f_digest;
|
|
|
+ }
|
|
|
+
|
|
|
+ crypto_digest_get_digest(digest, (char *) crypto->sendme_digest,
|
|
|
sizeof(crypto->sendme_digest));
|
|
|
}
|
|
|
|
|
@@ -161,11 +171,6 @@ relay_decrypt_cell(circuit_t *circ, cell_t *cell,
|
|
|
if (relay_digest_matches(cpath_get_incoming_digest(thishop), cell)) {
|
|
|
*recognized = 1;
|
|
|
*layer_hint = thishop;
|
|
|
-
|
|
|
- * use it in the next SENDME cell. */
|
|
|
- if (sendme_circuit_cell_is_next(thishop->deliver_window)) {
|
|
|
- cpath_sendme_circuit_record_inbound_cell(thishop);
|
|
|
- }
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
@@ -213,6 +218,9 @@ relay_encrypt_cell_outbound(cell_t *cell,
|
|
|
crypt_path_t *thishop;
|
|
|
cpath_set_cell_forward_digest(layer_hint, cell);
|
|
|
|
|
|
+
|
|
|
+ sendme_record_sending_cell_digest(TO_CIRCUIT(circ), layer_hint);
|
|
|
+
|
|
|
thishop = layer_hint;
|
|
|
|
|
|
do {
|
|
@@ -237,11 +245,8 @@ relay_encrypt_cell_inbound(cell_t *cell,
|
|
|
{
|
|
|
relay_set_digest(or_circ->crypto.b_digest, cell);
|
|
|
|
|
|
-
|
|
|
- * this cell if we are expecting that the next cell is a SENDME. */
|
|
|
- if (sendme_circuit_cell_is_next(TO_CIRCUIT(or_circ)->package_window)) {
|
|
|
- sendme_circuit_record_outbound_cell(or_circ);
|
|
|
- }
|
|
|
+
|
|
|
+ sendme_record_sending_cell_digest(TO_CIRCUIT(or_circ), NULL);
|
|
|
|
|
|
|
|
|
relay_crypt_one_payload(or_circ->crypto.b_crypto, cell->payload);
|