Ticket #2994: aj-smime-algo-hack.diff
| File aj-smime-algo-hack.diff, 1.8 kB (added by AndreasJ, 14 months ago) |
|---|
-
crypt-gpgme.c
old new 756 756 which must have been allocated by the caller with size BUFLEN. 757 757 Returns 0 on success or -1 in case of an error. The return string 758 758 is truncted to BUFLEN - 1. */ 759 static int get_micalg (gpgme_ctx_t ctx, char *buf, size_t buflen)759 static int get_micalg (gpgme_ctx_t ctx, int use_smime, char *buf, size_t buflen) 760 760 { 761 761 gpgme_sign_result_t result = NULL; 762 762 const char *algorithm_name = NULL; … … 771 771 algorithm_name = gpgme_hash_algo_name (result->signatures->hash_algo); 772 772 if (algorithm_name) 773 773 { 774 /* convert GPGME raw hash name to RFC 3156 format */ 775 snprintf (buf, buflen, "pgp-%s", algorithm_name); 776 ascii_strlower (buf + 4); 774 if (use_smime) 775 { 776 /* convert GPGME raw hash name to RFC 2633 format */ 777 snprintf (buf, buflen, "%s", algorithm_name); 778 ascii_strlower (buf); 779 } else { 780 /* convert GPGME raw hash name to RFC 3156 format */ 781 snprintf (buf, buflen, "pgp-%s", algorithm_name); 782 ascii_strlower (buf + 4); 783 } 777 784 } 778 785 } 779 786 … … 873 880 &t->parameter); 874 881 /* Get the micalg from gpgme. Old gpgme versions don't support this 875 882 for S/MIME so we assume sha-1 in this case. */ 876 if (!get_micalg (ctx, buf, sizeof buf))883 if (!get_micalg (ctx, use_smime, buf, sizeof buf)) 877 884 mutt_set_parameter ("micalg", buf, &t->parameter); 878 885 else if (use_smime) 879 mutt_set_parameter ("micalg", " pgp-sha1", &t->parameter);886 mutt_set_parameter ("micalg", "sha1", &t->parameter); 880 887 gpgme_release (ctx); 881 888 882 889 t->parts = a;
