aboutsummaryrefslogtreecommitdiff
path: root/src/or/circuitbuild.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-12-04 16:51:31 -0500
committerNick Mathewson <nickm@torproject.org>2013-01-03 11:29:02 -0500
commit5fa1c7484cba293e6467acbca06a4143ce9da68d (patch)
tree5a7c2003488b5882882bb8a31b9080c03080291a /src/or/circuitbuild.c
parentf7e590df05b1b3568a68ee3eae3965cb58e13de7 (diff)
downloadtor-5fa1c7484cba293e6467acbca06a4143ce9da68d.tar.gz
tor-5fa1c7484cba293e6467acbca06a4143ce9da68d.zip
Refactor the CREATE_FAST handshake code to match the others.
Diffstat (limited to 'src/or/circuitbuild.c')
-rw-r--r--src/or/circuitbuild.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 33a13515e1..b6cf1252f6 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -645,11 +645,14 @@ circuit_send_next_onion_skin(origin_circuit_t *circ)
* new OR: we can be speedy and use CREATE_FAST to save an RSA operation
* and a DH operation. */
cell_type = CELL_CREATE_FAST;
+
memset(payload, 0, sizeof(payload));
- crypto_rand((char*) circ->cpath->fast_handshake_state,
- sizeof(circ->cpath->fast_handshake_state));
- memcpy(payload, circ->cpath->fast_handshake_state,
- sizeof(circ->cpath->fast_handshake_state));
+ if (fast_onionskin_create(&circ->cpath->fast_handshake_state,
+ (uint8_t *)payload) < 0) {
+ log_warn(LD_CIRC,"onion_skin_create FAST (first hop) failed.");
+ return - END_CIRC_REASON_INTERNAL;
+ }
+
note_request("cell: create fast", 1);
}