]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
269c12b0107e697d41788ff72cf89c09c7be0863
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From 59bcb169c4777bb3b1a50fee2ae20e4e8574b749 Mon Sep 17 00:00:00 2001
2 From: Daiki Ueno <dueno@src.gnome.org>
3 Date: Tue, 14 Jan 2020 10:09:29 +0100
4 Subject: [PATCH] secret-file-collection: Rename internal functions to avoid
5 conflicts
6
7 As encrypt() is a standard POSIX function, its declaration had
8 conflict with our own. Let's be more verbose about naming of the
9 internal crypto functions.
10
11 Fixes #35.
12
13 Upstream-Status: Backport [https://github.com/GNOME/libsecret/commit/cf21ad50b62f7c8e4b22ef374f0a73290a99bdb8]
14 Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com>
15 ---
16 libsecret/secret-file-collection.c | 38 +++++++++++++++---------------
17 1 file changed, 19 insertions(+), 19 deletions(-)
18
19 diff --git a/libsecret/secret-file-collection.c b/libsecret/secret-file-collection.c
20 index 79863ea..8ffb542 100644
21 --- a/libsecret/secret-file-collection.c
22 +++ b/libsecret/secret-file-collection.c
23 @@ -68,7 +68,7 @@ enum {
24 };
25
26 static gboolean
27 -derive (SecretFileCollection *self)
28 +do_derive_key (SecretFileCollection *self)
29 {
30 const gchar *password;
31 gsize n_password;
32 @@ -93,9 +93,9 @@ derive (SecretFileCollection *self)
33 }
34
35 static gboolean
36 -calculate_mac (SecretFileCollection *self,
37 - const guint8 *value, gsize n_value,
38 - guint8 *buffer)
39 +do_calculate_mac (SecretFileCollection *self,
40 + const guint8 *value, gsize n_value,
41 + guint8 *buffer)
42 {
43 gcry_mac_hd_t hd;
44 gcry_error_t gcry;
45 @@ -130,9 +130,9 @@ calculate_mac (SecretFileCollection *self,
46 }
47
48 static gboolean
49 -decrypt (SecretFileCollection *self,
50 - guint8 *data,
51 - gsize n_data)
52 +do_decrypt (SecretFileCollection *self,
53 + guint8 *data,
54 + gsize n_data)
55 {
56 gcry_cipher_hd_t hd;
57 gcry_error_t gcry;
58 @@ -164,9 +164,9 @@ decrypt (SecretFileCollection *self,
59 }
60
61 static gboolean
62 -encrypt (SecretFileCollection *self,
63 - guint8 *data,
64 - gsize n_data)
65 +do_encrypt (SecretFileCollection *self,
66 + guint8 *data,
67 + gsize n_data)
68 {
69 gcry_cipher_hd_t hd;
70 gcry_error_t gcry;
71 @@ -311,7 +311,7 @@ on_load_contents (GObject *source_object,
72 self->modified = g_date_time_new_now_utc ();
73 self->usage_count = 0;
74
75 - if (!derive (self)) {
76 + if (!do_derive_key (self)) {
77 g_task_return_new_error (task,
78 SECRET_ERROR,
79 SECRET_ERROR_PROTOCOL,
80 @@ -375,7 +375,7 @@ on_load_contents (GObject *source_object,
81 g_assert (n_data == salt_size);
82
83 self->salt = g_bytes_new (data, n_data);
84 - if (!derive (self)) {
85 + if (!do_derive_key (self)) {
86 g_task_return_new_error (task,
87 SECRET_ERROR,
88 SECRET_ERROR_PROTOCOL,
89 @@ -442,7 +442,7 @@ hash_attributes (SecretFileCollection *self,
90 GVariant *variant;
91
92 value = g_hash_table_lookup (attributes, l->data);
93 - if (!calculate_mac (self, (guint8 *)value, strlen (value), buffer)) {
94 + if (!do_calculate_mac (self, (guint8 *)value, strlen (value), buffer)) {
95 g_list_free (keys);
96 return NULL;
97 }
98 @@ -485,7 +485,7 @@ hashed_attributes_match (SecretFileCollection *self,
99 return FALSE;
100 }
101
102 - if (!calculate_mac (self, value, strlen ((char *)value), buffer)) {
103 + if (!do_calculate_mac (self, value, strlen ((char *)value), buffer)) {
104 g_variant_unref (hashed_attribute);
105 return FALSE;
106 }
107 @@ -584,7 +584,7 @@ secret_file_collection_replace (SecretFileCollection *self,
108 g_variant_store (serialized_item, data);
109 g_variant_unref (serialized_item);
110 memset (data + n_data, n_padded - n_data, n_padded - n_data);
111 - if (!encrypt (self, data, n_padded)) {
112 + if (!do_encrypt (self, data, n_padded)) {
113 egg_secure_free (data);
114 g_set_error (error,
115 SECRET_ERROR,
116 @@ -593,8 +593,8 @@ secret_file_collection_replace (SecretFileCollection *self,
117 return FALSE;
118 }
119
120 - if (!calculate_mac (self, data, n_padded + IV_SIZE,
121 - data + n_padded + IV_SIZE)) {
122 + if (!do_calculate_mac (self, data, n_padded + IV_SIZE,
123 + data + n_padded + IV_SIZE)) {
124 egg_secure_free (data);
125 g_set_error (error,
126 SECRET_ERROR,
127 @@ -681,7 +681,7 @@ _secret_file_item_decrypt (GVariant *encrypted,
128 }
129 n_padded -= IV_SIZE + MAC_SIZE;
130
131 - if (!calculate_mac (collection, data, n_padded + IV_SIZE, mac)) {
132 + if (!do_calculate_mac (collection, data, n_padded + IV_SIZE, mac)) {
133 egg_secure_free (data);
134 g_set_error (error,
135 SECRET_ERROR,
136 @@ -699,7 +699,7 @@ _secret_file_item_decrypt (GVariant *encrypted,
137 return FALSE;
138 }
139
140 - if (!decrypt (collection, data, n_padded)) {
141 + if (!do_decrypt (collection, data, n_padded)) {
142 egg_secure_free (data);
143 g_set_error (error,
144 SECRET_ERROR,