aboutsummaryrefslogtreecommitdiffstats
path: root/smime/lib
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2011-08-16 23:25:56 +0800
committerMatthew Barnes <mbarnes@redhat.com>2011-09-04 19:34:32 +0800
commitfcbbdfbd18e15b4ee8322a0217cf03a689a5e033 (patch)
treee16cd2a2279558c6a2bfb6ca39fcbaac4c85ba59 /smime/lib
parentf78417c48861759d7b0c4535ecd3febe4638a7d3 (diff)
downloadgsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.gz
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.tar.zst
gsoc2013-evolution-fcbbdfbd18e15b4ee8322a0217cf03a689a5e033.zip
Coding style and whitespace cleanup.
Diffstat (limited to 'smime/lib')
-rw-r--r--smime/lib/e-asn1-object.c88
-rw-r--r--smime/lib/e-cert-db.c194
-rw-r--r--smime/lib/e-cert-db.h14
-rw-r--r--smime/lib/e-cert-trust.c8
-rw-r--r--smime/lib/e-cert.c161
-rw-r--r--smime/lib/e-cert.h10
-rw-r--r--smime/lib/e-pkcs12.c81
-rw-r--r--smime/lib/e-pkcs12.h6
8 files changed, 303 insertions, 259 deletions
diff --git a/smime/lib/e-asn1-object.c b/smime/lib/e-asn1-object.c
index a717a6942a..28c3aa7c85 100644
--- a/smime/lib/e-asn1-object.c
+++ b/smime/lib/e-asn1-object.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* The following is the mozilla license blurb, as the bodies some of
- these functions were derived from the mozilla source. */
+ * these functions were derived from the mozilla source. */
/*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -131,14 +131,15 @@ e_asn1_object_get_type (void)
/* This function is used to interpret an integer that
- was encoded in a DER buffer. This function is used
- when converting a DER buffer into a nsIASN1Object
- structure. This interprets the buffer in data
- as defined by the DER (Distinguised Encoding Rules) of
- ASN1.
+ * was encoded in a DER buffer. This function is used
+ * when converting a DER buffer into a nsIASN1Object
+ * structure. This interprets the buffer in data
+ * as defined by the DER (Distinguised Encoding Rules) of
+ * ASN1.
*/
static gint
-get_integer_256 (guchar *data, guint nb)
+get_integer_256 (guchar *data,
+ guint nb)
{
gint val;
@@ -163,17 +164,19 @@ get_integer_256 (guchar *data, guint nb)
}
/* This function is used to retrieve the lenght of a DER encoded
- item. It looks to see if this a multibyte length and then
- interprets the buffer accordingly to get the actual length value.
- This funciton is used mostly while parsing the DER headers.
-
- A DER encoded item has the following structure:
-
- <tag><length<data consisting of lenght bytes>
-*/
+ * item. It looks to see if this a multibyte length and then
+ * interprets the buffer accordingly to get the actual length value.
+ * This funciton is used mostly while parsing the DER headers.
+ *
+ * A DER encoded item has the following structure:
+ *
+ * <tag><length<data consisting of lenght bytes>
+ */
static guint32
-get_der_item_length (guchar *data, guchar *end,
- unsigned long *bytesUsed, gboolean *indefinite)
+get_der_item_length (guchar *data,
+ guchar *end,
+ gulong *bytesUsed,
+ gboolean *indefinite)
{
guchar lbyte = *data++;
PRInt32 length = -1;
@@ -181,13 +184,13 @@ get_der_item_length (guchar *data, guchar *end,
*indefinite = FALSE;
if (lbyte >= 0x80) {
/* Multibyte length */
- unsigned nb = (unsigned) (lbyte & 0x7f);
+ guint nb = (guint) (lbyte & 0x7f);
if (nb > 4) {
return -1;
}
if (nb > 0) {
- if ((data+nb) > end) {
+ if ((data + nb) > end) {
return -1;
}
length = get_integer_256 (data, nb);
@@ -206,9 +209,11 @@ get_der_item_length (guchar *data, guchar *end,
}
static gboolean
-build_from_der (EASN1Object *parent, gchar *data, gchar *end)
+build_from_der (EASN1Object *parent,
+ gchar *data,
+ gchar *end)
{
- unsigned long bytesUsed;
+ gulong bytesUsed;
gboolean indefinite;
PRInt32 len;
PRUint32 type;
@@ -219,13 +224,13 @@ build_from_der (EASN1Object *parent, gchar *data, gchar *end)
return TRUE;
/*
- A DER item has the form of |tag|len|data
- tag is one byte and describes the type of elment
- we are dealing with.
- len is a DER encoded gint telling us how long the data is
- data is a buffer that is len bytes long and has to be
- interpreted according to its type.
- */
+ * A DER item has the form of |tag|len|data
+ * tag is one byte and describes the type of elment
+ * we are dealing with.
+ * len is a DER encoded gint telling us how long the data is
+ * data is a buffer that is len bytes long and has to be
+ * interpreted according to its type.
+ */
while (data < end) {
code = *data;
@@ -242,7 +247,7 @@ build_from_der (EASN1Object *parent, gchar *data, gchar *end)
(guchar *) data, (guchar *) end,
&bytesUsed, &indefinite);
data += bytesUsed;
- if ((len < 0) || ((data+len) > end))
+ if ((len < 0) || ((data + len) > end))
return FALSE;
if (code & SEC_ASN1_CONSTRUCTED) {
@@ -292,8 +297,9 @@ build_from_der (EASN1Object *parent, gchar *data, gchar *end)
return TRUE;
}
-EASN1Object*
-e_asn1_object_new_from_der (gchar *data, guint32 len)
+EASN1Object *
+e_asn1_object_new_from_der (gchar *data,
+ guint32 len)
{
EASN1Object *obj = g_object_new (E_TYPE_ASN1_OBJECT, NULL);
@@ -305,14 +311,15 @@ e_asn1_object_new_from_der (gchar *data, guint32 len)
return obj;
}
-EASN1Object*
+EASN1Object *
e_asn1_object_new (void)
{
return E_ASN1_OBJECT (g_object_new (E_TYPE_ASN1_OBJECT, NULL));
}
void
-e_asn1_object_set_valid_container (EASN1Object *obj, gboolean flag)
+e_asn1_object_set_valid_container (EASN1Object *obj,
+ gboolean flag)
{
obj->priv->valid_container = flag;
}
@@ -335,7 +342,7 @@ e_asn1_object_get_asn1_tag (EASN1Object *obj)
return obj->priv->tag;
}
-GList*
+GList *
e_asn1_object_get_children (EASN1Object *obj)
{
GList *children = g_list_copy (obj->priv->children);
@@ -346,14 +353,16 @@ e_asn1_object_get_children (EASN1Object *obj)
}
void
-e_asn1_object_append_child (EASN1Object *parent, EASN1Object *child)
+e_asn1_object_append_child (EASN1Object *parent,
+ EASN1Object *child)
{
parent->priv->children = g_list_append (
parent->priv->children, g_object_ref (child));
}
void
-e_asn1_object_set_display_name (EASN1Object *obj, const gchar *name)
+e_asn1_object_set_display_name (EASN1Object *obj,
+ const gchar *name)
{
g_free (obj->priv->display_name);
obj->priv->display_name = g_strdup (name);
@@ -366,7 +375,8 @@ e_asn1_object_get_display_name (EASN1Object *obj)
}
void
-e_asn1_object_set_display_value (EASN1Object *obj, const gchar *value)
+e_asn1_object_set_display_value (EASN1Object *obj,
+ const gchar *value)
{
g_free (obj->priv->value);
obj->priv->value = g_strdup (value);
@@ -379,7 +389,9 @@ e_asn1_object_get_display_value (EASN1Object *obj)
}
void
-e_asn1_object_get_data (EASN1Object *obj, gchar **data, guint32 *len)
+e_asn1_object_get_data (EASN1Object *obj,
+ gchar **data,
+ guint32 *len)
{
*data = obj->priv->data;
*len = obj->priv->data_len;
diff --git a/smime/lib/e-cert-db.c b/smime/lib/e-cert-db.c
index a5fbbbed23..7fdd20f6e7 100644
--- a/smime/lib/e-cert-db.c
+++ b/smime/lib/e-cert-db.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* The following is the mozilla license blurb, as the bodies some of
- these functions were derived from the mozilla source. */
+ * these functions were derived from the mozilla source. */
/* e-cert-db.c
*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
@@ -315,7 +315,9 @@ set_nss_error (GError **error)
}
static SECStatus PR_CALLBACK
-collect_certs (gpointer arg, SECItem **certs, gint numcerts)
+collect_certs (gpointer arg,
+ SECItem **certs,
+ gint numcerts)
{
CERTDERCerts *collectArgs;
SECItem *cert;
@@ -342,10 +344,10 @@ collect_certs (gpointer arg, SECItem **certs, gint numcerts)
return (SECSuccess);
}
-static CERTDERCerts*
+static CERTDERCerts *
e_cert_db_get_certs_from_package (PRArenaPool *arena,
- gchar *data,
- guint32 length)
+ gchar *data,
+ guint32 length)
{
/*nsNSSShutDownPreventionLock locker;*/
CERTDERCerts *collectArgs =
@@ -386,19 +388,21 @@ e_cert_db_dispose (GObject *object)
#ifdef notyet
PRBool
ucs2_ascii_conversion_fn (PRBool toUnicode,
- guchar *inBuf,
- guint inBufLen,
- guchar *outBuf,
- guint maxOutBufLen,
- guint *outBufLen,
- PRBool swapBytes)
+ guchar *inBuf,
+ guint inBufLen,
+ guchar *outBuf,
+ guint maxOutBufLen,
+ guint *outBufLen,
+ PRBool swapBytes)
{
printf ("in ucs2_ascii_conversion_fn\n");
}
#endif
static gchar * PR_CALLBACK
-pk11_password (PK11SlotInfo* slot, PRBool retry, gpointer arg)
+pk11_password (PK11SlotInfo *slot,
+ PRBool retry,
+ gpointer arg)
{
gchar *pwd;
gchar *nsspwd;
@@ -497,9 +501,9 @@ install_loadable_roots (void)
if (!RootsModule) {
#ifndef G_OS_WIN32
/* grovel in various places for mozilla's built-in
- cert module.
-
- XXX yes this is gross. *sigh*
+ * cert module.
+ *
+ * XXX yes this is gross. *sigh *
*/
const gchar *paths_to_check[] = {
#ifdef MOZILLA_NSS_LIB_DIR
@@ -617,7 +621,7 @@ e_cert_db_get_type (void)
GStaticMutex init_mutex = G_STATIC_MUTEX_INIT;
static ECertDB *cert_db = NULL;
-ECertDB*
+ECertDB *
e_cert_db_peek (void)
{
g_static_mutex_lock (&init_mutex);
@@ -635,10 +639,10 @@ e_cert_db_shutdown (void)
}
/* searching for certificates */
-ECert*
+ECert *
e_cert_db_find_cert_by_nickname (ECertDB *certdb,
- const gchar *nickname,
- GError **error)
+ const gchar *nickname,
+ GError **error)
{
/* nsNSSShutDownPreventionLock locker;*/
CERTCertificate *cert = NULL;
@@ -661,16 +665,16 @@ e_cert_db_find_cert_by_nickname (ECertDB *certdb,
}
#ifdef notyet
-ECert*
+ECert *
e_cert_db_find_cert_by_key (ECertDB *certdb,
- const gchar *db_key,
- GError **error)
+ const gchar *db_key,
+ GError **error)
{
/* nsNSSShutDownPreventionLock locker;*/
SECItem keyItem = {siBuffer, NULL, 0};
SECItem *dummy;
CERTIssuerAndSN issuerSN;
- unsigned long moduleID,slotID;
+ gulong moduleID,slotID;
CERTCertificate *cert;
if (!db_key) {
@@ -686,10 +690,10 @@ e_cert_db_find_cert_by_key (ECertDB *certdb,
slotID = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG]);
/* build the issuer/SN structure*/
- issuerSN.serialNumber.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG*2]);
- issuerSN.derIssuer.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG*3]);
- issuerSN.serialNumber.data= &keyItem.data[NS_NSS_LONG*4];
- issuerSN.derIssuer.data= &keyItem.data[NS_NSS_LONG*4+
+ issuerSN.serialNumber.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG *2]);
+ issuerSN.derIssuer.len = NS_NSS_GET_LONG (&keyItem.data[NS_NSS_LONG *3]);
+ issuerSN.serialNumber.data= &keyItem.data[NS_NSS_LONG *4];
+ issuerSN.derIssuer.data= &keyItem.data[NS_NSS_LONG *4+
issuerSN.serialNumber.len];
cert = CERT_FindCertByIssuerAndSN (CERT_GetDefaultCertDB (), &issuerSN);
@@ -703,32 +707,32 @@ e_cert_db_find_cert_by_key (ECertDB *certdb,
return NULL;
}
-GList*
-e_cert_db_get_cert_nicknames (ECertDB *certdb,
- ECertType cert_type,
- GError **error)
+GList *
+e_cert_db_get_cert_nicknames (ECertDB *certdb,
+ ECertType cert_type,
+ GError **error)
{
}
-ECert*
+ECert *
e_cert_db_find_email_encryption_cert (ECertDB *certdb,
- const gchar *nickname,
- GError **error)
+ const gchar *nickname,
+ GError **error)
{
}
-ECert*
+ECert *
e_cert_db_find_email_signing_cert (ECertDB *certdb,
- const gchar *nickname,
- GError **error)
+ const gchar *nickname,
+ GError **error)
{
}
#endif
-ECert*
+ECert *
e_cert_db_find_cert_by_email_address (ECertDB *certdb,
- const gchar *email,
- GError **error)
+ const gchar *email,
+ GError **error)
{
/* nsNSSShutDownPreventionLock locker; */
ECert *cert;
@@ -803,7 +807,9 @@ confirm_download_ca_cert (ECertDB *cert_db,
}
static gboolean
-handle_ca_cert_download (ECertDB *cert_db, GList *certs, GError **error)
+handle_ca_cert_download (ECertDB *cert_db,
+ GList *certs,
+ GError **error)
{
ECert *certToShow;
SECItem der;
@@ -811,18 +817,18 @@ handle_ca_cert_download (ECertDB *cert_db, GList *certs, GError **error)
CERTCertificate *tmpCert;
/* First thing we have to do is figure out which certificate
- we're gonna present to the user. The CA may have sent down
- a list of certs which may or may not be a chained list of
- certs. Until the day we can design some solid UI for the
- general case, we'll code to the > 90% case. That case is
- where a CA sends down a list that is a chain up to its root
- in either ascending or descending order. What we're gonna
- do is compare the first 2 entries, if the first was signed
- by the second, we assume the leaf cert is the first cert
- and display it. If the second cert was signed by the first
- cert, then we assume the first cert is the root and the
- last cert in the array is the leaf. In this case we
- display the last cert.
+ * we're gonna present to the user. The CA may have sent down
+ * a list of certs which may or may not be a chained list of
+ * certs. Until the day we can design some solid UI for the
+ * general case, we'll code to the > 90% case. That case is
+ * where a CA sends down a list that is a chain up to its root
+ * in either ascending or descending order. What we're gonna
+ * do is compare the first 2 entries, if the first was signed
+ * by the second, we assume the leaf cert is the first cert
+ * and display it. If the second cert was signed by the first
+ * cert, then we assume the first cert is the root and the
+ * last cert in the array is the leaf. In this case we
+ * display the last cert.
*/
/* nsNSSShutDownPreventionLock locker;*/
@@ -855,17 +861,17 @@ handle_ca_cert_download (ECertDB *cert_db, GList *certs, GError **error)
if (!strcmp (cert1IssuerName, cert0SubjectName)) {
/* In this case, the first cert in the list signed the second,
- so the first cert is the root. Let's display the last cert
- in the list. */
+ * so the first cert is the root. Let's display the last cert
+ * in the list. */
certToShow = E_CERT (g_list_last (certs)->data);
}
else if (!strcmp (cert0IssuerName, cert1SubjectName)) {
/* In this case the second cert has signed the first cert. The
- first cert is the leaf, so let's display it. */
+ * first cert is the leaf, so let's display it. */
certToShow = cert0;
} else {
/* It's not a chain, so let's just show the first one in the
- downloaded list. */
+ * downloaded list. */
certToShow = cert0;
}
}
@@ -967,17 +973,17 @@ handle_ca_cert_download (ECertDB *cert_db, GList *certs, GError **error)
#if 0
/* Now it's time to add the rest of the certs we just downloaded.
- Since we didn't prompt the user about any of these certs, we
- won't set any trust bits for them. */
+ * Since we didn't prompt the user about any of these certs, we
+ * won't set any trust bits for them. */
e_cert_trust_init (&trust);
e_cert_trust_set_valid_ca (&trust);
e_cert_trusts_add_ca_trust (&trust, 0, 0, 0);
- for (PRUint32 i=0; i<numCerts; i++) {
+ for (PRUint32 i = 0; i < numCerts; i++) {
if (i == selCertIndex)
continue;
certToShow = do_QueryElementAt (x509Certs, i);
- certToShow->GetRawDER (&der.len, (PRUint8 **)&der.data);
+ certToShow->GetRawDER (&der.len, (PRUint8 **) &der.data);
CERTCertificate *tmpCert2 =
CERT_NewTempCertificate (certdb, &der, nsnull, PR_FALSE, PR_TRUE);
@@ -1019,10 +1025,10 @@ gboolean e_cert_db_change_cert_trust (CERTCertificate *cert, CERTCertTrust *trus
/* deleting certificates */
gboolean
e_cert_db_delete_cert (ECertDB *certdb,
- ECert *ecert)
+ ECert *ecert)
{
/* nsNSSShutDownPreventionLock locker;
- nsNSSCertificate *nssCert = NS_STATIC_CAST (nsNSSCertificate*, aCert); */
+ * nsNSSCertificate *nssCert = NS_STATIC_CAST (nsNSSCertificate *, aCert); */
CERTCertificate *cert;
@@ -1051,10 +1057,11 @@ e_cert_db_delete_cert (ECertDB *certdb,
/* importing certificates */
gboolean
e_cert_db_import_certs (ECertDB *certdb,
- gchar *data, guint32 length,
- ECertType cert_type,
- GSList **imported_certs,
- GError **error)
+ gchar *data,
+ guint32 length,
+ ECertType cert_type,
+ GSList **imported_certs,
+ GError **error)
{
/*nsNSSShutDownPreventionLock locker;*/
PRArenaPool *arena = PORT_NewArena (DER_DEFAULT_CHUNKSIZE);
@@ -1070,7 +1077,7 @@ e_cert_db_import_certs (ECertDB *certdb,
}
/* Now let's create some certs to work with */
- for (i=0; i<certCollection->numcerts; i++) {
+ for (i = 0; i < certCollection->numcerts; i++) {
SECItem *currItem = &certCollection->rawCerts[i];
ECert *cert;
@@ -1117,9 +1124,10 @@ e_cert_db_import_certs (ECertDB *certdb,
gboolean
e_cert_db_import_email_cert (ECertDB *certdb,
- gchar *data, guint32 length,
- GSList **imported_certs,
- GError **error)
+ gchar *data,
+ guint32 length,
+ GSList **imported_certs,
+ GError **error)
{
/*nsNSSShutDownPreventionLock locker;*/
SECStatus srv = SECFailure;
@@ -1198,9 +1206,9 @@ default_nickname (CERTCertificate *cert)
gchar *nickname = NULL;
gchar *tmp = NULL;
gint count;
- const gchar *nickFmt=NULL;
+ const gchar *nickFmt = NULL;
CERTCertificate *dummycert;
- PK11SlotInfo *slot=NULL;
+ PK11SlotInfo *slot = NULL;
CK_OBJECT_HANDLE keyHandle;
CERTCertDBHandle *defaultcertdb = CERT_GetDefaultCertDB ();
@@ -1316,8 +1324,9 @@ default_nickname (CERTCertificate *cert)
gboolean
e_cert_db_import_user_cert (ECertDB *certdb,
- gchar *data, guint32 length,
- GError **error)
+ gchar *data,
+ guint32 length,
+ GError **error)
{
/* nsNSSShutDownPreventionLock locker;*/
PK11SlotInfo *slot;
@@ -1327,7 +1336,7 @@ e_cert_db_import_user_cert (ECertDB *certdb,
SECItem *CACerts;
CERTDERCerts * collectArgs;
PRArenaPool *arena;
- CERTCertificate * cert=NULL;
+ CERTCertificate * cert = NULL;
arena = PORT_NewArena (DER_DEFAULT_CHUNKSIZE);
if (arena == NULL) {
@@ -1376,7 +1385,7 @@ e_cert_db_import_user_cert (ECertDB *certdb,
numCACerts = collectArgs->numcerts - 1;
if (numCACerts) {
- CACerts = collectArgs->rawCerts+1;
+ CACerts = collectArgs->rawCerts + 1;
if (!CERT_ImportCAChain (CACerts, numCACerts, certUsageUserCertImport)) {
rv = TRUE;
}
@@ -1394,21 +1403,22 @@ e_cert_db_import_user_cert (ECertDB *certdb,
gboolean
e_cert_db_import_server_cert (ECertDB *certdb,
- gchar *data, guint32 length,
- GSList **imported_certs,
- GError **error)
+ gchar *data,
+ guint32 length,
+ GSList **imported_certs,
+ GError **error)
{
/* not c&p'ing this over at the moment, as we don't have a UI
- for server certs anyway */
+ * for server certs anyway */
return FALSE;
}
gboolean
e_cert_db_import_certs_from_file (ECertDB *cert_db,
- const gchar *file_path,
- ECertType cert_type,
- GSList **imported_certs,
- GError **error)
+ const gchar *file_path,
+ ECertType cert_type,
+ GSList **imported_certs,
+ GError **error)
{
gboolean rv;
gint fd;
@@ -1429,7 +1439,7 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db,
return FALSE;
}
- fd = g_open (file_path, O_RDONLY|O_BINARY, 0);
+ fd = g_open (file_path, O_RDONLY | O_BINARY, 0);
if (fd == -1) {
set_nss_error (error);
return FALSE;
@@ -1484,8 +1494,8 @@ e_cert_db_import_certs_from_file (ECertDB *cert_db,
gboolean
e_cert_db_import_pkcs12_file (ECertDB *cert_db,
- const gchar *file_path,
- GError **error)
+ const gchar *file_path,
+ GError **error)
{
EPKCS12 *pkcs12 = e_pkcs12_new ();
GError *e = NULL;
@@ -1501,16 +1511,16 @@ e_cert_db_import_pkcs12_file (ECertDB *cert_db,
#ifdef notyet
gboolean
e_cert_db_export_pkcs12_file (ECertDB *cert_db,
- const gchar *file_path,
- GList *certs,
- GError **error)
+ const gchar *file_path,
+ GList *certs,
+ GError **error)
{
}
#endif
gboolean
e_cert_db_login_to_slot (ECertDB *cert_db,
- PK11SlotInfo *slot)
+ PK11SlotInfo *slot)
{
if (PK11_NeedLogin (slot)) {
PK11_Logout (slot);
diff --git a/smime/lib/e-cert-db.h b/smime/lib/e-cert-db.h
index 6e1bc5a7c5..26d0a25c2a 100644
--- a/smime/lib/e-cert-db.h
+++ b/smime/lib/e-cert-db.h
@@ -66,34 +66,34 @@ struct _ECertDBClass {
GType e_cert_db_get_type (void);
/* single instance */
-ECertDB* e_cert_db_peek (void);
+ECertDB * e_cert_db_peek (void);
void e_cert_db_shutdown (void);
/* searching for certificates */
-ECert* e_cert_db_find_cert_by_nickname (ECertDB *certdb,
+ECert * e_cert_db_find_cert_by_nickname (ECertDB *certdb,
const gchar *nickname,
GError **error);
#ifdef notyet
-ECert* e_cert_db_find_cert_by_key (ECertDB *certdb,
+ECert * e_cert_db_find_cert_by_key (ECertDB *certdb,
const gchar *db_key,
GError **error);
-GList* e_cert_db_get_cert_nicknames (ECertDB *certdb,
+GList * e_cert_db_get_cert_nicknames (ECertDB *certdb,
ECertType cert_type,
GError **error);
-ECert* e_cert_db_find_email_encryption_cert (ECertDB *certdb,
+ECert * e_cert_db_find_email_encryption_cert (ECertDB *certdb,
const gchar *nickname,
GError **error);
-ECert* e_cert_db_find_email_signing_cert (ECertDB *certdb,
+ECert * e_cert_db_find_email_signing_cert (ECertDB *certdb,
const gchar *nickname,
GError **error);
#endif
-ECert* e_cert_db_find_cert_by_email_address (ECertDB *certdb,
+ECert * e_cert_db_find_cert_by_email_address (ECertDB *certdb,
const gchar *nickname,
GError **error);
diff --git a/smime/lib/e-cert-trust.c b/smime/lib/e-cert-trust.c
index 5bb13318a8..e1c7124e41 100644
--- a/smime/lib/e-cert-trust.c
+++ b/smime/lib/e-cert-trust.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* The following is the mozilla license blurb, as the bodies some of
- these functions were derived from the mozilla source. */
+ * these functions were derived from the mozilla source. */
/*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -442,13 +442,15 @@ e_cert_trust_has_trusted_peer (CERTCertTrust *trust,
}
void
-e_cert_trust_add_trust (guint *t, guint v)
+e_cert_trust_add_trust (guint *t,
+ guint v)
{
*t |= v;
}
PRBool
-e_cert_trust_has_trust (guint t, guint v)
+e_cert_trust_has_trust (guint t,
+ guint v)
{
return (t & v);
}
diff --git a/smime/lib/e-cert.c b/smime/lib/e-cert.c
index 6d00ffb20c..e7aecc10c8 100644
--- a/smime/lib/e-cert.c
+++ b/smime/lib/e-cert.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* The following is the mozilla license blurb, as the bodies some of
- these functions were derived from the mozilla source. */
+ * these functions were derived from the mozilla source. */
/*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -59,7 +59,7 @@ struct _ECertPrivate {
CERTCertificate *cert;
/* pointers we cache since the nss implementation allocs the
- string */
+ * string */
gchar *org_name;
gchar *org_unit_name;
gchar *cn;
@@ -134,8 +134,8 @@ e_cert_dispose (GObject *object)
PK11_DeleteTokenCertAndKey (ec->priv->cert, NULL);
} else if (!PK11_IsReadOnly (ec->priv->cert->slot)) {
/* If the list of built-ins does contain a non-removable
- copy of this certificate, our call will not remove
- the certificate permanently, but rather remove all trust. */
+ * copy of this certificate, our call will not remove
+ * the certificate permanently, but rather remove all trust. */
SEC_DeletePermCertificate (ec->priv->cert);
}
}
@@ -258,7 +258,7 @@ e_cert_populate (ECert *cert)
cert->priv->md5_fingerprint = CERT_Hexify (&fpItem, TRUE);
}
-ECert*
+ECert *
e_cert_new (CERTCertificate *cert)
{
ECert *ecert = E_CERT (g_object_new (E_TYPE_CERT, NULL));
@@ -271,8 +271,9 @@ e_cert_new (CERTCertificate *cert)
return ecert;
}
-ECert*
-e_cert_new_from_der (gchar *data, guint32 len)
+ECert *
+e_cert_new_from_der (gchar *data,
+ guint32 len)
{
CERTCertificate *cert = CERT_DecodeCertFromPackage (data, len);
@@ -287,7 +288,7 @@ e_cert_new_from_der (gchar *data, guint32 len)
-CERTCertificate*
+CERTCertificate *
e_cert_get_internal_cert (ECert *cert)
{
/* XXX should this refcnt it? */
@@ -295,11 +296,13 @@ e_cert_get_internal_cert (ECert *cert)
}
gboolean
-e_cert_get_raw_der (ECert *cert, gchar **data, guint32 *len)
+e_cert_get_raw_der (ECert *cert,
+ gchar **data,
+ guint32 *len)
{
/* XXX do we really need to check if cert->priv->cert is NULL
- here? it should always be non-null if we have the
- ECert.. */
+ * here? it should always be non - null if we have the
+ * ECert.. */
if (cert->priv->cert) {
*data = (gchar *)cert->priv->cert->derCert.data;
*len = (guint32)cert->priv->cert->derCert.len;
@@ -312,7 +315,7 @@ e_cert_get_raw_der (ECert *cert, gchar **data, guint32 *len)
}
const gchar *
-e_cert_get_window_title (ECert *cert)
+e_cert_get_window_title (ECert *cert)
{
if (cert->priv->cert->nickname)
return cert->priv->cert->nickname;
@@ -329,13 +332,13 @@ e_cert_get_nickname (ECert *cert)
}
const gchar *
-e_cert_get_email (ECert *cert)
+e_cert_get_email (ECert *cert)
{
return cert->priv->cert->emailAddr;
}
const gchar *
-e_cert_get_org (ECert *cert)
+e_cert_get_org (ECert *cert)
{
return cert->priv->org_name;
}
@@ -347,7 +350,7 @@ e_cert_get_org_unit (ECert *cert)
}
const gchar *
-e_cert_get_cn (ECert *cert)
+e_cert_get_cn (ECert *cert)
{
return cert->priv->cn;
}
@@ -383,7 +386,7 @@ e_cert_get_subject_name (ECert *cert)
}
PRTime
-e_cert_get_issued_on_time (ECert *cert)
+e_cert_get_issued_on_time (ECert *cert)
{
return cert->priv->issued_on;
}
@@ -395,7 +398,7 @@ e_cert_get_issued_on (ECert *cert)
}
PRTime
-e_cert_get_expires_on_time (ECert *cert)
+e_cert_get_expires_on_time (ECert *cert)
{
return cert->priv->expires_on;
}
@@ -451,12 +454,12 @@ e_cert_get_sha1_fingerprint (ECert *cert)
}
const gchar *
-e_cert_get_md5_fingerprint (ECert *cert)
+e_cert_get_md5_fingerprint (ECert *cert)
{
return cert->priv->md5_fingerprint;
}
-GList*
+GList *
e_cert_get_chain (ECert *ecert)
{
GList *l = NULL;
@@ -506,7 +509,7 @@ e_cert_get_ca_cert (ECert *ecert)
static gboolean
get_int_value (SECItem *versionItem,
- unsigned long *version)
+ gulong *version)
{
SECStatus srv;
srv = SEC_ASN1DecodeInteger (versionItem,version);
@@ -518,11 +521,11 @@ get_int_value (SECItem *versionItem,
}
static gboolean
-process_version (SECItem *versionItem,
- EASN1Object **retItem)
+process_version (SECItem *versionItem,
+ EASN1Object **retItem)
{
EASN1Object *item = e_asn1_object_new ();
- unsigned long version;
+ gulong version;
e_asn1_object_set_display_name (item, _("Version"));
@@ -533,7 +536,7 @@ process_version (SECItem *versionItem,
return FALSE;
} else {
/* If there is no version present in the cert, then rfc2459
- says we default to v1 (0) */
+ * says we default to v1 (0) */
version = 0;
}
@@ -557,8 +560,8 @@ process_version (SECItem *versionItem,
}
static gboolean
-process_serial_number_der (SECItem *serialItem,
- EASN1Object **retItem)
+process_serial_number_der (SECItem *serialItem,
+ EASN1Object **retItem)
{
gchar *serialNumber;
EASN1Object *item = e_asn1_object_new ();
@@ -576,13 +579,13 @@ process_serial_number_der (SECItem *serialItem,
static gboolean
get_default_oid_format (SECItem *oid,
- gchar **text)
+ gchar **text)
{
gchar buf[300];
guint len;
gint written;
- unsigned long val = oid->data[0];
+ gulong val = oid->data[0];
guint i = val % 40;
val /= 40;
written = PR_snprintf(buf, 300, "%lu %u ", val, i);
@@ -593,13 +596,13 @@ get_default_oid_format (SECItem *oid,
val = 0;
for (i = 1; i < oid->len; ++i) {
/* In this loop, we have to parse a DER formatted
- If the first bit is a 1, then the integer is
- represented by more than one byte. If the
- first bit is set then we continue on and add
- the values of the later bytes until we get
- a byte without the first bit set.
+ * If the first bit is a 1, then the integer is
+ * represented by more than one byte. If the
+ * first bit is set then we continue on and add
+ * the values of the later bytes until we get
+ * a byte without the first bit set.
*/
- unsigned long j;
+ gulong j;
j = oid->data[i];
val = (val << 7) | (j & 0x7f);
@@ -620,7 +623,8 @@ get_default_oid_format (SECItem *oid,
}
static gboolean
-get_oid_text (SECItem *oid, gchar **text)
+get_oid_text (SECItem *oid,
+ gchar **text)
{
SECOidTag oidTag = SECOID_FindOIDTag (oid);
gchar *temp;
@@ -699,22 +703,23 @@ get_oid_text (SECItem *oid, gchar **text)
}
static gboolean
-process_raw_bytes (SECItem *data, gchar **text)
+process_raw_bytes (SECItem *data,
+ gchar **text)
{
/* This function is used to display some DER bytes
- that we have not added support for decoding.
- It prints the value of the byte out into a
- string that can later be displayed as a byte
- string. We place a new line after 24 bytes
- to break up extermaly long sequence of bytes.
+ * that we have not added support for decoding.
+ * It prints the value of the byte out into a
+ * string that can later be displayed as a byte
+ * string. We place a new line after 24 bytes
+ * to break up extermaly long sequence of bytes.
*/
GString *str = g_string_new ("");
PRUint32 i;
gchar buffer[5];
- for (i=0; i<data->len; i++) {
+ for (i = 0; i < data->len; i++) {
PR_snprintf(buffer, 5, "%02x ", data->data[i]);
g_string_append (str, buffer);
- if ((i+1)%16 == 0) {
+ if ((i + 1) % 16 == 0) {
g_string_append (str, "\n");
}
}
@@ -723,8 +728,8 @@ process_raw_bytes (SECItem *data, gchar **text)
}
static gboolean
-process_sec_algorithm_id (SECAlgorithmID *algID,
- EASN1Object **retSequence)
+process_sec_algorithm_id (SECAlgorithmID *algID,
+ EASN1Object **retSequence)
{
EASN1Object *sequence = e_asn1_object_new ();
gchar *text;
@@ -763,7 +768,7 @@ process_sec_algorithm_id (SECAlgorithmID *algID,
static gboolean
process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki,
- EASN1Object *parentSequence)
+ EASN1Object *parentSequence)
{
EASN1Object *spkiSequence = e_asn1_object_new ();
EASN1Object *sequenceItem;
@@ -781,8 +786,8 @@ process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki,
e_asn1_object_append_child (spkiSequence, sequenceItem);
/* The subjectPublicKey field is encoded as a bit string.
- ProcessRawBytes expects the lenght to be in bytes, so
- let's convert the lenght into a temporary SECItem.
+ * ProcessRawBytes expects the lenght to be in bytes, so
+ * let's convert the lenght into a temporary SECItem.
*/
data.data = spki->subjectPublicKey.data;
data.len = spki->subjectPublicKey.len / 8;
@@ -802,8 +807,8 @@ process_subject_public_key_info (CERTSubjectPublicKeyInfo *spki,
}
static gboolean
-process_ns_cert_type_extensions (SECItem *extData,
- GString *text)
+process_ns_cert_type_extensions (SECItem *extData,
+ GString *text)
{
SECItem decoded;
guchar nsCertType;
@@ -852,7 +857,8 @@ process_ns_cert_type_extensions (SECItem *extData,
}
static gboolean
-process_key_usage_extensions (SECItem *extData, GString *text)
+process_key_usage_extensions (SECItem *extData,
+ GString *text)
{
SECItem decoded;
guchar keyUsage;
@@ -901,8 +907,9 @@ process_key_usage_extensions (SECItem *extData, GString *text)
}
static gboolean
-process_extension_data (SECOidTag oidTag, SECItem *extData,
- GString *str)
+process_extension_data (SECOidTag oidTag,
+ SECItem *extData,
+ GString *str)
{
gboolean rv;
switch (oidTag) {
@@ -925,7 +932,7 @@ process_extension_data (SECOidTag oidTag, SECItem *extData,
static gboolean
process_single_extension (CERTCertExtension *extension,
- EASN1Object **retExtension)
+ EASN1Object **retExtension)
{
GString *str = g_string_new ("");
gchar *text;
@@ -962,14 +969,14 @@ process_single_extension (CERTCertExtension *extension,
static gboolean
process_extensions (CERTCertExtension **extensions,
- EASN1Object *parentSequence)
+ EASN1Object *parentSequence)
{
EASN1Object *extensionSequence = e_asn1_object_new ();
PRInt32 i;
e_asn1_object_set_display_name (extensionSequence, _("Extensions"));
- for (i=0; extensions[i] != NULL; i++) {
+ for (i = 0; extensions[i] != NULL; i++) {
EASN1Object *newExtension;
if (!process_single_extension (extensions[i],
@@ -983,12 +990,13 @@ process_extensions (CERTCertExtension **extensions,
}
static gboolean
-process_name (CERTName *name, gchar **value)
+process_name (CERTName *name,
+ gchar **value)
{
- CERTRDN** rdns;
- CERTRDN** rdn;
- CERTAVA** avas;
- CERTAVA* ava;
+ CERTRDN ** rdns;
+ CERTRDN ** rdn;
+ CERTAVA ** avas;
+ CERTAVA * ava;
SECItem *decodeItem = NULL;
GString *final_string = g_string_new ("");
@@ -1057,7 +1065,8 @@ process_name (CERTName *name, gchar **value)
}
static gboolean
-create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq)
+create_tbs_certificate_asn1_struct (ECert *cert,
+ EASN1Object **seq)
{
/*
** TBSCertificate ::= SEQUENCE {
@@ -1113,14 +1122,14 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq)
g_object_unref (subitem);
#ifdef notyet
- nsCOMPtr<nsIASN1Sequence> validitySequence = new nsNSSASN1Sequence ();
+ nsCOMPtr < nsIASN1Sequence> validitySequence = new nsNSSASN1Sequence ();
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpValidity").get(),
text);
validitySequence->SetDisplayName (text);
asn1Objects->AppendElement (validitySequence, PR_FALSE);
nssComponent->GetPIPNSSBundleString(NS_LITERAL_STRING("CertDumpNotBefore").get(),
text);
- nsCOMPtr<nsIX509CertValidity> validityData;
+ nsCOMPtr < nsIX509CertValidity> validityData;
GetValidity (getter_AddRefs (validityData));
PRTime notBefore, notAfter;
@@ -1154,9 +1163,9 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq)
/* Is there an issuerUniqueID? */
if (cert->priv->cert->issuerID.data) {
/* The issuerID is encoded as a bit string.
- The function ProcessRawBytes expects the
- length to be in bytes, so let's convert the
- length in a temporary SECItem
+ * The function ProcessRawBytes expects the
+ * length to be in bytes, so let's convert the
+ * length in a temporary SECItem
*/
data.data = cert->priv->cert->issuerID.data;
data.len = cert->priv->cert->issuerID.len / 8;
@@ -1173,9 +1182,9 @@ create_tbs_certificate_asn1_struct (ECert *cert, EASN1Object **seq)
if (cert->priv->cert->subjectID.data) {
/* The subjectID is encoded as a bit string.
- The function ProcessRawBytes expects the
- length to be in bytes, so let's convert the
- length in a temporary SECItem
+ * The function ProcessRawBytes expects the
+ * length to be in bytes, so let's convert the
+ * length in a temporary SECItem
*/
data.data = cert->priv->cert->issuerID.data;
data.len = cert->priv->cert->issuerID.len / 8;
@@ -1211,7 +1220,7 @@ create_asn1_struct (ECert *cert)
e_asn1_object_set_display_name (cert->priv->asn1, e_cert_get_window_title (cert));
/* This sequence will be contain the tbsCertificate, signatureAlgorithm,
- and signatureValue. */
+ * and signatureValue. */
if (!create_tbs_certificate_asn1_struct (cert, &sequence))
return FALSE;
@@ -1231,9 +1240,9 @@ create_asn1_struct (ECert *cert)
sequence, _("Certificate Signature Value"));
/* The signatureWrap is encoded as a bit string.
- The function ProcessRawBytes expects the
- length to be in bytes, so let's convert the
- length in a temporary SECItem */
+ * The function ProcessRawBytes expects the
+ * length to be in bytes, so let's convert the
+ * length in a temporary SECItem */
temp.data = cert->priv->cert->signatureWrap.signature.data;
temp.len = cert->priv->cert->signatureWrap.signature.len / 8;
process_raw_bytes (&temp, &text);
@@ -1244,7 +1253,7 @@ create_asn1_struct (ECert *cert)
return TRUE;
}
-EASN1Object*
+EASN1Object *
e_cert_get_asn1_struct (ECert *cert)
{
if (!cert->priv->asn1)
@@ -1260,7 +1269,7 @@ e_cert_mark_for_deletion (ECert *cert)
#if 0
/* make sure user is logged in to the token */
- nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext ();
+ nsCOMPtr < nsIInterfaceRequestor> ctx = new PipUIContext ();
#endif
if (PK11_NeedLogin (cert->priv->cert->slot)
diff --git a/smime/lib/e-cert.h b/smime/lib/e-cert.h
index 3a092a71d4..4159c40cb9 100644
--- a/smime/lib/e-cert.h
+++ b/smime/lib/e-cert.h
@@ -66,10 +66,10 @@ struct _ECertClass {
GType e_cert_get_type (void);
-ECert* e_cert_new (CERTCertificate *cert);
-ECert* e_cert_new_from_der (gchar *data, guint32 len);
+ECert * e_cert_new (CERTCertificate *cert);
+ECert * e_cert_new_from_der (gchar *data, guint32 len);
-CERTCertificate* e_cert_get_internal_cert (ECert *cert);
+CERTCertificate * e_cert_get_internal_cert (ECert *cert);
gboolean e_cert_get_raw_der (ECert *cert, gchar **data, guint32 *len);
const gchar * e_cert_get_window_title (ECert *cert);
@@ -95,9 +95,9 @@ const gchar * e_cert_get_serial_number (ECert *cert);
const gchar * e_cert_get_sha1_fingerprint (ECert *cert);
const gchar * e_cert_get_md5_fingerprint (ECert *cert);
-GList* e_cert_get_chain (ECert *cert);
+GList * e_cert_get_chain (ECert *cert);
ECert * e_cert_get_ca_cert (ECert *ecert);
-EASN1Object* e_cert_get_asn1_struct (ECert *cert);
+EASN1Object * e_cert_get_asn1_struct (ECert *cert);
gboolean e_cert_mark_for_deletion (ECert *cert);
diff --git a/smime/lib/e-pkcs12.c b/smime/lib/e-pkcs12.c
index f4fa995207..959924e69d 100644
--- a/smime/lib/e-pkcs12.c
+++ b/smime/lib/e-pkcs12.c
@@ -1,6 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* The following is the mozilla license blurb, as the bodies some of
- these functions were derived from the mozilla source. */
+ * these functions were derived from the mozilla source. */
/*
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
@@ -145,7 +145,7 @@ e_pkcs12_get_type (void)
-EPKCS12*
+EPKCS12 *
e_pkcs12_new (void)
{
EPKCS12 *pk = E_PKCS12 (g_object_new (E_TYPE_PKCS12, NULL));
@@ -154,7 +154,9 @@ e_pkcs12_new (void)
}
static gboolean
-input_to_decoder (SEC_PKCS12DecoderContext *dcx, const gchar *path, GError **error)
+input_to_decoder (SEC_PKCS12DecoderContext *dcx,
+ const gchar *path,
+ GError **error)
{
/* nsNSSShutDownPreventionLock locker; */
SECStatus srv;
@@ -194,15 +196,17 @@ input_to_decoder (SEC_PKCS12DecoderContext *dcx, const gchar *path, GError **err
}
/* XXX toshok - this needs to be done using a signal as in the
- e_cert_db_login_to_slot stuff, instead of a direct gui dep here..
- for now, though, it stays. */
+ * e_cert_db_login_to_slot stuff, instead of a direct gui dep here..
+ * for now, though, it stays. */
static gboolean
-prompt_for_password (gchar *title, gchar *prompt, SECItem *pwd)
+prompt_for_password (gchar *title,
+ gchar *prompt,
+ SECItem *pwd)
{
gchar *passwd;
passwd = e_passwords_ask_password (title, NULL, "", prompt,
- E_PASSWORDS_REMEMBER_NEVER|E_PASSWORDS_SECRET, NULL,
+ E_PASSWORDS_REMEMBER_NEVER | E_PASSWORDS_SECRET, NULL,
NULL);
if (passwd) {
@@ -232,8 +236,11 @@ prompt_for_password (gchar *title, gchar *prompt, SECItem *pwd)
}
static gboolean
-import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot,
- const gchar *path, gboolean *aWantRetry, GError **error)
+import_from_file_helper (EPKCS12 *pkcs12,
+ PK11SlotInfo *slot,
+ const gchar *path,
+ gboolean *aWantRetry,
+ GError **error)
{
/*nsNSSShutDownPreventionLock locker; */
gboolean rv;
@@ -294,8 +301,8 @@ import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot,
handle_error (PKCS12_RESTORE_OK);
finish:
/* If srv != SECSuccess, NSS probably set a specific error code.
- We should use that error code instead of inventing a new one
- for every error possible. */
+ * We should use that error code instead of inventing a new one
+ * for every error possible. */
if (srv != SECSuccess) {
if (SEC_ERROR_BAD_PASSWORD == PORT_GetError ()) {
*aWantRetry = TRUE;
@@ -311,7 +318,9 @@ import_from_file_helper (EPKCS12 *pkcs12, PK11SlotInfo *slot,
}
gboolean
-e_pkcs12_import_from_file (EPKCS12 *pkcs12, const gchar *path, GError **error)
+e_pkcs12_import_from_file (EPKCS12 *pkcs12,
+ const gchar *path,
+ GError **error)
{
/*nsNSSShutDownPreventionLock locker;*/
gboolean rv = TRUE;
@@ -342,9 +351,11 @@ e_pkcs12_export_to_file (EPKCS12 *pkcs12,
}
/* what to do when the nickname collides with one already in the db.
- TODO: not handled, throw a dialog allowing the nick to be changed? */
+ * TODO: not handled, throw a dialog allowing the nick to be changed? */
static SECItem * PR_CALLBACK
-nickname_collision (SECItem *oldNick, PRBool *cancel, gpointer wincx)
+nickname_collision (SECItem *oldNick,
+ PRBool *cancel,
+ gpointer wincx)
{
/* nsNSSShutDownPreventionLock locker; */
gint count = 1;
@@ -356,32 +367,32 @@ nickname_collision (SECItem *oldNick, PRBool *cancel, gpointer wincx)
printf ("nickname_collision\n");
/* The user is trying to import a PKCS#12 file that doesn't have the
- attribute we use to set the nickname. So in order to reduce the
- number of interactions we require with the user, we'll build a nickname
- for the user. The nickname isn't prominently displayed in the UI,
- so it's OK if we generate one on our own here.
- XXX If the NSS API were smarter and actually passed a pointer to
- the CERTCertificate* we're importing we could actually just
- call default_nickname (which is what the issuance code path
- does) and come up with a reasonable nickname. Alas, the NSS
- API limits our ability to produce a useful nickname without
- bugging the user. :(
+ * attribute we use to set the nickname. So in order to reduce the
+ * number of interactions we require with the user, we'll build a nickname
+ * for the user. The nickname isn't prominently displayed in the UI,
+ * so it's OK if we generate one on our own here.
+ * XXX If the NSS API were smarter and actually passed a pointer to
+ * the CERTCertificate * we're importing we could actually just
+ * call default_nickname (which is what the issuance code path
+ * does) and come up with a reasonable nickname. Alas, the NSS
+ * API limits our ability to produce a useful nickname without
+ * bugging the user. :(
*/
while (1) {
CERTCertificate *cert;
/* If we've gotten this far, that means there isn't a certificate
- in the database that has the same subject name as the cert we're
- trying to import. So we need to come up with a "nickname" to
- satisfy the NSS requirement or fail in trying to import.
- Basically we use a default nickname from a properties file and
- see if a certificate exists with that nickname. If there isn't, then
- create update the count by one and append the string '#1' Or
- whatever the count currently is, and look for a cert with
- that nickname. Keep updating the count until we find a nickname
- without a corresponding cert.
- XXX If a user imports *many* certs without the 'friendly name'
- attribute, then this may take a long time. :(
+ * in the database that has the same subject name as the cert we're
+ * trying to import. So we need to come up with a "nickname" to
+ * satisfy the NSS requirement or fail in trying to import.
+ * Basically we use a default nickname from a properties file and
+ * see if a certificate exists with that nickname. If there isn't, then
+ * create update the count by one and append the string '#1' Or
+ * whatever the count currently is, and look for a cert with
+ * that nickname. Keep updating the count until we find a nickname
+ * without a corresponding cert.
+ * XXX If a user imports *many * certs without the 'friendly name'
+ * attribute, then this may take a long time. :(
*/
if (count > 1) {
g_free (nickname);
diff --git a/smime/lib/e-pkcs12.h b/smime/lib/e-pkcs12.h
index 6e98fdb0cb..940187bc18 100644
--- a/smime/lib/e-pkcs12.h
+++ b/smime/lib/e-pkcs12.h
@@ -53,12 +53,12 @@ struct _EPKCS12Class {
GType e_pkcs12_get_type (void);
-EPKCS12* e_pkcs12_new (void);
+EPKCS12 * e_pkcs12_new (void);
#if 0
/* XXX we're not going to support additional slots in the initial ssl
- stuff, so we just always default to the internal token (and thus
- don't need this function yet. */
+ * stuff, so we just always default to the internal token (and thus
+ * don't need this function yet. */
gboolean e_pkcs12_set_token (void);
#endif