mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-09-22 22:14:58 +02:00
prop289: Add random bytes to the unused portion of the cell
Signed-off-by: David Goulet <dgoulet@torproject.org>
This commit is contained in:
parent
402f0a4f5d
commit
a6e012508e
@ -572,6 +572,14 @@ relay_send_command_from_edge_,(streamid_t stream_id, circuit_t *circ,
|
|||||||
if (payload_len)
|
if (payload_len)
|
||||||
memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
|
memcpy(cell.payload+RELAY_HEADER_SIZE, payload, payload_len);
|
||||||
|
|
||||||
|
/* Add random bytes to the unused portion of the payload, to foil attacks
|
||||||
|
* where the other side can predict all of the bytes in the payload and thus
|
||||||
|
* compute authenticated sendme cells without seeing the traffic. See
|
||||||
|
* proposal 289. */
|
||||||
|
crypto_fast_rng_getbytes(get_thread_fast_rng(),
|
||||||
|
cell.payload + RELAY_HEADER_SIZE + payload_len,
|
||||||
|
RELAY_PAYLOAD_SIZE - payload_len);
|
||||||
|
|
||||||
log_debug(LD_OR,"delivering %d cell %s.", relay_command,
|
log_debug(LD_OR,"delivering %d cell %s.", relay_command,
|
||||||
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
cell_direction == CELL_DIRECTION_OUT ? "forward" : "backward");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user