Skip to content

Commit

Permalink
Updated libtor dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorropo-berty-bot committed Mar 24, 2021
1 parent 2d01e27 commit c3a8a2d
Show file tree
Hide file tree
Showing 13 changed files with 98 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ The `go-libtor` project is a self-contained, fully statically linked Tor library
| Library | Version | Commit |
|:-:|:-:|:-:|
| zlib | 1.2.11 | [`cacf7f1d4e3d44d871b605da3b647f07d718623f`](https://github.com/madler/zlib/commit/cacf7f1d4e3d44d871b605da3b647f07d718623f) |
| libevent | 2.2.0-alpha-dev | [`00b92f42b69af29a820b46049fd00be9cd3fb7d4`](https://github.com/libevent/libevent/commit/00b92f42b69af29a820b46049fd00be9cd3fb7d4) |
| openssl | 1.1.1-stable | [`ffefffa000437da5703dd8a173386623304b055d`](https://github.com/openssl/openssl/commit/ffefffa000437da5703dd8a173386623304b055d) |
| libevent | 2.2.0-alpha-dev | [`8e5e7bb8a82458ba5ac4193d88cef38a3ad6dddb`](https://github.com/libevent/libevent/commit/8e5e7bb8a82458ba5ac4193d88cef38a3ad6dddb) |
| openssl | 1.1.1-stable | [`cfd74383d9b06f85cb1e166180346115a3f9a452`](https://github.com/openssl/openssl/commit/cfd74383d9b06f85cb1e166180346115a3f9a452) |
| tor | 0.3.5.14-dev | [`1693b6151e1369ce0938761cac95e7a0a524f5f3`](https://gitweb.torproject.org/tor.git/commit/?id=1693b6151e1369ce0938761cac95e7a0a524f5f3) |

The library is currently supported on:
Expand Down
28 changes: 28 additions & 0 deletions darwin/libevent/bufferevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,34 @@ bufferevent_setfd(struct bufferevent *bev, evutil_socket_t fd)
return res;
}

int
bufferevent_replacefd(struct bufferevent *bev, evutil_socket_t fd)
{
union bufferevent_ctrl_data d;
int err = -1;
evutil_socket_t old_fd = EVUTIL_INVALID_SOCKET;

BEV_LOCK(bev);
if (bev->be_ops->ctrl) {
err = bev->be_ops->ctrl(bev, BEV_CTRL_GET_FD, &d);
if (!err) {
old_fd = d.fd;
if (old_fd != EVUTIL_INVALID_SOCKET) {
err = evutil_closesocket(old_fd);
}
}
if (!err) {
d.fd = fd;
err = bev->be_ops->ctrl(bev, BEV_CTRL_SET_FD, &d);
}
}
if (err)
event_debug(("%s: cannot replace fd for %p from "EV_SOCK_FMT" to "EV_SOCK_FMT, __func__, bev, old_fd, fd));
BEV_UNLOCK(bev);

return err;
}

evutil_socket_t
bufferevent_getfd(struct bufferevent *bev)
{
Expand Down
8 changes: 4 additions & 4 deletions darwin/libevent/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
int err;

/* XXXX This is not actually an optimal fix. Instead we ought to have
an API for "stop connecting", or use bufferevent_setfd to turn off
an API for "stop connecting", or use bufferevent_replacefd to turn off
connecting. But for Libevent 2.0, this seems like a minimal change
least likely to disrupt the rest of the bufferevent and http code.
Expand All @@ -1437,7 +1437,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
(*evcon->closecb)(evcon, evcon->closecb_arg);

/** FIXME: manipulating with fd is unwanted */
err = bufferevent_setfd(evcon->bufev, -1);
err = bufferevent_replacefd(evcon->bufev, -1);
EVUTIL_ASSERT(!err && "setfd");

/* we need to clean up any buffered data */
Expand Down Expand Up @@ -2766,7 +2766,7 @@ evhttp_connection_connect_(struct evhttp_connection *evcon)
return (-1);
}

if (bufferevent_setfd(evcon->bufev, fd))
if (bufferevent_replacefd(evcon->bufev, fd))
return (-1);
}

Expand Down Expand Up @@ -4495,7 +4495,7 @@ evhttp_get_request_connection(
evcon->flags |= EVHTTP_CON_INCOMING;
evcon->state = EVCON_READING_FIRSTLINE;

if (bufferevent_setfd(evcon->bufev, fd))
if (bufferevent_replacefd(evcon->bufev, fd))
goto err;
if (bufferevent_enable(evcon->bufev, EV_READ))
goto err;
Expand Down
12 changes: 12 additions & 0 deletions darwin/libevent/include/event2/bufferevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,18 @@ void bufferevent_getcb(struct bufferevent *bufev,
EVENT2_EXPORT_SYMBOL
int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);

/**
Replaces the file descriptor on which the bufferevent operates.
Not supported for all bufferevent types.
Unlike bufferevent_setfd() it will close previous file descriptor (if any).
@param bufev the bufferevent object for which to change the file descriptor
@param fd the file descriptor to operate on
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_replacefd(struct bufferevent *bufev, evutil_socket_t fd);

/**
Returns the file descriptor associated with a bufferevent, or -1 if
no file descriptor is associated with the bufferevent.
Expand Down
2 changes: 2 additions & 0 deletions darwin/openssl/ssl/statem/extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ static const EXTENSION_DEFINITION ext_defs[] = {
tls_construct_stoc_key_share, tls_construct_ctos_key_share,
final_key_share
},
#else
INVALID_EXTENSION,
#endif
{
/* Must be after key_share */
Expand Down
28 changes: 28 additions & 0 deletions linux/libevent/bufferevent.c
Original file line number Diff line number Diff line change
Expand Up @@ -881,6 +881,34 @@ bufferevent_setfd(struct bufferevent *bev, evutil_socket_t fd)
return res;
}

int
bufferevent_replacefd(struct bufferevent *bev, evutil_socket_t fd)
{
union bufferevent_ctrl_data d;
int err = -1;
evutil_socket_t old_fd = EVUTIL_INVALID_SOCKET;

BEV_LOCK(bev);
if (bev->be_ops->ctrl) {
err = bev->be_ops->ctrl(bev, BEV_CTRL_GET_FD, &d);
if (!err) {
old_fd = d.fd;
if (old_fd != EVUTIL_INVALID_SOCKET) {
err = evutil_closesocket(old_fd);
}
}
if (!err) {
d.fd = fd;
err = bev->be_ops->ctrl(bev, BEV_CTRL_SET_FD, &d);
}
}
if (err)
event_debug(("%s: cannot replace fd for %p from "EV_SOCK_FMT" to "EV_SOCK_FMT, __func__, bev, old_fd, fd));
BEV_UNLOCK(bev);

return err;
}

evutil_socket_t
bufferevent_getfd(struct bufferevent *bev)
{
Expand Down
8 changes: 4 additions & 4 deletions linux/libevent/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -1420,7 +1420,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
int err;

/* XXXX This is not actually an optimal fix. Instead we ought to have
an API for "stop connecting", or use bufferevent_setfd to turn off
an API for "stop connecting", or use bufferevent_replacefd to turn off
connecting. But for Libevent 2.0, this seems like a minimal change
least likely to disrupt the rest of the bufferevent and http code.
Expand All @@ -1437,7 +1437,7 @@ evhttp_connection_reset_hard_(struct evhttp_connection *evcon)
(*evcon->closecb)(evcon, evcon->closecb_arg);

/** FIXME: manipulating with fd is unwanted */
err = bufferevent_setfd(evcon->bufev, -1);
err = bufferevent_replacefd(evcon->bufev, -1);
EVUTIL_ASSERT(!err && "setfd");

/* we need to clean up any buffered data */
Expand Down Expand Up @@ -2766,7 +2766,7 @@ evhttp_connection_connect_(struct evhttp_connection *evcon)
return (-1);
}

if (bufferevent_setfd(evcon->bufev, fd))
if (bufferevent_replacefd(evcon->bufev, fd))
return (-1);
}

Expand Down Expand Up @@ -4495,7 +4495,7 @@ evhttp_get_request_connection(
evcon->flags |= EVHTTP_CON_INCOMING;
evcon->state = EVCON_READING_FIRSTLINE;

if (bufferevent_setfd(evcon->bufev, fd))
if (bufferevent_replacefd(evcon->bufev, fd))
goto err;
if (bufferevent_enable(evcon->bufev, EV_READ))
goto err;
Expand Down
12 changes: 12 additions & 0 deletions linux/libevent/include/event2/bufferevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,18 @@ void bufferevent_getcb(struct bufferevent *bufev,
EVENT2_EXPORT_SYMBOL
int bufferevent_setfd(struct bufferevent *bufev, evutil_socket_t fd);

/**
Replaces the file descriptor on which the bufferevent operates.
Not supported for all bufferevent types.
Unlike bufferevent_setfd() it will close previous file descriptor (if any).
@param bufev the bufferevent object for which to change the file descriptor
@param fd the file descriptor to operate on
*/
EVENT2_EXPORT_SYMBOL
int bufferevent_replacefd(struct bufferevent *bufev, evutil_socket_t fd);

/**
Returns the file descriptor associated with a bufferevent, or -1 if
no file descriptor is associated with the bufferevent.
Expand Down
2 changes: 2 additions & 0 deletions linux/openssl/ssl/statem/extensions.c
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,8 @@ static const EXTENSION_DEFINITION ext_defs[] = {
tls_construct_stoc_key_share, tls_construct_ctos_key_share,
final_key_share
},
#else
INVALID_EXTENSION,
#endif
{
/* Must be after key_share */
Expand Down
2 changes: 1 addition & 1 deletion lock.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"zlib":"cacf7f1d4e3d44d871b605da3b647f07d718623f","libevent":"00b92f42b69af29a820b46049fd00be9cd3fb7d4","openssl":"ffefffa000437da5703dd8a173386623304b055d","tor":"1693b6151e1369ce0938761cac95e7a0a524f5f3"}
{"zlib":"cacf7f1d4e3d44d871b605da3b647f07d718623f","libevent":"8e5e7bb8a82458ba5ac4193d88cef38a3ad6dddb","openssl":"cfd74383d9b06f85cb1e166180346115a3f9a452","tor":"1693b6151e1369ce0938761cac95e7a0a524f5f3"}
2 changes: 1 addition & 1 deletion openssl_config/buildinf.macos64.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

#define PLATFORM "platform: darwin64-x86_64-cc"
#define DATE "built on: Sun Mar 21 12:30:01 2021 +0100"
#define DATE "built on: Mon Mar 22 15:29:28 2021 +0800"

/*
* Generate compiler_flags as an array of individual characters. This is a
Expand Down
2 changes: 1 addition & 1 deletion openssl_config/buildinf.x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

#define PLATFORM "platform: linux-x86_64"
#define DATE "built on: Sun Mar 21 12:30:01 2021 +0100"
#define DATE "built on: Mon Mar 22 15:29:28 2021 +0800"

/*
* Generate compiler_flags as an array of individual characters. This is a
Expand Down
2 changes: 1 addition & 1 deletion openssl_config/buildinf.x86.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/

#define PLATFORM "platform: linux-x86"
#define DATE "built on: Sun Mar 21 12:30:01 2021 +0100"
#define DATE "built on: Mon Mar 22 15:29:28 2021 +0800"

/*
* Generate compiler_flags as an array of individual characters. This is a
Expand Down

0 comments on commit c3a8a2d

Please sign in to comment.