Lines 756-762
Link Here
|
756 |
which must have been allocated by the caller with size BUFLEN. |
756 |
which must have been allocated by the caller with size BUFLEN. |
757 |
Returns 0 on success or -1 in case of an error. The return string |
757 |
Returns 0 on success or -1 in case of an error. The return string |
758 |
is truncted to BUFLEN - 1. */ |
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 |
gpgme_sign_result_t result = NULL; |
761 |
gpgme_sign_result_t result = NULL; |
762 |
const char *algorithm_name = NULL; |
762 |
const char *algorithm_name = NULL; |
Lines 771-779
Link Here
|
771 |
algorithm_name = gpgme_hash_algo_name (result->signatures->hash_algo); |
771 |
algorithm_name = gpgme_hash_algo_name (result->signatures->hash_algo); |
772 |
if (algorithm_name) |
772 |
if (algorithm_name) |
773 |
{ |
773 |
{ |
774 |
/* convert GPGME raw hash name to RFC 3156 format */ |
774 |
if (use_smime) |
775 |
snprintf (buf, buflen, "pgp-%s", algorithm_name); |
775 |
{ |
776 |
ascii_strlower (buf + 4); |
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 |
|
Lines 873-882
Link Here
|
873 |
&t->parameter); |
880 |
&t->parameter); |
874 |
/* Get the micalg from gpgme. Old gpgme versions don't support this |
881 |
/* Get the micalg from gpgme. Old gpgme versions don't support this |
875 |
for S/MIME so we assume sha-1 in this case. */ |
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 |
mutt_set_parameter ("micalg", buf, &t->parameter); |
884 |
mutt_set_parameter ("micalg", buf, &t->parameter); |
878 |
else if (use_smime) |
885 |
else if (use_smime) |
879 |
mutt_set_parameter ("micalg", "pgp-sha1", &t->parameter); |
886 |
mutt_set_parameter ("micalg", "sha1", &t->parameter); |
880 |
gpgme_release (ctx); |
887 |
gpgme_release (ctx); |
881 |
|
888 |
|
882 |
t->parts = a; |
889 |
t->parts = a; |