[glib-networking/mcatanzaro/tls-thread] progress
- From: Michael Catanzaro <mcatanzaro src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib-networking/mcatanzaro/tls-thread] progress
- Date: Thu, 5 Dec 2019 03:53:08 +0000 (UTC)
commit e21e676572858165c091acc4f8b3223fa76eebf2
Author: Michael Catanzaro <mcatanzaro gnome org>
Date: Wed Dec 4 20:38:10 2019 -0600
progress
meson.build | 2 +-
tls/base/gtlsconnection-base.h | 2 +-
tls/base/gtlsoperationsthread-base.h | 3 ---
tls/gnutls/gtlsoperationsthread-gnutls.c | 20 +++++++------------
tls/openssl/gtlsoperationsthread-openssl.c | 31 ++++++++++--------------------
5 files changed, 19 insertions(+), 39 deletions(-)
---
diff --git a/meson.build b/meson.build
index f04b60f..82333a3 100644
--- a/meson.build
+++ b/meson.build
@@ -76,7 +76,7 @@ gsettings_desktop_schemas_dep = dependency('gsettings-desktop-schemas', required
backends = []
# *** Checks for GnuTLS ***
-gnutls_dep = dependency('gnutls', version: '>= 3.6.5', required: get_option('gnutls'))
+gnutls_dep = dependency('gnutls', version: '>= 3.6.7', required: get_option('gnutls'))
if gnutls_dep.found()
backends += ['gnutls']
diff --git a/tls/base/gtlsconnection-base.h b/tls/base/gtlsconnection-base.h
index a91ea40..8be17f1 100644
--- a/tls/base/gtlsconnection-base.h
+++ b/tls/base/gtlsconnection-base.h
@@ -88,7 +88,7 @@ struct _GTlsConnectionBaseClass
void (*push_io) (GTlsConnectionBase *tls,
GIOCondition direction,
- gint64 timeout,
+ gint64 timeout, /* FIXME: remove
timeout */
GCancellable *cancellable);
GTlsConnectionBaseStatus (*pop_io) (GTlsConnectionBase *tls,
GIOCondition direction,
diff --git a/tls/base/gtlsoperationsthread-base.h b/tls/base/gtlsoperationsthread-base.h
index e910f01..f2fea94 100644
--- a/tls/base/gtlsoperationsthread-base.h
+++ b/tls/base/gtlsoperationsthread-base.h
@@ -38,7 +38,6 @@ struct _GTlsOperationsThreadBaseClass
{
GObjectClass parent_class;
- /* FIXME: must remove timeout parameters from all vfuncs, including handshake vfuncs */
GTlsConnectionBaseStatus (*read_fn) (GTlsOperationsThreadBase *self,
void *buffer,
gsize size,
@@ -48,7 +47,6 @@ struct _GTlsOperationsThreadBaseClass
GTlsConnectionBaseStatus (*read_message_fn) (GTlsOperationsThreadBase *self,
GInputVector *vectors,
guint num_vectors,
- gint64 timeout,
gssize *nread,
GCancellable *cancellable,
GError **error);
@@ -62,7 +60,6 @@ struct _GTlsOperationsThreadBaseClass
GTlsConnectionBaseStatus (*write_message_fn) (GTlsOperationsThreadBase *self,
GOutputVector *vectors,
guint num_vectors,
- gint64 timeout,
gssize *nwrote,
GCancellable *cancellable,
GError **error);
diff --git a/tls/gnutls/gtlsoperationsthread-gnutls.c b/tls/gnutls/gtlsoperationsthread-gnutls.c
index e0aaf6c..1ac7e56 100644
--- a/tls/gnutls/gtlsoperationsthread-gnutls.c
+++ b/tls/gnutls/gtlsoperationsthread-gnutls.c
@@ -127,11 +127,7 @@ end_gnutls_io (GTlsOperationsThreadGnutls *self,
return G_TLS_CONNECTION_BASE_OK;
}
- if (ret == GNUTLS_E_NO_CERTIFICATE_FOUND
-#ifdef GNUTLS_E_CERTIFICATE_REQUIRED
- || ret == GNUTLS_E_CERTIFICATE_REQUIRED /* Added in GnuTLS 3.6.7 */
-#endif
- )
+ if (ret == GNUTLS_E_NO_CERTIFICATE_FOUND || ret == GNUTLS_E_CERTIFICATE_REQUIRED)
{
g_clear_error (&my_error);
g_set_error_literal (error, G_TLS_ERROR, G_TLS_ERROR_CERTIFICATE_REQUIRED,
@@ -195,9 +191,9 @@ end_gnutls_io (GTlsOperationsThreadGnutls *self,
return G_TLS_CONNECTION_BASE_ERROR;
}
-#define BEGIN_GNUTLS_IO(self, direction, timeout, cancellable) \
+#define BEGIN_GNUTLS_IO(self, direction, cancellable) \
g_tls_connection_base_push_io (g_tls_operations_thread_base_get_connection (G_TLS_OPERATIONS_THREAD_BASE
(self)), \
- direction, timeout, cancellable); \
+ direction, 0, cancellable); \
do {
#define END_GNUTLS_IO(self, direction, ret, status, errmsg, err) \
@@ -216,7 +212,7 @@ g_tls_operations_thread_gnutls_read (GTlsOperationsThreadBase *base,
GTlsConnectionBaseStatus status;
gssize ret;
- BEGIN_GNUTLS_IO (self, G_IO_IN, 0, cancellable);
+ BEGIN_GNUTLS_IO (self, G_IO_IN, cancellable);
ret = gnutls_record_recv (self->session, buffer, size);
END_GNUTLS_IO (self, G_IO_IN, ret, status, _("Error reading data from TLS socket"), error);
@@ -253,7 +249,6 @@ static GTlsConnectionBaseStatus
g_tls_operations_thread_gnutls_read_message (GTlsOperationsThreadBase *base,
GInputVector *vectors,
guint num_vectors,
- gint64 timeout,
gssize *nread,
GCancellable *cancellable,
GError **error)
@@ -263,7 +258,7 @@ g_tls_operations_thread_gnutls_read_message (GTlsOperationsThreadBase *base,
gssize ret;
gnutls_packet_t packet = { 0, };
- BEGIN_GNUTLS_IO (self, G_IO_IN, timeout, cancellable);
+ BEGIN_GNUTLS_IO (self, G_IO_IN, cancellable);
/* Receive the entire datagram (zero-copy). */
ret = gnutls_record_recv_packet (self->session, &packet);
@@ -295,7 +290,7 @@ g_tls_operations_thread_gnutls_write (GTlsOperationsThreadBase *base,
GTlsConnectionBaseStatus status;
gssize ret;
- BEGIN_GNUTLS_IO (self, G_IO_OUT, 0, cancellable);
+ BEGIN_GNUTLS_IO (self, G_IO_OUT, cancellable);
ret = gnutls_record_send (self->session, buffer, size);
END_GNUTLS_IO (self, G_IO_OUT, ret, status, _("Error writing data to TLS socket"), error);
@@ -307,7 +302,6 @@ static GTlsConnectionBaseStatus
g_tls_operations_thread_gnutls_write_message (GTlsOperationsThreadBase *base,
GOutputVector *vectors,
guint num_vectors,
- gint64 timeout,
gssize *nwrote,
GCancellable *cancellable,
GError **error)
@@ -361,7 +355,7 @@ g_tls_operations_thread_gnutls_write_message (GTlsOperationsThreadBase *base,
}
}
- BEGIN_GNUTLS_IO (self, G_IO_OUT, timeout, cancellable);
+ BEGIN_GNUTLS_IO (self, G_IO_OUT, cancellable);
ret = gnutls_record_uncork (self->session, 0 /* flags */);
END_GNUTLS_IO (self, G_IO_OUT, ret, status, _("Error writing data to TLS socket"), error);
diff --git a/tls/openssl/gtlsoperationsthread-openssl.c b/tls/openssl/gtlsoperationsthread-openssl.c
index 7e5d4b1..9e5fa60 100644
--- a/tls/openssl/gtlsoperationsthread-openssl.c
+++ b/tls/openssl/gtlsoperationsthread-openssl.c
@@ -43,7 +43,6 @@ static GTlsConnectionBaseStatus
end_openssl_io (GTlsOperationsThreadOpenssl *self,
GIOCondition direction,
int ret,
- gboolean blocking,
GError **error,
const char *err_prefix,
const char *err_str)
@@ -59,15 +58,6 @@ end_openssl_io (GTlsOperationsThreadOpenssl *self,
status = g_tls_connection_base_pop_io (tls, direction, ret > 0, &my_error);
- if ((err_code == SSL_ERROR_WANT_READ ||
- err_code == SSL_ERROR_WANT_WRITE) &&
- blocking)
- {
- if (my_error)
- g_error_free (my_error);
- return G_TLS_CONNECTION_BASE_TRY_AGAIN;
- }
-
if (err_code == SSL_ERROR_ZERO_RETURN)
return G_TLS_CONNECTION_BASE_OK;
@@ -170,16 +160,15 @@ end_openssl_io (GTlsOperationsThreadOpenssl *self,
return G_TLS_CONNECTION_BASE_ERROR;
}
-// FIXME: remove timeout params
-#define BEGIN_OPENSSL_IO(self, direction, timeout, cancellable) \
- do { \
- char error_str[256]; \
+#define BEGIN_OPENSSL_IO(self, direction, cancellable) \
+ do { \
+ char error_str[256]; \
g_tls_connection_base_push_io (g_tls_operations_thread_base_get_connection (G_TLS_OPERATIONS_THREAD_BASE
(self)), \
- direction, timeout, cancellable);
+ direction, 0, cancellable);
-#define END_OPENSSL_IO(self, direction, ret, timeout, status, errmsg, err) \
+#define END_OPENSSL_IO(self, direction, ret, status, errmsg, err) \
ERR_error_string_n (SSL_get_error (self->ssl, ret), error_str, sizeof (error_str)); \
- status = end_openssl_io (self, direction, ret, timeout == -1, err, errmsg, error_str); \
+ status = end_openssl_io (self, direction, ret, err, errmsg, error_str); \
} while (status == G_TLS_CONNECTION_BASE_TRY_AGAIN);
static GTlsConnectionBaseStatus
@@ -194,9 +183,9 @@ g_tls_operations_thread_openssl_read (GTlsOperationsThreadBase *base,
GTlsConnectionBaseStatus status;
gssize ret;
- BEGIN_OPENSSL_IO (self, G_IO_OUT, 0, cancellable);
+ BEGIN_OPENSSL_IO (self, G_IO_OUT, cancellable);
ret = SSL_read (self->ssl, buffer, size);
- END_OPENSSL_IO (self, G_IO_OUT, ret, 0, status,
+ END_OPENSSL_IO (self, G_IO_OUT, ret, status,
_("Error reading data from TLS socket"), error);
@@ -216,9 +205,9 @@ g_tls_operations_thread_openssl_write (GTlsOperationsThreadBase *base,
GTlsConnectionBaseStatus status;
gssize ret;
- BEGIN_OPENSSL_IO (self, G_IO_OUT, 0, cancellable);
+ BEGIN_OPENSSL_IO (self, G_IO_OUT, cancellable);
ret = SSL_write (self->ssl, buffer, size);
- END_OPENSSL_IO (self, G_IO_OUT, ret, 0, status,
+ END_OPENSSL_IO (self, G_IO_OUT, ret, status,
_("Error writing data to TLS socket"), error);
*nwrote = MAX (ret, 0);
return status;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]