[gmime] Dropped GMimeDigestAlgo argument from sign() and encrypt() methods
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Dropped GMimeDigestAlgo argument from sign() and encrypt() methods
- Date: Mon, 13 Mar 2017 13:58:54 +0000 (UTC)
commit f5a40ccc59e672a2a110ba1cc648349797fa9944
Author: Jeffrey Stedfast <jestedfa microsoft com>
Date: Mon Mar 13 09:57:43 2017 -0400
Dropped GMimeDigestAlgo argument from sign() and encrypt() methods
gmime/gmime-application-pkcs7-mime.c | 7 +++----
gmime/gmime-application-pkcs7-mime.h | 3 +--
gmime/gmime-crypto-context.c | 34 +++++++++++++---------------------
gmime/gmime-crypto-context.h | 21 ++++++++-------------
gmime/gmime-gpg-context.c | 22 +++++++++-------------
gmime/gmime-gpgme-utils.c | 7 ++++---
gmime/gmime-gpgme-utils.h | 7 ++++---
gmime/gmime-multipart-encrypted.c | 6 ++----
gmime/gmime-multipart-encrypted.h | 5 +++--
gmime/gmime-multipart-signed.c | 10 ++++------
gmime/gmime-multipart-signed.h | 3 +--
gmime/gmime-pkcs7-context.c | 22 +++++++++-------------
tests/test-pgp.c | 10 +++++-----
tests/test-pgpmime.c | 6 ++----
tests/test-pkcs7.c | 11 +++--------
tests/test-smime.c | 5 ++---
16 files changed, 73 insertions(+), 106 deletions(-)
---
diff --git a/gmime/gmime-application-pkcs7-mime.c b/gmime/gmime-application-pkcs7-mime.c
index 78780e2..95a3986 100644
--- a/gmime/gmime-application-pkcs7-mime.c
+++ b/gmime/gmime-application-pkcs7-mime.c
@@ -261,7 +261,7 @@ g_mime_application_pkcs7_mime_encrypt (GMimeObject *entity, GMimeEncryptFlags fl
/* encrypt the content stream */
ciphertext = g_mime_stream_mem_new ();
- if (g_mime_crypto_context_encrypt (ctx, FALSE, NULL, GMIME_DIGEST_ALGO_DEFAULT, flags, recipients,
stream, ciphertext, err) == -1) {
+ if (g_mime_crypto_context_encrypt (ctx, FALSE, NULL, flags, recipients, stream, ciphertext, err) ==
-1) {
g_object_unref (ciphertext);
g_object_unref (stream);
g_object_unref (ctx);
@@ -389,7 +389,6 @@ g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime,
* g_mime_application_pkcs7_mime_sign:
* @entity: a #GMimeObject
* @userid: the user id to sign with
- * @digest: a #GMimeDigestAlgo
* @err: a #GError
*
* Signs the @entity using S/MIME.
@@ -397,7 +396,7 @@ g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *pkcs7_mime,
* Returns: the signed @entity.
**/
GMimeApplicationPkcs7Mime *
-g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid, GMimeDigestAlgo digest, GError
**err)
+g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid, GError **err)
{
GMimeStream *filtered_stream, *ciphertext, *stream;
GMimeApplicationPkcs7Mime *pkcs7_mime;
@@ -433,7 +432,7 @@ g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid, GMi
/* sign the content stream */
ciphertext = g_mime_stream_mem_new ();
- if (g_mime_crypto_context_sign (ctx, FALSE, userid, digest, stream, ciphertext, err) == -1) {
+ if (g_mime_crypto_context_sign (ctx, FALSE, userid, stream, ciphertext, err) == -1) {
g_object_unref (ciphertext);
g_object_unref (stream);
g_object_unref (ctx);
diff --git a/gmime/gmime-application-pkcs7-mime.h b/gmime/gmime-application-pkcs7-mime.h
index f85aaee..656558c 100644
--- a/gmime/gmime-application-pkcs7-mime.h
+++ b/gmime/gmime-application-pkcs7-mime.h
@@ -92,8 +92,7 @@ GMimeObject *g_mime_application_pkcs7_mime_decrypt (GMimeApplicationPkcs7Mime *p
GMimeDecryptFlags flags, const char *session_key,
GMimeDecryptResult **result, GError **err);
-GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid,
- GMimeDigestAlgo digest, GError **err);
+GMimeApplicationPkcs7Mime *g_mime_application_pkcs7_mime_sign (GMimeObject *entity, const char *userid,
GError **err);
GMimeSignatureList *g_mime_application_pkcs7_mime_verify (GMimeApplicationPkcs7Mime *pkcs7_mime,
GMimeVerifyFlags flags,
GMimeObject **entity, GError **err);
diff --git a/gmime/gmime-crypto-context.c b/gmime/gmime-crypto-context.c
index 08ad261..a428b29 100644
--- a/gmime/gmime-crypto-context.c
+++ b/gmime/gmime-crypto-context.c
@@ -47,23 +47,20 @@ static void g_mime_crypto_context_finalize (GObject *object);
static GMimeDigestAlgo crypto_digest_id (GMimeCryptoContext *ctx, const char *name);
-static const char *crypto_digest_name (GMimeCryptoContext *ctx, GMimeDigestAlgo );
+static const char *crypto_digest_name (GMimeCryptoContext *ctx, GMimeDigestAlgo digest);
static const char *crypto_get_signature_protocol (GMimeCryptoContext *ctx);
static const char *crypto_get_encryption_protocol (GMimeCryptoContext *ctx);
static const char *crypto_get_key_exchange_protocol (GMimeCryptoContext *ctx);
-static int crypto_sign (GMimeCryptoContext *ctx, gboolean detach,
- const char *userid, GMimeDigestAlgo digest,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+static int crypto_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
+ GMimeStream *istream, GMimeStream *ostream, GError **err);
static GMimeSignatureList *crypto_verify (GMimeCryptoContext *ctx, GMimeVerifyFlags flags,
GMimeStream *istream, GMimeStream *sigstream,
GMimeStream *ostream, GError **err);
-static int crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign,
- const char *userid, GMimeDigestAlgo digest,
+static int crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid,
GMimeEncryptFlags flags, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
@@ -352,7 +349,7 @@ g_mime_crypto_context_get_key_exchange_protocol (GMimeCryptoContext *ctx)
static int
-crypto_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid, GMimeDigestAlgo digest,
+crypto_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
@@ -367,25 +364,23 @@ crypto_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid, GMime
* @ctx: a #GMimeCryptoContext
* @detach: %TRUE if @ostream should be the detached signature; otherwise, %FALSE
* @userid: private key to use to sign the stream
- * @digest: digest algorithm to use
* @istream: input stream
* @ostream: output stream
* @err: a #GError
*
* Signs the input stream and writes the resulting signature to the output stream.
*
- * Returns: the #GMimeDigestAlgo used on success (useful if @digest is
- * specified as #GMIME_DIGEST_ALGO_DEFAULT) or %-1 on fail.
+ * Returns: the #GMimeDigestAlgo used on success or %-1 on fail.
**/
int
-g_mime_crypto_context_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid, GMimeDigestAlgo
digest,
+g_mime_crypto_context_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (istream), -1);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), -1);
- return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->sign (ctx, detach, userid, digest, istream, ostream,
err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->sign (ctx, detach, userid, istream, ostream, err);
}
@@ -430,9 +425,8 @@ g_mime_crypto_context_verify (GMimeCryptoContext *ctx, GMimeVerifyFlags flags, G
static int
-crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream,
- GError **err)
+crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeEncryptFlags flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError **err)
{
g_set_error (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED,
"Encryption is not supported by this crypto context");
@@ -446,7 +440,6 @@ crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMim
* @ctx: a #GMimeCryptoContext
* @sign: sign as well as encrypt
* @userid: key id (or email address) to use when signing (assuming @sign is %TRUE)
- * @digest: digest algorithm to use when signing
* @flags: a #GMimeEncryptFlags
* @recipients: (element-type utf8): an array of recipient key ids
* and/or email addresses
@@ -460,15 +453,14 @@ crypto_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMim
* Returns: %0 on success or %-1 on fail.
**/
int
-g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeDigestAlgo
digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream,
GMimeStream *ostream,
- GError **err)
+g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeEncryptFlags
flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError
**err)
{
g_return_val_if_fail (GMIME_IS_CRYPTO_CONTEXT (ctx), -1);
g_return_val_if_fail (GMIME_IS_STREAM (istream), -1);
g_return_val_if_fail (GMIME_IS_STREAM (ostream), -1);
- return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->encrypt (ctx, sign, userid, digest, flags, recipients,
istream, ostream, err);
+ return GMIME_CRYPTO_CONTEXT_GET_CLASS (ctx)->encrypt (ctx, sign, userid, flags, recipients, istream,
ostream, err);
}
diff --git a/gmime/gmime-crypto-context.h b/gmime/gmime-crypto-context.h
index dda8f55..de1fa8b 100644
--- a/gmime/gmime-crypto-context.h
+++ b/gmime/gmime-crypto-context.h
@@ -137,19 +137,17 @@ struct _GMimeCryptoContextClass {
const char * (* get_key_exchange_protocol) (GMimeCryptoContext *ctx);
int (* sign) (GMimeCryptoContext *ctx, gboolean detach,
- const char *userid, GMimeDigestAlgo digest,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+ const char *userid, GMimeStream *istream,
+ GMimeStream *ostream, GError **err);
GMimeSignatureList * (* verify) (GMimeCryptoContext *ctx, GMimeVerifyFlags flags,
GMimeStream *istream, GMimeStream *sigstream,
GMimeStream *ostream, GError **err);
int (* encrypt) (GMimeCryptoContext *ctx, gboolean sign,
- const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+ const char *userid, GMimeEncryptFlags flags,
+ GPtrArray *recipients, GMimeStream *istream,
+ GMimeStream *ostream, GError **err);
GMimeDecryptResult * (* decrypt) (GMimeCryptoContext *ctx, GMimeDecryptFlags flags,
const char *session_key, GMimeStream *istream,
@@ -180,17 +178,14 @@ const char *g_mime_crypto_context_get_encryption_protocol (GMimeCryptoContext *c
const char *g_mime_crypto_context_get_key_exchange_protocol (GMimeCryptoContext *ctx);
/* crypto routines */
-int g_mime_crypto_context_sign (GMimeCryptoContext *ctx, gboolean detach,
- const char *userid, GMimeDigestAlgo digest,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+int g_mime_crypto_context_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
+ GMimeStream *istream, GMimeStream *ostream, GError **err);
GMimeSignatureList *g_mime_crypto_context_verify (GMimeCryptoContext *ctx, GMimeVerifyFlags flags,
GMimeStream *istream, GMimeStream *sigstream,
GMimeStream *ostream, GError **err);
-int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign,
- const char *userid, GMimeDigestAlgo digest,
+int g_mime_crypto_context_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid,
GMimeEncryptFlags flags, GPtrArray *recipients,
GMimeStream *istream, GMimeStream *ostream,
GError **err);
diff --git a/gmime/gmime-gpg-context.c b/gmime/gmime-gpg-context.c
index 0f453f2..d534561 100644
--- a/gmime/gmime-gpg-context.c
+++ b/gmime/gmime-gpg-context.c
@@ -84,10 +84,8 @@ static void g_mime_gpg_context_finalize (GObject *object);
static GMimeDigestAlgo gpg_digest_id (GMimeCryptoContext *ctx, const char *name);
static const char *gpg_digest_name (GMimeCryptoContext *ctx, GMimeDigestAlgo digest);
-static int gpg_sign (GMimeCryptoContext *ctx, gboolean detach,
- const char *userid, GMimeDigestAlgo digest,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+static int gpg_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
+ GMimeStream *istream, GMimeStream *ostream, GError **err);
static const char *gpg_get_signature_protocol (GMimeCryptoContext *ctx);
static const char *gpg_get_encryption_protocol (GMimeCryptoContext *ctx);
@@ -97,9 +95,8 @@ static GMimeSignatureList *gpg_verify (GMimeCryptoContext *ctx, GMimeVerifyFlags
GMimeStream *istream, GMimeStream *sigstream,
GMimeStream *ostream, GError **err);
-static int gpg_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream, GMimeStream
*ostream,
- GError **err);
+static int gpg_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeEncryptFlags flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError **err);
static GMimeDecryptResult *gpg_decrypt (GMimeCryptoContext *ctx, GMimeDecryptFlags flags, const char
*session_key,
GMimeStream *istream, GMimeStream *ostream, GError **err);
@@ -267,7 +264,7 @@ gpg_get_key_exchange_protocol (GMimeCryptoContext *ctx)
}
static int
-gpg_sign (GMimeCryptoContext *context, gboolean detach, const char *userid, GMimeDigestAlgo digest,
+gpg_sign (GMimeCryptoContext *context, gboolean detach, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_CRYPTO
@@ -276,7 +273,7 @@ gpg_sign (GMimeCryptoContext *context, gboolean detach, const char *userid, GMim
gpgme_set_textmode (gpg->ctx, !detach);
- return g_mime_gpgme_sign (gpg->ctx, mode, userid, digest, istream, ostream, err);
+ return g_mime_gpgme_sign (gpg->ctx, mode, userid, istream, ostream, err);
#else
g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in
this build"));
@@ -300,14 +297,13 @@ gpg_verify (GMimeCryptoContext *context, GMimeVerifyFlags flags, GMimeStream *is
}
static int
-gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream,
- GError **err)
+gpg_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, GMimeEncryptFlags flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_CRYPTO
GMimeGpgContext *gpg = (GMimeGpgContext *) context;
- return g_mime_gpgme_encrypt (gpg->ctx, sign, userid, digest, flags, recipients, istream, ostream,
err);
+ return g_mime_gpgme_encrypt (gpg->ctx, sign, userid, flags, recipients, istream, ostream, err);
#else
g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("PGP support is not enabled in
this build"));
diff --git a/gmime/gmime-gpgme-utils.c b/gmime/gmime-gpgme-utils.c
index 7b4a78b..a325019 100644
--- a/gmime/gmime-gpgme-utils.c
+++ b/gmime/gmime-gpgme-utils.c
@@ -208,7 +208,7 @@ g_mime_gpgme_add_signer (gpgme_ctx_t ctx, const char *signer, GError **err)
}
int
-g_mime_gpgme_sign (gpgme_ctx_t ctx, gpgme_sig_mode_t mode, const char *userid, GMimeDigestAlgo digest,
+g_mime_gpgme_sign (gpgme_ctx_t ctx, gpgme_sig_mode_t mode, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
gpgme_sign_result_t result;
@@ -417,8 +417,9 @@ g_mime_gpgme_keylist_free (gpgme_key_t *keys)
}
int
-g_mime_gpgme_encrypt (gpgme_ctx_t ctx, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream, GMimeStream
*ostream,
+g_mime_gpgme_encrypt (gpgme_ctx_t ctx, gboolean sign, const char *userid,
+ GMimeEncryptFlags flags, GPtrArray *recipients,
+ GMimeStream *istream, GMimeStream *ostream,
GError **err)
{
gpgme_encrypt_flags_t encrypt_flags = 0;
diff --git a/gmime/gmime-gpgme-utils.h b/gmime/gmime-gpgme-utils.h
index 601b5a0..7bf053a 100644
--- a/gmime/gmime-gpgme-utils.h
+++ b/gmime/gmime-gpgme-utils.h
@@ -34,14 +34,15 @@ G_GNUC_INTERNAL gpgme_error_t g_mime_gpgme_passphrase_callback (void *hook, cons
const char *passphrase_info,
int prev_was_bad, int fd);
-G_GNUC_INTERNAL int g_mime_gpgme_sign (gpgme_ctx_t ctx, gpgme_sig_mode_t mode, const char *userid,
GMimeDigestAlgo digest,
+G_GNUC_INTERNAL int g_mime_gpgme_sign (gpgme_ctx_t ctx, gpgme_sig_mode_t mode, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err);
G_GNUC_INTERNAL GMimeSignatureList *g_mime_gpgme_verify (gpgme_ctx_t ctx, GMimeVerifyFlags flags,
GMimeStream *istream,
GMimeStream *sigstream, GMimeStream *ostream, GError
**err);
-G_GNUC_INTERNAL int g_mime_gpgme_encrypt (gpgme_ctx_t ctx, gboolean sign, const char *userid,
GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream
*istream, GMimeStream *ostream,
+G_GNUC_INTERNAL int g_mime_gpgme_encrypt (gpgme_ctx_t ctx, gboolean sign, const char *userid,
+ GMimeEncryptFlags flags, GPtrArray *recipients,
+ GMimeStream *istream, GMimeStream *ostream,
GError **err);
G_GNUC_INTERNAL GMimeDecryptResult *g_mime_gpgme_decrypt (gpgme_ctx_t ctx, GMimeDecryptFlags flags, const
char *session_key,
diff --git a/gmime/gmime-multipart-encrypted.c b/gmime/gmime-multipart-encrypted.c
index f0a383a..f2f282e 100644
--- a/gmime/gmime-multipart-encrypted.c
+++ b/gmime/gmime-multipart-encrypted.c
@@ -142,7 +142,6 @@ g_mime_multipart_encrypted_new (void)
* @entity: MIME part to encrypt
* @sign: %TRUE if the content should also be signed or %FALSE otherwise
* @userid: user id to use for signing (only used if @sign is %TRUE)
- * @digest: digest algorithm to use when signing
* @flags: a #GMimeEncryptFlags
* @recipients: (element-type utf8): an array of recipients to encrypt to
* @err: a #GError
@@ -156,8 +155,7 @@ g_mime_multipart_encrypted_new (void)
* as to why the failure occured.
**/
GMimeMultipartEncrypted *
-g_mime_multipart_encrypted_encrypt (GMimeCryptoContext *ctx, GMimeObject *entity,
- gboolean sign, const char *userid, GMimeDigestAlgo digest,
+g_mime_multipart_encrypted_encrypt (GMimeCryptoContext *ctx, GMimeObject *entity, gboolean sign, const char
*userid,
GMimeEncryptFlags flags, GPtrArray *recipients, GError **err)
{
GMimeParserOptions *options = g_mime_parser_options_get_default ();
@@ -194,7 +192,7 @@ g_mime_multipart_encrypted_encrypt (GMimeCryptoContext *ctx, GMimeObject *entity
/* encrypt the content stream */
ciphertext = g_mime_stream_mem_new ();
- if (g_mime_crypto_context_encrypt (ctx, sign, userid, digest, flags, recipients, stream, ciphertext,
err) == -1) {
+ if (g_mime_crypto_context_encrypt (ctx, sign, userid, flags, recipients, stream, ciphertext, err) ==
-1) {
g_object_unref (ciphertext);
g_object_unref (stream);
return NULL;
diff --git a/gmime/gmime-multipart-encrypted.h b/gmime/gmime-multipart-encrypted.h
index 6567aef..c02c9da 100644
--- a/gmime/gmime-multipart-encrypted.h
+++ b/gmime/gmime-multipart-encrypted.h
@@ -65,8 +65,9 @@ GType g_mime_multipart_encrypted_get_type (void);
GMimeMultipartEncrypted *g_mime_multipart_encrypted_new (void);
GMimeMultipartEncrypted *g_mime_multipart_encrypted_encrypt (GMimeCryptoContext *ctx, GMimeObject *entity,
- gboolean sign, const char *user_id,
GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients,
GError **err);
+ gboolean sign, const char *user_id,
+ GMimeEncryptFlags flags, GPtrArray *recipients,
+ GError **err);
GMimeObject *g_mime_multipart_encrypted_decrypt (GMimeMultipartEncrypted *encrypted,
GMimeDecryptFlags flags,
diff --git a/gmime/gmime-multipart-signed.c b/gmime/gmime-multipart-signed.c
index fc876be..10f8c9e 100644
--- a/gmime/gmime-multipart-signed.c
+++ b/gmime/gmime-multipart-signed.c
@@ -197,12 +197,11 @@ sign_prepare (GMimeObject *mime_part)
* @ctx: a #GMimeCryptoContext
* @entity: MIME part to sign
* @userid: user id to sign with
- * @digest: preferred digest algorithm
* @err: a #GError
*
* Attempts to sign the @content MIME part with @userid's private key
- * using the @ctx signing context with the @digest algorithm. If
- * successful, a new multipart/signed object is returned.
+ * using the @ctx signing context. If successful, a new multipart/signed
+ * object is returned.
*
* Returns: a new #GMimeMultipartSigned object on success or %NULL on fail.
* If signing fails, an exception will be set on @err to provide information
@@ -210,8 +209,7 @@ sign_prepare (GMimeObject *mime_part)
**/
GMimeMultipartSigned *
g_mime_multipart_signed_sign (GMimeCryptoContext *ctx, GMimeObject *entity,
- const char *userid, GMimeDigestAlgo digest,
- GError **err)
+ const char *userid, GError **err)
{
GMimeParserOptions *options = g_mime_parser_options_get_default ();
GMimeStream *stream, *filtered, *sigstream;
@@ -265,7 +263,7 @@ g_mime_multipart_signed_sign (GMimeCryptoContext *ctx, GMimeObject *entity,
sigstream = g_mime_stream_mem_new ();
/* sign the content stream */
- if ((algo = g_mime_crypto_context_sign (ctx, TRUE, userid, digest, filtered, sigstream, err)) == -1) {
+ if ((algo = g_mime_crypto_context_sign (ctx, TRUE, userid, filtered, sigstream, err)) == -1) {
g_object_unref (sigstream);
g_object_unref (filtered);
g_object_unref (stream);
diff --git a/gmime/gmime-multipart-signed.h b/gmime/gmime-multipart-signed.h
index b82f3d1..d021541 100644
--- a/gmime/gmime-multipart-signed.h
+++ b/gmime/gmime-multipart-signed.h
@@ -65,8 +65,7 @@ GType g_mime_multipart_signed_get_type (void);
GMimeMultipartSigned *g_mime_multipart_signed_new (void);
GMimeMultipartSigned *g_mime_multipart_signed_sign (GMimeCryptoContext *ctx, GMimeObject *entity,
- const char *userid, GMimeDigestAlgo digest,
- GError **err);
+ const char *userid, GError **err);
GMimeSignatureList *g_mime_multipart_signed_verify (GMimeMultipartSigned *mps, GMimeVerifyFlags flags,
GError **err);
diff --git a/gmime/gmime-pkcs7-context.c b/gmime/gmime-pkcs7-context.c
index ba4a75b..80b6b30 100644
--- a/gmime/gmime-pkcs7-context.c
+++ b/gmime/gmime-pkcs7-context.c
@@ -87,18 +87,15 @@ static const char *pkcs7_get_signature_protocol (GMimeCryptoContext *ctx);
static const char *pkcs7_get_encryption_protocol (GMimeCryptoContext *ctx);
static const char *pkcs7_get_key_exchange_protocol (GMimeCryptoContext *ctx);
-static int pkcs7_sign (GMimeCryptoContext *ctx, gboolean detach,
- const char *userid, GMimeDigestAlgo digest,
- GMimeStream *istream, GMimeStream *ostream,
- GError **err);
+static int pkcs7_sign (GMimeCryptoContext *ctx, gboolean detach, const char *userid,
+ GMimeStream *istream, GMimeStream *ostream, GError **err);
static GMimeSignatureList *pkcs7_verify (GMimeCryptoContext *ctx, GMimeVerifyFlags flags,
GMimeStream *istream, GMimeStream *sigstream,
GMimeStream *ostream, GError **err);
-static int pkcs7_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream,
- GMimeStream *ostream, GError **err);
+static int pkcs7_encrypt (GMimeCryptoContext *ctx, gboolean sign, const char *userid, GMimeEncryptFlags
flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError **err);
static GMimeDecryptResult *pkcs7_decrypt (GMimeCryptoContext *ctx, GMimeDecryptFlags flags, const char
*session_key,
GMimeStream *istream, GMimeStream *ostream, GError **err);
@@ -263,14 +260,14 @@ pkcs7_get_key_exchange_protocol (GMimeCryptoContext *ctx)
}
static int
-pkcs7_sign (GMimeCryptoContext *context, gboolean detach, const char *userid, GMimeDigestAlgo digest,
+pkcs7_sign (GMimeCryptoContext *context, gboolean detach, const char *userid,
GMimeStream *istream, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_CRYPTO
gpgme_sig_mode_t mode = detach ? GPGME_SIG_MODE_DETACH : GPGME_SIG_MODE_NORMAL;
GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
- return g_mime_gpgme_sign (pkcs7->ctx, mode, userid, digest, istream, ostream, err);
+ return g_mime_gpgme_sign (pkcs7->ctx, mode, userid, istream, ostream, err);
#else
g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in
this build"));
@@ -294,9 +291,8 @@ pkcs7_verify (GMimeCryptoContext *context, GMimeVerifyFlags flags, GMimeStream *
}
static int
-pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, GMimeDigestAlgo digest,
- GMimeEncryptFlags flags, GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream,
- GError **err)
+pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, GMimeEncryptFlags flags,
+ GPtrArray *recipients, GMimeStream *istream, GMimeStream *ostream, GError **err)
{
#ifdef ENABLE_CRYPTO
GMimePkcs7Context *pkcs7 = (GMimePkcs7Context *) context;
@@ -307,7 +303,7 @@ pkcs7_encrypt (GMimeCryptoContext *context, gboolean sign, const char *userid, G
return -1;
}
- return g_mime_gpgme_encrypt (pkcs7->ctx, sign, userid, digest, flags, recipients, istream, ostream,
err);
+ return g_mime_gpgme_encrypt (pkcs7->ctx, sign, userid, flags, recipients, istream, ostream, err);
#else
g_set_error_literal (err, GMIME_ERROR, GMIME_ERROR_NOT_SUPPORTED, _("S/MIME support is not enabled in
this build"));
diff --git a/tests/test-pgp.c b/tests/test-pgp.c
index 504236c..e82b40e 100644
--- a/tests/test-pgp.c
+++ b/tests/test-pgp.c
@@ -71,9 +71,7 @@ test_sign (GMimeCryptoContext *ctx, gboolean detached, GMimeStream *cleartext, G
Exception *ex;
int rv;
- rv = g_mime_crypto_context_sign (ctx, detached, "no.user@no.domain",
- GMIME_DIGEST_ALGO_SHA256,
- cleartext, ciphertext, &err);
+ rv = g_mime_crypto_context_sign (ctx, detached, "no.user@no.domain", cleartext, ciphertext, &err);
if (rv == -1 || err != NULL) {
ex = exception_new ("%s", err->message);
@@ -167,8 +165,10 @@ test_encrypt (GMimeCryptoContext *ctx, gboolean sign, GMimeStream *cleartext, GM
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "no.user@no.domain");
- g_mime_crypto_context_encrypt (ctx, sign, "no.user@no.domain", GMIME_DIGEST_ALGO_SHA256,
- GMIME_ENCRYPT_FLAGS_ALWAYS_TRUST, recipients, cleartext, ciphertext,
&err);
+ g_mime_crypto_context_encrypt (ctx, sign, "no.user@no.domain",
+ GMIME_ENCRYPT_FLAGS_ALWAYS_TRUST,
+ recipients, cleartext, ciphertext,
+ &err);
g_ptr_array_free (recipients, TRUE);
diff --git a/tests/test-pgpmime.c b/tests/test-pgpmime.c
index 5d39c6b..3aebfe1 100644
--- a/tests/test-pgpmime.c
+++ b/tests/test-pgpmime.c
@@ -230,8 +230,7 @@ test_multipart_signed (GMimeCryptoContext *ctx)
g_mime_text_part_set_text (part, MULTIPART_SIGNED_CONTENT);
/* sign the part */
- mps = g_mime_multipart_signed_sign (ctx, (GMimeObject *) part, "no.user@no.domain",
- GMIME_DIGEST_ALGO_SHA1, &err);
+ mps = g_mime_multipart_signed_sign (ctx, (GMimeObject *) part, "no.user@no.domain", &err);
g_object_unref (part);
if (err != NULL) {
@@ -291,8 +290,7 @@ create_encrypted_message (GMimeCryptoContext *ctx, gboolean sign,
/* encrypt the part */
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "no.user@no.domain");
- mpe = g_mime_multipart_encrypted_encrypt (ctx, (GMimeObject *) part,
- sign, "no.user@no.domain", GMIME_DIGEST_ALGO_SHA256,
+ mpe = g_mime_multipart_encrypted_encrypt (ctx, (GMimeObject *) part, sign, "no.user@no.domain",
GMIME_ENCRYPT_FLAGS_ALWAYS_TRUST, recipients, &err);
g_ptr_array_free (recipients, TRUE);
g_object_unref (part);
diff --git a/tests/test-pkcs7.c b/tests/test-pkcs7.c
index 0bc1d1d..a360a3f 100644
--- a/tests/test-pkcs7.c
+++ b/tests/test-pkcs7.c
@@ -77,9 +77,7 @@ test_sign (GMimeCryptoContext *ctx, gboolean detached, GMimeStream *cleartext, G
Exception *ex;
int rv;
- rv = g_mime_crypto_context_sign (ctx, detached, "mimekit example com",
- GMIME_DIGEST_ALGO_SHA256,
- cleartext, ciphertext, &err);
+ rv = g_mime_crypto_context_sign (ctx, detached, "mimekit example com", cleartext, ciphertext, &err);
if (rv == -1 || err != NULL) {
ex = exception_new ("%s", err->message);
@@ -168,11 +166,8 @@ test_encrypt (GMimeCryptoContext *ctx, GMimeStream *cleartext, GMimeStream *ciph
recipients = g_ptr_array_new ();
g_ptr_array_add (recipients, "mimekit example com");
- g_mime_crypto_context_encrypt (ctx, FALSE, NULL,
- GMIME_DIGEST_ALGO_DEFAULT,
- GMIME_ENCRYPT_FLAGS_NONE,
- recipients, cleartext, ciphertext,
- &err);
+ g_mime_crypto_context_encrypt (ctx, FALSE, NULL, GMIME_ENCRYPT_FLAGS_NONE,
+ recipients, cleartext, ciphertext, &err);
g_ptr_array_free (recipients, TRUE);
diff --git a/tests/test-smime.c b/tests/test-smime.c
index 281e983..7657f1f 100644
--- a/tests/test-smime.c
+++ b/tests/test-smime.c
@@ -232,8 +232,7 @@ test_multipart_signed (GMimeCryptoContext *ctx)
g_mime_text_part_set_text (part, MULTIPART_SIGNED_CONTENT);
/* sign the part */
- mps = g_mime_multipart_signed_sign (ctx, (GMimeObject *) part, "mimekit example com",
- GMIME_DIGEST_ALGO_SHA1, &err);
+ mps = g_mime_multipart_signed_sign (ctx, (GMimeObject *) part, "mimekit example com", &err);
g_object_unref (part);
if (err != NULL) {
@@ -282,7 +281,7 @@ test_pkcs7_mime_sign (void)
part = g_mime_text_part_new ();
g_mime_text_part_set_text (part, SIGNED_CONTENT);
- pkcs7_mime = g_mime_application_pkcs7_mime_sign ((GMimeObject *) part, "mimekit example com",
GMIME_DIGEST_ALGO_SHA1, &err);
+ pkcs7_mime = g_mime_application_pkcs7_mime_sign ((GMimeObject *) part, "mimekit example com", &err);
g_object_unref (part);
if (err != NULL) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]