diff --git a/briar-android/assets/tor b/briar-android/assets/tor
index a73b9505e..96731bf2e 100644
Binary files a/briar-android/assets/tor and b/briar-android/assets/tor differ
diff --git a/tor.patch b/tor.patch
index f4e278c56..eaf0f8dee 100644
--- a/tor.patch
+++ b/tor.patch
@@ -1,8 +1,8 @@
diff --git a/src/or/config.c b/src/or/config.c
-index 919dd27..c2d3caf 100644
+index 39b85aa..ff42d27 100644
--- a/src/or/config.c
+++ b/src/or/config.c
-@@ -1039,6 +1039,8 @@ options_act_reversible(const or_options_t *old_options, char **msg)
+@@ -1096,6 +1096,8 @@ options_act_reversible(const or_options_t *old_options, char **msg)
"non-control network connections. Shutting down all existing "
"connections.");
connection_mark_all_noncontrol_connections();
@@ -12,10 +12,10 @@ index 919dd27..c2d3caf 100644
}
diff --git a/src/or/control.c b/src/or/control.c
-index ae9dd69..0ead4c1 100644
+index 9378f38..17d2a46 100644
--- a/src/or/control.c
+++ b/src/or/control.c
-@@ -36,6 +36,8 @@
+@@ -37,6 +37,8 @@
#include "nodelist.h"
#include "policies.h"
#include "reasons.h"
@@ -24,7 +24,7 @@ index ae9dd69..0ead4c1 100644
#include "rephist.h"
#include "router.h"
#include "routerlist.h"
-@@ -197,6 +199,8 @@ static int handle_control_resolve(control_connection_t *conn, uint32_t len,
+@@ -156,6 +158,8 @@ static int handle_control_resolve(control_connection_t *conn, uint32_t len,
static int handle_control_usefeature(control_connection_t *conn,
uint32_t len,
const char *body);
@@ -33,7 +33,7 @@ index ae9dd69..0ead4c1 100644
static int write_stream_target_to_buf(entry_connection_t *conn, char *buf,
size_t len);
static void orconn_target_get_name(char *buf, size_t len,
-@@ -3181,6 +3185,33 @@ handle_control_usefeature(control_connection_t *conn,
+@@ -3164,6 +3168,33 @@ handle_control_dropguards(control_connection_t *conn,
return 0;
}
@@ -67,9 +67,9 @@ index ae9dd69..0ead4c1 100644
/** Called when conn has no more bytes left on its outbuf. */
int
connection_control_finished_flushing(control_connection_t *conn)
-@@ -3480,6 +3511,9 @@ connection_control_process_inbuf(control_connection_t *conn)
- } else if (!strcasecmp(conn->incoming_cmd, "AUTHCHALLENGE")) {
- if (handle_control_authchallenge(conn, cmd_data_len, args))
+@@ -3461,6 +3492,9 @@ connection_control_process_inbuf(control_connection_t *conn)
+ } else if (!strcasecmp(conn->incoming_cmd, "DROPGUARDS")) {
+ if (handle_control_dropguards(conn, cmd_data_len, args))
return -1;
+ } else if (!strcasecmp(conn->incoming_cmd, "FORGETHS")) {
+ if (handle_control_forgeths(conn, cmd_data_len, args))
@@ -78,10 +78,10 @@ index ae9dd69..0ead4c1 100644
connection_printf_to_buf(conn, "510 Unrecognized command \"%s\"\r\n",
conn->incoming_cmd);
diff --git a/src/or/rendclient.c b/src/or/rendclient.c
-index 7abbfd6..e550b65 100644
+index 19a8cef..c17439d 100644
--- a/src/or/rendclient.c
+++ b/src/or/rendclient.c
-@@ -29,6 +29,8 @@
+@@ -31,6 +31,8 @@
static extend_info_t *rend_client_get_random_intro_impl(
const rend_cache_entry_t *rend_query,
const int strict, const int warnings);
@@ -90,7 +90,7 @@ index 7abbfd6..e550b65 100644
/** Purge all potentially remotely-detectable state held in the hidden
* service client code. Called on SIGNAL NEWNYM. */
-@@ -40,6 +42,16 @@ rend_client_purge_state(void)
+@@ -42,6 +44,16 @@ rend_client_purge_state(void)
rend_client_purge_last_hid_serv_requests();
}
@@ -120,10 +120,10 @@ index 1f731d0..7084aef 100644
void rend_client_introcirc_has_opened(origin_circuit_t *circ);
void rend_client_rendcirc_has_opened(origin_circuit_t *circ);
diff --git a/src/or/rendcommon.c b/src/or/rendcommon.c
-index d1b4941..3deb5fc 100644
+index a664b5d..70d7283 100644
--- a/src/or/rendcommon.c
+++ b/src/or/rendcommon.c
-@@ -954,6 +954,34 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e)
+@@ -881,6 +881,34 @@ rend_cache_lookup_entry(const char *query, int version, rend_cache_entry_t **e)
return 1;
}
@@ -155,26 +155,26 @@ index d1b4941..3deb5fc 100644
+ }
+}
+
- /** query is a base32'ed service id. If it's malformed, return -1.
- * Else look it up.
- * - If it is found, point *desc to it, and write its length into
+ /** Lookup the v2 service descriptor with base32-encoded desc_id and
+ * copy the pointer to it to *desc. Return 1 on success, 0 on
+ * well-formed-but-not-found, and -1 on failure.
diff --git a/src/or/rendcommon.h b/src/or/rendcommon.h
-index f476593..331784f 100644
+index 07a47ac..0a3160d 100644
--- a/src/or/rendcommon.h
+++ b/src/or/rendcommon.h
-@@ -43,6 +43,7 @@ int rend_cache_lookup_desc(const char *query, int version, const char **desc,
- size_t *desc_len);
+@@ -39,6 +39,7 @@ void rend_cache_free_all(void);
+ int rend_valid_service_id(const char *query);
int rend_cache_lookup_entry(const char *query, int version,
rend_cache_entry_t **entry_out);
+void rend_cache_remove_entry(const char *service_id);
int rend_cache_lookup_v2_desc_as_dir(const char *query, const char **desc);
- int rend_cache_store(const char *desc, size_t desc_len, int published,
- const char *service_id);
+ /** Return value from rend_cache_store_v2_desc_as_{dir,client}. */
+ typedef enum {
diff --git a/src/or/rendservice.c b/src/or/rendservice.c
-index 8a4a11e..35f5e18 100644
+index a7c1e32..cc9c0f8 100644
--- a/src/or/rendservice.c
+++ b/src/or/rendservice.c
-@@ -15,6 +15,7 @@
+@@ -16,6 +16,7 @@
#include "circuituse.h"
#include "config.h"
#include "directory.h"
@@ -182,7 +182,7 @@ index 8a4a11e..35f5e18 100644
#include "networkstatus.h"
#include "nodelist.h"
#include "rendclient.h"
-@@ -3024,6 +3025,9 @@ rend_services_introduce(void)
+@@ -3033,6 +3034,9 @@ rend_services_introduce(void)
time_t now;
const or_options_t *options = get_options();