Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Update libs (#2)
Browse files Browse the repository at this point in the history
* Update the linux build of tor

* Update macOS build

* Update README docs

* Bump versions of dependencies

This was done running:
```
go run build/wrap.go --nobuild --update
./build/local-linux-build.sh
```

The following libs were updated:
zlib -> 1.2.12
libevent -> 2.2.0-alpha-dev
openssl -> 1.1.1-stable
tor -> 0.4.6.12-dev

See ooni/probe#2130
  • Loading branch information
hellais authored Sep 5, 2022
1 parent 02638cf commit 24b2ee1
Show file tree
Hide file tree
Showing 181 changed files with 2,354 additions and 1,960 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ The `go-libtor` project is a self-contained, fully statically linked Tor library
| Library | Version | Commit |
|:-:|:-:|:-:|
| zlib | 1.2.12 | [`21767c654d31d2dccdde4330529775c6c5fd5389`](https://github.com/madler/zlib/commit/21767c654d31d2dccdde4330529775c6c5fd5389) |
| libevent | 2.2.0-alpha-dev | [`21e2862689edc59b6265998c4a1a2729552ab0b1`](https://github.com/libevent/libevent/commit/21e2862689edc59b6265998c4a1a2729552ab0b1) |
| openssl | 1.1.1-stable | [`564a8d442cbd8ce68d452ff2e8a58c0aea6b0632`](https://github.com/openssl/openssl/commit/564a8d442cbd8ce68d452ff2e8a58c0aea6b0632) |
| tor | 0.4.6.10-dev | [`18cc67f1614a3819b55883a421710a59a66c27a5`](https://gitweb.torproject.org/tor.git/commit/?id=18cc67f1614a3819b55883a421710a59a66c27a5) |
| libevent | 2.2.0-alpha-dev | [`b19af675c7601a7867f26c33072cda7ea125adb2`](https://github.com/libevent/libevent/commit/b19af675c7601a7867f26c33072cda7ea125adb2) |
| openssl | 1.1.1-stable | [`9eae491721209f302a9a475bffd271370e8bcb8f`](https://github.com/openssl/openssl/commit/9eae491721209f302a9a475bffd271370e8bcb8f) |
| tor | 0.4.6.12-dev | [`e7dddda9c155bc91ef87dc6cb0600f6986e63b52`](https://gitweb.torproject.org/tor.git/commit/?id=e7dddda9c155bc91ef87dc6cb0600f6986e63b52) |

The library is currently supported on:

Expand Down
6 changes: 5 additions & 1 deletion darwin/libevent/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -1668,7 +1668,7 @@ evbuffer_search_eol(struct evbuffer *buffer,
if (evbuffer_strchr(&it, '\n') < 0)
goto done;
extra_drain = 1;
/* ... optionally preceeded by a CR. */
/* ... optionally preceded by a CR. */
if (it.pos == start_pos)
break; /* If the first character is \n, don't back up */
/* This potentially does an extra linear walk over the first
Expand Down Expand Up @@ -3080,7 +3080,11 @@ evbuffer_file_segment_materialize(struct evbuffer_file_segment *seg)
offset_leftover = offset % page_size;
offset_rounded = offset - offset_leftover;
}
#if defined(EVENT__HAVE_MMAP64)
mapped = mmap64(NULL, length + offset_leftover,
#else
mapped = mmap(NULL, length + offset_leftover,
#endif
PROT_READ,
#ifdef MAP_NOCACHE
MAP_NOCACHE | /* ??? */
Expand Down
2 changes: 1 addition & 1 deletion darwin/libevent/buffer_iocp.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ struct evbuffer_overlapped {
WSABUF buffers[MAX_WSABUFS];
};

/** Given an evbuffer, return the correponding evbuffer structure, or NULL if
/** Given an evbuffer, return the corresponding evbuffer structure, or NULL if
* the evbuffer isn't overlapped. */
static inline struct evbuffer_overlapped *
upcast_evbuffer(struct evbuffer *buf)
Expand Down
4 changes: 2 additions & 2 deletions darwin/libevent/bufferevent-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -485,8 +485,8 @@ bufferevent_socket_set_conn_address_(struct bufferevent *bev, struct sockaddr *a
#define BEV_UPCAST(b) EVUTIL_UPCAST((b), struct bufferevent_private, bev)

#ifdef EVENT__DISABLE_THREAD_SUPPORT
#define BEV_LOCK(b) EVUTIL_NIL_STMT_
#define BEV_UNLOCK(b) EVUTIL_NIL_STMT_
#define BEV_LOCK(b) (void)(b)
#define BEV_UNLOCK(b) (void)(b)
#else
/** Internal: Grab the lock (if any) on a bufferevent */
#define BEV_LOCK(b) do { \
Expand Down
10 changes: 5 additions & 5 deletions darwin/libevent/bufferevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ bufferevent_enable(struct bufferevent *bufev, short event)
if (impl_events && bufev->be_ops->enable(bufev, impl_events) < 0)
r = -1;
if (r)
event_debug(("%s: cannot enable 0x%hx on %p", __func__, event, bufev));
event_debug(("%s: cannot enable 0x%hx on %p", __func__, event, (void *)bufev));

bufferevent_decref_and_unlock_(bufev);
return r;
Expand Down Expand Up @@ -585,7 +585,7 @@ bufferevent_disable(struct bufferevent *bufev, short event)
if (bufev->be_ops->disable(bufev, event) < 0)
r = -1;
if (r)
event_debug(("%s: cannot disable 0x%hx on %p", __func__, event, bufev));
event_debug(("%s: cannot disable 0x%hx on %p", __func__, event, (void *)bufev));

BEV_UNLOCK(bufev);
return r;
Expand Down Expand Up @@ -876,7 +876,7 @@ bufferevent_setfd(struct bufferevent *bev, evutil_socket_t fd)
if (bev->be_ops->ctrl)
res = bev->be_ops->ctrl(bev, BEV_CTRL_SET_FD, &d);
if (res)
event_debug(("%s: cannot set fd for %p to "EV_SOCK_FMT, __func__, bev, fd));
event_debug(("%s: cannot set fd for %p to "EV_SOCK_FMT, __func__, (void *)bev, fd));
BEV_UNLOCK(bev);
return res;
}
Expand All @@ -903,7 +903,7 @@ bufferevent_replacefd(struct bufferevent *bev, evutil_socket_t fd)
}
}
if (err)
event_debug(("%s: cannot replace fd for %p from "EV_SOCK_FMT" to "EV_SOCK_FMT, __func__, bev, old_fd, fd));
event_debug(("%s: cannot replace fd for %p from "EV_SOCK_FMT" to "EV_SOCK_FMT, __func__, (void *)bev, old_fd, fd));
BEV_UNLOCK(bev);

return err;
Expand All @@ -919,7 +919,7 @@ bufferevent_getfd(struct bufferevent *bev)
if (bev->be_ops->ctrl)
res = bev->be_ops->ctrl(bev, BEV_CTRL_GET_FD, &d);
if (res)
event_debug(("%s: cannot get fd for %p", __func__, bev));
event_debug(("%s: cannot get fd for %p", __func__, (void *)bev));
BEV_UNLOCK(bev);
return (res<0) ? -1 : d.fd;
}
Expand Down
9 changes: 8 additions & 1 deletion darwin/libevent/bufferevent_mbedtls.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,15 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/


/* Mbed-TLS 3.x does not currently expose a function to retrieve
the bio parameters from the SSL object. When the above issue has been
fixed, remove the MBEDTLS_ALLOW_PRIVATE_ACCESS define and use the
appropriate getter function in bufferevent_mbedtls_socket_new rather than
accessing the struct fields directly. */
#define MBEDTLS_ALLOW_PRIVATE_ACCESS
#include "mbedtls-compat.h"
#include <mbedtls/config.h>
#include <mbedtls/version.h>
#include <mbedtls/ssl.h>
#include <mbedtls/error.h>

Expand Down
6 changes: 4 additions & 2 deletions darwin/libevent/bufferevent_openssl.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,9 @@ conn_closed(struct bufferevent_ssl *bev_ssl, int when, int errcode, int ret)
bufferevent_ssl_put_error(bev_ssl, errcode);
break;
case SSL_ERROR_SSL:
/* Protocol error. */
/* Protocol error; possibly a dirty shutdown. */
if (ret == 0 && SSL_is_init_finished(bev_ssl->ssl) == 0)
dirty_shutdown = 1;
bufferevent_ssl_put_error(bev_ssl, errcode);
break;
case SSL_ERROR_WANT_X509_LOOKUP:
Expand Down Expand Up @@ -475,7 +477,7 @@ bufferevent_openssl_socket_new(struct event_base *base,
This is probably an error on our part. Fail. */
goto err;
}
BIO_set_close(bio, 0);
(void)BIO_set_close(bio, 0);
} else {
/* The SSL isn't configured with a BIO with an fd. */
if (fd >= 0) {
Expand Down
2 changes: 1 addition & 1 deletion darwin/libevent/bufferevent_ratelim.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ ev_token_bucket_update_(struct ev_token_bucket *bucket,
ev_uint32_t current_tick)
{
/* It's okay if the tick number overflows, since we'll just
* wrap around when we do the unsigned substraction. */
* wrap around when we do the unsigned subtraction. */
unsigned n_ticks = current_tick - bucket->last_updated;

/* Make sure some ticks actually happened, and that time didn't
Expand Down
3 changes: 3 additions & 0 deletions darwin/libevent/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@
/* Define to 1 if you have the `mmap' function. */
#define HAVE_MMAP 1

/* Define to 1 if you have the `mmap64' function. */
/* #undef HAVE_MMAP64 */

/* Define to 1 if you have the `nanosleep' function. */
#define HAVE_NANOSLEEP 1

Expand Down
40 changes: 20 additions & 20 deletions darwin/libevent/evdns.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,8 @@
#define EVDNS_LOG_WARN EVENT_LOG_WARN
#define EVDNS_LOG_MSG EVENT_LOG_MSG

#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#ifndef EVDNS_NAME_MAX
#define EVDNS_NAME_MAX 255
#endif

#include <stdio.h>
Expand Down Expand Up @@ -854,7 +854,7 @@ request_finished(struct request *const req, struct request **head, int free_hand
if (head)
evdns_request_remove(req, head);

log(EVDNS_LOG_DEBUG, "Removing timeout for request %p", req);
log(EVDNS_LOG_DEBUG, "Removing timeout for request %p", (void *)req);
if (was_inflight) {
evtimer_del(&req->timeout_event);
base->global_requests_inflight--;
Expand Down Expand Up @@ -1350,7 +1350,7 @@ reply_parse(struct evdns_base *base, u8 *packet, int length)
* to parse the response. To simplify things let's just allocate
* a little bit more to avoid complex evaluations.
*/
buf_size = MAX(length - j, HOST_NAME_MAX);
buf_size = MAX(length - j, EVDNS_NAME_MAX);
reply.data.raw = mm_malloc(buf_size);

/* now we have the answer section which looks like
Expand Down Expand Up @@ -1394,7 +1394,7 @@ reply_parse(struct evdns_base *base, u8 *packet, int length)
reply.have_answer = 1;
break;
} else if (type == TYPE_CNAME) {
char cname[HOST_NAME_MAX];
char cname[EVDNS_NAME_MAX];
if (name_parse(packet, length, &j, cname,
sizeof(cname))<0)
goto err;
Expand Down Expand Up @@ -1755,7 +1755,7 @@ server_send_response(struct evdns_server_port *port, struct server_request *req)
}

beferevent_error:
log(EVDNS_LOG_WARN, "Failed to send reply to request %p for client %p", req, req->client);
log(EVDNS_LOG_WARN, "Failed to send reply to request %p for client %p", (void *)req, (void *)req->client);
/* disconnect if we got bufferevent error */
evdns_remove_tcp_client(port, req->client);
return -1;
Expand Down Expand Up @@ -2196,7 +2196,7 @@ server_tcp_read_packet_cb(struct bufferevent *bev, void *ctx)

while (1) {
if (tcp_read_message(conn, &msg, &msg_len)) {
log(EVDNS_LOG_MSG, "Closing client connection %p due to error", bev);
log(EVDNS_LOG_MSG, "Closing client connection %p due to error", (void *)bev);
evdns_remove_tcp_client(port, client);
rc = port->refcnt;
EVDNS_UNLOCK(port);
Expand Down Expand Up @@ -2230,7 +2230,7 @@ server_tcp_event_cb(struct bufferevent *bev, short events, void *ctx)
EVUTIL_ASSERT(port && bev);
EVDNS_LOCK(port);
if (events & (BEV_EVENT_EOF | BEV_EVENT_ERROR | BEV_EVENT_TIMEOUT)) {
log(EVDNS_LOG_DEBUG, "Closing connection %p", bev);
log(EVDNS_LOG_DEBUG, "Closing connection %p", (void *)bev);
evdns_remove_tcp_client(port, client);
}
rc = port->refcnt;
Expand All @@ -2250,7 +2250,7 @@ incoming_conn_cb(struct evconnlistener *listener, evutil_socket_t fd,

if (!bev)
goto error;
log(EVDNS_LOG_DEBUG, "New incoming client connection %p", bev);
log(EVDNS_LOG_DEBUG, "New incoming client connection %p", (void *)bev);

bufferevent_set_timeouts(bev, &port->tcp_idle_timeout, &port->tcp_idle_timeout);

Expand Down Expand Up @@ -2721,7 +2721,7 @@ retransmit_all_tcp_requests_for(struct nameserver *server)
if (req->ns == server && (req->handle->tcp_flags & DNS_QUERY_USEVC)) {
if (req->tx_count >= req->base->global_max_retransmits) {
log(EVDNS_LOG_DEBUG, "Giving up on request %p; tx_count==%d",
req, req->tx_count);
(void *)req, req->tx_count);
reply_schedule_callback(req, 0, DNS_ERR_TIMEOUT, NULL);
request_finished(req, &REQ_HEAD(req->base, req->trans_id), 1);
} else {
Expand Down Expand Up @@ -2843,7 +2843,7 @@ evdns_tcp_connect_if_disconnected(struct nameserver *server)
return 1;

conn->state = TS_CONNECTING;
log(EVDNS_LOG_DEBUG, "New tcp connection %p created", conn);
log(EVDNS_LOG_DEBUG, "New tcp connection %p created", (void *)conn);
return 0;
}

Expand Down Expand Up @@ -2893,7 +2893,7 @@ client_tcp_event_cb(struct bufferevent *bev, short events, void *ctx) {
EVDNS_LOCK(server->base);
EVUTIL_ASSERT(conn && conn->bev == bev && bev);

log(EVDNS_LOG_DEBUG, "Event %d on connection %p", events, conn);
log(EVDNS_LOG_DEBUG, "Event %d on connection %p", events, (void *)conn);

if (events & (BEV_EVENT_TIMEOUT)) {
disconnect_and_free_connection(server->connection);
Expand Down Expand Up @@ -2931,7 +2931,7 @@ evdns_request_transmit_through_tcp(struct request *req, struct nameserver *serve
conn = server->connection;
bufferevent_setcb(conn->bev, client_tcp_read_packet_cb, NULL, client_tcp_event_cb, server);

log(EVDNS_LOG_DEBUG, "Sending request %p via tcp connection %p", req, conn);
log(EVDNS_LOG_DEBUG, "Sending request %p via tcp connection %p", (void *)req, (void *)conn);
packet_size = htons(req->request_len);
if (bufferevent_write(conn->bev, &packet_size, sizeof(packet_size)) )
goto fail;
Expand All @@ -2944,7 +2944,7 @@ evdns_request_transmit_through_tcp(struct request *req, struct nameserver *serve

return 0;
fail:
log(EVDNS_LOG_WARN, "Failed to send request %p via tcp connection %p", req, conn);
log(EVDNS_LOG_WARN, "Failed to send request %p via tcp connection %p", (void *)req, (void *)conn);
disconnect_and_free_connection(server->connection);
server->connection = NULL;
return 2;
Expand Down Expand Up @@ -3006,11 +3006,11 @@ evdns_request_transmit(struct request *req) {
default:
/* all ok */
log(EVDNS_LOG_DEBUG,
"Setting timeout for request %p, sent to nameserver %p", req, req->ns);
"Setting timeout for request %p, sent to nameserver %p", (void *)req, (void *)req->ns);
if (evtimer_add(&req->timeout_event, &req->base->global_timeout) < 0) {
log(EVDNS_LOG_WARN,
"Error from libevent when adding timer for request %p",
req);
(void *)req);
/* ???? Do more? */
}
req->tx_count++;
Expand Down Expand Up @@ -3290,7 +3290,7 @@ evdns_nameserver_add_impl_(struct evdns_base *base, const struct sockaddr *addre
}

log(EVDNS_LOG_DEBUG, "Added nameserver %s as %p",
evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), ns);
evutil_format_sockaddr_port_(address, addrbuf, sizeof(addrbuf)), (void *)ns);

/* insert this nameserver into the list of them */
if (!base->server_head) {
Expand Down Expand Up @@ -3982,7 +3982,7 @@ evdns_search_ndots_set(const int ndots) {

static void
search_set_from_hostname(struct evdns_base *base) {
char hostname[HOST_NAME_MAX + 1], *domainname;
char hostname[EVDNS_NAME_MAX + 1], *domainname;

ASSERT_LOCKED(base);
search_postfix_clear(base);
Expand Down Expand Up @@ -5670,7 +5670,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,

if (hints.ai_family != PF_INET6) {
log(EVDNS_LOG_DEBUG, "Sending request for %s on ipv4 as %p",
nodename, &data->ipv4_request);
nodename, (void *)&data->ipv4_request);

data->ipv4_request.r = evdns_base_resolve_ipv4(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
Expand All @@ -5681,7 +5681,7 @@ evdns_getaddrinfo(struct evdns_base *dns_base,
}
if (hints.ai_family != PF_INET) {
log(EVDNS_LOG_DEBUG, "Sending request for %s on ipv6 as %p",
nodename, &data->ipv6_request);
nodename, (void *)&data->ipv6_request);

data->ipv6_request.r = evdns_base_resolve_ipv6(dns_base,
nodename, 0, evdns_getaddrinfo_gotresolve,
Expand Down
Loading

0 comments on commit 24b2ee1

Please sign in to comment.