commit e5bdfd66cf03e8410c511f6dcf309142c64c85f5
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Mon Jun 5 09:35:55 2017 -0400
Make code more clear about own_link_cert safety
It's okay to call add_ed25519_cert with a NULL argument: so,
document that. Also, add a tor_assert_nonfatal() to catch any case
where we have failed to set own_link_cert when conn_in_server_mode.
---
src/or/connection_or.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
…
[View More]diff --git a/src/or/connection_or.c b/src/or/connection_or.c
index 0966ec8..9c806d1 100644
--- a/src/or/connection_or.c
+++ b/src/or/connection_or.c
@@ -2238,7 +2238,8 @@ add_certs_cell_cert_helper(certs_cell_t *certs_cell,
/** Add an encoded X509 cert (stored as <b>cert_len</b> bytes at
* <b>cert_encoded</b>) to the trunnel certs_cell_t object that we are
- * building in <b>certs_cell</b>. Set its type field to <b>cert_type</b>. */
+ * building in <b>certs_cell</b>. Set its type field to <b>cert_type</b>.
+ * (If <b>cert</b> is NULL, take no action.) */
static void
add_x509_cert(certs_cell_t *certs_cell,
uint8_t cert_type,
@@ -2256,7 +2257,7 @@ add_x509_cert(certs_cell_t *certs_cell,
/** Add an Ed25519 cert from <b>cert</b> to the trunnel certs_cell_t object
* that we are building in <b>certs_cell</b>. Set its type field to
- * <b>cert_type</b>. */
+ * <b>cert_type</b>. (If <b>cert</b> is NULL, take no action.) */
static void
add_ed25519_cert(certs_cell_t *certs_cell,
uint8_t cert_type,
@@ -2313,6 +2314,7 @@ connection_or_send_certs_cell(or_connection_t *conn)
CERTTYPE_ED_ID_SIGN,
get_master_signing_key_cert());
if (conn_in_server_mode) {
+ tor_assert_nonfatal(conn->handshake_state->own_link_cert);
add_ed25519_cert(certs_cell,
CERTTYPE_ED_SIGN_LINK,
conn->handshake_state->own_link_cert);
[View Less]
commit 01878fa3095a949575d922da6fc8342eeaad2afb
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Thu Jun 1 09:03:13 2017 -0400
Changes file for the x509 link certificate case of bug22460
---
changes/bug22460_case2 | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/changes/bug22460_case2 b/changes/bug22460_case2
new file mode 100644
index 0000000..0a11759
--- /dev/null
+++ b/changes/bug22460_case2
@@ -0,0 +1,8 @@
+ o Major bugfixes (relay, link handshake):
+
+ - …
[View More]When performing the v3 link handshake on a TLS connection, report that
+ we have the x509 certificate that we actually used on that connection,
+ even if we have changed certificates since that connection was first
+ opened. Previously, we would claim to have used our most recent x509
+ link certificate, which would sometimes make the link handshake fail.
+ Fixes one case of bug 22460; bugfix on 0.2.3.6-alpha.
[View Less]
commit ec84fc1d8ecb56fde887eb01d3bca1a031bd1e89
Author: Nick Mathewson <nickm(a)torproject.org>
Date: Mon Jun 5 09:42:02 2017 -0400
Improve documentation on get_{peer,own}_certificate()
Make it clear that we're returning a newly allocated copy.
---
src/common/tortls.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/src/common/tortls.c b/src/common/tortls.c
index 1661b7e..d61cc2e 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -2018,…
[View More]7 +2018,8 @@ tor_tls_peer_has_cert(tor_tls_t *tls)
return 1;
}
-/** Return the peer certificate, or NULL if there isn't one. */
+/** Return a newly allocated copy of the peer certificate, or NULL if there
+ * isn't one. */
MOCK_IMPL(tor_x509_cert_t *,
tor_tls_get_peer_cert,(tor_tls_t *tls))
{
@@ -2030,8 +2031,8 @@ tor_tls_get_peer_cert,(tor_tls_t *tls))
return tor_x509_cert_new(cert);
}
-/** Return the cerficate we used on the connection, or NULL if somehow
- * we didn't use one. */
+/** Return a newly allocated copy of the cerficate we used on the connection,
+ * or NULL if somehow we didn't use one. */
MOCK_IMPL(tor_x509_cert_t *,
tor_tls_get_own_cert,(tor_tls_t *tls))
{
[View Less]