]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Revert "Get rid of tor_tls_block_renegotiation()."
authorNick Mathewson <nickm@torproject.org>
Wed, 7 Dec 2011 00:49:21 +0000 (19:49 -0500)
committerNick Mathewson <nickm@torproject.org>
Wed, 7 Dec 2011 00:49:21 +0000 (19:49 -0500)
This reverts commit 340809dd224b244675496e301d3ba154a6fe68d0.

src/common/tortls.c
src/common/tortls.h
src/or/connection_or.c

index ddb5ea1efc275403a557273a8adb7a1c5a7760ca..9caf9308bf282ffba1ec8fb36b20c58d301d0246 100644 (file)
@@ -1572,6 +1572,16 @@ tor_tls_unblock_renegotiation(tor_tls_t *tls)
   }
 }
 
+/** If this version of openssl supports it, turn off renegotiation on
+ * <b>tls</b>.  (Our protocol never requires this for security, but it's nice
+ * to use belt-and-suspenders here.)
+ */
+void
+tor_tls_block_renegotiation(tor_tls_t *tls)
+{
+  tls->ssl->s3->flags &= ~SSL3_FLAGS_ALLOW_UNSAFE_LEGACY_RENEGOTIATION;
+}
+
 void
 tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls)
 {
index e558df756cfcf386fdc5a9e1606bf98df13fc7b7..673f18dfe80143c0853d0084c1f1b03da7559f3f 100644 (file)
@@ -77,6 +77,7 @@ int tor_tls_handshake(tor_tls_t *tls);
 int tor_tls_finish_handshake(tor_tls_t *tls);
 int tor_tls_renegotiate(tor_tls_t *tls);
 void tor_tls_unblock_renegotiation(tor_tls_t *tls);
+void tor_tls_block_renegotiation(tor_tls_t *tls);
 void tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls);
 int tor_tls_shutdown(tor_tls_t *tls);
 int tor_tls_get_pending_bytes(tor_tls_t *tls);
index 992db9a40c748794e5402e9d30a2c07a536d6d70..cbe678d6cf5ed0fe23c78245ebedd49a7cbe39b6 100644 (file)
@@ -1149,6 +1149,10 @@ connection_or_tls_renegotiated_cb(tor_tls_t *tls, void *_conn)
   or_connection_t *conn = _conn;
   (void)tls;
 
+  /* Don't invoke this again. */
+  tor_tls_set_renegotiate_callback(tls, NULL, NULL);
+  tor_tls_block_renegotiation(tls);
+
   if (connection_tls_finish_handshake(conn) < 0) {
     /* XXXX_TLS double-check that it's ok to do this from inside read. */
     /* XXXX_TLS double-check that this verifies certificates. */
@@ -1537,6 +1541,7 @@ connection_tls_finish_handshake(or_connection_t *conn)
       connection_or_init_conn_from_address(conn, &conn->_base.addr,
                                            conn->_base.port, digest_rcvd, 0);
     }
+    tor_tls_block_renegotiation(conn->tls);
     return connection_or_set_state_open(conn);
   } else {
     conn->_base.state = OR_CONN_STATE_OR_HANDSHAKING_V2;