summaryrefslogtreecommitdiffstats
path: root/crypt.c
AgeCommit message (Collapse)Author
2016-05-09Change M_* symbols to MUTT_*Derek Martin
Changeset 23334e967dd7 created a workaround for a namespace conflict with Solaris and derivatives. After some discussion, the team decided it would be best to move away from using the "M_" prefix for macros. This patch was automatically generated by running: perl -wpi -e 's/\bM_(\w+)\b/MUTT_$1/g' `find . -name '*.[ch]' -print` with the exception that sys_socket.h was exempted. (That file will be backed out subsequent to this commit.) Thanks to Andras Salamon for supplying the perl script used to make this change.
2016-04-10Fix mutt_protect() when INLINE is set. (closes #3828)Kevin McCarthy
The oppenc changes allow security bits to be set even when not encrypting or signing (for instance, OPPENCRYPT and INLINE). mutt_protect() assumed that if INLINE is set, then either ENCRYPT or SIGN must also be set. Specifically, it would end up inline-signing the message even though neither was set. Ensure mutt_protect() is a noop if neither SIGN or ENCRYPT are set. In ci_send_message(), check for sign or encrypt before calling the crypt_get_keys() / mutt_protect() block, and also in the fcc section (since clear_content would be NULL if not). The second change to the fcc part is somewhat redundant, but better to be explicit and avoid the case where the subtype is somehow "encrypted" or "signed" even though msg->security wasn't set thus.
2016-01-01Convert copyright years to all use 4 digit years.Kevin McCarthy
Vincent Lefèvre pointed out the common shortcut, e.g 1996-9, is actually not allowed for copyright years. Convert all the copyright years (for mutt files) to use 4 digits.
2015-12-03Provide a better prompt and error for inline PGP with attachments. (closes ↵Kevin McCarthy
#3738) Change mutt_protect() to check for text/plain before trying to invoke crypt_pgp_traditional_encryptsign(). This way, mutt can provide a bit more specific prompt and error message. Since pgp_mime_auto says it will prompt in the event of any failure, keep the more generic prompt after the encryptsign call too.
2015-12-01Loosen mutt_signed_handler() protocol value consistency check. (closes #3639)Kevin McCarthy
Apparently, for S/MIME, some MUAs mismatch the protocol value of the multipart/signed and the content-type of the signature: putting "pkcs7-signature" in one and "x-pkcs7-signature" in the other. Change mutt_signed_handler() to independently verify the values of the protocol and the content-type. This still checks for correct values but doesn't ensure they match between the two (for S/MIME).
2015-07-26Handle malformed ms-exchange pgp-encrypted block. (closes #3742)Kevin McCarthy
In certain circumstances, Exchange corrupts a multipart/encrypted block into: <multipart/mixed> <text/plain> <application/pgp-encrypted> [BASE64-encoded] <application/octet-stream> [BASE64-encoded] This patch pulls the full detection of valid/invalid multiparts into mutt_body_handler(). It extracts a run_decode_and_handler() function, which is reused by new intermediate handlers to decode the application/octet-stream part before passing it directly to crypt_pgp_encrypted_handler. These intermediate handlers then check and set any GOODSIG flags back into the parent part. This change may result in less error messages for invalid multipart/encrypted parts. Instead, mutt will default to the multipart_handler if it isn't fully "correct". Viewing attachments uses crypt_pgp_decrypt_mime() which bypasses the handler mechanism. Add decoding to the decrypt_mime() functions for pgp and gpgme. Thanks to Vincent Brillault for his analysis and initial patch.
2015-03-30Add a security bit to the message for oppenc mode.Kevin McCarthy
This allows oppenc to be enabled/disabled on a message level. If something initially enables encryption, such as crypt_autoencrypt or crypt_replyencrypt, oppenc is turned off for the message. Change the postpone/resume code to persist the oppenc bit. Also change resend message to enable and invoke oppenc if the option is set.
2015-03-30Add the crypt_opportunistic_encrypt option and calls.Kevin McCarthy
This patch creates the OPTCRYPTOPPORTUNISTICENCRYPT option and documentation. It also adds calls to crypt_opportunistic_encrypt() during initial message composition, after updating to, cc, or bcc, and after editing the message (if edit_headers is enabled).
2015-03-30Implement crypt_opportunistic_encrypt().Kevin McCarthy
This function will be called to flip encryption on and off based on message recipients.
2015-03-30Pull is_numerical_keyid() into crypt.c.Kevin McCarthy
A subsequent patch (re?)-introduces a call to is_numerical_keyid inside find_keys(). Rather than duplicate the function, this patch pulls it into crypt.c, where find_keys() and pgp_findKeys() can both call it.
2015-03-30Introduce an oppenc_mode parameterKevin McCarthy
It's added to the parameter lists through the call stack down to the find_keys calls. No functionality is implemented yet. This patch is separated just to keep other patches more readable.
2015-03-30Refactor the address list generation out of the find_keys routines.Kevin McCarthy
All four find_keys routines have a similar set up code for generating a single address list out of the to, cc, bcc lists. This patch pulls all the code into crypt_get_keys. This is done to simplify the functions before later patches make them more complicated (with the oppenc_mode parameter).
2015-02-11Allow fingerprint user input for key selection. (see #3695)Eike Rathke
Accept and check input of a fingerprint and find the matching key. Note that for both to work, match against and display of fingerprint, the pgp_list_pubring_command and pgp_list_secring_command need to contain the --with-fingerprint option, or have with-fingerprint in ~/.gnupg/gpg.conf.
2012-07-08Fix some spelling errors (closes #3493)Antonio Radici
2009-06-21Pass buffer size to mutt_mktemp()Rocco Rutte
2009-03-15Use safe_fclose() instead of fclose(), add fclose() to check_sec.shRocco Rutte
2009-01-04Update copyrights. Closes #3016.Brendan Cully
I went through the logs of each file with a copyright header and updated the years for the authors in the headers for any non-comment changes they introduced. What a pain!
2008-12-16Remove unused #include directivesErik Hovland
2007-02-24PKA signature verification via GPGME, controlled by $crypt_use_pka.Moritz Schulte
2006-06-08Fix #2272.Thomas Roessler
2005-12-16Use ascii_str* instead of mutt_str* in several places where it's needed.Recai Oktas
2005-10-21Full large file support. Keep a close watch on your mailboxes everyone!Brendan Cully
2005-09-17Gah, forgot the zip code when updating the FSF address...Brendan Cully
2005-09-17Update FSF address (via sed, I hope nothing got mangled). Closes: #2071.Brendan Cully
2005-08-11Add error results to mutt_body_handlers, and check them when doingBrendan Cully
decode-save. Closes: #1919.
2005-06-24Remove a warning about unused variable 'now' in crypt_valid_passphraseSébastien Hinderer
2005-03-05The attached patch fixes a segfault I observed today: mutt failed toChristoph Ludwig
check for a possible null pointer in mutt_is_application_smime(Body*).
2005-02-03Add config.h to the top of every C file that could possibly want it.Brendan Cully
Remove it from mutt.h
2004-06-17This is the sequel to the crypto modularization changes I did onMoritz Schulte
2003-01-21. Moritz added another abstraction layer which cleans up the code and allows the crypto modules to use their own option menu. Everything should work as it used to but is now in a really good shape for part III, the Return of the GnuPG Easy Makers. -wk * crypt-mod-pgp-classic.c, crypt-mod-smime-classic.c, crypt-mod.c, crypt-mod.h: New files. * smime.c (smime_valid_passphrase, smime_send_menu): New functions. * smime.h: Removed macro: smime_valid_passphrase. Declared: smime_valid_passphrase, smime_send_menu. * pgp.c: Include "mutt_menu.h". (pgp_valid_passphrase, pgp_send_menu): New functions. * pgp.h: Removed macro: pgp_valid_passphrase. Declared: pgp_valid_passphrase, pgp_send_menu. * mutt_curses.h: Declare: mutt_need_hard_redraw. * mutt_crypt.h: Declare: crypt_pgp_valid_passphrase, crypt_pgp_send_menu, crypt_smime_valid_passphrase, crypt_smime_send_menu, crypt_init. Adjust WithCrypto definition since the GPGME backend does not exclude anymore the other `classic' backends. (KEYFLAG_ISX509): New symbol. * mutt.h (enum): New symbol: OPTCRYPTUSEGPGME. (struct body): New member: is_signed_data, warnsig. * main.c (main): Call crypt_init. * keymap.c (km_get_table): Support for MENU_KEY_SELECT_PGP and MENU_KEY_SELECT_SMIME. (Menus): Added entries fuer MENU_KEY_SELECT_PGP and MENU_KEY_SELECT_SMIME. (km_init): Create bindings for MENU_KEY_SELECT_PGP and MENU_KEY_SELECT_SMIME. * keymap.h (enum): New enum symbols: MENU_KEY_SELECT_PGP, MENU_KEY_SELECT_SMIME. * init.h: New configuration variable: crypt_use_gpgme. * compose.c (pgp_send_menu, smime_send_menu): Removed functions, they are now contained in the crypto backend modules. (mutt_compose_menu): Use crypt_pgp_send_menu and crypt_smime_send_menu instead pgp_send_menu and smime_send_menu. * cryptglue.c: Slightly rewritten in order to make use of the module mechanism used to access crypto backends. * curs_lib.c (mutt_need_hard_redraw): New function. * crypt.c (crypt_forget_passphrase): Adjust for new crypto backend interface. (crypt_valid_passphrase): Stripped, use calls to crypt_pgp_valid_passphrase and crypt_smime_valid_passphrase.
2004-04-13Rename pgp_mime_ask to pgp_mime_auto; change the default; change theDavid Shaw
error message given if that variable is set to "no."
2004-04-12See: http://does-not-exist.org/mail-archives/mutt-dev/msg00843.htmlDale Woolridge
2004-01-12Retainable PGP signatures were broken badly. #1757.Thomas Roessler
2003-12-30Handle partially signed messages more reasonably. See #1743.Thomas Roessler
2003-12-17pkcs7-signature wasn't recognized properly in one more place.Scott Koranda
2003-09-19As the ones of you who compile with new gcc's probably have noticed,Mads Martin Joergensen
there's a lot of type-punning in Mutt. With help from Philipp Thomas, I've fixed all I could find in CVS (please double-check, one might have slipped through the cracks), I can make one for 1.4 CVS branch as well if wanted.
2003-05-13Fix gpg-agent use.Dale Woolridge
2003-03-07Don't use functions without importing the corresponding prototype.Thomas Roessler
2003-02-25I should test-compile things before committing. Stupid typo.Thomas Roessler
2003-02-25Fix #1486; noted by Jeroen Coekaerts <jeroen@coekaerts.be>.Thomas Roessler
2003-01-30Introduce $pgp_auto_traditional.David Shaw
2003-01-21- To cleanup the pgp/smime code and prepare for other backends.Werner Koch
- Support gpg-agent by not asking for a passphrase - autconf cleanups. This is just a start and probably we need a couple of other things to do. One drawback is that the help menu does always list all crypto realted stuff even when configured for no crypto at all. Same goes for the configure options but I consider thsi a feature: It allows to use the same .muttrc for different versions of mutt - at least during development, this is an advantage. This all might be fixed but requires some changes to the configuration system. Note, the use of the WithCrypto macro - it enables the compiler to do dead-code-elimination depending on the configured backend. This is better readable than all the nested ifdefs. I did some short tests and it seems to work, althoug mutt's size does not change largely when compiled w/o crypto. cryptglue.c is new as a warpper to all crypto calls; some are still in crypt.c but they should eventually also be wrapped. We don't use function pointers to keep a path to use dlopen or runtime configured backends. crypt.h is also new and replaces pgp.h and smime.h in most files (except for the backend). 2003-01-06 Werner Koch <wk@gnupg.org> * crypt.c (crypt_valid_passphrase): Detect gpg-agent and don't ask for the passphrase. * pgp.c (pgp_decrypt_part, pgp_application_pgp_handler) (pgp_sign_message, pgp_encrypt_message) (pgp_traditional_encryptsign): Make sure that we never ever send the passphrase if the gpg-agent has been detected. Likewise. * acconfig.h: Removed all remaining stuff as AC_TEMPLATEs to configure.in. BTW, we should consider to rename configure.in to configure.ac. 2003-01-04 Werner Koch <wk@gnupg.org> Replaced the use of HAVE_PGP and HAVE_SMIME by a more readable and extendable solution. * pgplib.h: Moved enum pgp_ring and KEYFLAGS_* to * crypt.h: here. * smime.c (mutt_is_application_smime): Moved to * crypt.c (mutt_is_application_smime): here. * pgp.c (mutt_is_application_pgp): Moved to * crypt.c (mutt_is_application_pgp): here. * pgp.c (pgp_is_multipart_encrypted): Removed. Merged code with * crypt.c (mutt_is_multipart_encrypted): this. * mutt.h: Protect against double inclusion. * pgplib.h (struct pgp_keyinfo): Remove the typedef to pgp_key_t. * crypt.h (pgp_key_t): Declare the typedef here. NOTE: This is now a pointer. Changed all usages accordingly. * configure.in: Replace HAVE_PGP and HAVE_SMIME by the new CRYPT_BACKEND macros. Always include all OPS.*. (LIBOBJ): Replaced by AC_LIBOBJ as required by newer autoconfs. * Makefile.am (EXTRA_mutt_SOURCES): Move crypt.c to mutt_SOURCES. (mutt_SOURCES): Add cryptglue.c (EXTRA_DIST): Add crypt.h * pgp.h, pgplib.h, smime.h: Use the header only when the approriate backend has been configured. * pgp.c, pgpkey.c, smime.c: Build only if the approriate CRYPT_BACKEND_ macro is defined. * pgp.h, smime.h, global.h: Moved all variable declarations to global.h because they are now always defined. * sort.h: Always define PgpSortKey, although it does not belong to here. * keymap.h: Unconditionally include all PGP and SMIME stuff. * mutt.h: Ditto. * protos.h: Ditto. * init.h (HAVE_SMIME): Unconditionally include all crypto related definitions. Mark the doc entries with "(Crypto/PGP/SMIME only)". * globals.h: Replace gpg.h and smime.h by crypt.h. * functions.h: Always include all crypto commands. * copy.h: Unconditionally define the crypto related M_CM_ * pgplib.h: Move APPLICATION_PGP and PGP* to crypt.h and include it. * smime.h: Move APPLICATION_SMIME and SMIME* to crypt.h and include it. * mutt_crypt.h (ENCRYPT,SIGN,GOODSIGN, BADSIGN): Move to crypt.h. * crypt.c: Replaced pgp.h and smime.h header by crypt.h. Always include all functions but shortcut them depending on WITHCRYPTO. All over the place use WITHCRYPTO instead of ifdefs. Replaced all direct calls of the backend fucntions by twrapper functions defined in cryptglue.c (crypt_get_keys): Removed prototypes. * pgp.h (pgp_findKeys): New prototype. * smime.h (smime_findKeys): New prototype. * cryptglue.c: New. * crypt.h: New. * mutt_crypt.h: Moved all crypt_* prototypes to gcrypt.h. Unconditionally use this file. * init.c: Replaced pgp.h and smime.h header by crypt.h. (parse_set): Use WITHCRYPTO instead of ifdefs. (mutt_var_value_complete): Ditto. * sendlib.c: Replaced pgp.h and smime.h header by crypt.h. (write_as_text_part): Now one macro using WITHCRYPTO. (mutt_write_mime_body): Use WITHCRYPTO instead of ifdefs. (mutt_make_message_attach): Ditto. (mutt_write_fcc): Ditto. * send.c: Replaced pgp.h and smime.h header by crypt.h. (include_forward): Use WITHCRYPTO and validate passphrases for pgp and smime. (include_reply): Ditto. (generate_body): Use WITHCRYPTO instead of ifdefs. (ci_send_message): Ditto. * recvattach.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_gen_attach_list): Use WITHCRYPTO instead of ifdefs. (mutt_attach_display_loop): Ditto (mutt_view_attachments): Ditto. * postpone.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_get_postponed): Use WITHCRYPTO instead of ifdefs. (mutt_parse_crypt_hdr): Always include and use WITHCRYPTO instead of ifdefs. (mutt_prepare_template): Use WITHCRYPTO instead of ifdefs. * pop.c: Removed pgp.h and smime.h. (pop_fetch_message): Use WITHCRYPTO instead of ifdefs. * pattern.c: Replaced pgp.h and smime.h header by crypt.h. (Flags): Always include the crypto flags. (msg_search): Use WITHCRYPTO instead of ifdefs. (mutt_pattern_exec): Ditto. * parse.c: Removed pgp.h and smime.h. (mutt_parse_mime_message): Use WITHCRYPTO instead of ifdefs. * pager.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_pager): Use WITHCRYPTO instead of ifdefs. * mx.c: Removed smime.h and pgp.h. (mx_update_context): Use WITHCRYPTO instead of ifdefs. * muttlib.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_needs_mailcap): Use WITHCRYPTO. Note, that there used to be an error when PGP was not configured so that TYPEAPPLICATION was not recognized for SMIME. (mutt_is_text_part): Use WITHCRYPTO instead of ifdefs. * main.c: Include crypt.h. (show_version): Remove HAVE_PGP and HAVE_SMIME. Add CRYPT_BACKEND_CLASSIC_PGP, CRYPT_BACKEND_CLASSIC_SMIME. * keymap.c: Include crypt.h so that we can test WITHCRYPTO. (Menus): Always include pgp and smime. (km_init): Create smime and pgp bindings depending on WITHCRYPTO. (km_get_table): Return OpPgp depending on WITHCRYPTO. * hook.c (mutt_parse_hook): Use WITHCRYPTO instead of ifdefs. (mutt_crypt_hook): Always include. * headers.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_edit_headers): Use WITHCRYPTO instead of ifdefs * hdrline.c: Replaced pgp.h and smime.h header by crypt.h. (hdr_format_str): Use WITHCRYPTO. * handler.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_can_decode): Use WITHCRYPTO instead of ifdefs. (mutt_can_decode): Application/smime is now also checked when PGP support is not configured. (mutt_body_handler): Use WITHCRYPTO * curs_main.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_index_menu): Shortcut crypto only operations depending on WITHCRYPTO. * copy.c: Replaced pgp.h and smime.h header by crypt.h. (_mutt_copy_message): * compose.c: Replaced pgp.h and smime.h header by crypt.h. (enum): Always include HDR_CRYPT and HDR_CRYPTINFO. (redraw_crypt_lines): Always include this fnc but shortcut it depending on WITHCRYPT. Draw lines depending on the configured crypto support. (pgp_send_menu): Always include this one. Call wrapper functions. (smime_send_menu): Likewise. (draw_envelope): Use WITHCRYPTO instead of ifdefs. (mutt_compose_menu): Allow pgp/smime commands only when configured. * commands.c: Replaced pgp.h and smime.h header by crypt.h. (mutt_display_message,pipe_msg, _mutt_pipe_message) (set_copy_flags, mutt_save_message, mutt_edit_content_type) (_mutt_check_traditional_pgp): Use pgp wrapper. * attach.c (mutt_view_attachment): Removed HAVE_GPG and HAVE_SMIME and replaced by global variable WITHCRYPTO. Replaced pgp and smime header by crypt.h.x
2002-12-18Rename crypt.h to mutt_crypt.h.Thomas Roessler
2002-12-11Call endwin() before calling PGP for traditional encryption.Thomas Roessler
2002-12-11Fix Mike's and my e-mail addresses in copyright lines.Thomas Roessler
2002-12-10Replace safe_free calls by the FREE macro.Thomas Roessler
2002-03-26More inline PGP changes.Thomas Roessler
2002-03-26OK, I'm giving up: pgp_create_traditional now creates text/plain;Thomas Roessler
x-mutt-action={pgp-encrypt,pgp-sign}.
2002-03-25Fix S/MIME signature type. Noted by Dan Ohnesorg <Dan@ohnesorg.cz>.Thomas Roessler
2002-02-04Some S/MIME fixes from Oliver Ehli <elmy@acm.org>.Thomas Roessler
2002-01-28Add a new crypt_timestamp option. The timestamps aren't reallyThomas Roessler
needed any more.