gnome-keyring r1046 - in trunk: . common common/tests pk pk/tests pkix pkix/tests ssh
- From: nnielsen svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-keyring r1046 - in trunk: . common common/tests pk pk/tests pkix pkix/tests ssh
- Date: Sun, 10 Feb 2008 17:11:14 +0000 (GMT)
Author: nnielsen
Date: Sun Feb 10 17:11:13 2008
New Revision: 1046
URL: http://svn.gnome.org/viewvc/gnome-keyring?rev=1046&view=rev
Log:
* common/gkr-crypto.c:
* common/gkr-crypto.h:
* common/gkr-unique.c: (moved to gkr-id.c)
* common/gkr-unique.h: (moved to gkr-id.h)
* common/Makefile.am:
* common/tests/unit-test-crypto.c:
* common/tests/unit-test-unique.c:
* pk/gkr-pk-cert.c:
* pk/gkr-pk-cert.h:
* pk/gkr-pk-index.c:
* pk/gkr-pk-index.h:
* pk/gkr-pk-netscape-trust.c:
* pk/gkr-pk-object.c:
* pk/gkr-pk-object.h:
* pk/gkr-pk-privkey.c:
* pk/gkr-pk-privkey.h:
* pk/gkr-pk-pubkey.c:
* pk/gkr-pk-pubkey.h:
* pk/gkr-pk-util.c:
* pk/gkr-pk-util.h:
* pk/tests/unit-test-pk-cert.c:
* pk/tests/unit-test-pk-index.c:
* pk/tests/unit-test-pk-key.c:
* pk/tests/unit-test-pk-netscape-trust.c:
* pkix/gkr-pkix-parser.c:
* pkix/gkr-pkix-parser.h:
* pkix/tests/unit-test-pkix-parser.c:
* pkix/tests/unit-test-pkix-serialize.c:
* ssh/gkr-ssh-daemon-ops.c: Change name of gkrunique to gkrid
Added:
trunk/common/gkr-id.c
- copied, changed from r1039, /trunk/common/gkr-unique.c
trunk/common/gkr-id.h
- copied, changed from r1039, /trunk/common/gkr-unique.h
Removed:
trunk/common/gkr-unique.c
trunk/common/gkr-unique.h
Modified:
trunk/ChangeLog
trunk/common/Makefile.am
trunk/common/gkr-crypto.c
trunk/common/gkr-crypto.h
trunk/common/tests/unit-test-crypto.c
trunk/common/tests/unit-test-unique.c
trunk/pk/gkr-pk-cert.c
trunk/pk/gkr-pk-cert.h
trunk/pk/gkr-pk-index.c
trunk/pk/gkr-pk-index.h
trunk/pk/gkr-pk-netscape-trust.c
trunk/pk/gkr-pk-object-manager.c
trunk/pk/gkr-pk-object-manager.h
trunk/pk/gkr-pk-object-storage.c
trunk/pk/gkr-pk-object.c
trunk/pk/gkr-pk-object.h
trunk/pk/gkr-pk-privkey.c
trunk/pk/gkr-pk-privkey.h
trunk/pk/gkr-pk-pubkey.c
trunk/pk/gkr-pk-pubkey.h
trunk/pk/gkr-pk-util.c
trunk/pk/gkr-pk-util.h
trunk/pk/tests/unit-test-pk-cert.c
trunk/pk/tests/unit-test-pk-index.c
trunk/pk/tests/unit-test-pk-key.c
trunk/pk/tests/unit-test-pk-netscape-trust.c
trunk/pkix/gkr-pkix-parser.c
trunk/pkix/gkr-pkix-parser.h
trunk/pkix/tests/unit-test-pkix-parser.c
trunk/pkix/tests/unit-test-pkix-serialize.c
trunk/ssh/gkr-ssh-daemon-ops.c
Modified: trunk/common/Makefile.am
==============================================================================
--- trunk/common/Makefile.am (original)
+++ trunk/common/Makefile.am Sun Feb 10 17:11:13 2008
@@ -29,7 +29,7 @@
gkr-location.c gkr-location.h \
gkr-location-watch.c gkr-location-watch.h \
gkr-secure-memory.c gkr-secure-memory.h \
- gkr-unique.c gkr-unique.h \
+ gkr-id.c gkr-id.h \
gkr-unix-credentials.c gkr-unix-credentials.h \
gkr-unix-signal.c gkr-unix-signal.h \
gkr-wakeup.c gkr-wakeup.h
Modified: trunk/common/gkr-crypto.c
==============================================================================
--- trunk/common/gkr-crypto.c (original)
+++ trunk/common/gkr-crypto.c Sun Feb 10 17:11:13 2008
@@ -830,7 +830,7 @@
return ret;
}
-gkrunique
+gkrid
gkr_crypto_skey_make_id (gcry_sexp_t s_key)
{
guchar hash[20];
@@ -838,7 +838,7 @@
if (!gcry_pk_get_keygrip (s_key, hash))
g_return_val_if_reached (NULL);
- return gkr_unique_new (hash, sizeof (hash));
+ return gkr_id_new (hash, sizeof (hash));
}
static gcry_sexp_t
Modified: trunk/common/gkr-crypto.h
==============================================================================
--- trunk/common/gkr-crypto.h (original)
+++ trunk/common/gkr-crypto.h Sun Feb 10 17:11:13 2008
@@ -27,7 +27,7 @@
#include <glib.h>
#include <gcrypt.h>
-#include "gkr-unique.h"
+#include "gkr-id.h"
void gkr_crypto_setup (void);
@@ -71,7 +71,7 @@
gboolean gkr_crypto_skey_parse (gcry_sexp_t s_key, int *algorithm,
gboolean *is_priv, gcry_sexp_t *numbers);
-gkrunique gkr_crypto_skey_make_id (gcry_sexp_t s_key);
+gkrid gkr_crypto_skey_make_id (gcry_sexp_t s_key);
gboolean gkr_crypto_skey_private_to_public (gcry_sexp_t privkey, gcry_sexp_t *pubkey);
Copied: trunk/common/gkr-id.c (from r1039, /trunk/common/gkr-unique.c)
==============================================================================
--- /trunk/common/gkr-unique.c (original)
+++ trunk/common/gkr-id.c Sun Feb 10 17:11:13 2008
@@ -1,5 +1,5 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gkr-unique.c - Unique binary identifiers
+/* gkr-id.c - Unique binary identifiers
Copyright (C) 2007 Stefan Walter
@@ -23,7 +23,7 @@
#include "config.h"
-#include "gkr-unique.h"
+#include "gkr-id.h"
#include <glib.h>
#include <gcrypt.h>
@@ -43,28 +43,28 @@
#endif
GType
-gkr_unique_get_boxed_type (void)
+gkr_id_get_boxed_type (void)
{
static GType type = 0;
if (!type) {
- type = g_boxed_type_register_static ("gkrunique",
- (GBoxedCopyFunc)gkr_unique_dup,
- gkr_unique_free);
+ type = g_boxed_type_register_static ("gkrid",
+ (GBoxedCopyFunc)gkr_id_dup,
+ gkr_id_free);
}
return type;
}
-gkrunique
-gkr_unique_new (const guchar *data, gsize n_data)
+gkrid
+gkr_id_new (const guchar *data, gsize n_data)
{
- guint *uni;
+ guint *id;
guint len;
g_assert (data != NULL);
g_assert (n_data > 0);
- g_assert (n_data < GKR_UNIQUE_MAX_LENGTH);
+ g_assert (n_data < GKR_ID_MAX_LENGTH);
len = sizeof (guint) + n_data;
@@ -72,23 +72,23 @@
len += sizeof (guint);
#endif
- uni = g_slice_alloc (len);
+ id = g_slice_alloc (len);
#ifdef DEBUG_HEADER
len -= sizeof (guint);
- uni[0] = HEADER_V;
- ++uni;
+ id[0] = HEADER_V;
+ ++id;
#endif
- uni[0] = len;
- memcpy (uni + 1, data, n_data);
- return uni;
+ id[0] = len;
+ memcpy (id + 1, data, n_data);
+ return id;
}
-gkrunique
-gkr_unique_new_digest (const guchar *data, gsize n_data)
+gkrid
+gkr_id_new_digest (const guchar *data, gsize n_data)
{
- guint *uni;
+ guint *id;
guint len;
g_assert (data != NULL);
@@ -100,27 +100,27 @@
len += sizeof (guint);
#endif
- uni = g_slice_alloc (len);
+ id = g_slice_alloc (len);
#ifdef DEBUG_HEADER
len -= sizeof (guint);
- uni[0] = HEADER_V;
- ++uni;
+ id[0] = HEADER_V;
+ ++id;
#endif
- uni[0] = len;
- gcry_md_hash_buffer (GCRY_MD_SHA1, uni + 1, data, n_data);
+ id[0] = len;
+ gcry_md_hash_buffer (GCRY_MD_SHA1, id + 1, data, n_data);
- return uni;
+ return id;
}
-gkrunique
-gkr_unique_new_digestv (const guchar *data, gsize n_data, ...)
+gkrid
+gkr_id_new_digestv (const guchar *data, gsize n_data, ...)
{
gcry_md_hd_t mdh;
gcry_error_t gcry;
const guchar *digest;
- gkrunique uni;
+ gkrid id;
va_list va;
g_assert (data);
@@ -148,99 +148,99 @@
digest = gcry_md_read (mdh, 0);
g_return_val_if_fail (digest != NULL, NULL);
- uni = gkr_unique_new (digest, 20);
+ id = gkr_id_new (digest, 20);
gcry_md_close (mdh);
- return uni;
+ return id;
}
guint
-gkr_unique_hash (gkrconstunique v)
+gkr_id_hash (gkrconstid v)
{
- const guint *uni = (guint*)v;
+ const guint *id = (guint*)v;
const guchar *p;
guint hash, i;
hash = 0;
- for (p = (guchar*)uni, i = *uni; i; i--, p++)
+ for (p = (guchar*)id, i = *id; i; i--, p++)
hash = hash * 33 + *p;
return hash;
}
gboolean
-gkr_unique_equals (gkrconstunique v1, gkrconstunique v2)
+gkr_id_equals (gkrconstid v1, gkrconstid v2)
{
const guint *u1 = (guint*)v1;
const guint *u2 = (guint*)v2;
if (!u1 || !u2)
return FALSE;
g_assert (*u1 > 0 && *u2 > 0);
- g_assert (*u1 < GKR_UNIQUE_MAX_LENGTH && *u2 < GKR_UNIQUE_MAX_LENGTH);
+ g_assert (*u1 < GKR_ID_MAX_LENGTH && *u2 < GKR_ID_MAX_LENGTH);
return (*u1 == *u2 && memcmp (u1, u2, *u1) == 0);
}
-gkrunique
-gkr_unique_dup (gkrconstunique v)
+gkrid
+gkr_id_dup (gkrconstid v)
{
- const guint *uni = (guint*)v;
- guint *nuni;
+ const guint *id = (guint*)v;
+ guint *nid;
guint len;
- if (!uni)
+ if (!id)
return NULL;
- g_assert (*uni > 0);
- g_assert (*uni < GKR_UNIQUE_MAX_LENGTH);
- len = uni[0];
+ g_assert (*id > 0);
+ g_assert (*id < GKR_ID_MAX_LENGTH);
+ len = id[0];
#ifdef DEBUG_HEADER
len += sizeof (guint);
#endif
- nuni = g_slice_alloc (len);
+ nid = g_slice_alloc (len);
#ifdef DEBUG_HEADER
- nuni[0] = HEADER_V;
+ nid[0] = HEADER_V;
len -= sizeof (guint);
- nuni++;
+ nid++;
#endif
- memcpy (nuni, uni, len);
- return nuni;
+ memcpy (nid, id, len);
+ return nid;
}
gconstpointer
-gkr_unique_get_raw (gkrconstunique v, gsize *len)
+gkr_id_get_raw (gkrconstid v, gsize *len)
{
- const guint *uni = (guint*)v;
- if (!uni)
+ const guint *id = (guint*)v;
+ if (!id)
return NULL;
- g_assert (*uni > 0);
- g_assert (*uni < GKR_UNIQUE_MAX_LENGTH);
+ g_assert (*id > 0);
+ g_assert (*id < GKR_ID_MAX_LENGTH);
if (len)
- *len = *uni - sizeof (guint);
- return (uni + 1);
+ *len = *id - sizeof (guint);
+ return (id + 1);
}
void
-gkr_unique_free (gkrunique v)
+gkr_id_free (gkrid v)
{
- guint *uni = (guint*)v;
+ guint *id = (guint*)v;
guint len;
- if (!uni)
+ if (!id)
return;
- g_assert (uni[0] > 0);
- g_assert (uni[0] < GKR_UNIQUE_MAX_LENGTH);
- len = uni[0];
+ g_assert (id[0] > 0);
+ g_assert (id[0] < GKR_ID_MAX_LENGTH);
+ len = id[0];
#ifdef DEBUG_HEADER
- --uni;
- g_assert (uni[0] == HEADER_V);
+ --id;
+ g_assert (id[0] == HEADER_V);
len += sizeof (guint);
#endif
- g_slice_free1 (len, uni);
+ g_slice_free1 (len, id);
}
Copied: trunk/common/gkr-id.h (from r1039, /trunk/common/gkr-unique.h)
==============================================================================
--- /trunk/common/gkr-unique.h (original)
+++ trunk/common/gkr-id.h Sun Feb 10 17:11:13 2008
@@ -1,5 +1,5 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gkr-unique.h - Unique binary identifiers
+/* gkr-id.h - Unique binary identifiers
Copyright (C) 2007 Stefan Walter
@@ -21,36 +21,36 @@
Author: Stef Walter <stef memberwebs com>
*/
-#ifndef GKRUNIQUE_H_
-#define GKRUNIQUE_H_
+#ifndef GKRID_H_
+#define GKRID_H_
#include <glib.h>
#include <glib-object.h>
-#define GKR_UNIQUE_MAX_LENGTH 1024 * 64
+#define GKR_ID_MAX_LENGTH 1024 * 64
-typedef gpointer gkrunique;
-typedef gconstpointer gkrconstunique;
+typedef gpointer gkrid;
+typedef gconstpointer gkrconstid;
-#define GKR_UNIQUE_BOXED_TYPE (gkr_unique_get_boxed_type ())
+#define GKR_ID_BOXED_TYPE (gkr_id_get_boxed_type ())
-GType gkr_unique_get_boxed_type (void);
+GType gkr_id_get_boxed_type (void);
-gkrunique gkr_unique_new (const guchar *data, gsize len);
+gkrid gkr_id_new (const guchar *data, gsize len);
-gkrunique gkr_unique_new_digest (const guchar *data, gsize len);
+gkrid gkr_id_new_digest (const guchar *data, gsize len);
-gkrunique gkr_unique_new_digestv (const guchar *data, gsize len, ...)
+gkrid gkr_id_new_digestv (const guchar *data, gsize len, ...)
G_GNUC_NULL_TERMINATED;
-guint gkr_unique_hash (gkrconstunique v);
+guint gkr_id_hash (gkrconstid v);
-gboolean gkr_unique_equals (gkrconstunique u1, gkrconstunique u2);
+gboolean gkr_id_equals (gkrconstid u1, gkrconstid u2);
-gkrunique gkr_unique_dup (gkrconstunique uni);
+gkrid gkr_id_dup (gkrconstid id);
-gconstpointer gkr_unique_get_raw (gkrconstunique uni, gsize *len);
+gconstpointer gkr_id_get_raw (gkrconstid id, gsize *len);
-void gkr_unique_free (gpointer v);
+void gkr_id_free (gpointer v);
-#endif /*GKRUNIQUE_H_*/
+#endif /*GKRID_H_*/
Modified: trunk/common/tests/unit-test-crypto.c
==============================================================================
--- trunk/common/tests/unit-test-crypto.c (original)
+++ trunk/common/tests/unit-test-crypto.c Sun Feb 10 17:11:13 2008
@@ -253,17 +253,17 @@
void unit_test_make_keyid (CuTest *cu)
{
guchar hash[20];
- gkrunique uni;
+ gkrid id;
const guchar *p;
gsize n;
p = gcry_pk_get_keygrip (thekey, hash);
g_return_if_fail (p == hash);
- uni = gkr_crypto_skey_make_id (thekey);
- CuAssert (cu, "no unique returned as key id", uni != NULL);
+ id = gkr_crypto_skey_make_id (thekey);
+ CuAssert (cu, "null returned as key id", id != NULL);
- p = gkr_unique_get_raw (uni, &n);
+ p = gkr_id_get_raw (id, &n);
CuAssert (cu, "key id is of wrong length", n == sizeof (hash));
CuAssert (cu, "key grip doesn't match key id", memcmp (hash, p, n) == 0);
}
@@ -272,7 +272,7 @@
{
gcry_sexp_t pubkey = NULL;
gboolean ret;
- gkrunique u1, u2;
+ gkrid u1, u2;
ret = gkr_crypto_skey_private_to_public (thekey, &pubkey);
CuAssert (cu, "couldn't make public key", ret);
@@ -281,6 +281,6 @@
u1 = gkr_crypto_skey_make_id (thekey);
u2 = gkr_crypto_skey_make_id (pubkey);
CuAssert (cu, "public and private keys are not equivalent",
- gkr_unique_equals (u1, u2));
+ gkr_id_equals (u1, u2));
}
Modified: trunk/common/tests/unit-test-unique.c
==============================================================================
--- trunk/common/tests/unit-test-unique.c (original)
+++ trunk/common/tests/unit-test-unique.c Sun Feb 10 17:11:13 2008
@@ -33,7 +33,7 @@
#include "run-auto-test.h"
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
/*
* Each test looks like (on one line):
@@ -50,48 +50,48 @@
void unit_test_unique_basics (CuTest* cu)
{
gchar test[] = "my big test";
- gkrunique uni, uni2;
+ gkrid id, id2;
const guchar *data;
gsize n_data;
- uni = gkr_unique_new ((guchar*)test, strlen (test));
- CuAssert (cu, "didn't create unique", uni != NULL);
+ id = gkr_id_new ((guchar*)test, strlen (test));
+ CuAssert (cu, "didn't create id", id != NULL);
- data = gkr_unique_get_raw (uni, &n_data);
+ data = gkr_id_get_raw (id, &n_data);
CuAssert (cu, "raw returned null", data != NULL);
CuAssert (cu, "length has changed", n_data == strlen (test));
CuAssert (cu, "unique data is wrong", memcmp (data, test, n_data) == 0);
- uni2 = gkr_unique_new ((guchar*)test, strlen(test));
- CuAssert (cu, "didn't create unique", uni != NULL);
- CuAssert (cu, "two identically created uniques are different",
- gkr_unique_equals (uni, uni2));
-
- uni2 = gkr_unique_dup (uni);
- CuAssert (cu, "didn't dup unique", uni != NULL);
- CuAssert (cu, "two duped created uniques are different",
- gkr_unique_equals (uni, uni2));
+ id2 = gkr_id_new ((guchar*)test, strlen(test));
+ CuAssert (cu, "didn't create id", id != NULL);
+ CuAssert (cu, "two identically created ids are different",
+ gkr_id_equals (id, id2));
+
+ id2 = gkr_id_dup (id);
+ CuAssert (cu, "didn't dup id", id != NULL);
+ CuAssert (cu, "two duped created ids are different",
+ gkr_id_equals (id, id2));
- gkr_unique_free (uni);
+ gkr_id_free (id);
}
-void unit_test_unique_digest (CuTest* cu)
+void unit_test_id_digest (CuTest* cu)
{
guchar test[40];
- gkrunique uni, uni2;
+ gkrid id, id2;
memset (test, 'h', 40);
- uni = gkr_unique_new_digest (test, 40);
- CuAssert (cu, "didn't create unique", uni != NULL);
+ id = gkr_id_new_digest (test, 40);
+ CuAssert (cu, "didn't create id", id != NULL);
- uni2 = gkr_unique_new_digest (test, 40);
- CuAssert (cu, "didn't create unique", uni != NULL);
- CuAssert (cu, "two identically digested uniques are different",
- gkr_unique_equals (uni, uni2));
-
- uni2 = gkr_unique_new_digestv (test, 20, test + 20, 20, NULL);
- CuAssert (cu, "didn't create unique", uni != NULL);
- CuAssert (cu, "block digested unique is different",
- gkr_unique_equals (uni, uni2));
+ id2 = gkr_id_new_digest (test, 40);
+ CuAssert (cu, "didn't create id", id != NULL);
+ CuAssert (cu, "two identically digested ids are different",
+ gkr_id_equals (id, id2));
+
+ id2 = gkr_id_new_digestv (test, 20, test + 20, 20, NULL);
+ CuAssert (cu, "didn't create id", id != NULL);
+ CuAssert (cu, "block digested id is different",
+ gkr_id_equals (id, id2));
}
Modified: trunk/pk/gkr-pk-cert.c
==============================================================================
--- trunk/pk/gkr-pk-cert.c (original)
+++ trunk/pk/gkr-pk-cert.c Sun Feb 10 17:11:13 2008
@@ -213,12 +213,12 @@
static gboolean
has_private_key (GkrPkCert *cert)
{
- gkrconstunique uni;
+ gkrconstid id;
- uni = gkr_pk_cert_get_keyid (cert);
- g_return_val_if_fail (uni, FALSE);
+ id = gkr_pk_cert_get_keyid (cert);
+ g_return_val_if_fail (id, FALSE);
- return gkr_pk_object_manager_find_by_id (GKR_PK_OBJECT (cert)->manager, GKR_TYPE_PK_PRIVKEY, uni) != NULL;
+ return gkr_pk_object_manager_find_by_id (GKR_PK_OBJECT (cert)->manager, GKR_TYPE_PK_PRIVKEY, id) != NULL;
}
static gboolean
@@ -406,7 +406,7 @@
{
GkrPkCert *cert = GKR_PK_CERT (obj);
const guchar *cdata = NULL;
- gkrconstunique keyid;
+ gkrconstid keyid;
CK_ULONG value;
gchar *index;
guchar *data;
@@ -506,7 +506,7 @@
keyid = gkr_pk_cert_get_keyid (cert);
if (!keyid)
return CKR_GENERAL_ERROR;
- data = (CK_VOID_PTR)gkr_unique_get_raw (keyid, &n_data);
+ data = (CK_VOID_PTR)gkr_id_get_raw (keyid, &n_data);
gkr_pk_attribute_set_data (attr, data, n_data);
return CKR_OK;
@@ -647,7 +647,7 @@
GkrPkCert*
gkr_pk_cert_new (GkrPkObjectManager *manager, GQuark location, ASN1_TYPE asn1)
{
- gkrunique unique = NULL;
+ gkrid id = NULL;
GkrPkCert *cert;
guchar *raw;
gsize n_raw;
@@ -656,14 +656,14 @@
if (asn1) {
raw = gkr_pkix_asn1_encode (asn1, "", &n_raw, NULL);
g_return_val_if_fail (raw, NULL);
- unique = gkr_unique_new_digest (raw, n_raw);
+ id = gkr_id_new_digest (raw, n_raw);
}
cert = g_object_new (GKR_TYPE_PK_CERT, "location", location,
- "unique", unique, "manager", manager,
+ "unique", id, "manager", manager,
"asn1-tree", asn1, NULL);
- gkr_unique_free (unique);
+ gkr_id_free (id);
return cert;
}
@@ -775,7 +775,7 @@
return val;
}
-gkrconstunique
+gkrconstid
gkr_pk_cert_get_keyid (GkrPkCert *cert)
{
GkrPkPubkey *pub;
Modified: trunk/pk/gkr-pk-cert.h
==============================================================================
--- trunk/pk/gkr-pk-cert.h (original)
+++ trunk/pk/gkr-pk-cert.h Sun Feb 10 17:11:13 2008
@@ -64,7 +64,7 @@
guchar* gkr_pk_cert_get_extension (GkrPkCert *cert, GQuark oid,
gsize *n_extension, gboolean *critical);
-gkrconstunique gkr_pk_cert_get_keyid (GkrPkCert *cert);
+gkrconstid gkr_pk_cert_get_keyid (GkrPkCert *cert);
const guchar* gkr_pk_cert_get_raw (GkrPkCert *cert, gsize *n_raw);
Modified: trunk/pk/gkr-pk-index.c
==============================================================================
--- trunk/pk/gkr-pk-index.c (original)
+++ trunk/pk/gkr-pk-index.c Sun Feb 10 17:11:13 2008
@@ -230,7 +230,7 @@
}
static gchar*
-unique_to_group (gkrconstunique uni)
+unique_to_group (gkrconstid uni)
{
const guchar *unidata;
gsize n_group, n_unidata;
@@ -239,7 +239,7 @@
g_return_val_if_fail (uni, NULL);
- unidata = gkr_unique_get_raw (uni, &n_unidata);
+ unidata = gkr_id_get_raw (uni, &n_unidata);
g_assert (unidata);
n_group = (n_unidata * 2) + 1;
group = g_malloc0 (n_group);
@@ -453,7 +453,7 @@
}
static void
-set_keyfile_value (GKeyFile *key_file, gkrconstunique uni,
+set_keyfile_value (GKeyFile *key_file, gkrconstid uni,
const gchar *field, WriteValueFunc func,
gpointer data, gboolean *updated)
{
@@ -665,7 +665,7 @@
}
static gboolean
-read_pk_index_value (GkrPkIndex *index, GQuark loc, gkrconstunique uni,
+read_pk_index_value (GkrPkIndex *index, GQuark loc, gkrconstid uni,
const gchar *field, GkrPkObject *object,
ReadValueFunc func, gpointer data)
{
@@ -720,7 +720,7 @@
}
static gboolean
-update_pk_index_value (GkrPkIndex *index, GQuark loc, gkrconstunique uni,
+update_pk_index_value (GkrPkIndex *index, GQuark loc, gkrconstid uni,
const gchar *field, GkrPkObject *object,
WriteValueFunc func, gpointer data)
{
@@ -970,7 +970,7 @@
}
gchar*
-gkr_pk_index_get_string_full (GQuark location, gkrconstunique uni,
+gkr_pk_index_get_string_full (GQuark location, gkrconstid uni,
const gchar *field)
{
gchar *ret = NULL;
@@ -1058,7 +1058,7 @@
}
gboolean
-gkr_pk_index_have_full (GQuark location, gkrconstunique uni)
+gkr_pk_index_have_full (GQuark location, gkrconstid uni)
{
gboolean ret;
@@ -1103,7 +1103,7 @@
}
gboolean
-gkr_pk_index_set_string_full (GQuark location, gkrconstunique uni, const gchar *field,
+gkr_pk_index_set_string_full (GQuark location, gkrconstid uni, const gchar *field,
const gchar *val)
{
g_return_val_if_fail (uni, FALSE);
Modified: trunk/pk/gkr-pk-index.h
==============================================================================
--- trunk/pk/gkr-pk-index.h (original)
+++ trunk/pk/gkr-pk-index.h Sun Feb 10 17:11:13 2008
@@ -37,7 +37,7 @@
gchar* gkr_pk_index_get_string (GkrPkObject *object, const gchar *field);
-gchar* gkr_pk_index_get_string_full (GQuark location, gkrconstunique uni, const gchar *field);
+gchar* gkr_pk_index_get_string_full (GQuark location, gkrconstid uni, const gchar *field);
guchar* gkr_pk_index_get_binary (GkrPkObject *object, const gchar *field,
gsize *n_data);
@@ -53,7 +53,7 @@
gboolean gkr_pk_index_set_string (GkrPkObject *object, const gchar *field,
const gchar *val);
-gboolean gkr_pk_index_set_string_full (GQuark location, gkrconstunique uni,
+gboolean gkr_pk_index_set_string_full (GQuark location, gkrconstid uni,
const gchar *field, const gchar *val);
gboolean gkr_pk_index_set_binary (GkrPkObject *object, const gchar *field,
@@ -68,7 +68,7 @@
gboolean gkr_pk_index_have (GkrPkObject *object);
-gboolean gkr_pk_index_have_full (GQuark location, gkrconstunique uni);
+gboolean gkr_pk_index_have_full (GQuark location, gkrconstid uni);
gboolean gkr_pk_index_clear (GkrPkObject *object);
Modified: trunk/pk/gkr-pk-netscape-trust.c
==============================================================================
--- trunk/pk/gkr-pk-netscape-trust.c (original)
+++ trunk/pk/gkr-pk-netscape-trust.c Sun Feb 10 17:11:13 2008
@@ -374,7 +374,7 @@
gkr_pk_netscape_trust_new (GkrPkObjectManager *mgr, GkrPkCert *cert)
{
GkrPkNetscapeTrust *trust;
- gkrunique unique = NULL;
+ gkrid unique = NULL;
GkrPkObject *obj;
const guchar *raw;
gsize n_raw;
@@ -384,14 +384,14 @@
/* Make a new unique based on the certificate */
if (obj->unique) {
- raw = gkr_unique_get_raw (obj->unique, &n_raw);
+ raw = gkr_id_get_raw (obj->unique, &n_raw);
g_return_val_if_fail (raw, NULL);
- unique = gkr_unique_new_digestv ((guchar*)"trust", 5, raw, n_raw, NULL);
+ unique = gkr_id_new_digestv ((guchar*)"trust", 5, raw, n_raw, NULL);
}
trust = g_object_new (GKR_TYPE_PK_NETSCAPE_TRUST, "manager", mgr,
"unique", unique, "certificate", cert, NULL);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return trust;
}
Modified: trunk/pk/gkr-pk-object-manager.c
==============================================================================
--- trunk/pk/gkr-pk-object-manager.c (original)
+++ trunk/pk/gkr-pk-object-manager.c Sun Feb 10 17:11:13 2008
@@ -155,7 +155,7 @@
GkrPkObjectManagerPrivate *pv = GKR_PK_OBJECT_MANAGER_GET_PRIVATE (objmgr);
pv->object_by_handle = g_hash_table_new (g_direct_hash, g_direct_equal);
- pv->object_by_unique = g_hash_table_new (gkr_unique_hash, gkr_unique_equals);
+ pv->object_by_unique = g_hash_table_new (gkr_id_hash, gkr_id_equals);
}
static void
@@ -421,7 +421,7 @@
GkrPkObject*
gkr_pk_object_manager_find_by_id (GkrPkObjectManager *objmgr, GType gtype,
- gkrconstunique id)
+ gkrconstid id)
{
CK_ATTRIBUTE attr;
GkrPkObject *object;
@@ -431,7 +431,7 @@
g_return_val_if_fail (id, NULL);
g_return_val_if_fail (GKR_IS_PK_OBJECT_MANAGER (objmgr), NULL);
- attr.pValue = (CK_VOID_PTR)gkr_unique_get_raw (id, &len);
+ attr.pValue = (CK_VOID_PTR)gkr_id_get_raw (id, &len);
attr.ulValueLen = len;
attr.type = CKA_ID;
@@ -448,7 +448,7 @@
}
GkrPkObject*
-gkr_pk_object_manager_find_by_unique (GkrPkObjectManager *objmgr, gkrconstunique unique)
+gkr_pk_object_manager_find_by_unique (GkrPkObjectManager *objmgr, gkrconstid unique)
{
GkrPkObjectManagerPrivate *pv;
GkrPkObject *object;
Modified: trunk/pk/gkr-pk-object-manager.h
==============================================================================
--- trunk/pk/gkr-pk-object-manager.h (original)
+++ trunk/pk/gkr-pk-object-manager.h Sun Feb 10 17:11:13 2008
@@ -94,10 +94,10 @@
GType gtype, ...) G_GNUC_NULL_TERMINATED;
GkrPkObject* gkr_pk_object_manager_find_by_id (GkrPkObjectManager *objmgr,
- GType gtype, gkrconstunique id);
+ GType gtype, gkrconstid id);
GkrPkObject* gkr_pk_object_manager_find_by_unique (GkrPkObjectManager *objmgr,
- gkrconstunique unique);
+ gkrconstid unique);
G_END_DECLS
Modified: trunk/pk/gkr-pk-object-storage.c
==============================================================================
--- trunk/pk/gkr-pk-object-storage.c (original)
+++ trunk/pk/gkr-pk-object-storage.c Sun Feb 10 17:11:13 2008
@@ -89,7 +89,7 @@
}
static gchar*
-parser_ask_password (GkrPkixParser *parser, GQuark loc, gkrunique unique,
+parser_ask_password (GkrPkixParser *parser, GQuark loc, gkrid unique,
GQuark type, const gchar *label, guint failures,
ParseContext *ctx)
{
@@ -213,7 +213,7 @@
}
/* Track that we prompted for this */
- g_hash_table_insert (ctx->types_by_unique, gkr_unique_dup (unique),
+ g_hash_table_insert (ctx->types_by_unique, gkr_id_dup (unique),
GUINT_TO_POINTER (type));
}
@@ -312,7 +312,7 @@
static GkrPkObject*
prepare_object (GkrPkObjectStorage *storage, GQuark location,
- gkrconstunique unique, GQuark type)
+ gkrconstid unique, GQuark type)
{
GkrPkObjectStoragePrivate *pv = GKR_PK_OBJECT_STORAGE_GET_PRIVATE (storage);
GkrPkObjectManager *manager;
@@ -351,7 +351,7 @@
}
static void
-parser_parsed_partial (GkrPkixParser *parser, GQuark location, gkrunique unique,
+parser_parsed_partial (GkrPkixParser *parser, GQuark location, gkrid unique,
GQuark type, ParseContext *ctx)
{
GkrPkObjectStoragePrivate *pv = GKR_PK_OBJECT_STORAGE_GET_PRIVATE (ctx->storage);
@@ -378,12 +378,12 @@
}
/* Track the type for this unique */
- g_hash_table_insert (ctx->types_by_unique, gkr_unique_dup (unique),
+ g_hash_table_insert (ctx->types_by_unique, gkr_id_dup (unique),
GUINT_TO_POINTER (type));
}
static void
-parser_parsed_sexp (GkrPkixParser *parser, GQuark location, gkrunique unique,
+parser_parsed_sexp (GkrPkixParser *parser, GQuark location, gkrid unique,
GQuark type, gcry_sexp_t sexp, ParseContext *ctx)
{
GkrPkObjectStoragePrivate *pv = GKR_PK_OBJECT_STORAGE_GET_PRIVATE (ctx->storage);
@@ -401,7 +401,7 @@
g_hash_table_remove (ctx->checks, object);
/* Track the type for this unique */
- g_hash_table_insert (ctx->types_by_unique, gkr_unique_dup (unique),
+ g_hash_table_insert (ctx->types_by_unique, gkr_id_dup (unique),
GUINT_TO_POINTER (type));
/* Setup the sexp, probably a key on this object */
@@ -409,7 +409,7 @@
}
static void
-parser_parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+parser_parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, ASN1_TYPE asn1, ParseContext *ctx)
{
GkrPkObjectStoragePrivate *pv = GKR_PK_OBJECT_STORAGE_GET_PRIVATE (ctx->storage);
@@ -427,7 +427,7 @@
g_hash_table_remove (ctx->checks, object);
/* Track the type for this unique */
- g_hash_table_insert (ctx->types_by_unique, gkr_unique_dup (unique),
+ g_hash_table_insert (ctx->types_by_unique, gkr_id_dup (unique),
GUINT_TO_POINTER (type));
/* Setup the asn1, probably a certificate on this object */
@@ -443,7 +443,7 @@
}
static void
-index_each_unique (gkrunique unique, gpointer value, gpointer data)
+index_each_unique (gkrid unique, gpointer value, gpointer data)
{
GQuark location = GPOINTER_TO_UINT (data);
GQuark type = GPOINTER_TO_UINT (value);
@@ -474,8 +474,8 @@
ctx.storage = storage;
ctx.checks = g_hash_table_new_full (g_direct_hash, g_direct_equal,
g_object_unref, NULL);
- ctx.types_by_unique = g_hash_table_new_full (gkr_unique_hash, gkr_unique_equals,
- gkr_unique_free, NULL);
+ ctx.types_by_unique = g_hash_table_new_full (gkr_id_hash, gkr_id_equals,
+ gkr_id_free, NULL);
/* Create a table of what is at the location */
k = GUINT_TO_POINTER (loc);
@@ -570,7 +570,7 @@
pv->objects = g_hash_table_new_full (g_direct_hash, g_direct_equal, g_object_unref, NULL);
pv->objects_by_location = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, free_array);
- pv->specific_load_requests = g_hash_table_new_full (gkr_unique_hash, gkr_unique_equals, gkr_unique_free, NULL);
+ pv->specific_load_requests = g_hash_table_new_full (gkr_id_hash, gkr_id_equals, gkr_id_free, NULL);
for (i = 0; i < G_N_ELEMENTS (gkr_pk_places); ++i) {
place = &gkr_pk_places[i];
@@ -694,7 +694,7 @@
/* Make note of the specific load request */
- g_hash_table_replace (pv->specific_load_requests, gkr_unique_dup (obj->unique), NO_VALUE);
+ g_hash_table_replace (pv->specific_load_requests, gkr_id_dup (obj->unique), NO_VALUE);
ret = load_objects_at_location (storage, obj->location, err);
if (!ret)
Modified: trunk/pk/gkr-pk-object.c
==============================================================================
--- trunk/pk/gkr-pk-object.c (original)
+++ trunk/pk/gkr-pk-object.c Sun Feb 10 17:11:13 2008
@@ -269,8 +269,8 @@
xobj->location = g_value_get_uint (value);
break;
case PROP_UNIQUE:
- gkr_unique_free (xobj->unique);
- xobj->unique = gkr_unique_dup (g_value_get_boxed (value));
+ gkr_id_free (xobj->unique);
+ xobj->unique = gkr_id_dup (g_value_get_boxed (value));
break;
case PROP_ORIG_LABEL:
g_free (pv->orig_label);
@@ -329,7 +329,7 @@
g_object_class_install_property (gobject_class, PROP_UNIQUE,
g_param_spec_boxed ("unique", "Unique", "Unique Identifier for Data",
- GKR_UNIQUE_BOXED_TYPE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ GKR_ID_BOXED_TYPE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_object_class_install_property (gobject_class, PROP_ORIG_LABEL,
g_param_spec_string ("orig-label", "Original Label", "Original Label",
Modified: trunk/pk/gkr-pk-object.h
==============================================================================
--- trunk/pk/gkr-pk-object.h (original)
+++ trunk/pk/gkr-pk-object.h Sun Feb 10 17:11:13 2008
@@ -27,7 +27,7 @@
#include <glib-object.h>
#include <pkcs11/pkcs11.h>
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
G_BEGIN_DECLS
@@ -52,7 +52,7 @@
GObject parent;
GQuark location;
- gkrunique unique;
+ gkrid unique;
CK_OBJECT_HANDLE handle;
GkrPkObjectManager *manager;
Modified: trunk/pk/gkr-pk-privkey.c
==============================================================================
--- trunk/pk/gkr-pk-privkey.c (original)
+++ trunk/pk/gkr-pk-privkey.c Sun Feb 10 17:11:13 2008
@@ -33,8 +33,8 @@
#include "gkr-pk-util.h"
#include "common/gkr-crypto.h"
+#include "common/gkr-id.h"
#include "common/gkr-location.h"
-#include "common/gkr-unique.h"
#include "pkcs11/pkcs11.h"
#include "pkcs11/pkcs11g.h"
@@ -308,7 +308,7 @@
attribute_from_certificate (GkrPkPrivkey *key, CK_ATTRIBUTE_PTR attr)
{
GkrPkObject *crt, *obj;
- gkrconstunique keyid;
+ gkrconstid keyid;
keyid = gkr_pk_privkey_get_keyid (key);
if (!keyid)
@@ -391,7 +391,7 @@
gkr_pk_privkey_get_attribute (GkrPkObject* obj, CK_ATTRIBUTE_PTR attr)
{
GkrPkPrivkey *key = GKR_PK_PRIVKEY (obj);
- gkrconstunique keyid;
+ gkrconstid keyid;
GQuark *quarks;
guchar *value;
gsize len;
@@ -450,7 +450,7 @@
keyid = gkr_pk_privkey_get_keyid (key);
if (!keyid)
return CKR_GENERAL_ERROR;
- value = (CK_VOID_PTR)gkr_unique_get_raw (keyid, &len);
+ value = (CK_VOID_PTR)gkr_id_get_raw (keyid, &len);
gkr_pk_attribute_set_data (attr, value, len);
return CKR_OK;
@@ -577,7 +577,7 @@
{
GkrPkObject *key;
guchar hash[20];
- gkrunique unique;
+ gkrid unique;
g_return_val_if_fail (s_key != NULL, NULL);
@@ -585,12 +585,12 @@
g_return_val_if_reached (NULL);
/* We need to create a unique for this key */
- unique = gkr_unique_new_digestv ((const guchar*)"private-key", 11, hash, 20, NULL);
+ unique = gkr_id_new_digestv ((const guchar*)"private-key", 11, hash, 20, NULL);
key = g_object_new (GKR_TYPE_PK_PRIVKEY, "manager", mgr, "location", location,
"gcrypt-sexp", s_key, "unique", unique, NULL);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return key;
}
@@ -633,7 +633,7 @@
return CKR_OK;
}
-gkrconstunique
+gkrconstid
gkr_pk_privkey_get_keyid (GkrPkPrivkey *key)
{
GkrPkPubkey *pub;
Modified: trunk/pk/gkr-pk-privkey.h
==============================================================================
--- trunk/pk/gkr-pk-privkey.h (original)
+++ trunk/pk/gkr-pk-privkey.h Sun Feb 10 17:11:13 2008
@@ -27,7 +27,7 @@
#include "gkr-pk-object.h"
#include "gkr-pk-pubkey.h"
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
#include <gcrypt.h>
@@ -61,9 +61,9 @@
CK_RV gkr_pk_privkey_create (GkrPkObjectManager* manager,
GArray* array, GkrPkObject **object);
-gkrconstunique gkr_pk_privkey_get_keyid (GkrPkPrivkey *pkey);
+gkrconstid gkr_pk_privkey_get_keyid (GkrPkPrivkey *pkey);
-gkrunique gkr_pk_privkey_make_keyid (gcry_sexp_t skey);
+gkrid gkr_pk_privkey_make_keyid (gcry_sexp_t skey);
gcry_sexp_t gkr_pk_privkey_get_key (GkrPkPrivkey *pkey);
Modified: trunk/pk/gkr-pk-pubkey.c
==============================================================================
--- trunk/pk/gkr-pk-pubkey.c (original)
+++ trunk/pk/gkr-pk-pubkey.c Sun Feb 10 17:11:13 2008
@@ -32,8 +32,8 @@
#include "gkr-pk-util.h"
#include "common/gkr-crypto.h"
+#include "common/gkr-id.h"
#include "common/gkr-location.h"
-#include "common/gkr-unique.h"
#include "pkix/gkr-pkix-der.h"
#include "pkix/gkr-pkix-serialize.h"
@@ -57,7 +57,7 @@
struct _GkrPkPubkeyData {
int algorithm;
- gkrunique keyid;
+ gkrid keyid;
gcry_sexp_t s_key;
gcry_sexp_t numbers;
};
@@ -78,7 +78,7 @@
gcry_sexp_release (key->pub->numbers);
key->pub->numbers = NULL;
- gkr_unique_free (key->pub->keyid);
+ gkr_id_free (key->pub->keyid);
key->pub->keyid = NULL;
key->pub->algorithm = 0;
@@ -380,7 +380,7 @@
/* Always a SHA-1 hash output buffer */
if (!load_public_key (key) || !key->pub->keyid)
return CKR_GENERAL_ERROR;
- gkr_pk_attribute_set_unique (attr, key->pub->keyid);
+ gkr_pk_attribute_set_id (attr, key->pub->keyid);
return CKR_OK;
case CKA_SUBJECT:
@@ -487,7 +487,7 @@
{
GkrPkObject *key;
guchar hash[20];
- gkrunique unique;
+ gkrid unique;
g_return_val_if_fail (s_key != NULL, NULL);
@@ -495,12 +495,12 @@
g_return_val_if_reached (NULL);
/* We need to create a unique for this key */
- unique = gkr_unique_new_digestv ((const guchar*)"public-key", 10, hash, 20, NULL);
+ unique = gkr_id_new_digestv ((const guchar*)"public-key", 10, hash, 20, NULL);
key = g_object_new (GKR_TYPE_PK_PUBKEY, "manager", manager, "location", location,
"gcrypt-sexp", s_key, "unique", unique, NULL);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return key;
}
@@ -508,7 +508,7 @@
gkr_pk_pubkey_instance (GkrPkObjectManager *manager, GQuark location, gcry_sexp_t s_key)
{
GkrPkObject *pub;
- gkrunique keyid;
+ gkrid keyid;
g_return_val_if_fail (s_key, NULL);
@@ -518,7 +518,7 @@
/* Try the lookup */
pub = gkr_pk_object_manager_find_by_id (manager, GKR_TYPE_PK_PUBKEY, keyid);
- gkr_unique_free (keyid);
+ gkr_id_free (keyid);
if (pub != NULL) {
gcry_sexp_release (s_key);
@@ -568,7 +568,7 @@
return CKR_OK;
}
-gkrconstunique
+gkrconstid
gkr_pk_pubkey_get_keyid (GkrPkPubkey *key)
{
g_return_val_if_fail (GKR_IS_PK_PUBKEY (key), NULL);
Modified: trunk/pk/gkr-pk-pubkey.h
==============================================================================
--- trunk/pk/gkr-pk-pubkey.h (original)
+++ trunk/pk/gkr-pk-pubkey.h Sun Feb 10 17:11:13 2008
@@ -26,7 +26,7 @@
#include "gkr-pk-object.h"
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
#include <gcrypt.h>
@@ -63,7 +63,7 @@
CK_RV gkr_pk_pubkey_create (GkrPkObjectManager* manager,
GArray* array, GkrPkObject **object);
-gkrconstunique gkr_pk_pubkey_get_keyid (GkrPkPubkey *key);
+gkrconstid gkr_pk_pubkey_get_keyid (GkrPkPubkey *key);
gcry_sexp_t gkr_pk_pubkey_get_key (GkrPkPubkey *key);
Modified: trunk/pk/gkr-pk-util.c
==============================================================================
--- trunk/pk/gkr-pk-util.c (original)
+++ trunk/pk/gkr-pk-util.c Sun Feb 10 17:11:13 2008
@@ -297,14 +297,14 @@
}
void
-gkr_pk_attribute_set_unique (CK_ATTRIBUTE_PTR attr, gkrconstunique uni)
+gkr_pk_attribute_set_id (CK_ATTRIBUTE_PTR attr, gkrconstid id)
{
const guchar* data;
gsize n_data;
g_assert (attr);
- data = gkr_unique_get_raw (uni, &n_data);
+ data = gkr_id_get_raw (id, &n_data);
g_return_if_fail (data && n_data);
gkr_pk_attribute_set_data (attr, data, n_data);
Modified: trunk/pk/gkr-pk-util.h
==============================================================================
--- trunk/pk/gkr-pk-util.h (original)
+++ trunk/pk/gkr-pk-util.h Sun Feb 10 17:11:13 2008
@@ -27,7 +27,7 @@
#include <glib.h>
#include <gcrypt.h>
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
#include "pkcs11/pkcs11.h"
@@ -62,7 +62,7 @@
void gkr_pk_attribute_set_string (CK_ATTRIBUTE_PTR attr, const gchar *str);
-void gkr_pk_attribute_set_unique (CK_ATTRIBUTE_PTR attr, gkrconstunique uni);
+void gkr_pk_attribute_set_id (CK_ATTRIBUTE_PTR attr, gkrconstid id);
void gkr_pk_attribute_set_boolean (CK_ATTRIBUTE_PTR attr, CK_BBOOL value);
Modified: trunk/pk/tests/unit-test-pk-cert.c
==============================================================================
--- trunk/pk/tests/unit-test-pk-cert.c (original)
+++ trunk/pk/tests/unit-test-pk-cert.c Sun Feb 10 17:11:13 2008
@@ -122,8 +122,8 @@
void unit_test_certificate_related (CuTest *cu)
{
GkrPkObject *obj;
- gkrconstunique keyid;
- gkrconstunique pubid;
+ gkrconstid keyid;
+ gkrconstid pubid;
keyid = gkr_pk_cert_get_keyid (certificate_1);
CuAssert (cu, "No key id returned from certificate", keyid != NULL);
@@ -134,7 +134,7 @@
pubid = gkr_pk_pubkey_get_keyid (GKR_PK_PUBKEY (obj));
CuAssert (cu, "No key id returned from public key", pubid != NULL);
- CuAssert (cu, "certificate and public key ids do not match", gkr_unique_equals (keyid, pubid));
+ CuAssert (cu, "certificate and public key ids do not match", gkr_id_equals (keyid, pubid));
}
void unit_test_certificate_extension (CuTest *cu)
Modified: trunk/pk/tests/unit-test-pk-index.c
==============================================================================
--- trunk/pk/tests/unit-test-pk-index.c (original)
+++ trunk/pk/tests/unit-test-pk-index.c Sun Feb 10 17:11:13 2008
@@ -28,8 +28,8 @@
#include "pk/gkr-pk-index.h"
#include "pk/gkr-pk-object.h"
+#include "common/gkr-id.h"
#include "common/gkr-location.h"
-#include "common/gkr-unique.h"
#include <glib.h>
#include <memory.h>
@@ -57,10 +57,10 @@
void unit_setup_index (void)
{
/* This is just any arbitrary data */
- gkrunique unique = gkr_unique_new (DATA, DATA_L);
+ gkrid id = gkr_id_new (DATA, DATA_L);
GQuark location = gkr_location_from_child (GKR_LOCATION_VOLUME_LOCAL, "woof");
- object = g_object_new (GKR_TYPE_PK_OBJECT, "location", location, "unique", unique, NULL);
+ object = g_object_new (GKR_TYPE_PK_OBJECT, "location", location, "unique", id, NULL);
gkr_pk_index_clear (object);
}
Modified: trunk/pk/tests/unit-test-pk-key.c
==============================================================================
--- trunk/pk/tests/unit-test-pk-key.c (original)
+++ trunk/pk/tests/unit-test-pk-key.c Sun Feb 10 17:11:13 2008
@@ -147,8 +147,8 @@
void unit_test_privkey_related (CuTest *cu)
{
GkrPkObject *obj;
- gkrconstunique keyid;
- gkrconstunique pubid;
+ gkrconstid keyid;
+ gkrconstid pubid;
keyid = gkr_pk_privkey_get_keyid (GKR_PK_PRIVKEY (privkey_1));
CuAssert (cu, "No key id returned from private key", keyid != NULL);
@@ -159,7 +159,7 @@
pubid = gkr_pk_pubkey_get_keyid (GKR_PK_PUBKEY (obj));
CuAssert (cu, "No key id returned from public key", pubid != NULL);
- CuAssert (cu, "private and public key ids do not match", gkr_unique_equals (keyid, pubid));
+ CuAssert (cu, "private and public key ids do not match", gkr_id_equals (keyid, pubid));
}
void unit_test_privkey_rsa_create (CuTest *cu)
Modified: trunk/pk/tests/unit-test-pk-netscape-trust.c
==============================================================================
--- trunk/pk/tests/unit-test-pk-netscape-trust.c (original)
+++ trunk/pk/tests/unit-test-pk-netscape-trust.c Sun Feb 10 17:11:13 2008
@@ -66,7 +66,7 @@
void unit_test_create_trust (CuTest* cu)
{
- gkrconstunique keyid;
+ gkrconstid keyid;
GkrPkixResult res;
ASN1_TYPE asn1;
gchar *data;
@@ -117,7 +117,7 @@
void unit_test_trust_related (CuTest *cu)
{
CK_ATTRIBUTE attr;
- gkrconstunique keyid;
+ gkrconstid keyid;
const guchar *id;
gsize n_id;
CK_RV ret;
@@ -125,7 +125,7 @@
keyid = gkr_pk_cert_get_keyid (certificate_1);
CuAssert (cu, "No key id returned from certificate", keyid != NULL);
- id = gkr_unique_get_raw (keyid, &n_id);
+ id = gkr_id_get_raw (keyid, &n_id);
memset (&attr, 0, sizeof (attr));
attr.type = CKA_ID;
Modified: trunk/pkix/gkr-pkix-parser.c
==============================================================================
--- trunk/pkix/gkr-pkix-parser.c (original)
+++ trunk/pkix/gkr-pkix-parser.c Sun Feb 10 17:11:13 2008
@@ -142,7 +142,7 @@
*/
static const gchar*
-enum_next_password (GkrPkixParser *parser, GQuark loc, gkrunique unique,
+enum_next_password (GkrPkixParser *parser, GQuark loc, gkrid unique,
GQuark type, const gchar *label, PasswordState *state)
{
GkrPkixParserPrivate *pv = GKR_PKIX_PARSER_GET_PRIVATE (parser);
@@ -230,7 +230,7 @@
static void
fire_parsed_partial (GkrPkixParser *parser, GQuark location,
- gkrconstunique unique, GQuark type)
+ gkrconstid unique, GQuark type)
{
gboolean owned = FALSE;
@@ -241,7 +241,7 @@
}
static void
-fire_parsed_sexp (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+fire_parsed_sexp (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, gcry_sexp_t sexp)
{
gboolean owned = FALSE;
@@ -256,7 +256,7 @@
}
static void
-fire_parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+fire_parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, ASN1_TYPE asn1)
{
gboolean owned = FALSE;
@@ -297,7 +297,7 @@
}
static gboolean
-gkr_pkix_parser_parsed_partial (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+gkr_pkix_parser_parsed_partial (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type)
{
/* Didn't take ownership of the data */
@@ -305,7 +305,7 @@
}
static gboolean
-gkr_pkix_parser_parsed_asn1 (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+gkr_pkix_parser_parsed_asn1 (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type, ASN1_TYPE asn1)
{
/* Didn't take ownership of the data */
@@ -313,7 +313,7 @@
}
static gboolean
-gkr_pkix_parser_parsed_sexp (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+gkr_pkix_parser_parsed_sexp (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type, gcry_sexp_t sexp)
{
/* Didn't take ownership of the data */
@@ -321,7 +321,7 @@
}
static gchar*
-gkr_pkix_parser_ask_password (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+gkr_pkix_parser_ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type, const gchar *details, guint n_prompts)
{
return NULL;
@@ -537,11 +537,11 @@
gkr_pkix_parser_der_private_key (GkrPkixParser *parser, GQuark loc,
const guchar *data, gsize n_data)
{
- gkrunique unique;
+ gkrid unique;
GkrPkixResult ret;
gcry_sexp_t s_key = NULL;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
ret = gkr_pkix_der_read_private_key_rsa (data, n_data, &s_key);
if (ret == GKR_PKIX_UNRECOGNIZED)
@@ -549,14 +549,14 @@
if (ret == GKR_PKIX_SUCCESS)
fire_parsed_sexp (parser, loc, unique, GKR_PKIX_PRIVATE_KEY, s_key);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return ret;
}
static GkrPkixResult
parse_der_pkcs8_plain (GkrPkixParser *parser, GQuark loc,
- gkrunique unique, const guchar *data, gsize n_data)
+ gkrid unique, const guchar *data, gsize n_data)
{
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
GkrPkixResult ret;
@@ -637,19 +637,19 @@
gkr_pkix_parser_der_pkcs8_plain (GkrPkixParser *parser, GQuark location,
const guchar *data, gsize n_data)
{
- gkrunique unique;
+ gkrid unique;
GkrPkixResult ret;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
ret = parse_der_pkcs8_plain (parser, location, unique, data, n_data);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return ret;
}
static GkrPkixResult
parse_der_pkcs8_encrypted (GkrPkixParser *parser, GQuark location,
- gkrunique unique, const guchar *data, gsize n_data)
+ gkrid unique, const guchar *data, gsize n_data)
{
PasswordState pstate = PASSWORD_STATE_INIT;
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
@@ -750,12 +750,12 @@
gkr_pkix_parser_der_pkcs8_encrypted (GkrPkixParser *parser, GQuark location,
const guchar *data, gsize n_data)
{
- gkrunique unique;
+ gkrid unique;
GkrPkixResult ret;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
ret = parse_der_pkcs8_encrypted (parser, location, unique, data, n_data);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return ret;
}
@@ -764,14 +764,14 @@
gkr_pkix_parser_der_pkcs8 (GkrPkixParser *parser, GQuark loc, const guchar *data,
gsize n_data)
{
- gkrunique unique;
+ gkrid unique;
GkrPkixResult ret;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
ret = parse_der_pkcs8_plain (parser, loc, unique, data, n_data);
if (ret == GKR_PKIX_UNRECOGNIZED)
ret = parse_der_pkcs8_encrypted (parser, loc, unique, data, n_data);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return ret;
}
@@ -784,16 +784,16 @@
gkr_pkix_parser_der_certificate (GkrPkixParser *parser, GQuark loc,
const guchar *data, gsize n_data)
{
- gkrunique unique;
+ gkrid unique;
GkrPkixResult ret;
ASN1_TYPE asn1;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
ret = gkr_pkix_der_read_certificate (data, n_data, &asn1);
if(ret == GKR_PKIX_SUCCESS)
fire_parsed_asn1 (parser, loc, unique, GKR_PKIX_CERTIFICATE, asn1);
- gkr_unique_free (unique);
+ gkr_id_free (unique);
return ret;
}
@@ -803,7 +803,7 @@
*/
static GkrPkixResult
-parse_pkcs12_cert_bag (GkrPkixParser *parser, GQuark loc, gkrunique uni, const guchar *data, gsize n_data)
+parse_pkcs12_cert_bag (GkrPkixParser *parser, GQuark loc, gkrid uni, const guchar *data, gsize n_data)
{
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
ASN1_TYPE casn = ASN1_TYPE_EMPTY;
@@ -843,7 +843,7 @@
}
static GkrPkixResult
-parse_pkcs12_bag (GkrPkixParser *parser, GQuark loc, gkrunique uni, const guchar *data, gsize n_data)
+parse_pkcs12_bag (GkrPkixParser *parser, GQuark loc, gkrid uni, const guchar *data, gsize n_data)
{
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
GkrPkixResult ret, r;
@@ -920,7 +920,7 @@
}
static GkrPkixResult
-parse_pkcs12_encrypted_bag (GkrPkixParser *parser, GQuark loc, gkrunique uni,
+parse_pkcs12_encrypted_bag (GkrPkixParser *parser, GQuark loc, gkrid uni,
const guchar *data, gsize n_data)
{
PasswordState pstate = PASSWORD_STATE_INIT;
@@ -1022,7 +1022,7 @@
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
GkrPkixResult ret, r;
const guchar *bag;
- gkrunique uni = NULL;
+ gkrid uni = NULL;
gsize n_bag;
gchar *part;
GQuark oid;
@@ -1056,8 +1056,8 @@
if (!bag) /* A parse error */
goto done;
- gkr_unique_free (uni);
- uni = gkr_unique_new_digest (bag, n_bag);
+ gkr_id_free (uni);
+ uni = gkr_id_new_digest (bag, n_bag);
/* A non encrypted bag, just parse */
if (oid == OID_PKCS7_DATA) {
@@ -1094,7 +1094,7 @@
if (asn)
asn1_delete_structure (&asn);
if (uni)
- gkr_unique_free (uni);
+ gkr_id_free (uni);
return ret;
}
@@ -1145,7 +1145,7 @@
}
static GkrPkixResult
-parse_pkcs7_signed_data (GkrPkixParser *parser, GQuark loc, gkrunique uni,
+parse_pkcs7_signed_data (GkrPkixParser *parser, GQuark loc, gkrid uni,
const guchar *data, gsize n_data)
{
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
@@ -1192,7 +1192,7 @@
}
static GkrPkixResult
-parse_der_pkcs7 (GkrPkixParser *parser, GQuark loc, gkrunique uni,
+parse_der_pkcs7 (GkrPkixParser *parser, GQuark loc, gkrid uni,
const guchar *data, gsize n_data)
{
ASN1_TYPE asn = ASN1_TYPE_EMPTY;
@@ -1235,11 +1235,11 @@
gkr_pkix_parser_der_pkcs7 (GkrPkixParser *parser, GQuark loc, const guchar *data, gsize n_data)
{
GkrPkixResult ret;
- gkrunique uni;
+ gkrid uni;
- uni = gkr_unique_new_digest (data, n_data);
+ uni = gkr_id_new_digest (data, n_data);
ret = parse_der_pkcs7 (parser, loc, uni, data, n_data);
- gkr_unique_free (uni);
+ gkr_id_free (uni);
return ret;
}
@@ -1271,7 +1271,7 @@
}
static GkrPkixResult
-parse_plain_pem (GkrPkixParser *parser, GQuark location, gkrunique unique,
+parse_plain_pem (GkrPkixParser *parser, GQuark location, gkrid unique,
GQuark type, const guchar *data, gsize n_data)
{
GkrPkixResult res;
@@ -1325,7 +1325,7 @@
}
static GkrPkixResult
-parse_encrypted_pem (GkrPkixParser *parser, GQuark location, gkrunique unique,
+parse_encrypted_pem (GkrPkixParser *parser, GQuark location, gkrid unique,
GQuark type, GHashTable *headers, const guchar *data, gsize n_data)
{
PasswordState pstate = PASSWORD_STATE_INIT;
@@ -1396,10 +1396,10 @@
ParserCtx *ctx = (ParserCtx*)user_data;
GkrPkixResult res = GKR_PKIX_FAILURE;
gboolean encrypted = FALSE;
- gkrunique unique;
+ gkrid unique;
const gchar *val;
- unique = gkr_unique_new_digest (data, n_data);
+ unique = gkr_id_new_digest (data, n_data);
/* See if it's encrypted PEM all openssl like*/
if (headers) {
@@ -1421,7 +1421,7 @@
} else if (ctx->result == GKR_PKIX_UNRECOGNIZED)
ctx->result = res;
- gkr_unique_free (unique);
+ gkr_id_free (unique);
}
GkrPkixResult
Modified: trunk/pkix/gkr-pkix-parser.h
==============================================================================
--- trunk/pkix/gkr-pkix-parser.h (original)
+++ trunk/pkix/gkr-pkix-parser.h Sun Feb 10 17:11:13 2008
@@ -32,7 +32,7 @@
#include <libtasn1.h>
#include "common/gkr-async.h"
-#include "common/gkr-unique.h"
+#include "common/gkr-id.h"
G_BEGIN_DECLS
@@ -57,21 +57,21 @@
/* When an object is not fully parsed because of restrictions */
gboolean (*parsed_partial) (GkrPkixParser *parser, GQuark location,
- gkrconstunique unique, GQuark type);
+ gkrconstid unique, GQuark type);
/* When an ASN.1 type object is parsed */
gboolean (*parsed_asn1) (GkrPkixParser *parser, GQuark location,
- gkrconstunique unique, GQuark type,
+ gkrconstid unique, GQuark type,
ASN1_TYPE asn1);
/* When a gcrypt sexp is parsed */
gboolean (*parsed_sexp) (GkrPkixParser *parser, GQuark location,
- gkrconstunique unique, GQuark type,
+ gkrconstid unique, GQuark type,
gcry_sexp_t sexp);
/* A callback for each password needed */
gchar* (*ask_password) (GkrPkixParser *parser, GQuark location,
- gkrconstunique unique, GQuark type,
+ gkrconstid unique, GQuark type,
const gchar *orig_label, guint failed);
};
Modified: trunk/pkix/tests/unit-test-pkix-parser.c
==============================================================================
--- trunk/pkix/tests/unit-test-pkix-parser.c (original)
+++ trunk/pkix/tests/unit-test-pkix-parser.c Sun Feb 10 17:11:13 2008
@@ -62,7 +62,7 @@
static CuTest *the_cu = NULL;
static gboolean
-parsed_partial (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+parsed_partial (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, gpointer user_data)
{
CuTest *cu = the_cu;
@@ -82,7 +82,7 @@
}
static gboolean
-parsed_sexp (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+parsed_sexp (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, gcry_sexp_t sexp, gpointer user_data)
{
CuTest *cu = the_cu;
@@ -104,7 +104,7 @@
}
static gboolean
-parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstunique unique,
+parsed_asn1 (GkrPkixParser *parser, GQuark location, gkrconstid unique,
GQuark type, ASN1_TYPE asn1, gpointer user_data)
{
CuTest *cu = the_cu;
@@ -126,7 +126,7 @@
}
static gchar*
-ask_password (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type, const gchar *details, guint n_prompts,
gpointer user_data)
{
Modified: trunk/pkix/tests/unit-test-pkix-serialize.c
==============================================================================
--- trunk/pkix/tests/unit-test-pkix-serialize.c (original)
+++ trunk/pkix/tests/unit-test-pkix-serialize.c Sun Feb 10 17:11:13 2008
@@ -68,7 +68,7 @@
}
static gchar*
-ask_password (GkrPkixParser *parser, GQuark loc, gkrconstunique unique,
+ask_password (GkrPkixParser *parser, GQuark loc, gkrconstid unique,
GQuark type, const gchar *details, guint n_prompts,
gpointer user_data)
{
Modified: trunk/ssh/gkr-ssh-daemon-ops.c
==============================================================================
--- trunk/ssh/gkr-ssh-daemon-ops.c (original)
+++ trunk/ssh/gkr-ssh-daemon-ops.c Sun Feb 10 17:11:13 2008
@@ -65,7 +65,7 @@
find_private_key (gcry_sexp_t s_key, gboolean manager)
{
GkrPkPrivkey *key = NULL;
- gkrunique keyid;
+ gkrid keyid;
const guchar *data;
gsize n_data;
GList *l, *objects;
@@ -75,7 +75,7 @@
for (l = ssh_session_keys; l; l = g_list_next (l)) {
key = GKR_PK_PRIVKEY (l->data);
- if (gkr_unique_equals (keyid, gkr_pk_privkey_get_keyid (key)))
+ if (gkr_id_equals (keyid, gkr_pk_privkey_get_keyid (key)))
break;
}
@@ -83,7 +83,7 @@
key = NULL;
if (!key && manager) {
- data = gkr_unique_get_raw (keyid, &n_data);
+ data = gkr_id_get_raw (keyid, &n_data);
g_assert (data && n_data);
objects = gkr_pk_object_manager_findv (gkr_pk_object_manager_for_token (), GKR_TYPE_PK_PRIVKEY,
@@ -94,7 +94,7 @@
}
}
- gkr_unique_free (keyid);
+ gkr_id_free (keyid);
return key;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]