[evolution-patches] Patches for #320876: Bad GPG message digest (hash) override behaviour



Hi all

	I am a PGP user and I use SHA-512 as my default OpenPGP message digest
(hash).. it's also set in my key preferences. Using Evolution, I get the
hash type force-set to SHA-1 every time I send a mail. I looked at the
source code just now, and I see that it enforces SHA-1 instead of using
the GnuPG defaults. Attached are two patches against my Fedora Core 4
Evolution SRPMS (evolution-2.2.3-2.fc4 and
evolution-data-server-1.2.3-3.fc4) to fix this behaviour and also
introduce SHA256, SHA384 and SHA512 message digests which GnuPG 1.4.x
stable supports. Attached is a screenshot of a working patched Evolution
too.

				Mukund


diff -ru evolution-2.2.3.orig/composer/e-msg-composer.c evolution-2.2.3/composer/e-msg-composer.c
--- evolution-2.2.3.orig/composer/e-msg-composer.c	2005-04-08 15:48:22.000000000 +0100
+++ evolution-2.2.3/composer/e-msg-composer.c	2005-11-07 13:46:10.000000000 +0000
@@ -670,7 +670,7 @@
 			CamelMimePart *npart = camel_mime_part_new();
 
 			cipher = mail_crypto_get_pgp_cipher_context(hdrs->account);
-			camel_cipher_sign(cipher, pgp_userid, CAMEL_CIPHER_HASH_SHA1, part, npart, &ex);
+			camel_cipher_sign(cipher, pgp_userid, CAMEL_CIPHER_HASH_DEFAULT, part, npart, &ex);
 			camel_object_unref(cipher);
 			
 			if (camel_exception_is_set(&ex)) {
diff -ru evolution-data-server-1.2.3.orig/camel/camel-cipher-context.h evolution-data-server-1.2.3/camel/camel-cipher-context.h
--- evolution-data-server-1.2.3.orig/camel/camel-cipher-context.h	2004-12-02 08:03:29.000000000 +0000
+++ evolution-data-server-1.2.3/camel/camel-cipher-context.h	2005-11-07 13:37:07.000000000 +0000
@@ -52,7 +52,10 @@
 	CAMEL_CIPHER_HASH_SHA1,
 	CAMEL_CIPHER_HASH_RIPEMD160,
 	CAMEL_CIPHER_HASH_TIGER192,
-	CAMEL_CIPHER_HASH_HAVAL5160
+	CAMEL_CIPHER_HASH_HAVAL5160,
+	CAMEL_CIPHER_HASH_SHA256,
+	CAMEL_CIPHER_HASH_SHA384,
+	CAMEL_CIPHER_HASH_SHA512
 } CamelCipherHash;
 
 enum _camel_cipher_validity_sign_t {
diff -ru evolution-data-server-1.2.3.orig/camel/camel-gpg-context.c evolution-data-server-1.2.3/camel/camel-gpg-context.c
--- evolution-data-server-1.2.3.orig/camel/camel-gpg-context.c	2005-02-01 05:57:15.000000000 +0000
+++ evolution-data-server-1.2.3/camel/camel-gpg-context.c	2005-11-07 13:42:44.000000000 +0000
@@ -122,7 +122,6 @@
 	case CAMEL_CIPHER_HASH_MD5:
 		return "pgp-md5";
 	case CAMEL_CIPHER_HASH_SHA1:
-	case CAMEL_CIPHER_HASH_DEFAULT:
 		return "pgp-sha1";
 	case CAMEL_CIPHER_HASH_RIPEMD160:
 		return "pgp-ripemd160";
@@ -130,6 +129,14 @@
 		return "pgp-tiger192";
 	case CAMEL_CIPHER_HASH_HAVAL5160:
 		return "pgp-haval-5-160";
+	case CAMEL_CIPHER_HASH_SHA256:
+		return "pgp-sha256";
+	case CAMEL_CIPHER_HASH_SHA384:
+		return "pgp-sha384";
+	case CAMEL_CIPHER_HASH_SHA512:
+		return "pgp-sha512";
+	case CAMEL_CIPHER_HASH_DEFAULT:
+		return "pgp-default";
 	}
 	
 	return NULL;
@@ -151,6 +158,14 @@
 			return CAMEL_CIPHER_HASH_TIGER192;
 		else if (!strcmp (id, "haval-5-160"))
 			return CAMEL_CIPHER_HASH_HAVAL5160;
+		else if (!strcmp (id, "pgp-sha256"))
+			return CAMEL_CIPHER_HASH_SHA256;
+		else if (!strcmp (id, "pgp-sha384"))
+			return CAMEL_CIPHER_HASH_SHA384;
+		else if (!strcmp (id, "pgp-sha512"))
+			return CAMEL_CIPHER_HASH_SHA512;
+		else if (!strcmp (id, "pgp-default"))
+			return CAMEL_CIPHER_HASH_DEFAULT;
 	}
 	
 	return CAMEL_CIPHER_HASH_DEFAULT;
@@ -476,6 +491,12 @@
 		return "--digest-algo=SHA1";
 	case CAMEL_CIPHER_HASH_RIPEMD160:
 		return "--digest-algo=RIPEMD160";
+	case CAMEL_CIPHER_HASH_SHA256:
+		return "--digest-algo=SHA256";
+	case CAMEL_CIPHER_HASH_SHA384:
+		return "--digest-algo=SHA384";
+	case CAMEL_CIPHER_HASH_SHA512:
+		return "--digest-algo=SHA512";
 	default:
 		return NULL;
 	}

Attachment: it-works.png
Description: PNG image



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