Compare commits
222 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
f9fbe5a4c8 | ||
|
a6c366328b | ||
|
f52f413589 | ||
|
78bc3e5c67 | ||
|
8f38a70fd6 | ||
|
74300be378 | ||
|
9b1f9aa2f2 | ||
|
b5748c4edb | ||
|
6c5949a8ca | ||
|
62d0b8f09a | ||
|
ce0559a035 | ||
|
22bd71a65a | ||
|
6248b5a00a | ||
|
e1ea8b2fcf | ||
|
c3df0e5227 | ||
|
683c99b0e4 | ||
|
1d384aa8fb | ||
|
b03aa2af4a | ||
|
7a981e97c7 | ||
|
ea83fb0237 | ||
|
06a3cf31cd | ||
|
ee2a246925 | ||
|
6e6595e611 | ||
|
fbd5247c7a | ||
|
46f4926d2c | ||
|
d43d0ce458 | ||
|
ec78e22b1b | ||
|
ba78ee1988 | ||
|
cf59eebaca | ||
|
1ac207bef9 | ||
|
898c00b2ad | ||
|
a23372a417 | ||
|
fdfddfe804 | ||
|
807f65d4bd | ||
|
ab00509fe1 | ||
|
af14559f8f | ||
|
e992d2d872 | ||
|
540aeada95 | ||
|
cfb57c36bc | ||
|
348b2bb6ec | ||
|
0085371da8 | ||
|
927ce866ba | ||
|
3f77266cf6 | ||
|
80b2df57b6 | ||
|
9558681601 | ||
|
dd3956be01 | ||
|
f45e5da632 | ||
|
aafbdc7a3c | ||
|
e81b0cb6f7 | ||
|
d40813ab05 | ||
|
0f797a67d7 | ||
|
8b0b09cbeb | ||
|
46304cbb85 | ||
|
12007a228d | ||
|
de2e4aad98 | ||
|
789d0acce0 | ||
|
66f00fe02c | ||
|
8594386f06 | ||
|
0660fa0c94 | ||
|
b0612ed4ec | ||
|
f877f72c6a | ||
|
1cc525296d | ||
|
9f7e13d0db | ||
|
cbe7cdc693 | ||
|
118876b458 | ||
|
aedd1304a1 | ||
|
6070ee78fb | ||
|
4acd8adcda | ||
|
03b8b8e2e3 | ||
|
5d7683bd2f | ||
|
e17445b580 | ||
|
8772f8141f | ||
|
9a01b6006b | ||
|
96178709bd | ||
|
61bd4d25e7 | ||
|
38b0fc282d | ||
|
fdc1cc9df5 | ||
|
9c3ca0aa8b | ||
|
6c43ffbb6e | ||
|
dea8a050cc | ||
|
4c1e2ebdaa | ||
|
98d0423b58 | ||
|
cda7784363 | ||
|
9b6973c83d | ||
|
2bf83454cd | ||
|
2cdd991d06 | ||
|
fd6c7196f2 | ||
|
ad56827ff1 | ||
|
14f6fc54a9 | ||
|
087ef3ba0f | ||
|
903f77fb2d | ||
|
acd3cbe4d5 | ||
|
0ce8af8d61 | ||
|
1267711fed | ||
|
9c81d716d8 | ||
|
a462f9ad53 | ||
|
a26ff7ab92 | ||
|
bdba4a7a70 | ||
|
d7233f80ab | ||
|
78ad5e06b9 | ||
|
7601a56f32 | ||
|
52c8682ec3 | ||
|
8a2874adbc | ||
|
9d1a02789c | ||
|
712673e983 | ||
|
a93430c4ec | ||
|
c120a31c5c | ||
|
15854645a4 | ||
|
ca7ad47973 | ||
|
05d466c2f3 | ||
|
020ac281a0 | ||
|
28d80c00df | ||
|
801e4a1ba0 | ||
|
13e91f1191 | ||
|
3d2fdcc93f | ||
|
d0061dc774 | ||
|
9212218622 | ||
|
c61950e22a | ||
|
d6f26ff142 | ||
|
0a852c03e0 | ||
|
521a0af72d | ||
|
6eddb09ca7 | ||
|
de68b09821 | ||
|
6ebc67f953 | ||
|
66ce32f8f6 | ||
|
909ce71f92 | ||
|
590ba0a7c2 | ||
|
f0e37d48aa | ||
|
b667522807 | ||
|
f19e684016 | ||
|
49888f2247 | ||
|
050e056f1a | ||
|
6fa82410a9 | ||
|
720a3c04d3 | ||
|
8c1e113e30 | ||
|
95c4ff00c9 | ||
|
bd79cc7078 | ||
|
3988005eba | ||
|
e80d9926c8 | ||
|
33893e2564 | ||
|
edffddfc65 | ||
|
87058bdf9c | ||
|
65184ef400 | ||
|
4a9a2168b8 | ||
|
c1a8bc0c27 | ||
|
d2f294c971 | ||
|
8fe0a4919c | ||
|
9a2f240e5e | ||
|
7bda568479 | ||
|
f441ba778e | ||
|
b409b5060b | ||
|
78b0c0f225 | ||
|
30be49854c | ||
|
43ad60e20e | ||
|
5472a32d5c | ||
|
7473b58ac4 | ||
|
cafbb83624 | ||
|
64b1fd19ea | ||
|
135a12a11c | ||
|
8efb30daf8 | ||
|
ee9fe8145c | ||
|
90bf1b32b0 | ||
|
4235df9f60 | ||
|
8b343f3544 | ||
|
6755798d12 | ||
|
2dcc4a3c39 | ||
|
33edb32972 | ||
|
37425187a1 | ||
|
bb5d4bcab2 | ||
|
155dac13a7 | ||
|
aaaadfa0e3 | ||
|
a7cfb69290 | ||
|
5b9d4813fe | ||
|
18083219d7 | ||
|
79b7e1a5e5 | ||
|
cc555d1c72 | ||
|
ff0cae3123 | ||
|
3678fff388 | ||
|
31b797e2a7 | ||
|
0766feafff | ||
|
fca95b7377 | ||
|
c894923a28 | ||
|
ee19c0cfd1 | ||
|
7173be9291 | ||
|
2c8f4e7a31 | ||
|
1759e582c5 | ||
|
b45bc84b46 | ||
|
b106300330 | ||
|
82f0a6a1c1 | ||
|
d143a7bba6 | ||
|
acaa117c64 | ||
|
2f6436c152 | ||
|
f4398cbb64 | ||
|
7ab7df4b4f | ||
|
94703bb293 | ||
|
062ae8743a | ||
|
73831db5f5 | ||
|
37f2e6a09b | ||
|
87399ddca1 | ||
|
9df1f592d1 | ||
|
af8f0d018f | ||
|
8d1f2560de | ||
|
c83908386e | ||
|
5ccb823475 | ||
|
6c0de58bfa | ||
|
0f1e253d42 | ||
|
3be72f99c3 | ||
|
d247541600 | ||
|
aafdb1dc21 | ||
|
8cc88f501a | ||
|
2beaa32957 | ||
|
9da0fb4b16 | ||
|
ef9967724e | ||
|
7262b9bce8 | ||
|
6dea828cc8 | ||
|
19a1f0d61e | ||
|
b95e4bd68c | ||
|
50d046e3fd | ||
|
b947f05ed6 | ||
|
828dd098f4 | ||
|
25351c5075 | ||
|
2d0f25ec3e |
3417
1719.patch
Normal file
3417
1719.patch
Normal file
File diff suppressed because it is too large
Load Diff
32
1728.patch
Normal file
32
1728.patch
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
From c2b8fa8a34765d42be69e7eb9a4c44eeb970f775 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Michael Catanzaro <mcatanzaro@gnome.org>
|
||||||
|
Date: Wed, 28 Oct 2020 10:41:13 -0500
|
||||||
|
Subject: [PATCH] gsocketclient: fix crash when async connection step fails
|
||||||
|
|
||||||
|
This is a regression from !1686. The tmp_error is no longer valid after
|
||||||
|
it is "considered" and cannot be used at this point. We should print the
|
||||||
|
error earlier instead.
|
||||||
|
|
||||||
|
Fixes #2233
|
||||||
|
---
|
||||||
|
gio/gsocketclient.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/gio/gsocketclient.c b/gio/gsocketclient.c
|
||||||
|
index ce3c186fb..373774682 100644
|
||||||
|
--- a/gio/gsocketclient.c
|
||||||
|
+++ b/gio/gsocketclient.c
|
||||||
|
@@ -1837,9 +1837,9 @@ g_socket_client_connected_callback (GObject *source,
|
||||||
|
{
|
||||||
|
if (!g_cancellable_is_cancelled (attempt->cancellable))
|
||||||
|
{
|
||||||
|
+ g_debug ("GSocketClient: Connection attempt failed: %s", data->error_info->tmp_error->message);
|
||||||
|
clarify_connect_error (data->error_info->tmp_error, data->connectable, attempt->address);
|
||||||
|
consider_tmp_error (data->error_info, G_SOCKET_CLIENT_CONNECTING);
|
||||||
|
- g_debug ("GSocketClient: Connection attempt failed: %s", data->error_info->tmp_error->message);
|
||||||
|
connection_attempt_remove (attempt);
|
||||||
|
connection_attempt_unref (attempt);
|
||||||
|
try_next_connection_or_finish (data, FALSE);
|
||||||
|
--
|
||||||
|
GitLab
|
||||||
|
|
@ -1,54 +0,0 @@
|
|||||||
From be2656f13952dd22d348ff5e3f43240700cdef5a Mon Sep 17 00:00:00 2001
|
|
||||||
From: Colin Walters <walters@verbum.org>
|
|
||||||
Date: Wed, 16 Oct 2013 14:10:22 +0000
|
|
||||||
Subject: g_file_copy: Fall back to pathname queryinfo to help gvfs backends
|
|
||||||
|
|
||||||
It's not difficult to do; not all backends implement it, and for some
|
|
||||||
it may be difficult to implement query_info_on_read(), so let's just
|
|
||||||
do both.
|
|
||||||
|
|
||||||
https://bugzilla.gnome.org/show_bug.cgi?id=706254
|
|
||||||
---
|
|
||||||
diff --git a/gio/gfile.c b/gio/gfile.c
|
|
||||||
index afaee21..bf936ec 100644
|
|
||||||
--- a/gio/gfile.c
|
|
||||||
+++ b/gio/gfile.c
|
|
||||||
@@ -3112,6 +3112,8 @@ file_copy_fallback (GFile *source,
|
|
||||||
|
|
||||||
if (attrs_to_read != NULL)
|
|
||||||
{
|
|
||||||
+ GError *tmp_error = NULL;
|
|
||||||
+
|
|
||||||
/* Ok, ditch the previous lightweight info (on Unix we just
|
|
||||||
* called lstat()); at this point we gather all the information
|
|
||||||
* we need about the source from the opened file descriptor.
|
|
||||||
@@ -3119,7 +3121,26 @@ file_copy_fallback (GFile *source,
|
|
||||||
g_object_unref (info);
|
|
||||||
|
|
||||||
info = g_file_input_stream_query_info (file_in, attrs_to_read,
|
|
||||||
- cancellable, error);
|
|
||||||
+ cancellable, &tmp_error);
|
|
||||||
+ if (!info)
|
|
||||||
+ {
|
|
||||||
+ /* Not all gvfs backends implement query_info_on_read(), we
|
|
||||||
+ * can just fall back to the pathname again.
|
|
||||||
+ * https://bugzilla.gnome.org/706254
|
|
||||||
+ */
|
|
||||||
+ if (g_error_matches (tmp_error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED))
|
|
||||||
+ {
|
|
||||||
+ g_clear_error (&tmp_error);
|
|
||||||
+ info = g_file_query_info (source, attrs_to_read, G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
|
|
||||||
+ cancellable, error);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ g_free (attrs_to_read);
|
|
||||||
+ g_propagate_error (error, tmp_error);
|
|
||||||
+ goto out;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
g_free (attrs_to_read);
|
|
||||||
if (!info)
|
|
||||||
goto out;
|
|
||||||
--
|
|
||||||
cgit v0.9.2
|
|
1905
glib2.spec
1905
glib2.spec
File diff suppressed because it is too large
Load Diff
668
gnutls-hmac.patch
Normal file
668
gnutls-hmac.patch
Normal file
@ -0,0 +1,668 @@
|
|||||||
|
From afb5735506e2ed1c638a8c916aa3748bf0615f32 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Colin Walters <walters@verbum.org>
|
||||||
|
Date: Fri, 7 Jun 2019 18:44:43 +0000
|
||||||
|
Subject: [PATCH 1/2] ghmac: Split off wrapper functions into ghmac-utils.c
|
||||||
|
|
||||||
|
Prep for adding a GnuTLS HMAC implementation; these are just
|
||||||
|
utility functions that call the "core" API.
|
||||||
|
---
|
||||||
|
glib/ghmac-utils.c | 145 +++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
glib/ghmac.c | 112 ----------------------------------
|
||||||
|
glib/meson.build | 1 +
|
||||||
|
3 files changed, 146 insertions(+), 112 deletions(-)
|
||||||
|
create mode 100644 glib/ghmac-utils.c
|
||||||
|
|
||||||
|
diff --git a/glib/ghmac-utils.c b/glib/ghmac-utils.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..a17359ff1
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/glib/ghmac-utils.c
|
||||||
|
@@ -0,0 +1,145 @@
|
||||||
|
+/* ghmac.h - data hashing functions
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2011 Collabora Ltd.
|
||||||
|
+ * Copyright (C) 2019 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "config.h"
|
||||||
|
+
|
||||||
|
+#include <string.h>
|
||||||
|
+
|
||||||
|
+#include "ghmac.h"
|
||||||
|
+
|
||||||
|
+#include "glib/galloca.h"
|
||||||
|
+#include "gatomic.h"
|
||||||
|
+#include "gslice.h"
|
||||||
|
+#include "gmem.h"
|
||||||
|
+#include "gstrfuncs.h"
|
||||||
|
+#include "gtestutils.h"
|
||||||
|
+#include "gtypes.h"
|
||||||
|
+#include "glibintl.h"
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * g_compute_hmac_for_data:
|
||||||
|
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
+ * @key: (array length=key_len): the key to use in the HMAC
|
||||||
|
+ * @key_len: the length of the key
|
||||||
|
+ * @data: (array length=length): binary blob to compute the HMAC of
|
||||||
|
+ * @length: length of @data
|
||||||
|
+ *
|
||||||
|
+ * Computes the HMAC for a binary @data of @length. This is a
|
||||||
|
+ * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||||
|
+ * and g_hmac_unref().
|
||||||
|
+ *
|
||||||
|
+ * The hexadecimal string returned will be in lower case.
|
||||||
|
+ *
|
||||||
|
+ * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||||
|
+ * The returned string should be freed with g_free() when done using it.
|
||||||
|
+ *
|
||||||
|
+ * Since: 2.30
|
||||||
|
+ */
|
||||||
|
+gchar *
|
||||||
|
+g_compute_hmac_for_data (GChecksumType digest_type,
|
||||||
|
+ const guchar *key,
|
||||||
|
+ gsize key_len,
|
||||||
|
+ const guchar *data,
|
||||||
|
+ gsize length)
|
||||||
|
+{
|
||||||
|
+ GHmac *hmac;
|
||||||
|
+ gchar *retval;
|
||||||
|
+
|
||||||
|
+ g_return_val_if_fail (length == 0 || data != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ hmac = g_hmac_new (digest_type, key, key_len);
|
||||||
|
+ if (!hmac)
|
||||||
|
+ return NULL;
|
||||||
|
+
|
||||||
|
+ g_hmac_update (hmac, data, length);
|
||||||
|
+ retval = g_strdup (g_hmac_get_string (hmac));
|
||||||
|
+ g_hmac_unref (hmac);
|
||||||
|
+
|
||||||
|
+ return retval;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * g_compute_hmac_for_bytes:
|
||||||
|
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
+ * @key: the key to use in the HMAC
|
||||||
|
+ * @data: binary blob to compute the HMAC of
|
||||||
|
+ *
|
||||||
|
+ * Computes the HMAC for a binary @data. This is a
|
||||||
|
+ * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||||
|
+ * and g_hmac_unref().
|
||||||
|
+ *
|
||||||
|
+ * The hexadecimal string returned will be in lower case.
|
||||||
|
+ *
|
||||||
|
+ * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||||
|
+ * The returned string should be freed with g_free() when done using it.
|
||||||
|
+ *
|
||||||
|
+ * Since: 2.50
|
||||||
|
+ */
|
||||||
|
+gchar *
|
||||||
|
+g_compute_hmac_for_bytes (GChecksumType digest_type,
|
||||||
|
+ GBytes *key,
|
||||||
|
+ GBytes *data)
|
||||||
|
+{
|
||||||
|
+ gconstpointer byte_data;
|
||||||
|
+ gsize length;
|
||||||
|
+ gconstpointer key_data;
|
||||||
|
+ gsize key_len;
|
||||||
|
+
|
||||||
|
+ g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
+ g_return_val_if_fail (key != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ byte_data = g_bytes_get_data (data, &length);
|
||||||
|
+ key_data = g_bytes_get_data (key, &key_len);
|
||||||
|
+ return g_compute_hmac_for_data (digest_type, key_data, key_len, byte_data, length);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+/**
|
||||||
|
+ * g_compute_hmac_for_string:
|
||||||
|
+ * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
+ * @key: (array length=key_len): the key to use in the HMAC
|
||||||
|
+ * @key_len: the length of the key
|
||||||
|
+ * @str: the string to compute the HMAC for
|
||||||
|
+ * @length: the length of the string, or -1 if the string is nul-terminated
|
||||||
|
+ *
|
||||||
|
+ * Computes the HMAC for a string.
|
||||||
|
+ *
|
||||||
|
+ * The hexadecimal string returned will be in lower case.
|
||||||
|
+ *
|
||||||
|
+ * Returns: the HMAC as a hexadecimal string.
|
||||||
|
+ * The returned string should be freed with g_free()
|
||||||
|
+ * when done using it.
|
||||||
|
+ *
|
||||||
|
+ * Since: 2.30
|
||||||
|
+ */
|
||||||
|
+gchar *
|
||||||
|
+g_compute_hmac_for_string (GChecksumType digest_type,
|
||||||
|
+ const guchar *key,
|
||||||
|
+ gsize key_len,
|
||||||
|
+ const gchar *str,
|
||||||
|
+ gssize length)
|
||||||
|
+{
|
||||||
|
+ g_return_val_if_fail (length == 0 || str != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ if (length < 0)
|
||||||
|
+ length = strlen (str);
|
||||||
|
+
|
||||||
|
+ return g_compute_hmac_for_data (digest_type, key, key_len,
|
||||||
|
+ (const guchar *) str, length);
|
||||||
|
+}
|
||||||
|
diff --git a/glib/ghmac.c b/glib/ghmac.c
|
||||||
|
index 49fd272f0..4f181f21f 100644
|
||||||
|
--- a/glib/ghmac.c
|
||||||
|
+++ b/glib/ghmac.c
|
||||||
|
@@ -329,115 +329,3 @@ g_hmac_get_digest (GHmac *hmac,
|
||||||
|
g_checksum_update (hmac->digesto, buffer, len);
|
||||||
|
g_checksum_get_digest (hmac->digesto, buffer, digest_len);
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-/**
|
||||||
|
- * g_compute_hmac_for_data:
|
||||||
|
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
- * @key: (array length=key_len): the key to use in the HMAC
|
||||||
|
- * @key_len: the length of the key
|
||||||
|
- * @data: (array length=length): binary blob to compute the HMAC of
|
||||||
|
- * @length: length of @data
|
||||||
|
- *
|
||||||
|
- * Computes the HMAC for a binary @data of @length. This is a
|
||||||
|
- * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||||
|
- * and g_hmac_unref().
|
||||||
|
- *
|
||||||
|
- * The hexadecimal string returned will be in lower case.
|
||||||
|
- *
|
||||||
|
- * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||||
|
- * The returned string should be freed with g_free() when done using it.
|
||||||
|
- *
|
||||||
|
- * Since: 2.30
|
||||||
|
- */
|
||||||
|
-gchar *
|
||||||
|
-g_compute_hmac_for_data (GChecksumType digest_type,
|
||||||
|
- const guchar *key,
|
||||||
|
- gsize key_len,
|
||||||
|
- const guchar *data,
|
||||||
|
- gsize length)
|
||||||
|
-{
|
||||||
|
- GHmac *hmac;
|
||||||
|
- gchar *retval;
|
||||||
|
-
|
||||||
|
- g_return_val_if_fail (length == 0 || data != NULL, NULL);
|
||||||
|
-
|
||||||
|
- hmac = g_hmac_new (digest_type, key, key_len);
|
||||||
|
- if (!hmac)
|
||||||
|
- return NULL;
|
||||||
|
-
|
||||||
|
- g_hmac_update (hmac, data, length);
|
||||||
|
- retval = g_strdup (g_hmac_get_string (hmac));
|
||||||
|
- g_hmac_unref (hmac);
|
||||||
|
-
|
||||||
|
- return retval;
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-/**
|
||||||
|
- * g_compute_hmac_for_bytes:
|
||||||
|
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
- * @key: the key to use in the HMAC
|
||||||
|
- * @data: binary blob to compute the HMAC of
|
||||||
|
- *
|
||||||
|
- * Computes the HMAC for a binary @data. This is a
|
||||||
|
- * convenience wrapper for g_hmac_new(), g_hmac_get_string()
|
||||||
|
- * and g_hmac_unref().
|
||||||
|
- *
|
||||||
|
- * The hexadecimal string returned will be in lower case.
|
||||||
|
- *
|
||||||
|
- * Returns: the HMAC of the binary data as a string in hexadecimal.
|
||||||
|
- * The returned string should be freed with g_free() when done using it.
|
||||||
|
- *
|
||||||
|
- * Since: 2.50
|
||||||
|
- */
|
||||||
|
-gchar *
|
||||||
|
-g_compute_hmac_for_bytes (GChecksumType digest_type,
|
||||||
|
- GBytes *key,
|
||||||
|
- GBytes *data)
|
||||||
|
-{
|
||||||
|
- gconstpointer byte_data;
|
||||||
|
- gsize length;
|
||||||
|
- gconstpointer key_data;
|
||||||
|
- gsize key_len;
|
||||||
|
-
|
||||||
|
- g_return_val_if_fail (data != NULL, NULL);
|
||||||
|
- g_return_val_if_fail (key != NULL, NULL);
|
||||||
|
-
|
||||||
|
- byte_data = g_bytes_get_data (data, &length);
|
||||||
|
- key_data = g_bytes_get_data (key, &key_len);
|
||||||
|
- return g_compute_hmac_for_data (digest_type, key_data, key_len, byte_data, length);
|
||||||
|
-}
|
||||||
|
-
|
||||||
|
-
|
||||||
|
-/**
|
||||||
|
- * g_compute_hmac_for_string:
|
||||||
|
- * @digest_type: a #GChecksumType to use for the HMAC
|
||||||
|
- * @key: (array length=key_len): the key to use in the HMAC
|
||||||
|
- * @key_len: the length of the key
|
||||||
|
- * @str: the string to compute the HMAC for
|
||||||
|
- * @length: the length of the string, or -1 if the string is nul-terminated
|
||||||
|
- *
|
||||||
|
- * Computes the HMAC for a string.
|
||||||
|
- *
|
||||||
|
- * The hexadecimal string returned will be in lower case.
|
||||||
|
- *
|
||||||
|
- * Returns: the HMAC as a hexadecimal string.
|
||||||
|
- * The returned string should be freed with g_free()
|
||||||
|
- * when done using it.
|
||||||
|
- *
|
||||||
|
- * Since: 2.30
|
||||||
|
- */
|
||||||
|
-gchar *
|
||||||
|
-g_compute_hmac_for_string (GChecksumType digest_type,
|
||||||
|
- const guchar *key,
|
||||||
|
- gsize key_len,
|
||||||
|
- const gchar *str,
|
||||||
|
- gssize length)
|
||||||
|
-{
|
||||||
|
- g_return_val_if_fail (length == 0 || str != NULL, NULL);
|
||||||
|
-
|
||||||
|
- if (length < 0)
|
||||||
|
- length = strlen (str);
|
||||||
|
-
|
||||||
|
- return g_compute_hmac_for_data (digest_type, key, key_len,
|
||||||
|
- (const guchar *) str, length);
|
||||||
|
-}
|
||||||
|
diff --git a/glib/meson.build b/glib/meson.build
|
||||||
|
index aaf40a218..b3bf067c7 100644
|
||||||
|
--- a/glib/meson.build
|
||||||
|
+++ b/glib/meson.build
|
||||||
|
@@ -253,6 +253,7 @@ glib_sources = files(
|
||||||
|
'ggettext.c',
|
||||||
|
'ghash.c',
|
||||||
|
'ghmac.c',
|
||||||
|
+ 'ghmac-utils.c',
|
||||||
|
'ghook.c',
|
||||||
|
'ghostutils.c',
|
||||||
|
'giochannel.c',
|
||||||
|
--
|
||||||
|
2.28.0
|
||||||
|
|
||||||
|
|
||||||
|
From 703e63f9d8b3ea4f26f41f0d2287b301025a73cc Mon Sep 17 00:00:00 2001
|
||||||
|
From: Colin Walters <walters@verbum.org>
|
||||||
|
Date: Fri, 7 Jun 2019 19:36:54 +0000
|
||||||
|
Subject: [PATCH 2/2] Add a gnutls backend for GHmac
|
||||||
|
|
||||||
|
For RHEL we want apps to use FIPS-certified crypto libraries,
|
||||||
|
and HMAC apparently counts as "keyed" and hence needs to
|
||||||
|
be validated.
|
||||||
|
|
||||||
|
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1630260
|
||||||
|
Replaces: https://gitlab.gnome.org/GNOME/glib/merge_requests/897
|
||||||
|
|
||||||
|
This is a build-time option that backs the GHmac API with GnuTLS.
|
||||||
|
Most distributors ship glib-networking built with GnuTLS, and
|
||||||
|
most apps use glib-networking, so this isn't a net-new library
|
||||||
|
in most cases.
|
||||||
|
|
||||||
|
mcatanzaro note: I've updated Colin's original patch to implement
|
||||||
|
g_hmac_copy() using gnutls_hmac_copy(), which didn't exist when Colin
|
||||||
|
developed this patch.
|
||||||
|
---
|
||||||
|
glib/gchecksum.c | 9 ++-
|
||||||
|
glib/gchecksumprivate.h | 32 ++++++++
|
||||||
|
glib/ghmac-gnutls.c | 164 ++++++++++++++++++++++++++++++++++++++++
|
||||||
|
glib/ghmac.c | 3 +
|
||||||
|
glib/meson.build | 10 ++-
|
||||||
|
meson.build | 7 ++
|
||||||
|
meson_options.txt | 5 ++
|
||||||
|
7 files changed, 224 insertions(+), 6 deletions(-)
|
||||||
|
create mode 100644 glib/gchecksumprivate.h
|
||||||
|
create mode 100644 glib/ghmac-gnutls.c
|
||||||
|
|
||||||
|
diff --git a/glib/gchecksum.c b/glib/gchecksum.c
|
||||||
|
index f8a3f9ab8..b391a6264 100644
|
||||||
|
--- a/glib/gchecksum.c
|
||||||
|
+++ b/glib/gchecksum.c
|
||||||
|
@@ -20,7 +20,7 @@
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
-#include "gchecksum.h"
|
||||||
|
+#include "gchecksumprivate.h"
|
||||||
|
|
||||||
|
#include "gslice.h"
|
||||||
|
#include "gmem.h"
|
||||||
|
@@ -173,9 +173,9 @@ sha_byte_reverse (guint32 *buffer,
|
||||||
|
}
|
||||||
|
#endif /* G_BYTE_ORDER == G_BIG_ENDIAN */
|
||||||
|
|
||||||
|
-static gchar *
|
||||||
|
-digest_to_string (guint8 *digest,
|
||||||
|
- gsize digest_len)
|
||||||
|
+gchar *
|
||||||
|
+gchecksum_digest_to_string (guint8 *digest,
|
||||||
|
+ gsize digest_len)
|
||||||
|
{
|
||||||
|
gsize i, len = digest_len * 2;
|
||||||
|
gchar *retval;
|
||||||
|
@@ -194,6 +194,7 @@ digest_to_string (guint8 *digest,
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
+#define digest_to_string gchecksum_digest_to_string
|
||||||
|
|
||||||
|
/*
|
||||||
|
* MD5 Checksum
|
||||||
|
diff --git a/glib/gchecksumprivate.h b/glib/gchecksumprivate.h
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..86c7a3b61
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/glib/gchecksumprivate.h
|
||||||
|
@@ -0,0 +1,32 @@
|
||||||
|
+/* gstdioprivate.h - Private GLib stdio functions
|
||||||
|
+ *
|
||||||
|
+ * Copyright 2017 Руслан Ижбулатов
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#ifndef __G_CHECKSUMPRIVATE_H__
|
||||||
|
+#define __G_CHECKSUMPRIVATE_H__
|
||||||
|
+
|
||||||
|
+#include "gchecksum.h"
|
||||||
|
+
|
||||||
|
+G_BEGIN_DECLS
|
||||||
|
+
|
||||||
|
+gchar *
|
||||||
|
+gchecksum_digest_to_string (guint8 *digest,
|
||||||
|
+ gsize digest_len);
|
||||||
|
+
|
||||||
|
+G_END_DECLS
|
||||||
|
+
|
||||||
|
+#endif
|
||||||
|
\ No newline at end of file
|
||||||
|
diff --git a/glib/ghmac-gnutls.c b/glib/ghmac-gnutls.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000..f1a74a849
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/glib/ghmac-gnutls.c
|
||||||
|
@@ -0,0 +1,164 @@
|
||||||
|
+/* ghmac.h - data hashing functions
|
||||||
|
+ *
|
||||||
|
+ * Copyright (C) 2011 Collabora Ltd.
|
||||||
|
+ * Copyright (C) 2019 Red Hat, Inc.
|
||||||
|
+ *
|
||||||
|
+ * This library is free software; you can redistribute it and/or
|
||||||
|
+ * modify it under the terms of the GNU Lesser General Public
|
||||||
|
+ * License as published by the Free Software Foundation; either
|
||||||
|
+ * version 2.1 of the License, or (at your option) any later version.
|
||||||
|
+ *
|
||||||
|
+ * This library is distributed in the hope that it will be useful,
|
||||||
|
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
+ * Lesser General Public License for more details.
|
||||||
|
+ *
|
||||||
|
+ * You should have received a copy of the GNU Lesser General Public License
|
||||||
|
+ * along with this library; if not, see <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include "config.h"
|
||||||
|
+
|
||||||
|
+#include <string.h>
|
||||||
|
+#include <gnutls/crypto.h>
|
||||||
|
+
|
||||||
|
+#include "ghmac.h"
|
||||||
|
+
|
||||||
|
+#include "glib/galloca.h"
|
||||||
|
+#include "gatomic.h"
|
||||||
|
+#include "gslice.h"
|
||||||
|
+#include "gmem.h"
|
||||||
|
+#include "gstrfuncs.h"
|
||||||
|
+#include "gchecksumprivate.h"
|
||||||
|
+#include "gtestutils.h"
|
||||||
|
+#include "gtypes.h"
|
||||||
|
+#include "glibintl.h"
|
||||||
|
+
|
||||||
|
+#ifndef HAVE_GNUTLS
|
||||||
|
+#error "build configuration error"
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
+struct _GHmac
|
||||||
|
+{
|
||||||
|
+ int ref_count;
|
||||||
|
+ GChecksumType digest_type;
|
||||||
|
+ gnutls_hmac_hd_t hmac;
|
||||||
|
+ gchar *digest_str;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+GHmac *
|
||||||
|
+g_hmac_new (GChecksumType digest_type,
|
||||||
|
+ const guchar *key,
|
||||||
|
+ gsize key_len)
|
||||||
|
+{
|
||||||
|
+ gnutls_mac_algorithm_t algo;
|
||||||
|
+ GHmac *hmac = g_slice_new0 (GHmac);
|
||||||
|
+ hmac->ref_count = 1;
|
||||||
|
+ hmac->digest_type = digest_type;
|
||||||
|
+
|
||||||
|
+ switch (digest_type)
|
||||||
|
+ {
|
||||||
|
+ case G_CHECKSUM_MD5:
|
||||||
|
+ algo = GNUTLS_MAC_MD5;
|
||||||
|
+ break;
|
||||||
|
+ case G_CHECKSUM_SHA1:
|
||||||
|
+ algo = GNUTLS_MAC_SHA1;
|
||||||
|
+ break;
|
||||||
|
+ case G_CHECKSUM_SHA256:
|
||||||
|
+ algo = GNUTLS_MAC_SHA256;
|
||||||
|
+ break;
|
||||||
|
+ case G_CHECKSUM_SHA384:
|
||||||
|
+ algo = GNUTLS_MAC_SHA384;
|
||||||
|
+ break;
|
||||||
|
+ case G_CHECKSUM_SHA512:
|
||||||
|
+ algo = GNUTLS_MAC_SHA512;
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ g_return_val_if_reached (NULL);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ gnutls_hmac_init (&hmac->hmac, algo, key, key_len);
|
||||||
|
+
|
||||||
|
+ return hmac;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+GHmac *
|
||||||
|
+g_hmac_copy (const GHmac *hmac)
|
||||||
|
+{
|
||||||
|
+ GHmac *copy;
|
||||||
|
+
|
||||||
|
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ copy = g_slice_new0 (GHmac);
|
||||||
|
+ copy->ref_count = 1;
|
||||||
|
+ copy->digest_type = hmac->digest_type;
|
||||||
|
+ copy->hmac = gnutls_hmac_copy (hmac->hmac);
|
||||||
|
+
|
||||||
|
+ return copy;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+GHmac *
|
||||||
|
+g_hmac_ref (GHmac *hmac)
|
||||||
|
+{
|
||||||
|
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ g_atomic_int_inc (&hmac->ref_count);
|
||||||
|
+
|
||||||
|
+ return hmac;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+g_hmac_unref (GHmac *hmac)
|
||||||
|
+{
|
||||||
|
+ g_return_if_fail (hmac != NULL);
|
||||||
|
+
|
||||||
|
+ if (g_atomic_int_dec_and_test (&hmac->ref_count))
|
||||||
|
+ {
|
||||||
|
+ gnutls_hmac_deinit (hmac->hmac, NULL);
|
||||||
|
+ g_free (hmac->digest_str);
|
||||||
|
+ g_slice_free (GHmac, hmac);
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+g_hmac_update (GHmac *hmac,
|
||||||
|
+ const guchar *data,
|
||||||
|
+ gssize length)
|
||||||
|
+{
|
||||||
|
+ g_return_if_fail (hmac != NULL);
|
||||||
|
+ g_return_if_fail (length == 0 || data != NULL);
|
||||||
|
+
|
||||||
|
+ gnutls_hmac (hmac->hmac, data, length);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+const gchar *
|
||||||
|
+g_hmac_get_string (GHmac *hmac)
|
||||||
|
+{
|
||||||
|
+ guint8 *buffer;
|
||||||
|
+ gsize digest_len;
|
||||||
|
+
|
||||||
|
+ g_return_val_if_fail (hmac != NULL, NULL);
|
||||||
|
+
|
||||||
|
+ if (hmac->digest_str)
|
||||||
|
+ return hmac->digest_str;
|
||||||
|
+
|
||||||
|
+ digest_len = g_checksum_type_get_length (hmac->digest_type);
|
||||||
|
+ buffer = g_alloca (digest_len);
|
||||||
|
+
|
||||||
|
+ gnutls_hmac_output (hmac->hmac, buffer);
|
||||||
|
+ hmac->digest_str = gchecksum_digest_to_string (buffer, digest_len);
|
||||||
|
+ return hmac->digest_str;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+void
|
||||||
|
+g_hmac_get_digest (GHmac *hmac,
|
||||||
|
+ guint8 *buffer,
|
||||||
|
+ gsize *digest_len)
|
||||||
|
+{
|
||||||
|
+ g_return_if_fail (hmac != NULL);
|
||||||
|
+
|
||||||
|
+ gnutls_hmac_output (hmac->hmac, buffer);
|
||||||
|
+ *digest_len = g_checksum_type_get_length (hmac->digest_type);
|
||||||
|
+}
|
||||||
|
diff --git a/glib/ghmac.c b/glib/ghmac.c
|
||||||
|
index 4f181f21f..c62d9ce4e 100644
|
||||||
|
--- a/glib/ghmac.c
|
||||||
|
+++ b/glib/ghmac.c
|
||||||
|
@@ -33,6 +33,9 @@
|
||||||
|
#include "gtypes.h"
|
||||||
|
#include "glibintl.h"
|
||||||
|
|
||||||
|
+#ifdef HAVE_GNUTLS
|
||||||
|
+#error "build configuration error"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SECTION:hmac
|
||||||
|
diff --git a/glib/meson.build b/glib/meson.build
|
||||||
|
index b3bf067c7..3cdc3b573 100644
|
||||||
|
--- a/glib/meson.build
|
||||||
|
+++ b/glib/meson.build
|
||||||
|
@@ -252,7 +252,6 @@ glib_sources = files(
|
||||||
|
'gfileutils.c',
|
||||||
|
'ggettext.c',
|
||||||
|
'ghash.c',
|
||||||
|
- 'ghmac.c',
|
||||||
|
'ghmac-utils.c',
|
||||||
|
'ghook.c',
|
||||||
|
'ghostutils.c',
|
||||||
|
@@ -308,6 +307,7 @@ glib_sources = files(
|
||||||
|
'guriprivate.h',
|
||||||
|
'gutils.c',
|
||||||
|
'gutilsprivate.h',
|
||||||
|
+ 'gchecksumprivate.h',
|
||||||
|
'guuid.c',
|
||||||
|
'gvariant.c',
|
||||||
|
'gvariant-core.c',
|
||||||
|
@@ -352,6 +352,12 @@ else
|
||||||
|
glib_dtrace_hdr = []
|
||||||
|
endif
|
||||||
|
|
||||||
|
+if get_option('gnutls')
|
||||||
|
+ glib_sources += files('ghmac-gnutls.c')
|
||||||
|
+else
|
||||||
|
+ glib_sources += files('ghmac.c')
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
pcre_static_args = []
|
||||||
|
|
||||||
|
if use_pcre_static_flag
|
||||||
|
@@ -378,7 +384,7 @@ libglib = library('glib-2.0',
|
||||||
|
# intl.lib is not compatible with SAFESEH
|
||||||
|
link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
|
||||||
|
include_directories : configinc,
|
||||||
|
- dependencies : pcre_deps + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep],
|
||||||
|
+ dependencies : pcre_deps + libgnutls_dep + [thread_dep, librt] + libintl_deps + libiconv + platform_deps + gnulib_libm_dependency + [libsysprof_capture_dep],
|
||||||
|
c_args : glib_c_args,
|
||||||
|
objc_args : glib_c_args,
|
||||||
|
)
|
||||||
|
diff --git a/meson.build b/meson.build
|
||||||
|
index e0b308a25..70dd5355e 100644
|
||||||
|
--- a/meson.build
|
||||||
|
+++ b/meson.build
|
||||||
|
@@ -2056,6 +2056,13 @@ if host_system == 'linux'
|
||||||
|
glib_conf.set('HAVE_LIBMOUNT', libmount_dep.found())
|
||||||
|
endif
|
||||||
|
|
||||||
|
+# gnutls is used optionally by ghmac
|
||||||
|
+libgnutls_dep = []
|
||||||
|
+if get_option('gnutls')
|
||||||
|
+ libgnutls_dep = [dependency('gnutls', version : '>=3.6.9', required : true)]
|
||||||
|
+ glib_conf.set('HAVE_GNUTLS', 1)
|
||||||
|
+endif
|
||||||
|
+
|
||||||
|
if host_system == 'windows'
|
||||||
|
winsock2 = cc.find_library('ws2_32')
|
||||||
|
endif
|
||||||
|
diff --git a/meson_options.txt b/meson_options.txt
|
||||||
|
index af9645eda..2c4b2c37e 100644
|
||||||
|
--- a/meson_options.txt
|
||||||
|
+++ b/meson_options.txt
|
||||||
|
@@ -34,6 +34,11 @@ option('libmount',
|
||||||
|
value : 'auto',
|
||||||
|
description : 'build with libmount support')
|
||||||
|
|
||||||
|
+option('gnutls',
|
||||||
|
+ type : 'boolean',
|
||||||
|
+ value : false,
|
||||||
|
+ description : 'build with gnutls support')
|
||||||
|
+
|
||||||
|
option('internal_pcre',
|
||||||
|
type : 'boolean',
|
||||||
|
value : false,
|
||||||
|
--
|
||||||
|
2.28.0
|
2
sources
2
sources
@ -1 +1 @@
|
|||||||
2f4b15f7ef43d8702d067ab987bf7aba glib-2.36.4.tar.xz
|
SHA512 (glib-2.67.0.tar.xz) = 82d562bc80885c7e516e38f17a8830596b32b1e1a4b58454ca589be79e6ab27e0a2fe0a108cb02da21981c75474abed0263c0aa38c71ead45a68db675a1d2f80
|
||||||
|
@ -1,19 +0,0 @@
|
|||||||
#! /bin/sh
|
|
||||||
|
|
||||||
if test $# != 1; then
|
|
||||||
echo "usage: update-gio-modules host_triplet" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Warning: update-gio-modules is deprecated and will be removed in glib2-2.28.0"
|
|
||||||
|
|
||||||
umask 022
|
|
||||||
|
|
||||||
case "$host" in
|
|
||||||
alpha*|ia64*|powerpc64*|ppc64*|s390x*|sparc64*|x86_64*)
|
|
||||||
/usr/bin/gio-querymodules-64 /usr/lib64/gio/modules
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
/usr/bin/gio-querymodules-32 /usr/lib/gio/modules
|
|
||||||
;;
|
|
||||||
esac
|
|
Loading…
Reference in New Issue
Block a user