aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2010-10-11 13:45:27 -0400
committerNick Mathewson <nickm@torproject.org>2010-10-12 14:52:33 -0400
commita9172c87beaf94119b0c0dc280267d9c76b957b7 (patch)
tree5c1b6fddfd4de8bd22d298e23e52876b013e4093 /src/common
parentc1c74c51d42e46d32f4fe765e653287e400dc6b6 (diff)
downloadtor-a9172c87beaf94119b0c0dc280267d9c76b957b7.tar.gz
tor-a9172c87beaf94119b0c0dc280267d9c76b957b7.zip
Actually call connection_tls_finish_handshake() with bufferevents
First start of a fix for bug2001, but my test network still isn't working: the client and the server send each other VERSIONS cells, but never notice that they got them.
Diffstat (limited to 'src/common')
-rw-r--r--src/common/tortls.c22
-rw-r--r--src/common/tortls.h2
2 files changed, 23 insertions, 1 deletions
diff --git a/src/common/tortls.c b/src/common/tortls.c
index fc671c73c2..d560cbf940 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -125,8 +125,10 @@ struct tor_tls_t {
* of the connection protocol (client sends
* different cipher list, server sends only
* one certificate). */
- /** True iff we should call negotiated_callback when we're done reading. */
+ /** True iff we should call negotiated_callback when we're done reading. */
unsigned int got_renegotiate:1;
+ /** Incremented every time we start the server side of a handshake. */
+ uint8_t server_handshake_count;
size_t wantwrite_n; /**< 0 normally, >0 if we returned wantwrite last
* time. */
/** Last values retrieved from BIO_number_read()/write(); see
@@ -841,6 +843,8 @@ tor_tls_server_info_callback(const SSL *ssl, int type, int val)
/* Check whether we're watching for renegotiates. If so, this is one! */
if (tls->negotiated_callback)
tls->got_renegotiate = 1;
+ if (tls->server_handshake_count < 127) /*avoid any overflow possibility*/
+ ++tls->server_handshake_count;
} else {
log_warn(LD_BUG, "Couldn't look up the tls for an SSL*. How odd!");
}
@@ -1658,6 +1662,22 @@ tor_tls_used_v1_handshake(tor_tls_t *tls)
return 1;
}
+/** Return the number of server handshakes that we've noticed doing on
+ * <b>tls</b>. */
+int
+tor_tls_get_num_server_handshakes(tor_tls_t *tls)
+{
+ return tls->server_handshake_count;
+}
+
+/** Return true iff the server TLS connection <b>tls</b> got the renegotiation
+ * request it was waiting for. */
+int
+tor_tls_server_got_renegotiate(tor_tls_t *tls)
+{
+ return tls->got_renegotiate;
+}
+
/** Examine the amount of memory used and available for buffers in <b>tls</b>.
* Set *<b>rbuf_capacity</b> to the amount of storage allocated for the read
* buffer and *<b>rbuf_bytes</b> to the amount actually used.
diff --git a/src/common/tortls.h b/src/common/tortls.h
index c52b6fd2a2..950d430788 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -80,6 +80,8 @@ void tor_tls_get_buffer_sizes(tor_tls_t *tls,
size_t *wbuf_capacity, size_t *wbuf_bytes);
int tor_tls_used_v1_handshake(tor_tls_t *tls);
+int tor_tls_get_num_server_handshakes(tor_tls_t *tls);
+int tor_tls_server_got_renegotiate(tor_tls_t *tls);
/* Log and abort if there are unhandled TLS errors in OpenSSL's error stack.
*/