[gmime] Merge decrypt and decrypt_session



commit ef7e87b1d115ee71dc5ee02f7476ac93a189c586
Author: Jeffrey Stedfast <fejj gnome org>
Date:   Sat Feb 18 15:59:12 2017 -0500

    Merge decrypt and decrypt_session

 gmime/gmime-application-pkcs7-mime.c |   23 +++++++--
 gmime/gmime-application-pkcs7-mime.h |    3 +-
 gmime/gmime-crypto-context.c         |   86 ++++++----------------------------
 gmime/gmime-crypto-context.h         |   17 ++----
 gmime/gmime-gpg-context.c            |   23 ++-------
 gmime/gmime-multipart-encrypted.c    |   39 ++-------------
 gmime/gmime-multipart-encrypted.h    |    6 +--
 gmime/gmime-pkcs7-context.c          |   23 ++-------
 tests/test-pgp.c                     |    2 +-
 tests/test-pgpmime.c                 |    2 +-
 tests/test-pkcs7.c                   |    2 +-
 tests/test-smime.c                   |    2 +-
 12 files changed, 65 insertions(+), 163 deletions(-)
---
diff --git a/gmime/gmime-application-pkcs7-mime.c b/gmime/gmime-application-pkcs7-mime.c
index 9f9e768..2416fc6 100644
--- a/gmime/gmime-application-pkcs7-mime.c
+++ b/gmime/gmime-application-pkcs7-mime.c
@@ -342,15 +342,30 @@ g_mime_data_wrapper_get_decoded_stream (GMimeDataWrapper *wrapper)
  * g_mime_application_pkcs7_mime_decrypt:
  * @pkcs7_mime: a #GMimeApplicationPkcs7Mime
  * @ctx: a #GMimePkcs7Context
+ * @session_key: session key to use or %NULL
  * @result: the decryption result
  * @err: a #GError
  *
- * Decrypts the @pkcs7_mime part.
+ * Attempts to decrypt the encrypted application/pkcs7-mime part.
  *
- * Returns: the decrypted @pkcs7_mime part.
+ * When non-%NULL, @session_key should be a %NULL-terminated string,
+ * such as the one returned by g_mime_decrypt_result_get_session_key()
+ * from a previous decryption. If the @sesion_key is not valid, decryption
+ * will fail.
+ *
+ * If @result is non-%NULL, then on a successful decrypt operation, it will be
+ * updated to point to a newly-allocated #GMimeDecryptResult with signature
+ * status information as well as a list of recipients that the part was
+ * encrypted to.
+ *
+ * Returns: (transfer full): the decrypted MIME part on success or
+ * %NULL on fail. If the decryption fails, an exception will be set on
+ * @err to provide information as to why the failure occured.
  **/
 GMimeObject *
-g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime, GMimePkcs7Context *ctx, 
GMimeDecryptResult **result, GError **err)
+g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime, GMimePkcs7Context *ctx,
+                                      const char *session_key, GMimeDecryptResult **result,
+                                      GError **err)
 {
        GMimeStream *filtered_stream, *ciphertext, *stream;
        GMimeDataWrapper *wrapper;
@@ -377,7 +392,7 @@ g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime, GM
        g_object_unref (crlf_filter);
        
        /* decrypt the content stream */
-       if (!(res = g_mime_crypto_context_decrypt ((GMimeCryptoContext *) ctx, ciphertext, filtered_stream, 
err))) {
+       if (!(res = g_mime_crypto_context_decrypt ((GMimeCryptoContext *) ctx, session_key, ciphertext, 
filtered_stream, err))) {
                g_object_unref (filtered_stream);
                g_object_unref (ciphertext);
                g_object_unref (stream);
diff --git a/gmime/gmime-application-pkcs7-mime.h b/gmime/gmime-application-pkcs7-mime.h
index 289f29d..661246d 100644
--- a/gmime/gmime-application-pkcs7-mime.h
+++ b/gmime/gmime-application-pkcs7-mime.h
@@ -87,7 +87,8 @@ GMimeSecureMimeType g_mime_application_pkcs7_mime_get_smime_type (GMimeApplicati
 GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_encrypt (GMimePkcs7Context *ctx, GMimeObject 
*entity,
                                                                  GPtrArray *recipients, GError **err);
 GMimeObject *g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime, GMimePkcs7Context 
*ctx,
-                                                   GMimeDecryptResult **result, GError **err);
+                                                   const char *session_key, GMimeDecryptResult **result,
+                                                   GError **err);
 
 GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_sign (GMimePkcs7Context *ctx, GMimeObject *entity,
                                                               const char *userid, GMimeDigestAlgo digest,
diff --git a/gmime/gmime-crypto-context.c b/gmime/gmime-crypto-context.c
index dd367d7..f0f4692 100644
--- a/gmime/gmime-crypto-context.c
+++ b/gmime/gmime-crypto-context.c
@@ -73,12 +73,9 @@ static int crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign,
                           GPtrArray *recipients, GMimeStream *istream,
                           GMimeStream *ostream, GError **err);
 
-static GMimeDecryptResult *crypto_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-                                          GMimeStream *ostream, GError **err);
-
-static GMimeDecryptResult *crypto_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                                                  GMimeStream *istream, GMimeStream *ostream,
-                                                  GError **err);
+static GMimeDecryptResult *crypto_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+                                          GMimeStream *istream, GMimeStream *ostream,
+                                          GError **err);
 
 static int crypto_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
                               GError **err);
@@ -134,7 +131,6 @@ g_mime_crypto_context_class_init (GMimeCryptoContextClass *klass)
        klass->verify = crypto_verify;
        klass->encrypt = crypto_encrypt;
        klass->decrypt = crypto_decrypt;
-       klass->decrypt_session = crypto_decrypt_session;
        klass->import_keys = crypto_import_keys;
        klass->export_keys = crypto_export_keys;
        klass->get_signature_protocol = crypto_get_signature_protocol;
@@ -481,8 +477,9 @@ g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign, const cha
 
 
 static GMimeDecryptResult *
-crypto_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-               GMimeStream *ostream, GError **err)
+crypto_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+               GMimeStream *istream, GMimeStream *ostream,
+               GError **err)
 {
        g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
                     "Decryption is not supported by this crypto context");
@@ -490,72 +487,22 @@ crypto_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
        return NULL;
 }
 
-static GMimeDecryptResult *
-crypto_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                       GMimeStream *istream, GMimeStream *ostream,
-                       GError **err)
-{
-       g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
-                    "Decryption with a session key is not supported by this crypto context");
-       
-       return NULL;
-}
-
 
 /**
  * g_mime_crypto_context_decrypt:
  * @ctx: a #GMimeCryptoContext
+ * @session_key: session key to use or %NULL
  * @istream: input/ciphertext stream
  * @ostream: output/cleartext stream
  * @err: a #GError
  *
- * Decrypts the ciphertext input stream and writes the resulting
- * cleartext to the output stream.
- *
- * If the encrypted input stream was also signed, the returned
- * #GMimeDecryptResult will have a non-%NULL list of signatures, each with a
- * #GMimeSignatureStatus (among other details about each signature).
- *
- * On success, the returned #GMimeDecryptResult will contain a list of
- * certificates, one for each recipient, that the original encrypted stream
- * was encrypted to.
- *
- * Note: It *may* be possible to maliciously design an encrypted stream such
- * that recursively decrypting it will result in an endless loop, causing
- * a denial of service attack on your application.
- *
- * Returns: (transfer full): a #GMimeDecryptResult on success or %NULL
- * on error.
- **/
-GMimeDecryptResult *
-g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-                              GMimeStream *ostream, GError **err)
-{
-       g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
-       g_return_val_if_fail (GMIME_IS_STREAM (istream), NULL);
-       g_return_val_if_fail (GMIME_IS_STREAM (ostream), NULL);
-       
-       return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->decrypt (ctx, istream, ostream, err);
-}
-
-/**
- * g_mime_crypto_context_decrypt_session:
- * @ctx: a #GMimeCryptoContext
- * @session_key: session key to use
- * @istream: input/ciphertext stream
- * @ostream: output/cleartext stream
- * @err: a #GError
- *
- * Decrypts the ciphertext input stream using a specific session key
- * and writes the resulting cleartext to the output stream. If
- * @session_key is non-%NULL, but is not valid for the ciphertext, the
- * decryption will fail even if other available secret key material
- * may have been able to decrypt it. If @session_key is %NULL, this
- * does the same thing as g_mime_crypto_context_decrypt().
+ * Decrypts the ciphertext input stream and writes the resulting cleartext
+ * to the output stream.
  *
  * When non-%NULL, @session_key should be a %NULL-terminated string,
  * such as the one returned by g_mime_decrypt_result_get_session_key()
- * from a previous decryption.
+ * from a previous decryption. If the @sesion_key is not valid, decryption
+ * will fail.
  *
  * If the encrypted input stream was also signed, the returned
  * #GMimeDecryptResult will have a non-%NULL list of signatures, each with a
@@ -573,18 +520,15 @@ g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
  * on error.
  **/
 GMimeDecryptResult *
-g_mime_crypto_context_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                                      GMimeStream *istream, GMimeStream *ostream,
-                                      GError **err)
+g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+                              GMimeStream *istream, GMimeStream *ostream,
+                              GError **err)
 {
        g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), NULL);
        g_return_val_if_fail (GMIME_IS_STREAM (istream), NULL);
        g_return_val_if_fail (GMIME_IS_STREAM (ostream), NULL);
        
-       if (session_key == NULL)
-               return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->decrypt (ctx, istream, ostream, err);
-       else
-               return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->decrypt_session (ctx, session_key, istream, 
ostream, err);
+       return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->decrypt (ctx, session_key, istream, ostream, err);
 }
 
 
diff --git a/gmime/gmime-crypto-context.h b/gmime/gmime-crypto-context.h
index 65b92bd..4ff3790 100644
--- a/gmime/gmime-crypto-context.h
+++ b/gmime/gmime-crypto-context.h
@@ -113,11 +113,9 @@ struct _GMimeCryptoContextClass {
                                                  GPtrArray *recipients, GMimeStream *istream,
                                                  GMimeStream *ostream, GError **err);
        
-       GMimeDecryptResult *     (* decrypt)     (GMimeCryptoContext *ctx, GMimeStream *istream,
-                                                 GMimeStream *ostream, GError **err);
-       GMimeDecryptResult *     (* decrypt_session) (GMimeCryptoContext *ctx, const char *session_key,
-                                                     GMimeStream *istream, GMimeStream *ostream,
-                                                     GError **err);
+       GMimeDecryptResult *     (* decrypt)     (GMimeCryptoContext *ctx, const char *session_key,
+                                                 GMimeStream *istream, GMimeStream *ostream,
+                                                 GError **err);
        
        int                      (* import_keys) (GMimeCryptoContext *ctx, GMimeStream *istream,
                                                  GError **err);
@@ -167,12 +165,9 @@ int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign,
                                   GPtrArray *recipients, GMimeStream *istream,
                                   GMimeStream *ostream, GError **err);
 
-GMimeDecryptResult *g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-                                                  GMimeStream *ostream, GError **err);
-
-GMimeDecryptResult *g_mime_crypto_context_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                                                          GMimeStream *istream, GMimeStream *ostream,
-                                                          GError **err);
+GMimeDecryptResult *g_mime_crypto_context_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+                                                  GMimeStream *istream, GMimeStream *ostream,
+                                                  GError **err);
 
 /* key/certificate routines */
 int g_mime_crypto_context_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream, GError **err);
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index d61c70c..da86e0b 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -112,12 +112,9 @@ static int gpg_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *user
                        GMimeDigestAlgo digest, GPtrArray *recipients, GMimeStream *istream,
                        GMimeStream *ostream, GError **err);
 
-static GMimeDecryptResult *gpg_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-                                       GMimeStream *ostream, GError **err);
-
-static GMimeDecryptResult *gpg_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                                               GMimeStream *istream, GMimeStream *ostream,
-                                               GError **err);
+static GMimeDecryptResult *gpg_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+                                       GMimeStream *istream, GMimeStream *ostream,
+                                       GError **err);
 
 static int gpg_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
                            GError **err);
@@ -170,7 +167,6 @@ g_mime_gpg_context_class_init (GMimeGpgContextClass *klass)
        crypto_class->verify = gpg_verify;
        crypto_class->encrypt = gpg_encrypt;
        crypto_class->decrypt = gpg_decrypt;
-       crypto_class->decrypt_session = gpg_decrypt_session;
        crypto_class->import_keys = gpg_import_keys;
        crypto_class->export_keys = gpg_export_keys;
        crypto_class->get_signature_protocol = gpg_get_signature_protocol;
@@ -785,16 +781,9 @@ gpg_get_decrypt_result (GMimeGpgContext *gpg)
 #endif /* ENABLE_CRYPTO */
 
 static GMimeDecryptResult *
-gpg_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
-            GMimeStream *ostream, GError **err)
-{
-       return gpg_decrypt_session (context, NULL, istream, ostream, err);
-}
-
-static GMimeDecryptResult *
-gpg_decrypt_session (GMimeCryptoContext *context, const char *session_key,
-                    GMimeStream *istream, GMimeStream *ostream,
-                    GError **err)
+gpg_decrypt (GMimeCryptoContext *context, const char *session_key,
+            GMimeStream *istream, GMimeStream *ostream,
+            GError **err)
 {
 #ifdef ENABLE_CRYPTO
        GMimeGpgContext *gpg = (GMimeGpgContext *) context;
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index 09194bb..f0765a7 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -272,44 +272,17 @@ g_mime_data_wrapper_get_decoded_stream (GMimeDataWrapper *wrapper)
 /**
  * g_mime_multipart_encrypted_decrypt:
  * @mpe: multipart/encrypted object
+ * @session_key: session key to use or %NULL
  * @result: a #GMimeDecryptionResult
  * @err: a #GError
  *
  * Attempts to decrypt the encrypted MIME part contained within the
  * multipart/encrypted object @mpe.
  *
- * If @result is non-%NULL, then on a successful decrypt operation, it will be
- * updated to point to a newly-allocated #GMimeDecryptResult with signature
- * status information as well as a list of recipients that the part was
- * encrypted to.
- *
- * Returns: (transfer full): the decrypted MIME part on success or
- * %NULL on fail. If the decryption fails, an exception will be set on
- * @err to provide information as to why the failure occured.
- **/
-GMimeObject *
-g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeDecryptResult **result, GError **err)
-{
-       return g_mime_multipart_encrypted_decrypt_session (mpe, NULL, result, err);
-}
-
-/**
- * g_mime_multipart_encrypted_decrypt_session:
- * @mpe: multipart/encrypted object
- * @session_key: session key to use
- * @result: a #GMimeDecryptionResult
- * @err: a #GError
- *
- * Attempts to decrypt the encrypted MIME part contained within the
- * multipart/encrypted object @mpe trying only the supplied session key.
- * If @session_key is non-%NULL, but is not valid for the ciphertext,
- * the decryption will fail even if other available secret key material
- * may have been able to decrypt it. If @session_key is %NULL, this does
- * the same thing as g_mime_multipart_encrypted_decrypt().
- *
  * When non-%NULL, @session_key should be a %NULL-terminated string,
  * such as the one returned by g_mime_decrypt_result_get_session_key()
- * from a previous decryption.
+ * from a previous decryption. If the @sesion_key is not valid, decryption
+ * will fail.
  *
  * If @result is non-%NULL, then on a successful decrypt operation, it will be
  * updated to point to a newly-allocated #GMimeDecryptResult with signature
@@ -321,8 +294,8 @@ g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, GMimeDecryptRe
  * @err to provide information as to why the failure occured.
  **/
 GMimeObject *
-g_mime_multipart_encrypted_decrypt_session (GMimeMultipartEncrypted *mpe, const char *session_key,
-                                           GMimeDecryptResult **result, GError **err)
+g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe, const char *session_key,
+                                   GMimeDecryptResult **result, GError **err)
 {
        GMimeObject *decrypted, *version, *encrypted;
        GMimeStream *stream, *ciphertext;
@@ -406,7 +379,7 @@ g_mime_multipart_encrypted_decrypt_session (GMimeMultipartEncrypted *mpe, const
        g_object_unref (crlf_filter);
        
        /* get the cleartext */
-       if (!(res = g_mime_crypto_context_decrypt_session (ctx, session_key, ciphertext, filtered_stream, 
err))) {
+       if (!(res = g_mime_crypto_context_decrypt (ctx, session_key, ciphertext, filtered_stream, err))) {
                g_object_unref (filtered_stream);
                g_object_unref (ciphertext);
                g_object_unref (stream);
diff --git a/gmime/gmime-multipart-encrypted.h b/gmime/gmime-multipart-encrypted.h
index bf09fb1..ebbe7b3 100644
--- a/gmime/gmime-multipart-encrypted.h
+++ b/gmime/gmime-multipart-encrypted.h
@@ -70,14 +70,10 @@ int g_mime_multipart_encrypted_encrypt (GMimeMultipartEncrypted *mpe, GMimeObjec
                                        GPtrArray *recipients, GError **err);
 
 GMimeObject *g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *mpe,
+                                                const char *session_key,
                                                 GMimeDecryptResult **result,
                                                 GError **err);
 
-GMimeObject *g_mime_multipart_encrypted_decrypt_session (GMimeMultipartEncrypted *mpe,
-                                                        const char *session_key,
-                                                        GMimeDecryptResult **result,
-                                                        GError **err);
-
 G_END_DECLS
 
 #endif /* __GMIME_MULTIPART_ENCRYPTED_H__ */
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index f67d029..86f860d 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -110,12 +110,9 @@ static int pkcs7_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *us
                          GMimeDigestAlgo digest, GPtrArray *recipients, GMimeStream *istream,
                          GMimeStream *ostream, GError **err);
 
-static GMimeDecryptResult *pkcs7_decrypt (GMimeCryptoContext *ctx, GMimeStream *istream,
-                                         GMimeStream *ostream, GError **err);
-
-static GMimeDecryptResult *pkcs7_decrypt_session (GMimeCryptoContext *ctx, const char *session_key,
-                                                 GMimeStream *istream, GMimeStream *ostream,
-                                               GError **err);
+static GMimeDecryptResult *pkcs7_decrypt (GMimeCryptoContext *ctx, const char *session_key,
+                                         GMimeStream *istream, GMimeStream *ostream,
+                                         GError **err);
 
 static int pkcs7_import_keys (GMimeCryptoContext *ctx, GMimeStream *istream,
                              GError **err);
@@ -168,7 +165,6 @@ g_mime_pkcs7_context_class_init (GMimePkcs7ContextClass *klass)
        crypto_class->verify = pkcs7_verify;
        crypto_class->encrypt = pkcs7_encrypt;
        crypto_class->decrypt = pkcs7_decrypt;
-       crypto_class->decrypt_session = pkcs7_decrypt_session;
        crypto_class->import_keys = pkcs7_import_keys;
        crypto_class->export_keys = pkcs7_export_keys;
        crypto_class->get_signature_protocol = pkcs7_get_signature_protocol;
@@ -769,16 +765,9 @@ pkcs7_get_decrypt_result (GMimePkcs7Context *pkcs7)
 #endif /* ENABLE_CRYPTO */
 
 static GMimeDecryptResult *
-pkcs7_decrypt (GMimeCryptoContext *context, GMimeStream *istream,
-              GMimeStream *ostream, GError **err)
-{
-       return pkcs7_decrypt_session (context, NULL, istream, ostream, err);
-}
-
-static GMimeDecryptResult *
-pkcs7_decrypt_session (GMimeCryptoContext *context, const char *session_key,
-                      GMimeStream *istream, GMimeStream *ostream,
-                      GError **err)
+pkcs7_decrypt (GMimeCryptoContext *context, const char *session_key,
+              GMimeStream *istream, GMimeStream *ostream,
+              GError **err)
 {
 #ifdef ENABLE_CRYPTO
        GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index 1167ab6..0624d32 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -154,7 +154,7 @@ test_decrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GM
        
        stream = g_mime_stream_mem_new ();
        
-       if (!(result = g_mime_crypto_context_decrypt (ctx, ciphertext, stream, &err))) {
+       if (!(result = g_mime_crypto_context_decrypt (ctx, NULL, ciphertext, stream, &err))) {
                g_object_unref (stream);
                ex = exception_new ("%s", err->message);
                g_error_free (err);
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 00b0f9b..6ba5526 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -377,7 +377,7 @@ test_multipart_encrypted (GMimeCryptoContext *ctx, gboolean sign,
        mpe = (GMimeMultipartEncrypted *) message->mime_part;
        
        /* okay, now to test our decrypt function... */
-       decrypted = g_mime_multipart_encrypted_decrypt_session (mpe, session_key, &result, &err);
+       decrypted = g_mime_multipart_encrypted_decrypt (mpe, session_key, &result, &err);
        if (!decrypted || err != NULL) {
                ex = exception_new ("decryption failed: %s", err->message);
                g_error_free (err);
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 5907100..197bc8a 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -156,7 +156,7 @@ test_decrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GM
        
        stream = g_mime_stream_mem_new ();
        
-       if (!(result = g_mime_crypto_context_decrypt (ctx, ciphertext, stream, &err))) {
+       if (!(result = g_mime_crypto_context_decrypt (ctx, NULL, ciphertext, stream, &err))) {
                g_object_unref (stream);
                ex = exception_new ("%s", err->message);
                g_error_free (err);
diff --git a/tests/test-smime.c b/tests/test-smime.c
index b031983..abd822c 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -359,7 +359,7 @@ test_multipart_encrypted (GMimeCryptoContext *ctx, gboolean sign)
        mpe = (GMimeMultipartEncrypted *) message->mime_part;
        
        /* okay, now to test our decrypt function... */
-       decrypted = g_mime_multipart_encrypted_decrypt (mpe, &result, &err);
+       decrypted = g_mime_multipart_encrypted_decrypt (mpe, NULL, &result, &err);
        if (!decrypted || err != NULL) {
                ex = exception_new ("decryption failed: %s", err->message);
                g_object_unref (cleartext);


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