[gmime] Privatized the GMimePkcs7Context structure and updated configure



commit e4110a884ec3320fe59cdffed31aeaa71d285248
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date:   Sun Feb 5 08:53:19 2017 -0500

    Privatized the GMimePkcs7Context structure and updated configure

 configure.ac                |   41 +++++---------
 gmime/gmime-certificate.h   |   40 +++++++++-----
 gmime/gmime-gpg-context.c   |   36 ++++++------
 gmime/gmime-gpg-context.h   |    4 +-
 gmime/gmime-pkcs7-context.c |  125 ++++++++++++++++++++++---------------------
 gmime/gmime-pkcs7-context.h |   20 -------
 tests/Makefile.am           |    6 +-
 7 files changed, 128 insertions(+), 144 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 28c4224..67a7fca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -235,16 +235,6 @@ if test "x$enable_strict_parser" = "xyes"; then
   AC_DEFINE(STRICT_PARSER, 1, [Define if GMime should enable stricter parsing rules.])
 fi
 
-dnl Disable cryptography support
-AC_ARG_ENABLE(cryptography,
-              AC_HELP_STRING([--enable-cryptography],
-             [enable cryptography support [[default=yes]]]),,
-             [enable_cryptography="yes"])
-AM_CONDITIONAL(ENABLE_CRYPTOGRAPHY, test "x$enable_cryptography" = "xyes")
-if test "x$enable_cryptography" = "xyes"; then
-  AC_DEFINE(ENABLE_CRYPTOGRAPHY, 1, [Define if cryptography in GMime is enabled.])
-fi
-
 dnl ***********************
 dnl *** Tests for iconv ***
 dnl ***********************
@@ -558,26 +548,23 @@ dnl *************************
 LIBNSL=""
 AC_CHECK_LIB(nsl, getaddrinfo, LIBNSL="-lnsl")
 
-dnl ******************************************
-dnl *** Checks for GpgME needed for S/MIME ***
-dnl ******************************************
-AC_ARG_ENABLE([smime], 
-             AC_HELP_STRING([--enable-smime],
-             [enable S/MIME support [[default=yes]]]),,
-             [enable_smime="yes"])
-
-if test "x$enable_cryptography" != "xyes"; then
-   enable_smime="no"
-fi
+dnl **************************************************
+dnl *** Checks for GpgME needed for PGP and S/MIME ***
+dnl **************************************************
+AC_ARG_ENABLE([crypto], 
+             AC_HELP_STRING([--enable-crypto],
+             [enable PGP and S/MIME support [[default=yes]]]),,
+             [enable_crypto="yes"])
 
 m4_ifdef([AM_PATH_GPGME_PTHREAD], [
-AS_IF([test "x$enable_smime" = "xyes"], [
-   AM_PATH_GPGME_PTHREAD(1.1.6, enable_smime="yes (via GpgME)", enable_smime="no")
-   if test "x$enable_smime" != "xno"; then
-      AC_DEFINE(ENABLE_SMIME, 1, [Define if GMime should enable experimental S/MIME support.])
+AS_IF([test "x$enable_crypto" = "xyes"], [
+   AM_PATH_GPGME_PTHREAD(1.1.6, enable_crypto="yes (via GpgME)", enable_crypto="no")
+   if test "x$enable_crypto" != "xno"; then
+      AC_DEFINE(ENABLE_CRYPTO, 1, [Define if GMime should enable GpgME PGP and S/MIME support.])
    fi
 ])
 ])
+AM_CONDITIONAL(ENABLE_CRYPTO, test "x$enable_crypto" != "xno")
 
 dnl ****************************
 dnl *** Enable Mono bindings ***
@@ -736,8 +723,8 @@ Configuration:
 
   Large file support:   ${enable_largefile}
   Console warnings:     ${enable_warnings}
-  PGP/MIME support:     ${enable_cryptography}
-  S/MIME support:       ${enable_smime}
+  PGP/MIME support:     ${enable_crypto}
+  S/MIME support:       ${enable_crypto}
   Strict parser:        ${enable_strict_parser}
 
   Mono bindings:        ${enable_mono}
diff --git a/gmime/gmime-certificate.h b/gmime/gmime-certificate.h
index 6a5db5a..2971790 100644
--- a/gmime/gmime-certificate.h
+++ b/gmime/gmime-certificate.h
@@ -65,22 +65,28 @@ typedef struct _GMimeCertificateListClass GMimeCertificateListClass;
  * @GMIME_DIGEST_ALGO_SHA512: The SHA-512 hash algorithm.
  * @GMIME_DIGEST_ALGO_SHA224: The SHA-224 hash algorithm.
  * @GMIME_DIGEST_ALGO_MD4: The MD4 hash algorithm.
+ * @GMIME_DIGEST_ALGO_CRC32: The CRC32 hash algorithm.
+ * @GMIME_DIGEST_ALGO_CRC32_RFC1510: The rfc1510 CRC32 hash algorithm.
+ * @GMIME_DIGEST_ALGO_CRC32_RFC2440: The rfc2440 CRC32 hash algorithm.
  *
  * A hash algorithm.
  **/
 typedef enum {
-       GMIME_DIGEST_ALGO_DEFAULT     = 0,
-       GMIME_DIGEST_ALGO_MD5         = 1,
-       GMIME_DIGEST_ALGO_SHA1        = 2,
-       GMIME_DIGEST_ALGO_RIPEMD160   = 3,
-       GMIME_DIGEST_ALGO_MD2         = 5,
-       GMIME_DIGEST_ALGO_TIGER192    = 6,
-       GMIME_DIGEST_ALGO_HAVAL5160   = 7,
-       GMIME_DIGEST_ALGO_SHA256      = 8,
-       GMIME_DIGEST_ALGO_SHA384      = 9,
-       GMIME_DIGEST_ALGO_SHA512      = 10,
-       GMIME_DIGEST_ALGO_SHA224      = 11,
-       GMIME_DIGEST_ALGO_MD4         = 301
+       GMIME_DIGEST_ALGO_DEFAULT       = 0,
+       GMIME_DIGEST_ALGO_MD5           = 1,
+       GMIME_DIGEST_ALGO_SHA1          = 2,
+       GMIME_DIGEST_ALGO_RIPEMD160     = 3,
+       GMIME_DIGEST_ALGO_MD2           = 5,
+       GMIME_DIGEST_ALGO_TIGER192      = 6,
+       GMIME_DIGEST_ALGO_HAVAL5160     = 7,
+       GMIME_DIGEST_ALGO_SHA256        = 8,
+       GMIME_DIGEST_ALGO_SHA384        = 9,
+       GMIME_DIGEST_ALGO_SHA512        = 10,
+       GMIME_DIGEST_ALGO_SHA224        = 11,
+       GMIME_DIGEST_ALGO_MD4           = 301,
+       GMIME_DIGEST_ALGO_CRC32         = 302,
+       GMIME_DIGEST_ALGO_CRC32_RFC1510 = 303,
+       GMIME_DIGEST_ALGO_CRC32_RFC2440 = 304
 } GMimeDigestAlgo;
 
 /**
@@ -91,7 +97,11 @@ typedef enum {
  * @GMIME_PUBKEY_ALGO_RSA_S: A signature-only RSA algorithm.
  * @GMIME_PUBKEY_ALGO_ELG_E: An encryption-only ElGamal algorithm.
  * @GMIME_PUBKEY_ALGO_DSA: The DSA algorithm.
+ * @GMIME_PUBKEY_ALGO_ECC: The Eliptic Curve algorithm.
  * @GMIME_PUBKEY_ALGO_ELG: The ElGamal algorithm.
+ * @GMIME_PUBKEY_ALGO_ECDSA: The Eliptic Curve + DSA algorithm.
+ * @GMIME_PUBKEY_ALGO_ECDH: The Eliptic Curve + Diffie Helman algorithm.
+ * @GMIME_PUBKEY_ALGO_ECDSA: The Eliptic Curve + DSA algorithm.
  *
  * A public-key algorithm.
  **/
@@ -102,7 +112,11 @@ typedef enum {
        GMIME_PUBKEY_ALGO_RSA_S    = 3,
        GMIME_PUBKEY_ALGO_ELG_E    = 16,
        GMIME_PUBKEY_ALGO_DSA      = 17,
-       GMIME_PUBKEY_ALGO_ELG      = 20
+       GMIME_PUBKEY_ALGO_ECC      = 18,
+       GMIME_PUBKEY_ALGO_ELG      = 20,
+       GMIME_PUBKEY_ALGO_ECDSA    = 301,
+       GMIME_PUBKEY_ALGO_ECDH     = 302,
+       GMIME_PUBKEY_ALGO_EDDSA    = 303
 } GMimePubKeyAlgo;
 
 /**
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 7fd4fb9..b77bb2c 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -48,14 +48,14 @@ typedef unsigned int nfds_t;
 #endif
 
 #include "gmime-gpg-context.h"
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
 #include "gmime-filter-charset.h"
 #include "gmime-stream-filter.h"
 #include "gmime-stream-pipe.h"
 #include "gmime-stream-mem.h"
 #include "gmime-stream-fs.h"
 #include "gmime-charset.h"
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 #include "gmime-error.h"
 
 #ifdef ENABLE_DEBUG
@@ -281,7 +281,7 @@ gpg_get_key_exchange_protocol (GMimeCryptoContext *ctx)
        return "application/pgp-keys";
 }
 
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
 enum _GpgCtxMode {
        GPG_CTX_MODE_SIGN,
        GPG_CTX_MODE_VERIFY,
@@ -1900,13 +1900,13 @@ gpg_ctx_op_wait (struct _GpgCtx *gpg)
        else
                return -1;
 }
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 
 static int
 gpg_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo digest,
          GMimeStream *istream, GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        struct _GpgCtx *gpg;
        
@@ -1961,7 +1961,7 @@ gpg_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo diges
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 
@@ -1970,7 +1970,7 @@ gpg_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
            GMimeStream *istream, GMimeStream *sigstream,
            GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        GMimeSignatureList *signatures;
        struct _GpgCtx *gpg;
@@ -2022,7 +2022,7 @@ gpg_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return NULL;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 
@@ -2031,7 +2031,7 @@ gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
             GMimeDigestAlgo digest, GPtrArray *recipients, GMimeStream *istream,
             GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        struct _GpgCtx *gpg;
        guint i;
@@ -2093,7 +2093,7 @@ gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 
@@ -2109,7 +2109,7 @@ gpg_decrypt_session (GMimeCryptoContext *context, const char *session_key,
                     GMimeStream *istream, GMimeStream *ostream,
                     GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        GMimeDecryptResult *result;
        const char *diagnostics;
@@ -2180,13 +2180,13 @@ gpg_decrypt_session (GMimeCryptoContext *context, const char *session_key,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return NULL;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 static int
 gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        struct _GpgCtx *gpg;
        
@@ -2233,13 +2233,13 @@ gpg_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 static int
 gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeGpgContext *ctx = (GMimeGpgContext *) context;
        struct _GpgCtx *gpg;
        guint i;
@@ -2292,7 +2292,7 @@ gpg_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostr
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 int
@@ -2359,7 +2359,7 @@ _g_mime_get_gpg_version (const char *path)
 GMimeCryptoContext *
 g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *path)
 {
-#ifdef ENABLE_CRYPTOGRAPHY
+#ifdef ENABLE_CRYPTO
        GMimeCryptoContext *crypto;
        GMimeGpgContext *ctx;
        
@@ -2374,7 +2374,7 @@ g_mime_gpg_context_new (GMimePasswordRequestFunc request_passwd, const char *pat
        return crypto;
 #else
        return NULL;
-#endif /* ENABLE_CRYPTOGRAPHY */
+#endif /* ENABLE_CRYPTO */
 }
 
 
diff --git a/gmime/gmime-gpg-context.h b/gmime/gmime-gpg-context.h
index 1218ffa..658943d 100644
--- a/gmime/gmime-gpg-context.h
+++ b/gmime/gmime-gpg-context.h
@@ -51,12 +51,12 @@ typedef struct _GMimeGpgContextClass GMimeGpgContextClass;
  **/
 struct _GMimeGpgContext {
        GMimeCryptoContext parent_object;
+       gboolean retrieve_session_key;
        gboolean auto_key_retrieve;
        gboolean always_trust;
        gboolean use_agent;
-       char *path;
-       gboolean retrieve_session_key;
        int version;
+       char *path;
 };
 
 struct _GMimeGpgContextClass {
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index 210bc51..91777a5 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -28,17 +28,17 @@
 #include <string.h>
 
 #include "gmime-pkcs7-context.h"
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 #include "gmime-filter-charset.h"
 #include "gmime-stream-filter.h"
 #include "gmime-stream-pipe.h"
 #include "gmime-stream-mem.h"
 #include "gmime-stream-fs.h"
 #include "gmime-charset.h"
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 #include "gmime-error.h"
 
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 #include <gpgme.h>
 #endif
 
@@ -61,12 +61,24 @@
  * all of the encryption and digital signatures.
  **/
 
-typedef struct _GMimePkcs7ContextPrivate {
+
+/**
+ * GMimePkcs7Context:
+ *
+ * A PKCS7 crypto context.
+ **/
+struct _GMimePkcs7Context {
+       GMimeCryptoContext parent_object;
        gboolean always_trust;
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
        gpgme_ctx_t ctx;
 #endif
-} Pkcs7Ctx;
+};
+
+struct _GMimePkcs7ContextClass {
+       GMimeCryptoContextClass parent_class;
+       
+};
 
 static void g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass);
 static void g_mime_pkcs7_context_init (GMimePkcs7Context *ctx, GMimePkcs7ContextClass *klass);
@@ -156,27 +168,24 @@ g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass)
 }
 
 static void
-g_mime_pkcs7_context_init (GMimePkcs7Context *ctx, GMimePkcs7ContextClass *klass)
+g_mime_pkcs7_context_init (GMimePkcs7Context *pkcs7, GMimePkcs7ContextClass *klass)
 {
-       ctx->priv = g_slice_new (Pkcs7Ctx);
-       ctx->priv->always_trust = FALSE;
-#ifdef ENABLE_SMIME
-       ctx->priv->ctx = NULL;
+       pkcs7->always_trust = FALSE;
+#ifdef ENABLE_CRYPTO
+       pkcs7->ctx = NULL;
 #endif
 }
 
 static void
 g_mime_pkcs7_context_finalize (GObject *object)
 {
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) object;
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) object;
        
-#ifdef ENABLE_SMIME
-       if (ctx->priv->ctx)
-               gpgme_release (ctx->priv->ctx);
+#ifdef ENABLE_CRYPTO
+       if (pkcs7->ctx)
+               gpgme_release (pkcs7->ctx);
 #endif
        
-       g_slice_free (Pkcs7Ctx, ctx->priv);
-       
        G_OBJECT_CLASS (parent_class)->finalize (object);
 }
 
@@ -261,7 +270,7 @@ pkcs7_get_key_exchange_protocol (GMimeCryptoContext *ctx)
        return "application/pkcs7-keys";
 }
 
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 static gpgme_error_t
 pkcs7_passphrase_cb (void *hook, const char *uid_hint, const char *passphrase_info, int prev_was_bad, int fd)
 {
@@ -335,7 +344,7 @@ static struct gpgme_data_cbs pkcs7_stream_funcs = {
                           (k)->disabled || (k)->invalid))
 
 static gpgme_key_t
-pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GError **err)
+pkcs7_get_key_by_name (GMimePkcs7Context *pkcs7, const char *name, gboolean secret, GError **err)
 {
        time_t now = time (NULL);
        gpgme_key_t key = NULL;
@@ -418,7 +427,7 @@ pkcs7_get_key_by_name (Pkcs7Ctx *pkcs7, const char *name, gboolean secret, GErro
 }
 
 static gboolean
-pkcs7_add_signer (Pkcs7Ctx *pkcs7, const char *signer, GError **err)
+pkcs7_add_signer (GMimePkcs7Context *pkcs7, const char *signer, GError **err)
 {
        gpgme_key_t key = NULL;
        
@@ -432,15 +441,14 @@ pkcs7_add_signer (Pkcs7Ctx *pkcs7, const char *signer, GError **err)
        
        return TRUE;
 }
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 
 static int
 pkcs7_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo digest,
            GMimeStream *istream, GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        gpgme_sign_result_t result;
        gpgme_data_t input, output;
        gpgme_error_t error;
@@ -480,10 +488,10 @@ pkcs7_sign (GMimeCryptoContext *context, const char *userid, GMimeDigestAlgo dig
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 static GMimeCertificateTrust
 pkcs7_trust (gpgme_validity_t trust)
 {
@@ -505,7 +513,7 @@ pkcs7_trust (gpgme_validity_t trust)
 }
 
 static GMimeSignatureList *
-pkcs7_get_signatures (Pkcs7Ctx *pkcs7, gboolean verify)
+pkcs7_get_signatures (GMimePkcs7Context *pkcs7, gboolean verify)
 {
        GMimeSignatureList *signatures;
        GMimeSignature *signature;
@@ -533,8 +541,8 @@ pkcs7_get_signatures (Pkcs7Ctx *pkcs7, gboolean verify)
                else
                        g_mime_signature_set_status (signature, GMIME_SIGNATURE_STATUS_GOOD);
                
-               g_mime_certificate_set_pubkey_algo (signature->cert, sig->pubkey_algo);
-               g_mime_certificate_set_digest_algo (signature->cert, sig->hash_algo);
+               g_mime_certificate_set_pubkey_algo (signature->cert, (GMimePubKeyAlgo) sig->pubkey_algo);
+               g_mime_certificate_set_digest_algo (signature->cert, (GMimeDigestAlgo) sig->hash_algo);
                g_mime_certificate_set_fingerprint (signature->cert, sig->fpr);
                g_mime_signature_set_expires (signature, sig->exp_timestamp);
                g_mime_signature_set_created (signature, sig->timestamp);
@@ -614,17 +622,16 @@ pkcs7_get_signatures (Pkcs7Ctx *pkcs7, gboolean verify)
        
        return signatures;
 }
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 
 static GMimeSignatureList *
 pkcs7_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
              GMimeStream *istream, GMimeStream *sigstream,
              GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        gpgme_data_t message, signature;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
        gpgme_error_t error;
        
        if ((error = gpgme_data_new_from_cbs (&message, &pkcs7_stream_funcs, istream)) != GPG_ERR_NO_ERROR) {
@@ -663,10 +670,10 @@ pkcs7_verify (GMimeCryptoContext *context, GMimeDigestAlgo digest,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return NULL;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 static void
 key_list_free (gpgme_key_t *keys)
 {
@@ -679,16 +686,15 @@ key_list_free (gpgme_key_t *keys)
        
        g_free (keys);
 }
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 
 static int
 pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
               GMimeDigestAlgo digest, GPtrArray *recipients, GMimeStream *istream,
               GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        gpgme_data_t input, output;
        gpgme_error_t error;
        gpgme_key_t *rcpts;
@@ -741,12 +747,12 @@ pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
 static GMimeDecryptResult *
-pkcs7_get_decrypt_result (Pkcs7Ctx *pkcs7)
+pkcs7_get_decrypt_result (GMimePkcs7Context *pkcs7)
 {
        GMimeDecryptResult *result;
        gpgme_decrypt_result_t res;
@@ -765,7 +771,7 @@ pkcs7_get_decrypt_result (Pkcs7Ctx *pkcs7)
                cert = g_mime_certificate_new ();
                g_mime_certificate_list_add (result->recipients, cert);
                
-               g_mime_certificate_set_pubkey_algo (cert, recipient->pubkey_algo);
+               g_mime_certificate_set_pubkey_algo (cert, (GMimePubKeyAlgo) recipient->pubkey_algo);
                g_mime_certificate_set_key_id (cert, recipient->keyid);
                
                recipient = recipient->next;
@@ -773,16 +779,15 @@ pkcs7_get_decrypt_result (Pkcs7Ctx *pkcs7)
        
        return result;
 }
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 
 static GMimeDecryptResult *
 pkcs7_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
               GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        GMimeDecryptResult *result;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
        gpgme_decrypt_result_t res;
        gpgme_data_t input, output;
        gpgme_error_t error;
@@ -814,15 +819,14 @@ pkcs7_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return NULL;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
 static int
 pkcs7_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        gpgme_data_t keydata;
        gpgme_error_t error;
        
@@ -846,15 +850,14 @@ pkcs7_import_keys (GMimeCryptoContext *context, GMimeStream *istream, GError **e
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
 static int
 pkcs7_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *ostream, GError **err)
 {
-#ifdef ENABLE_SMIME
-       GMimePkcs7Context *ctx = (GMimePkcs7Context *) context;
-       Pkcs7Ctx *pkcs7 = ctx->priv;
+#ifdef ENABLE_CRYPTO
+       GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
        gpgme_data_t keydata;
        gpgme_error_t error;
        guint i;
@@ -880,7 +883,7 @@ pkcs7_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *os
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in this 
build"));
        
        return -1;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
 
@@ -895,7 +898,7 @@ pkcs7_export_keys (GMimeCryptoContext *context, GPtrArray *keys, GMimeStream *os
 GMimeCryptoContext *
 g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd)
 {
-#ifdef ENABLE_SMIME
+#ifdef ENABLE_CRYPTO
        GMimeCryptoContext *crypto;
        GMimePkcs7Context *pkcs7;
        gpgme_ctx_t ctx;
@@ -911,7 +914,7 @@ g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd)
        pkcs7 = g_object_newv (GMIME_TYPE_PKCS7_CONTEXT, 0, NULL);
        gpgme_set_passphrase_cb (ctx, pkcs7_passphrase_cb, pkcs7);
        gpgme_set_protocol (ctx, GPGME_PROTOCOL_CMS);
-       pkcs7->priv->ctx = ctx;
+       pkcs7->ctx = ctx;
        
        crypto = (GMimeCryptoContext *) pkcs7;
        crypto->request_passwd = request_passwd;
@@ -919,7 +922,7 @@ g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd)
        return crypto;
 #else
        return NULL;
-#endif /* ENABLE_SMIME */
+#endif /* ENABLE_CRYPTO */
 }
 
 
@@ -936,7 +939,7 @@ g_mime_pkcs7_context_get_always_trust (GMimePkcs7Context *ctx)
 {
        g_return_val_if_fail (GMIME_IS_PKCS7_CONTEXT (ctx), FALSE);
        
-       return ctx->priv->always_trust;
+       return ctx->always_trust;
 }
 
 
@@ -953,5 +956,5 @@ g_mime_pkcs7_context_set_always_trust (GMimePkcs7Context *ctx, gboolean always_t
 {
        g_return_if_fail (GMIME_IS_PKCS7_CONTEXT (ctx));
        
-       ctx->priv->always_trust = always_trust;
+       ctx->always_trust = always_trust;
 }
diff --git a/gmime/gmime-pkcs7-context.h b/gmime/gmime-pkcs7-context.h
index c4ad5d7..67918a5 100644
--- a/gmime/gmime-pkcs7-context.h
+++ b/gmime/gmime-pkcs7-context.h
@@ -36,26 +36,6 @@ G_BEGIN_DECLS
 typedef struct _GMimePkcs7Context GMimePkcs7Context;
 typedef struct _GMimePkcs7ContextClass GMimePkcs7ContextClass;
 
-
-/**
- * GMimePkcs7Context:
- * @parent_object: parent #GMimeCryptoContext
- * @priv: private context data
- *
- * A PKCS7 crypto context.
- **/
-struct _GMimePkcs7Context {
-       GMimeCryptoContext parent_object;
-       
-       struct _GMimePkcs7ContextPrivate *priv;
-};
-
-struct _GMimePkcs7ContextClass {
-       GMimeCryptoContextClass parent_class;
-       
-};
-
-
 GType g_mime_pkcs7_context_get_type (void);
 
 GMimeCryptoContext *g_mime_pkcs7_context_new (GMimePasswordRequestFunc request_passwd);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 055f37f..8a3e726 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -17,7 +17,7 @@ AUTOMATED_TESTS =     \
        test-mbox       \
        test-mime
 
-if ENABLE_CRYPTOGRAPHY
+if ENABLE_CRYPTO
 AUTOMATED_TESTS +=     \
        test-pgp        \
        test-pgpmime
@@ -29,7 +29,7 @@ MANUAL_TESTS =                \
        test-html       \
        test-partial
 
-if ENABLE_CRYPTOGRAPHY
+if ENABLE_CRYPTO
 MANUAL_TESTS +=                \
        test-pkcs7      \
        test-smime
@@ -90,7 +90,7 @@ test_partial_LDFLAGS =
 test_partial_DEPENDENCIES = $(DEPS)
 test_partial_LDADD = $(LDADDS)
 
-if ENABLE_CRYPTOGRAPHY
+if ENABLE_CRYPTO
 test_pgp_SOURCES = test-pgp.c testsuite.c testsuite.h
 test_pgp_LDFLAGS = 
 test_pgp_DEPENDENCIES = $(DEPS)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]