diff options
author | Stefan Walter <stefw@src.gnome.org> | 2009-01-17 23:27:10 +0000 |
---|---|---|
committer | Stefan Walter <stefw@src.gnome.org> | 2009-01-17 23:27:10 +0000 |
commit | 8275e87c00dee20cef93fe43859146625b4e0125 (patch) | |
tree | a51ac95811071e22acc0fda7ead6e0254dea5002 /daemon | |
parent | 9ecb5005899a9fd5cd1575b5d10f294cf126d24b (diff) |
Consolidate truly common functionality into 'egg' library. Many more files
* egg/egg-asn1.c: (moved from pkcs11/gck/gck-data-asn1.c)
* egg/egg-asn1.h: (moved from pkcs11/gck/gck-data-asn1.h)
* egg/egg-buffer.c: (moved from common/gkr-buffer.c)
* egg/egg-buffer.h: (moved from common/gkr-buffer.h)
* egg/egg-secure-memory.c: (moved from common/gkr-secure-memory.c)
* egg/egg-secure-memory.h: (moved from common/gkr-secure-memory.h)
* egg/egg-unix-credentials.c: (moved from common/gkr-unix-credentials.c)
* egg/egg-unix-credentials.h: (moved from common/gkr-unix-credentials.h)
* egg/Makefile.am: (added)
* egg/pk.asn: (moved from pkcs11/gck/pk.asn)
* egg/pkix.asn: (moved from pkcs11/gck/pkix.asn)
* egg/tests/Makefile.am: (added)
* egg/tests/test.asn: (moved from pkcs11/gck/tests/test.asn)
* egg/tests/unit-test-asn1.c: (moved from pkcs11/gck/tests/unit-test-data-asn1.c)
* egg/tests/unit-test-secmem.c: (moved from common/tests/unit-test-secmem.c)
* egg/tests/test-data: (added) Consolidate truly common functionality into 'egg'
library. Many more files touched due to above changes.
svn path=/trunk/; revision=1461
Diffstat (limited to 'daemon')
37 files changed, 405 insertions, 405 deletions
diff --git a/daemon/gkr-daemon-io.c b/daemon/gkr-daemon-io.c index 6ad16414..4c7976ad 100644 --- a/daemon/gkr-daemon-io.c +++ b/daemon/gkr-daemon-io.c @@ -35,11 +35,11 @@ #include "gkr-daemon.h" #include "common/gkr-async.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-cleanup.h" #include "common/gkr-daemon-util.h" -#include "common/gkr-secure-memory.h" -#include "common/gkr-unix-credentials.h" +#include "egg/egg-secure-memory.h" +#include "egg/egg-unix-credentials.h" #include "keyrings/gkr-keyrings.h" @@ -69,8 +69,8 @@ typedef struct { GnomeKeyringApplicationRef *app_ref; - GkrBuffer input_buffer; - GkrBuffer output_buffer; + EggBuffer input_buffer; + EggBuffer output_buffer; } GnomeKeyringClient; static char socket_path[1024] = { 0, }; @@ -188,7 +188,7 @@ read_packet_with_size (GnomeKeyringClient *client) fd = client->sock; - gkr_buffer_resize (&client->input_buffer, 4); + egg_buffer_resize (&client->input_buffer, 4); if (!yield_and_read_all (fd, client->input_buffer.buf, 4)) return FALSE; @@ -198,7 +198,7 @@ read_packet_with_size (GnomeKeyringClient *client) return FALSE; } - gkr_buffer_resize (&client->input_buffer, packet_size + 4); + egg_buffer_resize (&client->input_buffer, packet_size + 4); if (!yield_and_read_all (fd, client->input_buffer.buf + 4, packet_size - 4)) return FALSE; @@ -212,7 +212,7 @@ yield_and_read_credentials (int sock, pid_t *pid, uid_t *uid) gkr_async_begin_concurrent (); - ret = gkr_unix_credentials_read (sock, pid, uid) >= 0; + ret = egg_unix_credentials_read (sock, pid, uid) >= 0; gkr_async_end_concurrent (); @@ -287,10 +287,10 @@ client_worker_main (gpointer user_data) /* Make sure keyrings in memory are up to date before doing anything */ gkr_keyrings_update (); - gkr_buffer_init_full (&client->output_buffer, 128, (GkrBufferAllocator)g_realloc); + egg_buffer_init_full (&client->output_buffer, 128, (EggBufferAllocator)g_realloc); /* Add empty size */ - gkr_buffer_add_uint32 (&client->output_buffer, 0); + egg_buffer_add_uint32 (&client->output_buffer, 0); memset (&req, 0, sizeof (req)); req.app_ref = client->app_ref; @@ -298,7 +298,7 @@ client_worker_main (gpointer user_data) if (!(keyring_ops[op])(&client->input_buffer, &client->output_buffer, &req)) return NULL; - if (!gkr_buffer_set_uint32 (&client->output_buffer, 0, + if (!egg_buffer_set_uint32 (&client->output_buffer, 0, client->output_buffer.len)) return NULL; @@ -319,8 +319,8 @@ client_worker_done (GkrAsyncWorker *worker, gpointer result, gpointer user_data) { GnomeKeyringClient *client = (GnomeKeyringClient*)user_data; - gkr_buffer_uninit (&client->input_buffer); - gkr_buffer_uninit (&client->output_buffer); + egg_buffer_uninit (&client->input_buffer); + egg_buffer_uninit (&client->output_buffer); if (client->app_ref != NULL) { gnome_keyring_application_ref_free (client->app_ref); @@ -346,7 +346,7 @@ client_new (int fd) * so we err on the side of caution and use secure memory in case * passwords or secrets are involved. */ - gkr_buffer_init_full (&client->input_buffer, 128, gkr_secure_realloc); + egg_buffer_init_full (&client->input_buffer, 128, egg_secure_realloc); client->worker = gkr_async_worker_start (client_worker_main, client_worker_done, client); diff --git a/daemon/gkr-daemon-ops.c b/daemon/gkr-daemon-ops.c index c20b9d89..ec1040f2 100644 --- a/daemon/gkr-daemon-ops.c +++ b/daemon/gkr-daemon-ops.c @@ -24,10 +24,10 @@ #include "gkr-daemon.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-daemon-util.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring.h" #include "keyrings/gkr-keyring-item.h" @@ -454,7 +454,7 @@ request_new_keyring_password (GkrKeyringRequest *req, const char *keyring_name, ret = ask->response >= GKR_ASK_RESPONSE_ALLOW; if (ret) { g_free (*password); - *password = gkr_secure_strdup (ask->typed_password); + *password = egg_secure_strdup (ask->typed_password); *volume = ask->location_selected; } @@ -550,10 +550,10 @@ request_change_keyring_password (GkrKeyringRequest *req, GkrKeyring* keyring, ret = ask->response >= GKR_ASK_RESPONSE_ALLOW; if (ret) { g_free (*password); - *password = gkr_secure_strdup (ask->typed_password); + *password = egg_secure_strdup (ask->typed_password); g_free (*original); - *original = gkr_secure_strdup (ask->original_password); + *original = egg_secure_strdup (ask->original_password); } g_object_unref (ask); @@ -686,14 +686,14 @@ change_keyring_password (GkrKeyring *keyring, const char *password) if (keyring->locked) { return GNOME_KEYRING_RESULT_DENIED; } else { - keyring->password = gkr_secure_strdup (password); + keyring->password = egg_secure_strdup (password); gkr_keyring_save_to_disk (keyring); return GNOME_KEYRING_RESULT_OK; } } static gboolean -op_lock_keyring (GkrBuffer *packet, GkrBuffer *result, +op_lock_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -705,10 +705,10 @@ op_lock_keyring (GkrBuffer *packet, GkrBuffer *result, keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); } else { gkr_keyring_lock (keyring); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); } g_free (keyring_name); @@ -724,16 +724,16 @@ lock_each_keyring (GkrKeyring* keyring, gpointer unused) } static gboolean -op_lock_all (GkrBuffer *packet, GkrBuffer *result, +op_lock_all (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { gkr_keyrings_foreach (lock_each_keyring, NULL); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); return TRUE; } static gboolean -op_set_default_keyring (GkrBuffer *packet, GkrBuffer *result, +op_set_default_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -745,14 +745,14 @@ op_set_default_keyring (GkrBuffer *packet, GkrBuffer *result, if (keyring_name == NULL) { gkr_keyrings_set_default (NULL); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); } else { keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); } else { gkr_keyrings_set_default (keyring); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); } } @@ -762,13 +762,13 @@ op_set_default_keyring (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_get_default_keyring (GkrBuffer *packet, GkrBuffer *result, +op_get_default_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { GkrKeyring* keyring; char *name; - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); name = NULL; @@ -785,17 +785,17 @@ op_get_default_keyring (GkrBuffer *packet, GkrBuffer *result, static gboolean add_name_to_result (GkrKeyring* keyring, gpointer result) { - return gkr_proto_add_utf8_string ((GkrBuffer*)result, + return gkr_proto_add_utf8_string ((EggBuffer*)result, keyring->keyring_name); } static gboolean -op_list_keyrings (GkrBuffer *packet, GkrBuffer *result, +op_list_keyrings (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); - gkr_buffer_add_uint32 (result, gkr_keyrings_get_count ()); + egg_buffer_add_uint32 (result, gkr_keyrings_get_count ()); if (!gkr_keyrings_foreach (add_name_to_result, result)) return FALSE; @@ -804,7 +804,7 @@ op_list_keyrings (GkrBuffer *packet, GkrBuffer *result, static gboolean -op_set_keyring_info (GkrBuffer *packet, GkrBuffer *result, +op_set_keyring_info (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -821,9 +821,9 @@ op_set_keyring_info (GkrBuffer *packet, GkrBuffer *result, keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); } else { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); keyring->lock_on_idle = lock_on_idle; keyring->lock_timeout = lock_timeout; @@ -835,7 +835,7 @@ op_set_keyring_info (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_get_keyring_info (GkrBuffer *packet, GkrBuffer *result, +op_get_keyring_info (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -847,15 +847,15 @@ op_get_keyring_info (GkrBuffer *packet, GkrBuffer *result, keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); } else { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); - gkr_buffer_add_uint32 (result, keyring->lock_on_idle); - gkr_buffer_add_uint32 (result, keyring->lock_timeout); + egg_buffer_add_uint32 (result, keyring->lock_on_idle); + egg_buffer_add_uint32 (result, keyring->lock_timeout); gkr_proto_add_time (result, keyring->mtime); gkr_proto_add_time (result, keyring->ctime); - gkr_buffer_add_uint32 (result, keyring->locked); + egg_buffer_add_uint32 (result, keyring->locked); } g_free (keyring_name); @@ -864,7 +864,7 @@ op_get_keyring_info (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_create_keyring (GkrBuffer *packet, GkrBuffer *result, +op_create_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { GQuark volume = GKR_LOCATION_VOLUME_LOCAL; @@ -881,25 +881,25 @@ op_create_keyring (GkrBuffer *packet, GkrBuffer *result, g_assert (opcode == GNOME_KEYRING_OP_CREATE_KEYRING); if (keyring_name == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_BAD_ARGUMENTS); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_BAD_ARGUMENTS); goto out; } keyring = gkr_keyrings_find (keyring_name); if (keyring != NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_ALREADY_EXISTS); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_ALREADY_EXISTS); goto out; } /* Let user pick password if necessary*/ if (!request_new_keyring_password (req, keyring_name, &password, &volume)) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); goto out; } keyring = gkr_keyring_create (volume, keyring_name, password); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); goto out; } @@ -910,17 +910,17 @@ op_create_keyring (GkrBuffer *packet, GkrBuffer *result, g_object_unref (keyring); g_assert (GKR_IS_KEYRING (keyring)); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); out: g_free (keyring_name); - gkr_secure_strfree (password); + egg_secure_strfree (password); return TRUE; } static gboolean -op_unlock_keyring (GkrBuffer *packet, GkrBuffer *result, +op_unlock_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name, *password; @@ -938,7 +938,7 @@ op_unlock_keyring (GkrBuffer *packet, GkrBuffer *result, keyring = gkr_keyrings_find (keyring_name); if (!keyring) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); goto out; } @@ -946,9 +946,9 @@ op_unlock_keyring (GkrBuffer *packet, GkrBuffer *result, /* User types password */ if (password == NULL) { if (request_keyring_access (req, keyring)) - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); else - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); /* Password specified */ } else { @@ -956,19 +956,19 @@ op_unlock_keyring (GkrBuffer *packet, GkrBuffer *result, res = GNOME_KEYRING_RESULT_OK; else res = GNOME_KEYRING_RESULT_DENIED; - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); } out: g_free (keyring_name); - gkr_secure_strfree (password); + egg_secure_strfree (password); return TRUE; } static gboolean -op_delete_keyring (GkrBuffer *packet, GkrBuffer *result, +op_delete_keyring (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -995,7 +995,7 @@ op_delete_keyring (GkrBuffer *packet, GkrBuffer *result, } } - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); g_free (keyring_name); if (res == GNOME_KEYRING_RESULT_OK) @@ -1005,7 +1005,7 @@ op_delete_keyring (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_change_keyring_password (GkrBuffer *packet, GkrBuffer *result, +op_change_keyring_password (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name, *original, *password; @@ -1022,41 +1022,41 @@ op_change_keyring_password (GkrBuffer *packet, GkrBuffer *result, g_assert (opcode == GNOME_KEYRING_OP_CHANGE_KEYRING_PASSWORD); if (keyring_name == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_BAD_ARGUMENTS); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_BAD_ARGUMENTS); goto out; } keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); goto out; } /* Prompt for any missing passwords */ if (!request_change_keyring_password (req, keyring, &original, &password)) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); goto out; } gkr_keyring_lock (keyring); if (!gkr_keyring_unlock (keyring, original)) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); goto out; } - gkr_buffer_add_uint32 (result, change_keyring_password (keyring, password)); + egg_buffer_add_uint32 (result, change_keyring_password (keyring, password)); out: g_free (keyring_name); - gkr_secure_strfree (original); - gkr_secure_strfree (password); + egg_secure_strfree (original); + egg_secure_strfree (password); return TRUE; } static gboolean -op_list_items (GkrBuffer *packet, GkrBuffer *result, +op_list_items (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { GkrKeyring *keyring; @@ -1070,16 +1070,16 @@ op_list_items (GkrBuffer *packet, GkrBuffer *result, keyring = gkr_keyrings_find (keyring_name); if (keyring == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); - gkr_buffer_add_uint32 (result, 0); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_SUCH_KEYRING); + egg_buffer_add_uint32 (result, 0); } else if (!request_keyring_access (req, keyring)) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); - gkr_buffer_add_uint32 (result, 0); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, 0); } else { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); items = NULL; for (l = keyring->items; l != NULL; l = l->next) { @@ -1089,10 +1089,10 @@ op_list_items (GkrBuffer *packet, GkrBuffer *result, items = g_list_reverse (items); /* Send the results */ - gkr_buffer_add_uint32 (result, g_list_length (items)); + egg_buffer_add_uint32 (result, g_list_length (items)); for (l = items; l != NULL; l = l->next) { item = l->data; - gkr_buffer_add_uint32 (result, item->id); + egg_buffer_add_uint32 (result, item->id); } g_list_free (items); @@ -1104,7 +1104,7 @@ op_list_items (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_create_item (GkrBuffer *packet, GkrBuffer *result, +op_create_item (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name, *display_name, *secret; @@ -1182,8 +1182,8 @@ op_create_item (GkrBuffer *packet, GkrBuffer *result, g_free (item->display_name); item->display_name = g_strdup (display_name); - gkr_secure_strfree (item->secret); - item->secret = gkr_secure_strdup (secret); + egg_secure_strfree (item->secret); + item->secret = egg_secure_strdup (secret); gnome_keyring_attribute_list_free (item->attributes); item->attributes = gnome_keyring_attribute_list_copy (attributes); @@ -1198,17 +1198,17 @@ op_create_item (GkrBuffer *packet, GkrBuffer *result, out: g_free (keyring_name); g_free (display_name); - gkr_secure_strfree (secret); + egg_secure_strfree (secret); gnome_keyring_attribute_list_free (hashed); gnome_keyring_attribute_list_free (attributes); - gkr_buffer_add_uint32 (result, res); - gkr_buffer_add_uint32 (result, id); + egg_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, id); return TRUE; } static gboolean -op_delete_item (GkrBuffer *packet, GkrBuffer *result, +op_delete_item (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1233,7 +1233,7 @@ op_delete_item (GkrBuffer *packet, GkrBuffer *result, TRUE, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { if (item->keyring) { keyring = item->keyring; @@ -1247,7 +1247,7 @@ op_delete_item (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_get_item_info (GkrBuffer *packet, GkrBuffer *result, +op_get_item_info (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name, *secret; @@ -1270,9 +1270,9 @@ op_get_item_info (GkrBuffer *packet, GkrBuffer *result, (flags & GNOME_KEYRING_ITEM_INFO_SECRET) == GNOME_KEYRING_ITEM_INFO_SECRET, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { - gkr_buffer_add_uint32 (result, item->type); + egg_buffer_add_uint32 (result, item->type); if (!gkr_proto_add_utf8_string (result, item->display_name)) ret = FALSE; @@ -1294,7 +1294,7 @@ op_get_item_info (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_get_item_attributes (GkrBuffer *packet, GkrBuffer *result, +op_get_item_attributes (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1318,7 +1318,7 @@ op_get_item_attributes (GkrBuffer *packet, GkrBuffer *result, FALSE, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { if (!gkr_proto_add_attribute_list (result, item->attributes)) ret = FALSE; @@ -1329,7 +1329,7 @@ op_get_item_attributes (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_get_item_acl (GkrBuffer *packet, GkrBuffer *result, +op_get_item_acl (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1353,7 +1353,7 @@ op_get_item_acl (GkrBuffer *packet, GkrBuffer *result, FALSE, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { if (!gkr_proto_add_acl (result, item->acl)) ret = FALSE; @@ -1364,7 +1364,7 @@ op_get_item_acl (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_set_item_acl (GkrBuffer *packet, GkrBuffer *result, +op_set_item_acl (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1395,7 +1395,7 @@ op_set_item_acl (GkrBuffer *packet, GkrBuffer *result, gkr_keyring_save_to_disk (item->keyring); } - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); gnome_keyring_acl_free (acl); g_free (keyring_name); @@ -1403,7 +1403,7 @@ op_set_item_acl (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_set_item_info (GkrBuffer *packet, GkrBuffer *result, +op_set_item_info (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1428,7 +1428,7 @@ op_set_item_info (GkrBuffer *packet, GkrBuffer *result, TRUE, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { if ((type & GNOME_KEYRING_ITEM_TYPE_MASK) != GNOME_KEYRING_ITEM_NO_TYPE) { item->type = type; @@ -1438,8 +1438,8 @@ op_set_item_info (GkrBuffer *packet, GkrBuffer *result, item->display_name = g_strdup (item_name); } if (secret != NULL) { - gkr_secure_strfree (item->secret); - item->secret = gkr_secure_strdup (secret); + egg_secure_strfree (item->secret); + item->secret = egg_secure_strdup (secret); } if (item->keyring) @@ -1448,12 +1448,12 @@ op_set_item_info (GkrBuffer *packet, GkrBuffer *result, g_free (keyring_name); g_free (item_name); - gkr_secure_strfree (secret); + egg_secure_strfree (secret); return TRUE; } static gboolean -op_set_daemon_display (GkrBuffer *packet, GkrBuffer *result, +op_set_daemon_display (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *display; @@ -1463,10 +1463,10 @@ op_set_daemon_display (GkrBuffer *packet, GkrBuffer *result, return FALSE; if (display == NULL) { - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); } else { g_setenv ("DISPLAY", display, FALSE); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); } g_free (display); @@ -1474,7 +1474,7 @@ op_set_daemon_display (GkrBuffer *packet, GkrBuffer *result, } static gboolean -op_set_item_attributes (GkrBuffer *packet, GkrBuffer *result, +op_set_item_attributes (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { char *keyring_name; @@ -1497,7 +1497,7 @@ op_set_item_attributes (GkrBuffer *packet, GkrBuffer *result, TRUE, &item); - gkr_buffer_add_uint32 (result, res); + egg_buffer_add_uint32 (result, res); if (res == GNOME_KEYRING_RESULT_OK) { gnome_keyring_attribute_list_free (item->attributes); item->attributes = gnome_keyring_attribute_list_copy (attributes); @@ -1614,7 +1614,7 @@ unref_object (gpointer obj, gpointer data) } static gboolean -op_find (GkrBuffer *packet, GkrBuffer *result, GkrKeyringRequest *req) +op_find (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { FindContext ctx; GList *l; @@ -1639,15 +1639,15 @@ op_find (GkrBuffer *packet, GkrBuffer *result, GkrKeyringRequest *req) /* No items given access to */ if (ctx.nfound > 0 && ctx.items == NULL) - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_DENIED); /* Zero items matched */ else if (ctx.nfound == 0) - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_MATCH); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_NO_MATCH); /* More than one item found and given access to */ else - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); ctx.items = g_list_sort_with_data (ctx.items, sort_found, ctx.attributes); @@ -1664,7 +1664,7 @@ op_find (GkrBuffer *packet, GkrBuffer *result, GkrKeyringRequest *req) break; } - gkr_buffer_add_uint32 (result, item->id); + egg_buffer_add_uint32 (result, item->id); if (!gkr_proto_add_utf8_secret (result, item->secret) || !gkr_proto_add_attribute_list (result, item->attributes)) { @@ -1684,7 +1684,7 @@ op_find (GkrBuffer *packet, GkrBuffer *result, GkrKeyringRequest *req) } static gboolean -op_prepare_daemon_environment (GkrBuffer *packet, GkrBuffer *result, GkrKeyringRequest *req) +op_prepare_daemon_environment (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req) { const gchar **daemonenv; gchar **environment, **e; @@ -1719,13 +1719,13 @@ op_prepare_daemon_environment (GkrBuffer *packet, GkrBuffer *result, GkrKeyringR */ gkr_daemon_complete_initialization(); - gkr_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); + egg_buffer_add_uint32 (result, GNOME_KEYRING_RESULT_OK); /* These are the environment variables that the daemon setup */ daemonenv = gkr_daemon_util_get_environment (); g_return_val_if_fail (daemonenv, FALSE); - gkr_buffer_add_stringv (result, daemonenv); + egg_buffer_add_stringv (result, daemonenv); return TRUE; } diff --git a/daemon/gkr-daemon.c b/daemon/gkr-daemon.c index 3b2f7a2a..6773cbbe 100644 --- a/daemon/gkr-daemon.c +++ b/daemon/gkr-daemon.c @@ -28,8 +28,8 @@ #include "common/gkr-cleanup.h" #include "common/gkr-crypto.h" #include "common/gkr-daemon-util.h" -#include "common/gkr-secure-memory.h" -#include "common/gkr-unix-credentials.h" +#include "egg/egg-secure-memory.h" +#include "egg/egg-unix-credentials.h" #include "common/gkr-unix-signal.h" #include "keyrings/gkr-keyring-login.h" @@ -220,19 +220,19 @@ static gboolean do_warning = TRUE; */ void -gkr_memory_lock (void) +egg_memory_lock (void) { /* The daemon uses cooperative threading, and doesn't need locking */ } void -gkr_memory_unlock (void) +egg_memory_unlock (void) { /* The daemon uses cooperative threading, and doesn't need locking */ } void* -gkr_memory_fallback (void *p, unsigned long sz) +egg_memory_fallback (void *p, unsigned long sz) { const gchar *env; @@ -368,7 +368,7 @@ read_login_password (int fd) * password. */ - gchar *buf = gkr_secure_alloc (MAX_BLOCK); + gchar *buf = egg_secure_alloc (MAX_BLOCK); gchar *ret = NULL; int r, len = 0; @@ -377,12 +377,12 @@ read_login_password (int fd) if (r < 0) { if (errno == EAGAIN) continue; - gkr_secure_free (ret); - gkr_secure_free (buf); + egg_secure_free (ret); + egg_secure_free (buf); return NULL; } else { - char *n = gkr_secure_realloc (ret, len + r + 1); + char *n = egg_secure_realloc (ret, len + r + 1); memset(n + len, 0, r + 1); ret = n; len = len + r; @@ -394,7 +394,7 @@ read_login_password (int fd) break; } - gkr_secure_free (buf); + egg_secure_free (buf); return ret; } @@ -409,7 +409,7 @@ static void clear_login_password (void) { if(login_password) - gkr_secure_strfree (login_password); + egg_secure_strfree (login_password); login_password = NULL; } @@ -458,20 +458,20 @@ initialize_other_running_daemon (int sock) { GnomeKeyringResult res; gchar **envp, **e; - GkrBuffer buf; + EggBuffer buf; gboolean ret; - if (gkr_unix_credentials_write (sock) < 0) + if (egg_unix_credentials_write (sock) < 0) return FALSE; - gkr_buffer_init_full (&buf, 128, (GkrBufferAllocator)g_realloc); + egg_buffer_init_full (&buf, 128, (EggBufferAllocator)g_realloc); envp = gnome_keyring_build_environment (GNOME_KEYRING_IN_ENVIRONMENT); ret = gkr_proto_encode_prepare_environment (&buf, (const gchar**)envp); g_strfreev (envp); if (!ret) { - gkr_buffer_uninit (&buf); + egg_buffer_uninit (&buf); g_return_val_if_reached (FALSE); } @@ -482,7 +482,7 @@ initialize_other_running_daemon (int sock) gkr_proto_decode_prepare_environment_reply (&buf, &res, &envp); - gkr_buffer_uninit (&buf); + egg_buffer_uninit (&buf); if(!ret) { g_warning ("couldn't initialize running daemon"); @@ -745,7 +745,7 @@ main (int argc, char *argv[]) if (login_password) { if (!gkr_keyring_login_unlock (login_password)) g_warning ("Failed to unlock login on startup"); - gkr_secure_strclear (login_password); + egg_secure_strclear (login_password); } g_main_loop_run (loop); diff --git a/daemon/gkr-daemon.h b/daemon/gkr-daemon.h index 2641e1b4..f37fd7eb 100644 --- a/daemon/gkr-daemon.h +++ b/daemon/gkr-daemon.h @@ -27,7 +27,7 @@ #include <sys/types.h> #include <glib.h> -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "keyrings/gkr-keyring.h" #include "keyrings/gkr-keyring-item.h" @@ -40,7 +40,7 @@ typedef struct { GnomeKeyringApplicationRef *app_ref; } GkrKeyringRequest; -typedef gboolean (*GkrDaemonOperation) (GkrBuffer *packet, GkrBuffer *result, +typedef gboolean (*GkrDaemonOperation) (EggBuffer *packet, EggBuffer *result, GkrKeyringRequest *req); extern GkrDaemonOperation keyring_ops[]; diff --git a/daemon/keyrings/gkr-keyring-binary.c b/daemon/keyrings/gkr-keyring-binary.c index b5a54e46..ab655f02 100644 --- a/daemon/keyrings/gkr-keyring-binary.c +++ b/daemon/keyrings/gkr-keyring-binary.c @@ -27,9 +27,9 @@ #include "gkr-keyring.h" #include "gkr-keyring-item.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring-private.h" #include "library/gnome-keyring-proto.h" @@ -105,7 +105,7 @@ init_salt (guchar salt[8]) } static gboolean -encrypt_buffer (GkrBuffer *buffer, +encrypt_buffer (EggBuffer *buffer, const char *password, guchar salt[8], int iterations) @@ -127,7 +127,7 @@ encrypt_buffer (GkrBuffer *buffer, if (gerr) { g_warning ("couldn't create aes cipher context: %s", gcry_strerror (gerr)); - gkr_secure_free (key); + egg_secure_free (key); g_free (iv); return FALSE; } @@ -135,7 +135,7 @@ encrypt_buffer (GkrBuffer *buffer, /* 16 = 128 bits */ gerr = gcry_cipher_setkey (cih, key, 16); g_return_val_if_fail (!gerr, FALSE); - gkr_secure_free (key); + egg_secure_free (key); /* 16 = 128 bits */ gerr = gcry_cipher_setiv (cih, iv, 16); @@ -154,7 +154,7 @@ encrypt_buffer (GkrBuffer *buffer, } static gboolean -decrypt_buffer (GkrBuffer *buffer, +decrypt_buffer (EggBuffer *buffer, const char *password, guchar salt[8], int iterations) @@ -176,7 +176,7 @@ decrypt_buffer (GkrBuffer *buffer, if (gerr) { g_warning ("couldn't create aes cipher context: %s", gcry_strerror (gerr)); - gkr_secure_free (key); + egg_secure_free (key); g_free (iv); return FALSE; } @@ -184,7 +184,7 @@ decrypt_buffer (GkrBuffer *buffer, /* 16 = 128 bits */ gerr = gcry_cipher_setkey (cih, key, 16); g_return_val_if_fail (!gerr, FALSE); - gkr_secure_free (key); + egg_secure_free (key); /* 16 = 128 bits */ gerr = gcry_cipher_setiv (cih, iv, 16); @@ -203,7 +203,7 @@ decrypt_buffer (GkrBuffer *buffer, } static gboolean -verify_decrypted_buffer (GkrBuffer *buffer) +verify_decrypted_buffer (EggBuffer *buffer) { guchar digest[16]; @@ -217,17 +217,17 @@ verify_decrypted_buffer (GkrBuffer *buffer) } static gboolean -generate_acl_data (GkrBuffer *buffer, GList *acl) +generate_acl_data (EggBuffer *buffer, GList *acl) { GList *l; GnomeKeyringAccessControl *ac; - gkr_buffer_add_uint32 (buffer, g_list_length (acl)); + egg_buffer_add_uint32 (buffer, g_list_length (acl)); for (l = acl; l != NULL; l = l->next) { ac = l->data; - gkr_buffer_add_uint32 (buffer, ac->types_allowed); + egg_buffer_add_uint32 (buffer, ac->types_allowed); if (!gkr_proto_add_utf8_string (buffer, ac->application->display_name)) { return FALSE; } @@ -238,14 +238,14 @@ generate_acl_data (GkrBuffer *buffer, GList *acl) if (!gkr_proto_add_utf8_string (buffer, NULL)) { return FALSE; } - gkr_buffer_add_uint32 (buffer, 0); + egg_buffer_add_uint32 (buffer, 0); } return TRUE; } static gboolean -generate_encrypted_data (GkrBuffer *buffer, GkrKeyring *keyring) +generate_encrypted_data (EggBuffer *buffer, GkrKeyring *keyring) { GList *l; int i; @@ -270,7 +270,7 @@ generate_encrypted_data (GkrBuffer *buffer, GkrKeyring *keyring) return FALSE; } for (i = 0; i < 4; i++) { - gkr_buffer_add_uint32 (buffer, 0); + egg_buffer_add_uint32 (buffer, 0); } if (!gkr_proto_add_attribute_list (buffer, item->attributes)) { @@ -284,13 +284,13 @@ generate_encrypted_data (GkrBuffer *buffer, GkrKeyring *keyring) } gboolean -gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer) +gkr_keyring_binary_generate (GkrKeyring *keyring, EggBuffer *buffer) { guint flags; GList *l; GkrKeyringItem *item; GnomeKeyringAttributeList *hashed; - GkrBuffer to_encrypt; + EggBuffer to_encrypt; guchar digest[16]; int i; @@ -306,11 +306,11 @@ gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer) keyring->salt_valid = TRUE; } - gkr_buffer_append (buffer, (guchar*)KEYRING_FILE_HEADER, KEYRING_FILE_HEADER_LEN); - gkr_buffer_add_byte (buffer, 0); /* Major version */ - gkr_buffer_add_byte (buffer, 0); /* Minor version */ - gkr_buffer_add_byte (buffer, 0); /* crypto (0 == AEL) */ - gkr_buffer_add_byte (buffer, 0); /* hash (0 == MD5) */ + egg_buffer_append (buffer, (guchar*)KEYRING_FILE_HEADER, KEYRING_FILE_HEADER_LEN); + egg_buffer_add_byte (buffer, 0); /* Major version */ + egg_buffer_add_byte (buffer, 0); /* Minor version */ + egg_buffer_add_byte (buffer, 0); /* crypto (0 == AEL) */ + egg_buffer_add_byte (buffer, 0); /* hash (0 == MD5) */ if (!gkr_proto_add_utf8_string (buffer, keyring->keyring_name)) { return FALSE; @@ -323,23 +323,23 @@ gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer) if (keyring->lock_on_idle) { flags |= 1; } - gkr_buffer_add_uint32 (buffer, flags); - gkr_buffer_add_uint32 (buffer, keyring->lock_timeout); - gkr_buffer_add_uint32 (buffer, keyring->hash_iterations); - gkr_buffer_append (buffer, (guchar*)keyring->salt, 8); + egg_buffer_add_uint32 (buffer, flags); + egg_buffer_add_uint32 (buffer, keyring->lock_timeout); + egg_buffer_add_uint32 (buffer, keyring->hash_iterations); + egg_buffer_append (buffer, (guchar*)keyring->salt, 8); /* Reserved: */ for (i = 0; i < 4; i++) { - gkr_buffer_add_uint32 (buffer, 0); + egg_buffer_add_uint32 (buffer, 0); } /* Hashed items: */ - gkr_buffer_add_uint32 (buffer, g_list_length (keyring->items)); + egg_buffer_add_uint32 (buffer, g_list_length (keyring->items)); for (l = keyring->items; l != NULL; l = l->next) { item = l->data; - gkr_buffer_add_uint32 (buffer, item->id); - gkr_buffer_add_uint32 (buffer, item->type); + egg_buffer_add_uint32 (buffer, item->id); + egg_buffer_add_uint32 (buffer, item->type); hashed = gkr_attribute_list_hash (item->attributes); @@ -351,18 +351,18 @@ gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer) } /* Encrypted data. Use non-pageable memory */ - gkr_buffer_init_full (&to_encrypt, 4096, gkr_secure_realloc); + egg_buffer_init_full (&to_encrypt, 4096, egg_secure_realloc); - gkr_buffer_append (&to_encrypt, (guchar*)digest, 16); /* Space for hash */ + egg_buffer_append (&to_encrypt, (guchar*)digest, 16); /* Space for hash */ if (!generate_encrypted_data (&to_encrypt, keyring)) { - gkr_buffer_uninit (&to_encrypt); + egg_buffer_uninit (&to_encrypt); return FALSE; } /* Pad with zeros to multiple of 16 bytes */ while (to_encrypt.len % 16 != 0) { - gkr_buffer_add_byte (&to_encrypt, 0); + egg_buffer_add_byte (&to_encrypt, 0); } gcry_md_hash_buffer (GCRY_MD_MD5, (void*)digest, @@ -373,18 +373,18 @@ gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer) g_assert (keyring->hash_iterations); if (!encrypt_buffer (&to_encrypt, keyring->password, keyring->salt, keyring->hash_iterations)) { - gkr_buffer_uninit (&to_encrypt); + egg_buffer_uninit (&to_encrypt); return FALSE; } - gkr_buffer_add_uint32 (buffer, to_encrypt.len); - gkr_buffer_append (buffer, to_encrypt.buf, to_encrypt.len); - gkr_buffer_uninit (&to_encrypt); + egg_buffer_add_uint32 (buffer, to_encrypt.len); + egg_buffer_append (buffer, to_encrypt.buf, to_encrypt.len); + egg_buffer_uninit (&to_encrypt); return TRUE; } static gboolean -decode_acl (GkrBuffer *buffer, gsize offset, gsize *offset_out, GList **out) +decode_acl (EggBuffer *buffer, gsize offset, gsize *offset_out, GList **out) { GList *acl; guint32 num_acs; @@ -395,11 +395,11 @@ decode_acl (GkrBuffer *buffer, gsize offset, gsize *offset_out, GList **out) acl = NULL; - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &num_acs)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &num_acs)) { return FALSE; } for (i = 0; i < num_acs; i++) { - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &x)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &x)) { goto bail; } if (!gkr_proto_get_utf8_string (buffer, offset, &offset, &name)) { @@ -416,7 +416,7 @@ decode_acl (GkrBuffer *buffer, gsize offset, gsize *offset_out, GList **out) g_free (reserved); goto bail; } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &y)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &y)) { g_free (name); g_free (path); g_free (reserved); @@ -456,7 +456,7 @@ remove_unavailable_item (gpointer key, gpointer dummy, GkrKeyring *keyring) } gint -gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) +gkr_keyring_binary_parse (GkrKeyring *keyring, EggBuffer *buffer) { gsize offset; guchar major, minor, crypto, hash; @@ -471,7 +471,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) guint32 hash_iterations; guchar salt[8]; ItemInfo *items; - GkrBuffer to_decrypt = GKR_BUFFER_EMPTY; + EggBuffer to_decrypt = EGG_BUFFER_EMPTY; gboolean locked; GList *l; GHashTable *checks = NULL; @@ -482,7 +482,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) items = 0; /* We're decrypting this, so use secure memory */ - gkr_buffer_set_allocator (&to_decrypt, gkr_secure_realloc); + egg_buffer_set_allocator (&to_decrypt, egg_secure_realloc); if (buffer->len < KEYRING_FILE_HEADER_LEN) { return 0; @@ -511,13 +511,13 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) if (!gkr_proto_get_time (buffer, offset, &offset, &mtime)) { goto bail; } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &flags)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &flags)) { goto bail; } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &lock_timeout)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &lock_timeout)) { goto bail; } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &hash_iterations)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &hash_iterations)) { goto bail; } if (!gkr_proto_get_bytes (buffer, offset, &offset, salt, 8)) { @@ -525,7 +525,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) } for (i = 0; i < 4; i++) { - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &tmp)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp)) { goto bail; } /* reserved bytes must be zero */ @@ -533,18 +533,18 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) goto bail; } } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &num_items)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &num_items)) { goto bail; } items = g_new0 (ItemInfo, num_items); for (i = 0; i < num_items; i++) { - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &items[i].id)) { goto bail; } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &items[i].type)) { goto bail; } @@ -554,7 +554,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) } } - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &crypto_size)) { goto bail; } @@ -565,7 +565,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) } /* Copy the data into to_decrypt into non-pageable memory */ - gkr_buffer_init_static (&to_decrypt, buffer->buf + offset, crypto_size); + egg_buffer_init_static (&to_decrypt, buffer->buf + offset, crypto_size); locked = TRUE; if (keyring->password != NULL) { @@ -574,7 +574,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) goto bail; } if (!verify_decrypted_buffer (&to_decrypt)) { - gkr_secure_strfree (keyring->password); + egg_secure_strfree (keyring->password); keyring->password = NULL; } else { locked = FALSE; @@ -605,7 +605,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) } for (j = 0; j < 4; j++) { guint32 tmp; - if (!gkr_buffer_get_uint32 (buffer, offset, &offset, &tmp)) { + if (!egg_buffer_get_uint32 (buffer, offset, &offset, &tmp)) { goto bail; } /* reserved bytes must be zero */ @@ -663,7 +663,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) g_free (item->display_name); item->display_name = NULL; - gkr_secure_strfree (item->secret); + egg_secure_strfree (item->secret); item->secret = NULL; if (item->acl) { gnome_keyring_acl_free (item->acl); @@ -692,7 +692,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) return 1; bail: - gkr_buffer_uninit (&to_decrypt); + egg_buffer_uninit (&to_decrypt); if (checks) g_hash_table_destroy (checks); g_free (display_name); @@ -700,7 +700,7 @@ gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer) if (items != NULL) { for (i = 0; i < num_items; i++) { g_free (items[i].display_name); - gkr_secure_strfree (items[i].secret); + egg_secure_strfree (items[i].secret); gnome_keyring_attribute_list_free (items[i].hashed_attributes); gnome_keyring_attribute_list_free (items[i].attributes); gnome_keyring_acl_free (items[i].acl); diff --git a/daemon/keyrings/gkr-keyring-item.c b/daemon/keyrings/gkr-keyring-item.c index f1b9b6db..60fac3dd 100644 --- a/daemon/keyrings/gkr-keyring-item.c +++ b/daemon/keyrings/gkr-keyring-item.c @@ -26,7 +26,7 @@ #include "gkr-keyring-item.h" #include "gkr-keyring.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <gcrypt.h> @@ -131,7 +131,7 @@ gkr_keyring_item_finalize (GObject *obj) if (item->acl != NULL) gnome_keyring_acl_free (item->acl); g_free (item->display_name); - gkr_secure_strfree (item->secret); + egg_secure_strfree (item->secret); G_OBJECT_CLASS (gkr_keyring_item_parent_class)->finalize (obj); } @@ -208,7 +208,7 @@ gkr_keyring_item_clone (GkrKeyring* new_keyring, GkrKeyringItem *item) nitem->locked = item->locked; nitem->type = item->type; - nitem->secret = gkr_secure_strdup (item->secret); + nitem->secret = egg_secure_strdup (item->secret); nitem->display_name = g_strdup (item->display_name); nitem->attributes = gnome_keyring_attribute_list_copy (item->attributes); diff --git a/daemon/keyrings/gkr-keyring-login.c b/daemon/keyrings/gkr-keyring-login.c index aed2bbfa..b9688ef8 100644 --- a/daemon/keyrings/gkr-keyring-login.c +++ b/daemon/keyrings/gkr-keyring-login.c @@ -30,7 +30,7 @@ #include "gkr-keyrings.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring.h" @@ -130,7 +130,7 @@ request_login_new (gchar **password) gkr_ask_daemon_process (ask); ret = ask->response >= GKR_ASK_RESPONSE_ALLOW; if (ret) - *password = gkr_secure_strdup (ask->typed_password); + *password = egg_secure_strdup (ask->typed_password); g_object_unref (ask); return ret; } @@ -173,7 +173,7 @@ gkr_keyring_login_unlock (const gchar *password) /* No such keyring exists, so create one */ login = gkr_keyring_create (GKR_LOCATION_VOLUME_LOCAL, "login", password); - gkr_secure_strfree (new_password); + egg_secure_strfree (new_password); if (!login) { g_warning ("Failed to create login keyring"); @@ -258,8 +258,8 @@ gkr_keyring_login_attach_secret (GnomeKeyringItemType type, const gchar *display g_free (item->display_name); item->display_name = g_strdup (display_name); - gkr_secure_strfree (item->secret); - item->secret = gkr_secure_strdup (secret); + egg_secure_strfree (item->secret); + item->secret = egg_secure_strdup (secret); gnome_keyring_attribute_list_free (item->attributes); item->attributes = attrs; diff --git a/daemon/keyrings/gkr-keyring-textual.c b/daemon/keyrings/gkr-keyring-textual.c index 4f3a3a99..62bb9e6b 100644 --- a/daemon/keyrings/gkr-keyring-textual.c +++ b/daemon/keyrings/gkr-keyring-textual.c @@ -26,7 +26,7 @@ #include "gkr-keyring.h" #include "gkr-keyring-item.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring.h" #include "library/gnome-keyring-private.h" @@ -277,9 +277,9 @@ parse_item (GKeyFile *file, GkrKeyringItem *item, const gchar **groups) item->display_name = g_key_file_get_string (file, groupname, "display-name", NULL); /* Even though this is from disk, use secure memory just to be consistent */ - gkr_secure_free (item->secret); + egg_secure_free (item->secret); val = g_key_file_get_string (file, groupname, "secret", NULL); - item->secret = gkr_secure_strdup (val); + item->secret = egg_secure_strdup (val); g_free (val); item->mtime = 0; @@ -297,7 +297,7 @@ parse_item (GKeyFile *file, GkrKeyringItem *item, const gchar **groups) } gboolean -gkr_keyring_textual_generate (GkrKeyring *keyring, GkrBuffer *buffer) +gkr_keyring_textual_generate (GkrKeyring *keyring, EggBuffer *buffer) { GkrKeyringItem *item; GKeyFile *file; @@ -332,8 +332,8 @@ gkr_keyring_textual_generate (GkrKeyring *keyring, GkrBuffer *buffer) return FALSE; } - gkr_buffer_uninit (buffer); - gkr_buffer_init_allocated (buffer, (guchar*)data, n_data, NULL); + egg_buffer_uninit (buffer); + egg_buffer_init_allocated (buffer, (guchar*)data, n_data, NULL); return TRUE; } @@ -353,7 +353,7 @@ remove_unavailable_item (gpointer key, gpointer dummy, GkrKeyring *keyring) } gint -gkr_keyring_textual_parse (GkrKeyring *keyring, GkrBuffer *buffer) +gkr_keyring_textual_parse (GkrKeyring *keyring, EggBuffer *buffer) { GkrKeyringItem *item; GError *err = NULL; diff --git a/daemon/keyrings/gkr-keyring.c b/daemon/keyrings/gkr-keyring.c index 90dc59c3..515ecc7e 100644 --- a/daemon/keyrings/gkr-keyring.c +++ b/daemon/keyrings/gkr-keyring.c @@ -29,9 +29,9 @@ #include "gkr-keyring-login.h" #include "gkr-keyrings.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring-private.h" #include "library/gnome-keyring-proto.h" @@ -183,7 +183,7 @@ gkr_keyring_dispose (GObject *obj) g_list_free (keyring->items); keyring->items = NULL; - gkr_secure_strfree (keyring->password); + egg_secure_strfree (keyring->password); keyring->password = NULL; G_OBJECT_CLASS (gkr_keyring_parent_class)->dispose (obj); @@ -263,7 +263,7 @@ gkr_keyring_create (GQuark location, const gchar *keyring_name, const gchar *pas if (keyring != NULL) { keyring->location = location; keyring->locked = FALSE; - keyring->password = gkr_secure_strdup (password); + keyring->password = egg_secure_strdup (password); keyring->salt_valid = FALSE; gkr_keyring_save_to_disk (keyring); } @@ -362,7 +362,7 @@ gkr_keyring_remove_item (GkrKeyring* keyring, GkrKeyringItem* item) gboolean gkr_keyring_update_from_disk (GkrKeyring *keyring) { - GkrBuffer buffer; + EggBuffer buffer; GError *err = NULL; guchar *contents = NULL; gsize len; @@ -377,13 +377,13 @@ gkr_keyring_update_from_disk (GkrKeyring *keyring) return FALSE; } - gkr_buffer_init_static (&buffer, contents, len); + egg_buffer_init_static (&buffer, contents, len); result = gkr_keyring_binary_parse (keyring, &buffer); if (result == 0) result = gkr_keyring_textual_parse (keyring, &buffer); - gkr_buffer_uninit (&buffer); + egg_buffer_uninit (&buffer); g_free (contents); if (result > 0) @@ -421,7 +421,7 @@ gboolean gkr_keyring_save_to_disk (GkrKeyring *keyring) { struct stat statbuf; - GkrBuffer out; + EggBuffer out; int fd; char *dirname; char *template; @@ -441,7 +441,7 @@ gkr_keyring_save_to_disk (GkrKeyring *keyring) if (!file) return FALSE; - gkr_buffer_init_full (&out, 4096, (GkrBufferAllocator)g_realloc); + egg_buffer_init_full (&out, 4096, (EggBufferAllocator)g_realloc); /* Generate it */ if (!keyring->password || !keyring->password[0]) @@ -486,7 +486,7 @@ gkr_keyring_save_to_disk (GkrKeyring *keyring) ret = FALSE; } - gkr_buffer_uninit (&out); + egg_buffer_uninit (&out); g_free (file); return ret; } @@ -503,7 +503,7 @@ gkr_keyring_lock (GkrKeyring *keyring) g_assert (keyring->password != NULL); - gkr_secure_strfree (keyring->password); + egg_secure_strfree (keyring->password); keyring->password = NULL; if (!gkr_keyring_update_from_disk (keyring)) { /* Failed to re-read, remove the keyring */ @@ -522,9 +522,9 @@ gkr_keyring_unlock (GkrKeyring *keyring, const gchar *password) g_assert (keyring->password == NULL); - keyring->password = gkr_secure_strdup (password); + keyring->password = egg_secure_strdup (password); if (!gkr_keyring_update_from_disk (keyring)) { - gkr_secure_strfree (keyring->password); + egg_secure_strfree (keyring->password); keyring->password = NULL; } if (keyring->locked) { diff --git a/daemon/keyrings/gkr-keyring.h b/daemon/keyrings/gkr-keyring.h index 4d7f44d8..26425ab3 100644 --- a/daemon/keyrings/gkr-keyring.h +++ b/daemon/keyrings/gkr-keyring.h @@ -33,7 +33,7 @@ #include "gkr-keyring-item.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "library/gnome-keyring.h" @@ -131,13 +131,13 @@ gboolean gkr_keyring_ask_check_unlock (GkrAskRequest* ask); * 1 : successful */ -gboolean gkr_keyring_textual_generate (GkrKeyring *keyring, GkrBuffer *buffer); +gboolean gkr_keyring_textual_generate (GkrKeyring *keyring, EggBuffer *buffer); -gboolean gkr_keyring_binary_generate (GkrKeyring *keyring, GkrBuffer *buffer); +gboolean gkr_keyring_binary_generate (GkrKeyring *keyring, EggBuffer *buffer); -gint gkr_keyring_textual_parse (GkrKeyring *keyring, GkrBuffer *buffer); +gint gkr_keyring_textual_parse (GkrKeyring *keyring, EggBuffer *buffer); -gint gkr_keyring_binary_parse (GkrKeyring *keyring, GkrBuffer *buffer); +gint gkr_keyring_binary_parse (GkrKeyring *keyring, EggBuffer *buffer); G_END_DECLS diff --git a/daemon/keyrings/tests/unit-test-keyring-file.c b/daemon/keyrings/tests/unit-test-keyring-file.c index 4d535d09..1bc64ba4 100644 --- a/daemon/keyrings/tests/unit-test-keyring-file.c +++ b/daemon/keyrings/tests/unit-test-keyring-file.c @@ -25,7 +25,7 @@ #include "run-auto-test.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring.h" @@ -99,7 +99,7 @@ validate_keyring_contents (GkrKeyring *keyring, CuTest *cu) void unit_test_keyring_parse_encrypted (CuTest *cu) { GkrKeyring *encrypted, *plain; - GkrBuffer buffer, output; + EggBuffer buffer, output; gchar *data; gsize n_data; gint ret; @@ -113,26 +113,26 @@ void unit_test_keyring_parse_encrypted (CuTest *cu) g_assert (FALSE && "couldn't read in encrypted.keyring"); /* Parse it */ - gkr_buffer_init_allocated (&buffer, (guchar*)data, n_data, NULL); + egg_buffer_init_allocated (&buffer, (guchar*)data, n_data, NULL); data = g_memdup (data, n_data); /* Make a copy for double parse */ ret = gkr_keyring_binary_parse (encrypted, &buffer); - gkr_buffer_uninit (&buffer); + egg_buffer_uninit (&buffer); CuAssert (cu, "couldn't parse encrypted keyring", ret == 1); CuAssert (cu, "didn't unlock encrypted keyring", !encrypted->locked); validate_keyring_contents (encrypted, cu); /* Double parse shouldn't change it */ - gkr_buffer_init_allocated (&buffer, (guchar*)data, n_data, NULL); + egg_buffer_init_allocated (&buffer, (guchar*)data, n_data, NULL); ret = gkr_keyring_binary_parse (encrypted, &buffer); - gkr_buffer_uninit (&buffer); + egg_buffer_uninit (&buffer); CuAssert (cu, "couldn't parse encrypted keyring", ret == 1); CuAssert (cu, "didn't unlock encrypted keyring", !encrypted->locked); validate_keyring_contents (encrypted, cu); /* Output same data in the cleartext format */ - gkr_buffer_init (&output, 128); + egg_buffer_init (&output, 128); success = gkr_keyring_textual_generate (encrypted, &output); CuAssert (cu, "couldn't generate textual data", success); @@ -147,7 +147,7 @@ void unit_test_keyring_parse_encrypted (CuTest *cu) void unit_test_keyring_parse_plain (CuTest *cu) { GkrKeyring *keyring; - GkrBuffer buffer; + EggBuffer buffer; gchar *data; gsize n_data; gint ret; @@ -158,7 +158,7 @@ void unit_test_keyring_parse_plain (CuTest *cu) g_assert (FALSE && "couldn't read in plain.keyring"); /* Parse it */ - gkr_buffer_init_static (&buffer, (guchar*)data, n_data); + egg_buffer_init_static (&buffer, (guchar*)data, n_data); ret = gkr_keyring_textual_parse (keyring, &buffer); CuAssert (cu, "couldn't parse generated textual data", ret == 1); CuAssert (cu, "keyring should not be locked", !keyring->locked); @@ -166,7 +166,7 @@ void unit_test_keyring_parse_plain (CuTest *cu) validate_keyring_contents (keyring, cu); /* Double parse shouldn't change it */ - gkr_buffer_init_static (&buffer, (guchar*)data, n_data); + egg_buffer_init_static (&buffer, (guchar*)data, n_data); ret = gkr_keyring_textual_parse (keyring, &buffer); CuAssert (cu, "couldn't parse generated textual data", ret == 1); CuAssert (cu, "keyring should not be locked", !keyring->locked); diff --git a/daemon/pk/gkr-pk-import.c b/daemon/pk/gkr-pk-import.c index 0f2b7e6b..128d96bc 100644 --- a/daemon/pk/gkr-pk-import.c +++ b/daemon/pk/gkr-pk-import.c @@ -30,7 +30,7 @@ #include "gkr-pk-storage.h" #include "gkr-pk-util.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "pkcs11/pkcs11.h" #include "pkcs11/pkcs11g.h" @@ -184,7 +184,7 @@ parser_ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid digest, /* Successful response */ } else { - *result = gkr_secure_strdup (ask->typed_password); + *result = egg_secure_strdup (ask->typed_password); if (*result && strlen (*result) == 0) *state = LAST_WAS_BLANK; } diff --git a/daemon/pk/gkr-pk-index.c b/daemon/pk/gkr-pk-index.c index c2011381..ced1d599 100644 --- a/daemon/pk/gkr-pk-index.c +++ b/daemon/pk/gkr-pk-index.c @@ -29,7 +29,7 @@ #include "common/gkr-cleanup.h" #include "common/gkr-crypto.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring-login.h" #include "keyrings/gkr-keyrings.h" @@ -103,7 +103,7 @@ request_keyring_new (GQuark location, gchar **password) gkr_ask_daemon_process (ask); ret = ask->response >= GKR_ASK_RESPONSE_ALLOW; if (ret) - *password = gkr_secure_strdup (ask->typed_password); + *password = egg_secure_strdup (ask->typed_password); g_object_unref (ask); return ret; } @@ -446,7 +446,7 @@ gkr_pk_index_open (GQuark index_location, const gchar *name, if (gkr_keyring_login_is_usable ()) { login = gkr_keyrings_get_login (); if (login) - password = gkr_secure_strdup (login->password); + password = egg_secure_strdup (login->password); } } @@ -459,7 +459,7 @@ gkr_pk_index_open (GQuark index_location, const gchar *name, g_return_val_if_fail (password, NULL); keyring = gkr_keyring_create (index_location, name, password); - gkr_secure_strfree (password); + egg_secure_strfree (password); /* Make it available */ gkr_keyrings_add (keyring); @@ -756,8 +756,8 @@ gkr_pk_index_set_secret (GkrPkIndex *index, gkrconstid digest, if (string_equal (item->secret, val)) return FALSE; - gkr_secure_strfree (item->secret); - item->secret = gkr_secure_strdup (val); + egg_secure_strfree (item->secret); + item->secret = egg_secure_strdup (val); if (!gkr_keyring_save_to_disk (index->keyring)) g_warning ("writing secret: couldn't write index keyring to disk"); return TRUE; diff --git a/daemon/pk/gkr-pk-manager.c b/daemon/pk/gkr-pk-manager.c index 6dff508e..9a0a2779 100644 --- a/daemon/pk/gkr-pk-manager.c +++ b/daemon/pk/gkr-pk-manager.c @@ -32,7 +32,7 @@ #include "common/gkr-cleanup.h" #include "common/gkr-location.h" #include "common/gkr-location-watch.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring-login.h" diff --git a/daemon/pk/gkr-pk-root-storage.c b/daemon/pk/gkr-pk-root-storage.c index 9a5c22e9..0e02a533 100644 --- a/daemon/pk/gkr-pk-root-storage.c +++ b/daemon/pk/gkr-pk-root-storage.c @@ -28,10 +28,10 @@ #include "gkr-pk-root-storage.h" #include "gkr-pk-util.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-location.h" #include "common/gkr-location-watch.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring-login.h" diff --git a/daemon/pk/gkr-pk-session-storage.c b/daemon/pk/gkr-pk-session-storage.c index 7344bc16..f930d739 100644 --- a/daemon/pk/gkr-pk-session-storage.c +++ b/daemon/pk/gkr-pk-session-storage.c @@ -28,10 +28,10 @@ #include "gkr-pk-session-storage.h" #include "gkr-pk-util.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-location.h" #include "common/gkr-location-watch.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring-login.h" diff --git a/daemon/pk/gkr-pk-storage.c b/daemon/pk/gkr-pk-storage.c index 5dc74a5a..732a6388 100644 --- a/daemon/pk/gkr-pk-storage.c +++ b/daemon/pk/gkr-pk-storage.c @@ -28,7 +28,7 @@ #include "common/gkr-cleanup.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyrings.h" #include "keyrings/gkr-keyring-login.h" @@ -680,7 +680,7 @@ gkr_pk_storage_get_store_password (GkrPkStorage *storage, GQuark location, gkrco g_return_val_if_fail (login, FALSE); g_return_val_if_fail (login->password, FALSE); - *result = gkr_secure_strdup (login->password); + *result = egg_secure_strdup (login->password); /* * Always same a 'login' password used as a secret. So that @@ -721,7 +721,7 @@ gkr_pk_storage_get_store_password (GkrPkStorage *storage, GQuark location, gkrco /* Successful response */ } else { - *result = gkr_secure_strdup (ask->typed_password); + *result = egg_secure_strdup (ask->typed_password); if (ask->checked) gkr_pk_index_set_secret (index, digest, *result); } @@ -768,7 +768,7 @@ gkr_pk_storage_get_load_password (GkrPkStorage *storage, GQuark location, gkrcon */ if (st == 0) { - *result = gkr_secure_strdup (""); + *result = egg_secure_strdup (""); return TRUE; } else if (st == 1) { @@ -791,7 +791,7 @@ gkr_pk_storage_get_load_password (GkrPkStorage *storage, GQuark location, gkrcon /* See if we can find a valid password for this location */ if (st == 2) { - *result = gkr_secure_strdup (gkr_pk_index_get_secret (index, digest)); + *result = egg_secure_strdup (gkr_pk_index_get_secret (index, digest)); if (*result != NULL) return TRUE; @@ -804,7 +804,7 @@ gkr_pk_storage_get_load_password (GkrPkStorage *storage, GQuark location, gkrcon password = gkr_keyring_login_lookup_secret (GNOME_KEYRING_ITEM_ENCRYPTION_KEY_PASSWORD, "pk-object", gkr_location_to_string (location), NULL); if (password != NULL) { - *result = gkr_secure_strdup (password); + *result = egg_secure_strdup (password); return TRUE; } @@ -854,7 +854,7 @@ gkr_pk_storage_get_load_password (GkrPkStorage *storage, GQuark location, gkrcon /* Successful response */ } else { - *result = gkr_secure_strdup (ask->typed_password); + *result = egg_secure_strdup (ask->typed_password); if (ask->checked) gkr_pk_index_set_secret (index, digest, ask->typed_password); } diff --git a/daemon/pk/tests/unit-test-memory-stubs.c b/daemon/pk/tests/unit-test-memory-stubs.c index dee8cac2..65892aa5 100644 --- a/daemon/pk/tests/unit-test-memory-stubs.c +++ b/daemon/pk/tests/unit-test-memory-stubs.c @@ -1,7 +1,7 @@ #include <glib.h> -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" /* * These are called from gkr-secure-memory.c to provide appropriate @@ -9,19 +9,19 @@ */ void -gkr_memory_lock (void) +egg_memory_lock (void) { } void -gkr_memory_unlock (void) +egg_memory_unlock (void) { } void* -gkr_memory_fallback (void *p, unsigned long sz) +egg_memory_fallback (void *p, unsigned long sz) { return g_realloc (p, sz); } diff --git a/daemon/pkcs11/gkr-pkcs11-auth.c b/daemon/pkcs11/gkr-pkcs11-auth.c index a6b81eb9..077e4bbb 100644 --- a/daemon/pkcs11/gkr-pkcs11-auth.c +++ b/daemon/pkcs11/gkr-pkcs11-auth.c @@ -23,7 +23,7 @@ #include "gkr-pkcs11-auth.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "common/gkr-cleanup.h" #include "keyrings/gkr-keyring-login.h" @@ -94,7 +94,7 @@ password_to_pin (const gchar *password, CK_UTF8CHAR_PTR *pin, CK_ULONG *pin_len) *pin = NULL; *pin_len = 0; } else { - *pin = (CK_UTF8CHAR_PTR)gkr_secure_strdup (password); + *pin = (CK_UTF8CHAR_PTR)egg_secure_strdup (password); *pin_len = strlen (password); } } @@ -268,10 +268,10 @@ gkr_pkcs11_auth_login_specific_prompt (CK_SESSION_HANDLE handle, CK_SESSION_INFO /* This is delayed allocation because we may never use this for a slot */ if (slot->auth_cache == NULL) slot->auth_cache = g_hash_table_new_full (ulong_hash, ulong_equal, ulong_free, - (GDestroyNotify)gkr_secure_free); + (GDestroyNotify)egg_secure_free); g_hash_table_replace (slot->auth_cache, ulong_alloc (object->handle), - gkr_secure_strdup (ask->typed_password)); + egg_secure_strdup (ask->typed_password)); } } @@ -318,7 +318,7 @@ gkr_pkcs11_auth_login_specific_done (CK_SESSION_HANDLE handle, CK_SESSION_INFO * break; } - gkr_secure_strfree ((gchar*)*pin); + egg_secure_strfree ((gchar*)*pin); *pin = NULL; *pin_len = 0; @@ -464,7 +464,7 @@ gkr_pkcs11_auth_login_user_done (CK_SESSION_HANDLE handle, CK_TOKEN_INFO *info, break; } - gkr_secure_strfree ((gchar*)*pin); + egg_secure_strfree ((gchar*)*pin); *pin = NULL; *pin_len = 0; @@ -578,7 +578,7 @@ gkr_pkcs11_auth_init_user_done (CK_SESSION_HANDLE handle, CK_TOKEN_INFO *token_i if (rv != CKR_OK) clear_user_login (token_info); - gkr_secure_strfree ((gchar*)*pin); + egg_secure_strfree ((gchar*)*pin); *pin = NULL; *pin_len = 0; diff --git a/daemon/pkix/gkr-pkix-asn1.c b/daemon/pkix/gkr-pkix-asn1.c index 49873181..5ba05578 100644 --- a/daemon/pkix/gkr-pkix-asn1.c +++ b/daemon/pkix/gkr-pkix-asn1.c @@ -25,8 +25,8 @@ #include "gkr-pkix-asn1.h" -#include "common/gkr-buffer.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-buffer.h" +#include "egg/egg-secure-memory.h" #include <libtasn1.h> @@ -116,7 +116,7 @@ gkr_pkix_asn1_decode (const gchar *type, const guchar *data, gsize n_data) guchar* gkr_pkix_asn1_encode (ASN1_TYPE asn, const gchar* part, gsize *n_data, - GkrBufferAllocator alloc) + EggBufferAllocator alloc) { guchar *data; int res, len; @@ -129,7 +129,7 @@ gkr_pkix_asn1_encode (ASN1_TYPE asn, const gchar* part, gsize *n_data, g_return_val_if_fail (res == ASN1_MEM_ERROR, NULL); if (!alloc) - alloc = (GkrBufferAllocator)g_realloc; + alloc = (EggBufferAllocator)g_realloc; data = (alloc) (NULL, len); g_return_val_if_fail (data != NULL, NULL); @@ -231,7 +231,7 @@ gkr_pkix_asn1_element_content (const guchar *data, gsize n_data, gsize *n_conten guchar* gkr_pkix_asn1_read_value (ASN1_TYPE asn, const gchar *part, gsize *len, - GkrBufferAllocator allocator) + EggBufferAllocator allocator) { int l, res; guchar *buf; @@ -241,7 +241,7 @@ gkr_pkix_asn1_read_value (ASN1_TYPE asn, const gchar *part, gsize *len, g_return_val_if_fail (len != NULL, NULL); if (allocator == NULL) - allocator = (GkrBufferAllocator)g_realloc; + allocator = (EggBufferAllocator)g_realloc; *len = 0; @@ -384,7 +384,7 @@ gkr_pkix_asn1_read_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi) gsize sz; guchar *buf; - buf = gkr_pkix_asn1_read_value (asn, part, &sz, (GkrBufferAllocator)g_realloc); + buf = gkr_pkix_asn1_read_value (asn, part, &sz, (EggBufferAllocator)g_realloc); if (!buf) return FALSE; @@ -404,12 +404,12 @@ gkr_pkix_asn1_read_secure_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t *mpi gsize sz; guchar *buf; - buf = gkr_pkix_asn1_read_value (asn, part, &sz, gkr_secure_realloc); + buf = gkr_pkix_asn1_read_value (asn, part, &sz, egg_secure_realloc); if (!buf) return FALSE; gcry = gcry_mpi_scan (mpi, GCRYMPI_FMT_STD, buf, sz, &sz); - gkr_secure_free (buf); + egg_secure_free (buf); if (gcry != 0) return FALSE; @@ -434,13 +434,13 @@ gkr_pkix_asn1_write_mpi (ASN1_TYPE asn, const gchar *part, gcry_mpi_t mpi) g_return_val_if_fail (gcry == 0, FALSE); g_return_val_if_fail (len > 0, FALSE); - buf = gkr_secure_alloc (len); + buf = egg_secure_alloc (len); gcry = gcry_mpi_print (GCRYMPI_FMT_STD, buf, len, &len, mpi); g_return_val_if_fail (gcry == 0, FALSE); res = asn1_write_value (asn, part, buf, len); - gkr_secure_free (buf); + egg_secure_free (buf); if (res != ASN1_SUCCESS) return FALSE; diff --git a/daemon/pkix/gkr-pkix-asn1.h b/daemon/pkix/gkr-pkix-asn1.h index 49510a99..0df94258 100644 --- a/daemon/pkix/gkr-pkix-asn1.h +++ b/daemon/pkix/gkr-pkix-asn1.h @@ -28,7 +28,7 @@ #include <gcrypt.h> #include <glib.h> -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" ASN1_TYPE gkr_pkix_asn1_get_pk_asn1type (void); @@ -38,10 +38,10 @@ ASN1_TYPE gkr_pkix_asn1_decode (const gchar *typ gsize n_data); guchar* gkr_pkix_asn1_encode (ASN1_TYPE asn, const gchar* part, - gsize *len, GkrBufferAllocator alloc); + gsize *len, EggBufferAllocator alloc); guchar* gkr_pkix_asn1_read_value (ASN1_TYPE asn, const gchar *part, - gsize *len, GkrBufferAllocator alloc); + gsize *len, EggBufferAllocator alloc); gboolean gkr_pkix_asn1_write_value (ASN1_TYPE asn, const gchar *part, const guchar* value, gsize len); diff --git a/daemon/pkix/gkr-pkix-der.c b/daemon/pkix/gkr-pkix-der.c index 63fe2d34..629c78ae 100644 --- a/daemon/pkix/gkr-pkix-der.c +++ b/daemon/pkix/gkr-pkix-der.c @@ -27,7 +27,7 @@ #include "gkr-pkix-der.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <glib.h> #include <gcrypt.h> @@ -1078,8 +1078,8 @@ gkr_pkix_der_read_cipher_pkcs5_pbe (int cipher_algo, int cipher_mode, ret = GKR_PKIX_SUCCESS; done: - gkr_secure_free (iv); - gkr_secure_free (key); + egg_secure_free (iv); + egg_secure_free (key); if (asn) asn1_delete_structure (&asn); @@ -1198,7 +1198,7 @@ setup_pkcs5_pbkdf2_params (const gchar *password, const guchar *data, ret = GKR_PKIX_SUCCESS; done: - gkr_secure_free (key); + egg_secure_free (key); if (asn) asn1_delete_structure (&asn); return ret; @@ -1373,8 +1373,8 @@ done: *cih = NULL; } - gkr_secure_free (iv); - gkr_secure_free (key); + egg_secure_free (iv); + egg_secure_free (key); if (asn) asn1_delete_structure (&asn); diff --git a/daemon/pkix/gkr-pkix-openssl.c b/daemon/pkix/gkr-pkix-openssl.c index 2ddbabed..98ed0622 100644 --- a/daemon/pkix/gkr-pkix-openssl.c +++ b/daemon/pkix/gkr-pkix-openssl.c @@ -26,7 +26,7 @@ #include "gkr-pkix-openssl.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <gcrypt.h> #include <libtasn1.h> @@ -236,7 +236,7 @@ gkr_pkix_openssl_decrypt_block (const gchar *dekinfo, const gchar *password, gcry = gcry_cipher_setkey (ch, key, gcry_cipher_get_algo_keylen (algo)); g_return_val_if_fail (!gcry, GKR_PKIX_UNRECOGNIZED); - gkr_secure_free (key); + egg_secure_free (key); /* 16 = 128 bits */ gcry = gcry_cipher_setiv (ch, iv, ivlen); @@ -245,11 +245,11 @@ gkr_pkix_openssl_decrypt_block (const gchar *dekinfo, const gchar *password, /* Allocate output area */ *n_decrypted = n_data; - *decrypted = gkr_secure_alloc (n_data); + *decrypted = egg_secure_alloc (n_data); gcry = gcry_cipher_decrypt (ch, *decrypted, *n_decrypted, (void*)data, n_data); if (gcry) { - gkr_secure_free (*decrypted); + egg_secure_free (*decrypted); g_return_val_if_reached (GKR_PKIX_FAILURE); } @@ -290,7 +290,7 @@ gkr_pkix_openssl_encrypt_block (const gchar *dekinfo, const gchar *password, gcry = gcry_cipher_setkey (ch, key, gcry_cipher_get_algo_keylen (algo)); g_return_val_if_fail (!gcry, FALSE); - gkr_secure_free (key); + egg_secure_free (key); /* 16 = 128 bits */ gcry = gcry_cipher_setiv (ch, iv, ivlen); @@ -317,11 +317,11 @@ gkr_pkix_openssl_encrypt_block (const gchar *dekinfo, const gchar *password, /* Encrypt the padded block */ if (n_overflow) { - padded = gkr_secure_alloc (ivlen); + padded = egg_secure_alloc (ivlen); memset (padded, 0, ivlen); memcpy (padded, data + n_batch, n_overflow); gcry = gcry_cipher_encrypt (ch, *encrypted + n_batch, ivlen, padded, ivlen); - gkr_secure_free (padded); + egg_secure_free (padded); if (gcry) { g_free (*encrypted); g_return_val_if_reached (FALSE); diff --git a/daemon/pkix/gkr-pkix-parser.c b/daemon/pkix/gkr-pkix-parser.c index 13036d9d..008d2601 100644 --- a/daemon/pkix/gkr-pkix-parser.c +++ b/daemon/pkix/gkr-pkix-parser.c @@ -40,7 +40,7 @@ #include "common/gkr-crypto.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring.h" #include "library/gnome-keyring-memory.h" @@ -354,7 +354,7 @@ gkr_pkix_parser_finalize (GObject *obj) GList *l; for (l = pv->seen_passwords; l; l = g_list_next (l)) - gkr_secure_strfree (l->data); + egg_secure_strfree (l->data); g_list_free (pv->seen_passwords); G_OBJECT_CLASS (gkr_pkix_parser_parent_class)->finalize (obj); @@ -719,7 +719,7 @@ parse_der_pkcs8_encrypted (GkrPkixParser *parser, GQuark location, } crypted = gkr_pkix_asn1_read_value (asn, "encryptedData", &n_crypted, - gkr_secure_realloc); + egg_secure_realloc); if (!crypted) goto done; @@ -739,7 +739,7 @@ parse_der_pkcs8_encrypted (GkrPkixParser *parser, GQuark location, /* Try to parse the resulting key */ r = parse_der_pkcs8_plain (parser, location, digest, crypted, n_crypted); - gkr_secure_free (crypted); + egg_secure_free (crypted); crypted = NULL; if (r != GKR_PKIX_UNRECOGNIZED) { @@ -755,7 +755,7 @@ done: gcry_cipher_close (cih); if (asn) asn1_delete_structure (&asn); - gkr_secure_free (crypted); + egg_secure_free (crypted); return ret; } @@ -988,7 +988,7 @@ parse_pkcs12_encrypted_bag (GkrPkixParser *parser, GQuark loc, gkrid digest, } crypted = gkr_pkix_asn1_read_value (asn, "encryptedContentInfo.encryptedContent", - &n_crypted, gkr_secure_realloc); + &n_crypted, egg_secure_realloc); if (!crypted) goto done; @@ -1008,7 +1008,7 @@ parse_pkcs12_encrypted_bag (GkrPkixParser *parser, GQuark loc, gkrid digest, /* Try to parse the resulting key */ r = parse_pkcs12_bag (parser, loc, digest, crypted, n_crypted); - gkr_secure_free (crypted); + egg_secure_free (crypted); crypted = NULL; if (r != GKR_PKIX_UNRECOGNIZED) { @@ -1024,7 +1024,7 @@ done: gcry_cipher_close (cih); if (asn) asn1_delete_structure (&asn); - gkr_secure_free (crypted); + egg_secure_free (crypted); return ret; } @@ -1393,7 +1393,7 @@ parse_encrypted_pem (GkrPkixParser *parser, GQuark location, gkrid digest, /* Try to parse */ ret = parse_plain_pem (parser, location, digest, type, decrypted, n_decrypted); - gkr_secure_free (decrypted); + egg_secure_free (decrypted); if (ret != GKR_PKIX_UNRECOGNIZED) return ret; diff --git a/daemon/pkix/gkr-pkix-pem.c b/daemon/pkix/gkr-pkix-pem.c index 4a67c475..e04a7fff 100644 --- a/daemon/pkix/gkr-pkix-pem.c +++ b/daemon/pkix/gkr-pkix-pem.c @@ -26,7 +26,7 @@ #include "gkr-pkix-pem.h" #include "common/gkr-async.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <glib.h> @@ -207,15 +207,15 @@ pem_parse_block (const gchar *data, gsize n_data, guchar **decoded, gsize *n_dec } *n_decoded = (n_data * 3) / 4 + 1; - if (gkr_secure_check (data)) - *decoded = gkr_secure_alloc (*n_decoded); + if (egg_secure_check (data)) + *decoded = egg_secure_alloc (*n_decoded); else *decoded = g_malloc (*n_decoded); g_return_val_if_fail (*decoded, FALSE); *n_decoded = g_base64_decode_step (data, n_data, *decoded, &state, &save); if (!*n_decoded) { - gkr_secure_free (*decoded); + egg_secure_free (*decoded); return FALSE; } @@ -267,7 +267,7 @@ gkr_pkix_pem_parse (const guchar *data, gsize n_data, if (pem_parse_block (beg, end - beg, &decoded, &n_decoded, &headers)) { (callback) (type, decoded, n_decoded, headers, user_data); ++nfound; - gkr_secure_free (decoded); + egg_secure_free (decoded); if (headers) g_hash_table_remove_all (headers); } diff --git a/daemon/pkix/gkr-pkix-serialize.c b/daemon/pkix/gkr-pkix-serialize.c index 432c597a..897b7305 100644 --- a/daemon/pkix/gkr-pkix-serialize.c +++ b/daemon/pkix/gkr-pkix-serialize.c @@ -8,7 +8,7 @@ #include "common/gkr-crypto.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <glib/gi18n.h> @@ -157,8 +157,8 @@ prepare_and_encode_pkcs8_cipher (ASN1_TYPE asn, const gchar *password, gsize *n_ gcry_cipher_setiv (cih, iv, *n_block); gcry_cipher_setkey (cih, key, n_key); - gkr_secure_free (iv); - gkr_secure_free (key); + egg_secure_free (iv); + egg_secure_free (key); asn1_delete_structure (&asn1_params); return cih; @@ -219,12 +219,12 @@ encode_pkcs8_private_key (gcry_sexp_t skey, gsize *n_data) /* Write out the parameters */ if (!gkr_pkix_asn1_write_value (asn, "privateKeyAlgorithm.parameters", params, n_params)) g_return_val_if_reached (NULL); - gkr_secure_free (params); + egg_secure_free (params); /* Write out the key portion */ if (!gkr_pkix_asn1_write_value (asn, "privateKey", key, n_key)) g_return_val_if_reached (NULL); - gkr_secure_free (key); + egg_secure_free (key); /* Add an empty attributes field */ if (!gkr_pkix_asn1_write_value (asn, "attributes", NULL, 0)) diff --git a/daemon/pkix/tests/unit-test-pkix-openssl.c b/daemon/pkix/tests/unit-test-pkix-openssl.c index 758a68f1..4f3bed7d 100644 --- a/daemon/pkix/tests/unit-test-pkix-openssl.c +++ b/daemon/pkix/tests/unit-test-pkix-openssl.c @@ -27,7 +27,7 @@ #include "common/gkr-location.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "pkix/gkr-pkix-openssl.h" #include "pkix/gkr-pkix-pem.h" diff --git a/daemon/pkix/tests/unit-test-pkix-parser.c b/daemon/pkix/tests/unit-test-pkix-parser.c index 80504252..e815adf9 100644 --- a/daemon/pkix/tests/unit-test-pkix-parser.c +++ b/daemon/pkix/tests/unit-test-pkix-parser.c @@ -27,7 +27,7 @@ #include "common/gkr-location.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "pkix/gkr-pkix-parser.h" @@ -147,7 +147,7 @@ ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid digest, /* Return "", null, and "booo" in that order */ switch (st) { case 0: - *password = gkr_secure_strdup (""); + *password = egg_secure_strdup (""); return TRUE; case 1: *password = NULL; @@ -155,7 +155,7 @@ ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid digest, case 2: /* Most of our test encrypted stuff use this password */ g_print ("getting password 'booo' for: %s\n", details); - *password = gkr_secure_strdup ("booo"); + *password = egg_secure_strdup ("booo"); return TRUE; default: msg = g_strdup_printf ("decryption didn't work for: %s", g_quark_to_string (loc)); diff --git a/daemon/pkix/tests/unit-test-pkix-serialize.c b/daemon/pkix/tests/unit-test-pkix-serialize.c index 13cf13fd..5c98e81b 100644 --- a/daemon/pkix/tests/unit-test-pkix-serialize.c +++ b/daemon/pkix/tests/unit-test-pkix-serialize.c @@ -27,7 +27,7 @@ #include "common/gkr-location.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "pkix/gkr-pkix-der.h" #include "pkix/gkr-pkix-parser.h" @@ -90,7 +90,7 @@ ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid unique, g_print ("getting password 'booo' for: %s\n", details); /* All our test encrypted stuff use this password */ - *password = gkr_secure_strdup ("booo"); + *password = egg_secure_strdup ("booo"); return TRUE; } diff --git a/daemon/ssh/gkr-ssh-private.h b/daemon/ssh/gkr-ssh-private.h index bbd1f2fd..9e4c0b8f 100644 --- a/daemon/ssh/gkr-ssh-private.h +++ b/daemon/ssh/gkr-ssh-private.h @@ -23,7 +23,7 @@ #ifndef GKRSSHPRIVATE_H_ #define GKRSSHPRIVATE_H_ -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include <gcrypt.h> @@ -75,7 +75,7 @@ * gkr-ssh-daemon-io.c */ -typedef gboolean (*GkrSshOperation) (GkrBuffer *req, GkrBuffer *resp); +typedef gboolean (*GkrSshOperation) (EggBuffer *req, EggBuffer *resp); extern const GkrSshOperation gkr_ssh_operations[GKR_SSH_OP_MAX]; /* ----------------------------------------------------------------------------- @@ -86,39 +86,39 @@ int gkr_ssh_proto_keytype_to_algo (const gchar *salg const gchar* gkr_ssh_proto_algo_to_keytype (int algo); -gboolean gkr_ssh_proto_read_mpi (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi); +gboolean gkr_ssh_proto_read_mpi (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi); -gboolean gkr_ssh_proto_read_mpi_v1 (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi); +gboolean gkr_ssh_proto_read_mpi_v1 (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi); -gboolean gkr_ssh_proto_write_mpi (GkrBuffer *resp, gcry_mpi_t mpi, int format); +gboolean gkr_ssh_proto_write_mpi (EggBuffer *resp, gcry_mpi_t mpi, int format); -gboolean gkr_ssh_proto_write_mpi_v1 (GkrBuffer *resp, gcry_mpi_t mpi); +gboolean gkr_ssh_proto_write_mpi_v1 (EggBuffer *resp, gcry_mpi_t mpi); -gboolean gkr_ssh_proto_read_public (GkrBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo); +gboolean gkr_ssh_proto_read_public (EggBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo); -gboolean gkr_ssh_proto_read_public_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_public_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_read_public_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_public_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_read_public_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_public_v1 (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_read_private_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_private_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_read_private_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_private_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_read_private_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp); +gboolean gkr_ssh_proto_read_private_v1 (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp); -gboolean gkr_ssh_proto_write_public (GkrBuffer *resp, int algorithm, gcry_sexp_t key); +gboolean gkr_ssh_proto_write_public (EggBuffer *resp, int algorithm, gcry_sexp_t key); -gboolean gkr_ssh_proto_write_public_rsa (GkrBuffer *resp, gcry_sexp_t key); +gboolean gkr_ssh_proto_write_public_rsa (EggBuffer *resp, gcry_sexp_t key); -gboolean gkr_ssh_proto_write_public_dsa (GkrBuffer *resp, gcry_sexp_t key); +gboolean gkr_ssh_proto_write_public_dsa (EggBuffer *resp, gcry_sexp_t key); -gboolean gkr_ssh_proto_write_public_v1 (GkrBuffer *resp, gcry_sexp_t key); +gboolean gkr_ssh_proto_write_public_v1 (EggBuffer *resp, gcry_sexp_t key); -gboolean gkr_ssh_proto_write_signature_rsa (GkrBuffer *resp, gcry_sexp_t ssig); +gboolean gkr_ssh_proto_write_signature_rsa (EggBuffer *resp, gcry_sexp_t ssig); -gboolean gkr_ssh_proto_write_signature_dsa (GkrBuffer *resp, gcry_sexp_t ssig); +gboolean gkr_ssh_proto_write_signature_dsa (EggBuffer *resp, gcry_sexp_t ssig); #endif /*GKRSSHPRIVATE_H_*/ diff --git a/daemon/ssh/gkr-ssh-proto.c b/daemon/ssh/gkr-ssh-proto.c index 89c8f7f9..1984b6d6 100644 --- a/daemon/ssh/gkr-ssh-proto.c +++ b/daemon/ssh/gkr-ssh-proto.c @@ -24,7 +24,7 @@ #include "gkr-ssh-private.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-crypto.h" #include <gcrypt.h> @@ -54,13 +54,13 @@ gkr_ssh_proto_algo_to_keytype (int algo) } gboolean -gkr_ssh_proto_read_mpi (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi) +gkr_ssh_proto_read_mpi (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi) { const guchar *data; gsize len; gcry_error_t gcry; - if (!gkr_buffer_get_byte_array (req, *offset, offset, &data, &len)) + if (!egg_buffer_get_byte_array (req, *offset, offset, &data, &len)) return FALSE; gcry = gcry_mpi_scan (mpi, GCRYMPI_FMT_USG, data, len, NULL); @@ -71,7 +71,7 @@ gkr_ssh_proto_read_mpi (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi) } gboolean -gkr_ssh_proto_read_mpi_v1 (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi) +gkr_ssh_proto_read_mpi_v1 (EggBuffer *req, gsize *offset, gcry_mpi_t *mpi) { const guchar *data; gsize bytes; @@ -79,7 +79,7 @@ gkr_ssh_proto_read_mpi_v1 (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi) guint16 bits; /* Get the number of bits */ - if (!gkr_buffer_get_uint16 (req, *offset, offset, &bits)) + if (!egg_buffer_get_uint16 (req, *offset, offset, &bits)) return FALSE; /* Figure out the number of binary bytes following */ @@ -101,7 +101,7 @@ gkr_ssh_proto_read_mpi_v1 (GkrBuffer *req, gsize *offset, gcry_mpi_t *mpi) } gboolean -gkr_ssh_proto_write_mpi (GkrBuffer *resp, gcry_mpi_t mpi, int format) +gkr_ssh_proto_write_mpi (EggBuffer *resp, gcry_mpi_t mpi, int format) { guchar *buf; size_t len; @@ -112,7 +112,7 @@ gkr_ssh_proto_write_mpi (GkrBuffer *resp, gcry_mpi_t mpi, int format) g_return_val_if_fail (gcry == 0, FALSE); /* Make a space for it in the buffer */ - buf = gkr_buffer_add_byte_array_empty (resp, len); + buf = egg_buffer_add_byte_array_empty (resp, len); if (!buf) return FALSE; @@ -124,7 +124,7 @@ gkr_ssh_proto_write_mpi (GkrBuffer *resp, gcry_mpi_t mpi, int format) } gboolean -gkr_ssh_proto_write_mpi_v1 (GkrBuffer *resp, gcry_mpi_t mpi) +gkr_ssh_proto_write_mpi_v1 (EggBuffer *resp, gcry_mpi_t mpi) { gcry_error_t gcry; guchar *buf; @@ -141,11 +141,11 @@ gkr_ssh_proto_write_mpi_v1 (GkrBuffer *resp, gcry_mpi_t mpi) g_return_val_if_fail (gcry == 0, FALSE); g_return_val_if_fail (bytes == len, FALSE); - if (!gkr_buffer_add_uint16 (resp, bits)) + if (!egg_buffer_add_uint16 (resp, bits)) return FALSE; /* Make a space for it in the buffer */ - buf = gkr_buffer_add_empty (resp, len); + buf = egg_buffer_add_empty (resp, len); if (!buf) return FALSE; @@ -157,14 +157,14 @@ gkr_ssh_proto_write_mpi_v1 (GkrBuffer *resp, gcry_mpi_t mpi) } gboolean -gkr_ssh_proto_read_public (GkrBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo) +gkr_ssh_proto_read_public (EggBuffer *req, gsize *offset, gcry_sexp_t *key, int *algo) { gboolean ret; gchar *stype; int alg; /* The string algorithm */ - if (!gkr_buffer_get_string (req, *offset, offset, &stype, (GkrBufferAllocator)g_realloc)) + if (!egg_buffer_get_string (req, *offset, offset, &stype, (EggBufferAllocator)g_realloc)) return FALSE; alg = gkr_ssh_proto_keytype_to_algo (stype); @@ -208,7 +208,7 @@ gkr_ssh_proto_read_public (GkrBuffer *req, gsize *offset, gcry_sexp_t *key, int " (u %m)))" gboolean -gkr_ssh_proto_read_private_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_private_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t n, e, d, p, q, u; gcry_mpi_t tmp; @@ -250,7 +250,7 @@ gkr_ssh_proto_read_private_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp } gboolean -gkr_ssh_proto_read_private_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_private_v1 (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t n, e, d, p, q, u; gcry_mpi_t tmp; @@ -298,7 +298,7 @@ gkr_ssh_proto_read_private_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) " (e %m)))" gboolean -gkr_ssh_proto_read_public_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_public_rsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t n, e; int gcry; @@ -320,13 +320,13 @@ gkr_ssh_proto_read_public_rsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) } gboolean -gkr_ssh_proto_read_public_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_public_v1 (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t n, e; guint32 bits; int gcry; - if (!gkr_buffer_get_uint32 (req, *offset, offset, &bits)) + if (!egg_buffer_get_uint32 (req, *offset, offset, &bits)) return FALSE; if (!gkr_ssh_proto_read_mpi_v1 (req, offset, &e) || @@ -355,7 +355,7 @@ gkr_ssh_proto_read_public_v1 (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) " (x %m)))" gboolean -gkr_ssh_proto_read_private_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_private_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t p, q, g, y, x; int gcry; @@ -391,7 +391,7 @@ gkr_ssh_proto_read_private_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp " (y %m)))" gboolean -gkr_ssh_proto_read_public_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) +gkr_ssh_proto_read_public_dsa (EggBuffer *req, gsize *offset, gcry_sexp_t *sexp) { gcry_mpi_t p, q, g, y; int gcry; @@ -417,14 +417,14 @@ gkr_ssh_proto_read_public_dsa (GkrBuffer *req, gsize *offset, gcry_sexp_t *sexp) } gboolean -gkr_ssh_proto_write_public (GkrBuffer *resp, int algo, gcry_sexp_t key) +gkr_ssh_proto_write_public (EggBuffer *resp, int algo, gcry_sexp_t key) { gboolean ret = FALSE; const gchar *salgo; salgo = gkr_ssh_proto_algo_to_keytype (algo); g_assert (salgo); - gkr_buffer_add_string (resp, salgo); + egg_buffer_add_string (resp, salgo); switch (algo) { case GCRY_PK_RSA: @@ -444,7 +444,7 @@ gkr_ssh_proto_write_public (GkrBuffer *resp, int algo, gcry_sexp_t key) } gboolean -gkr_ssh_proto_write_public_rsa (GkrBuffer *resp, gcry_sexp_t key) +gkr_ssh_proto_write_public_rsa (EggBuffer *resp, gcry_sexp_t key) { gcry_mpi_t mpi; gboolean ret; @@ -468,7 +468,7 @@ gkr_ssh_proto_write_public_rsa (GkrBuffer *resp, gcry_sexp_t key) } gboolean -gkr_ssh_proto_write_public_dsa (GkrBuffer *resp, gcry_sexp_t key) +gkr_ssh_proto_write_public_dsa (EggBuffer *resp, gcry_sexp_t key) { gcry_mpi_t mpi; gboolean ret; @@ -510,7 +510,7 @@ gkr_ssh_proto_write_public_dsa (GkrBuffer *resp, gcry_sexp_t key) } gboolean -gkr_ssh_proto_write_public_v1 (GkrBuffer *resp, gcry_sexp_t key) +gkr_ssh_proto_write_public_v1 (EggBuffer *resp, gcry_sexp_t key) { gboolean ret = FALSE; gcry_mpi_t mpi; @@ -521,7 +521,7 @@ gkr_ssh_proto_write_public_v1 (GkrBuffer *resp, gcry_sexp_t key) /* Write out the number of bits of the key */ bits = gcry_pk_get_nbits (key); g_return_val_if_fail (bits > 0, FALSE); - gkr_buffer_add_uint32 (resp, bits); + egg_buffer_add_uint32 (resp, bits); /* Write out the exponent */ ret = gkr_crypto_sexp_extract_mpi (key, &mpi, "rsa", "e", NULL); @@ -542,7 +542,7 @@ gkr_ssh_proto_write_public_v1 (GkrBuffer *resp, gcry_sexp_t key) } gboolean -gkr_ssh_proto_write_signature_rsa (GkrBuffer *resp, gcry_sexp_t ssig) +gkr_ssh_proto_write_signature_rsa (EggBuffer *resp, gcry_sexp_t ssig) { gboolean ret; gcry_mpi_t mpi; @@ -557,7 +557,7 @@ gkr_ssh_proto_write_signature_rsa (GkrBuffer *resp, gcry_sexp_t ssig) } gboolean -gkr_ssh_proto_write_signature_dsa (GkrBuffer *resp, gcry_sexp_t ssig) +gkr_ssh_proto_write_signature_dsa (EggBuffer *resp, gcry_sexp_t ssig) { guchar buffer[GKR_SSH_DSA_SIGNATURE_PADDING * 2]; gboolean ret; @@ -570,6 +570,6 @@ gkr_ssh_proto_write_signature_dsa (GkrBuffer *resp, gcry_sexp_t ssig) GKR_SSH_DSA_SIGNATURE_PADDING, "dsa", "s", NULL); g_return_val_if_fail (ret, FALSE); - return gkr_buffer_add_byte_array (resp, buffer, sizeof (buffer)); + return egg_buffer_add_byte_array (resp, buffer, sizeof (buffer)); } diff --git a/daemon/ssh/gkr-ssh-storage.c b/daemon/ssh/gkr-ssh-storage.c index 3d57e324..37025daa 100644 --- a/daemon/ssh/gkr-ssh-storage.c +++ b/daemon/ssh/gkr-ssh-storage.c @@ -26,11 +26,11 @@ #include "gkr-ssh-private.h" #include "gkr-ssh-storage.h" -#include "common/gkr-buffer.h" +#include "egg/egg-buffer.h" #include "common/gkr-crypto.h" #include "common/gkr-location.h" #include "common/gkr-location-watch.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "keyrings/gkr-keyring-login.h" @@ -230,7 +230,7 @@ load_encrypted_key (GkrSshStorage *storage, gkrid digest, GQuark location, /* Decrypt, this will result in garble if invalid password */ res = gkr_pkix_openssl_decrypt_block (dekinfo, password, data, n_data, &decrypted, &n_decrypted); - gkr_secure_free (password); + egg_secure_free (password); if (!res) return GKR_PKIX_UNRECOGNIZED; @@ -244,7 +244,7 @@ load_encrypted_key (GkrSshStorage *storage, gkrid digest, GQuark location, /* Try to parse */ ret = gkr_pkix_der_read_private_key (decrypted, n_decrypted, skey); - gkr_secure_free (decrypted); + egg_secure_free (decrypted); if (ret != GKR_PKIX_UNRECOGNIZED) return ret; @@ -493,7 +493,7 @@ storage_write_private_key (GkrSshStorage *storage, gcry_sexp_t sexp, done: if (headers) g_hash_table_destroy (headers); - gkr_secure_free (data); + egg_secure_free (data); g_free (result); g_free (encrypted); @@ -620,7 +620,7 @@ gkr_ssh_storage_store (GkrPkStorage *stor, GkrPkObject *obj, GError **err) /* Store the private key */ digest = storage_write_private_key (storage, sexp, loc, password, err); - gkr_secure_strfree (password); + egg_secure_strfree (password); if (!digest) return FALSE; @@ -772,7 +772,7 @@ GkrPkixResult gkr_ssh_storage_load_public_key (const guchar *data, gsize n_data, gcry_sexp_t *sexp, gchar **comment) { - GkrBuffer buf; + EggBuffer buf; const guchar *at; guchar *decoded; gsize n_decoded; @@ -846,7 +846,7 @@ gkr_ssh_storage_load_public_key (const guchar *data, gsize n_data, n_decoded = g_base64_decode_step ((gchar*)data, n_data, decoded, &state, &save); /* Parse the actual key */ - gkr_buffer_init_static (&buf, decoded, n_decoded); + egg_buffer_init_static (&buf, decoded, n_decoded); offset = 0; ret = gkr_ssh_proto_read_public (&buf, &offset, sexp, NULL); g_free (decoded); @@ -875,7 +875,7 @@ gkr_ssh_storage_write_public_key (gcry_sexp_t sexp, const gchar *comment, gsize *n_data) { GString *result; - GkrBuffer buffer; + EggBuffer buffer; const gchar *type; gchar *encoded; gboolean is_priv; @@ -897,11 +897,11 @@ gkr_ssh_storage_write_public_key (gcry_sexp_t sexp, const gchar *comment, g_string_append (result, type); g_string_append_c (result, ' '); - gkr_buffer_init_full (&buffer, 4096, (GkrBufferAllocator)g_realloc); + egg_buffer_init_full (&buffer, 4096, (EggBufferAllocator)g_realloc); gkr_ssh_proto_write_public (&buffer, algo, sexp); encoded = g_base64_encode (buffer.buf, buffer.len); - gkr_buffer_uninit (&buffer); + egg_buffer_uninit (&buffer); g_return_val_if_fail (encoded, NULL); g_string_append (result, encoded); diff --git a/daemon/ssh/tests/unit-test-ssh-storage.c b/daemon/ssh/tests/unit-test-ssh-storage.c index 73e39a2f..7ff56428 100644 --- a/daemon/ssh/tests/unit-test-ssh-storage.c +++ b/daemon/ssh/tests/unit-test-ssh-storage.c @@ -27,7 +27,7 @@ #include "common/gkr-location.h" #include "common/gkr-crypto.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "ssh/gkr-ssh-storage.h" diff --git a/daemon/ui/Makefile.am b/daemon/ui/Makefile.am index c6685069..007d7b82 100644 --- a/daemon/ui/Makefile.am +++ b/daemon/ui/Makefile.am @@ -21,7 +21,7 @@ gnome_keyring_ask_SOURCES = \ gkr-ask-request.h gnome_keyring_ask_LDADD = \ - $(top_builddir)/common/libgkr-common-secure.la \ + $(top_builddir)/egg/libegg-secure.la \ $(GTK_LIBS) noinst_LTLIBRARIES=libgkr-ui.la diff --git a/daemon/ui/gkr-ask-entry.c b/daemon/ui/gkr-ask-entry.c index d2384542..9550039d 100644 --- a/daemon/ui/gkr-ask-entry.c +++ b/daemon/ui/gkr-ask-entry.c @@ -48,7 +48,7 @@ #include "gkr-ask-entry.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #define MIN_ASK_ENTRY_WIDTH 150 #define DRAW_TIMEOUT 20 @@ -504,7 +504,7 @@ gkr_ask_entry_init (GkrAskEntry *entry) gtk_widget_set_style (GTK_WIDGET (entry), style); entry->text_size = MIN_SIZE; - entry->text = gkr_secure_alloc (entry->text_size + 1); + entry->text = egg_secure_alloc (entry->text_size + 1); entry->text[0] = '\0'; entry->visibility = FALSE; @@ -554,7 +554,7 @@ gkr_ask_entry_finalize (GObject *object) entry->text_size = 0; if (entry->text) - gkr_secure_free (entry->text); + egg_secure_free (entry->text); entry->text = NULL; G_OBJECT_CLASS (parent_class)->finalize (object); @@ -1093,7 +1093,7 @@ gkr_ask_entry_insert_text (GtkEditable *editable, const gchar *new_text, g_object_ref (editable); - text = gkr_secure_alloc (new_text_length + 1); + text = egg_secure_alloc (new_text_length + 1); strncpy (text, new_text, new_text_length); text[new_text_length] = '\0'; @@ -1101,7 +1101,7 @@ gkr_ask_entry_insert_text (GtkEditable *editable, const gchar *new_text, g_signal_emit_by_name (editable, "insert_text", text, new_text_length, position); - gkr_secure_free (text); + egg_secure_free (text); g_object_unref (editable); } @@ -1280,7 +1280,7 @@ gkr_ask_entry_real_insert_text (GtkEditable *editable, const gchar *new_text, } } - entry->text = gkr_secure_realloc (entry->text, entry->text_size + 1); + entry->text = egg_secure_realloc (entry->text, entry->text_size + 1); } _index = g_utf8_offset_to_pointer (entry->text, *position) - entry->text; diff --git a/daemon/ui/gkr-ask-request.c b/daemon/ui/gkr-ask-request.c index 334a828b..0a499b18 100644 --- a/daemon/ui/gkr-ask-request.c +++ b/daemon/ui/gkr-ask-request.c @@ -30,7 +30,7 @@ #include "common/gkr-async.h" #include "common/gkr-location.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include "library/gnome-keyring.h" #include "library/gnome-keyring-private.h" @@ -85,7 +85,7 @@ struct _GkrAskRequestPrivate { gint ask_pid; gint in_fd; gint out_fd; - GkrBuffer buffer; + EggBuffer buffer; }; #define GKR_ASK_REQUEST_GET_PRIVATE(o) \ @@ -284,9 +284,9 @@ finish_ask_io (GkrAskRequest *ask, gboolean success) pv->ask_pid = 0; /* Cleanup for response processing */ - gkr_secure_strfree (ask->typed_password); + egg_secure_strfree (ask->typed_password); ask->typed_password = NULL; - gkr_secure_strfree (ask->original_password); + egg_secure_strfree (ask->original_password); ask->original_password = NULL; /* A failed request */ @@ -310,11 +310,11 @@ finish_ask_io (GkrAskRequest *ask, gboolean success) /* First line is the password */ if (i == 0) - ask->typed_password = gkr_secure_strdup (line); + ask->typed_password = egg_secure_strdup (line); /* Second line is the original password (if any)*/ else if (i == 1) - ask->original_password = gkr_secure_strdup (line); + ask->original_password = egg_secure_strdup (line); line = next; } @@ -499,7 +499,7 @@ read_until_end (GkrAskRequest *ask) g_return_val_if_fail (pv->out_fd >= 0, FALSE); /* Passwords come through this buffer */ - buf = gkr_secure_alloc (128); + buf = egg_secure_alloc (128); gkr_async_register_cancel (close_fd, &pv->out_fd); @@ -521,7 +521,7 @@ read_until_end (GkrAskRequest *ask) /* Got some data */ } else if (res > 0) { - gkr_buffer_append (&pv->buffer, buf, res); + egg_buffer_append (&pv->buffer, buf, res); /* End of data */ } else if (res == 0) { @@ -531,9 +531,9 @@ read_until_end (GkrAskRequest *ask) } /* Always null terminate */ - gkr_buffer_add_byte (&pv->buffer, 0); + egg_buffer_add_byte (&pv->buffer, 0); - gkr_secure_free (buf); + egg_secure_free (buf); gkr_async_unregister_cancel (close_fd, &pv->out_fd); close_fd (&pv->out_fd); @@ -570,7 +570,7 @@ launch_ask_helper (GkrAskRequest *ask) envp[i++] = NULL; g_strfreev (names); - gkr_buffer_resize (&pv->buffer, 0); + egg_buffer_resize (&pv->buffer, 0); ret = g_spawn_async_with_pipes (NULL, argv, envp, 0, NULL, NULL, &pv->ask_pid, &pv->in_fd, &pv->out_fd, NULL, &error); @@ -687,7 +687,7 @@ gkr_ask_request_init (GkrAskRequest *ask) pv->in_fd = -1; /* Use a secure memory buffer */ - gkr_buffer_init_full (&pv->buffer, 128, gkr_secure_realloc); + egg_buffer_init_full (&pv->buffer, 128, egg_secure_realloc); } static guint @@ -706,10 +706,10 @@ gkr_ask_request_dispose (GObject *obj) mark_completed (ask, GKR_ASK_RESPONSE_FAILURE); g_assert (pv->ask_pid == 0); - gkr_secure_strfree (ask->original_password); + egg_secure_strfree (ask->original_password); ask->original_password = NULL; - gkr_secure_strfree (ask->typed_password); + egg_secure_strfree (ask->typed_password); ask->typed_password = NULL; if (pv->in_fd >= 0) @@ -739,7 +739,7 @@ gkr_ask_request_finalize (GObject *obj) g_assert (pv->in_fd < 0); g_assert (pv->out_fd < 0); - gkr_buffer_uninit (&pv->buffer); + egg_buffer_uninit (&pv->buffer); G_OBJECT_CLASS(gkr_ask_request_parent_class)->finalize (obj); } diff --git a/daemon/ui/gkr-ask-tool.c b/daemon/ui/gkr-ask-tool.c index 80e75363..72a4167b 100644 --- a/daemon/ui/gkr-ask-tool.c +++ b/daemon/ui/gkr-ask-tool.c @@ -26,7 +26,7 @@ #include "gkr-ask-tool.h" #include "gkr-ask-request.h" -#include "common/gkr-secure-memory.h" +#include "egg/egg-secure-memory.h" #include <gtk/gtk.h> #include <glib/gi18n.h> @@ -63,19 +63,19 @@ static gboolean do_warning = TRUE; */ void -gkr_memory_lock (void) +egg_memory_lock (void) { /* No threads used in ask tool, doesn't need locking */ } void -gkr_memory_unlock (void) +egg_memory_unlock (void) { /* No threads used in ask tool, doesn't need locking */ } void* -gkr_memory_fallback (void *p, unsigned long sz) +egg_memory_fallback (void *p, unsigned long sz) { const gchar *env; @@ -600,7 +600,7 @@ run_dialog (gboolean include_password, /* Get the original password */ if (include_original && old != NULL && response >= GKR_ASK_RESPONSE_ALLOW) { original = gkr_ask_entry_get_text (GKR_ASK_ENTRY (old)); - *original_out = gkr_secure_strdup (original); + *original_out = egg_secure_strdup (original); } /* Get the main password entry, and confirmation */ @@ -616,7 +616,7 @@ run_dialog (gboolean include_password, goto retry; } } - *password_out = gkr_secure_strdup (password); + *password_out = egg_secure_strdup (password); } /* When it's a new password and blank, double check */ @@ -728,9 +728,9 @@ prepare_dialog (void) } if (!password) - password = gkr_secure_strdup (""); + password = egg_secure_strdup (""); if (!original) - original = gkr_secure_strdup (""); + original = egg_secure_strdup (""); /* First two lines of the response are always the passwords */ if (response < GKR_ASK_RESPONSE_ALLOW || !(flags & GKR_ASK_REQUEST_PASSWORD)) @@ -746,8 +746,8 @@ prepare_dialog (void) /* Send back the response */ g_key_file_set_integer (output_data, "general", "response", response); - gkr_secure_free (password); - gkr_secure_free (original); + egg_secure_free (password); + egg_secure_free (original); } static gchar* |