summaryrefslogtreecommitdiffstats
path: root/cryptglue.c
AgeCommit message (Collapse)Author
2020-03-31Create crypt glue cleanup method.Kevin McCarthy
Create stub classic smime and cleanup functions, which will be used in the next commit.
2020-02-29Change send_menus to set sctx instead of globals.Kevin McCarthy
Add a "cleared" bit for smime_crypt_alg. Otherwise clearing the value in smime.c's menu would cause the compose menu and mutt_protect() to fall back to using SmimeCryptAlg.
2019-10-20Remove make_key_attachment parameter.Kevin McCarthy
The parameter is not actually used anywhere. The next commit will convert the classic pgp implementation to use the buffer pool. This change will simplify the logic.
2019-09-25Convert crypt_extract_keys and signed handler to use buffers.Kevin McCarthy
2019-08-04Don't try to decrypt autocrypt messages if the option is off.Kevin McCarthy
2019-08-03Handle autocrypt message decryption.Kevin McCarthy
Try autocrypt first for crypt_pgp_decrypt_mime() and pgp_gpgme_encrypted_handler(). Propagate the autocrypt bit if successful. This is used when replying to an autocrypt message, to force a reply using autocrypt.
2019-08-03Autocrypt outgoing emails.Kevin McCarthy
Change crypt_get_keys() to query autocrypt. When oppenc_mode is set, we still query the original keyring regardless, because the compose menu can still run oppenc even if autocrypt is on. Since mutt_autocrypt_ui_recommendation() checks each key as part of making the recommendation, add a keylist parameter and use that function. Add gpgme changes to use the autocrypt context for encryption. Postpone work: * Change mutt_protect() to have a postpone parameter. Remove the manual toggling of the SIGN bit outside the call when postponing. * Since autocrypt doesn't set the SIGN bit, this allows us to turn off signing inside mutt_protect() for both normal and autocrypt mode. * Set the autocrypt postpone key in AutocryptDefaultKey. Write autocrypt and gossip headers in outgoing emails.
2019-01-04Clean up code indentation.Kevin McCarthy
These are mostly automated changes corresponding to the emacs settings: (c-set-style "linux") (setq c-basic-offset 2) (c-set-offset 'case-label '+) Most of the code follows the convention: (add-to-list 'c-cleanup-list 'space-before-funcall) but this is not enforced by this indentation cleanup. Also, I personally dislike tabs, so I have: (setq-default indent-tabs-mode nil) in my own configuration. However I have no desire to change every line just for that effect. So this cleanup does nothing about the mix issue. Some of the secondary files (e.g. regex.c) have been skipped. I've also skipped crypt-gpgme.c, because I need to think about that file. Werner Koch and the GnuPG team contributed most it, and it follows the Gnu indentation settings. It should probably be made uniform with Mutt, but I don't want to discourage future GnuPG contribution to the file. I manually reverted a few unsightly cleanups, and added a few tweeks when I saw things that could be improved.
2018-12-04Nuke trailing white space from the crypt-* files.Werner Koch
2017-12-30Disable message security if the backend is not available.Kevin McCarthy
Gitlab issue #3 exposed an awkward corner case: if mutt is configured without PGP or S/MIME, and with GPGME, but $crypt_use_gpgme is unset. In this case, no backend will be available, but WithCrypto will be set with both APPLICATION_PGP and APPLICATION_SMIME bits. That will allow various config vars to enable encryption or signing, even though there will be no backend available to perform them. The message security flag might then be set, but when the user hits send, will end up back at the compose menu due to the error. The pgp or smime menu might not even be available to clear the security setting! Add a check in send.c before the compose menu is invoked, and give a warning message for the menu ops inside the compose menu. I believe this should prevent the issue. However this is a corner case combined with user misconfiguration, so I don't believe is worth a large effort to completely eradicate.
2017-08-10Fix attachment check_traditional and extract_keys operations. (see #3728)Kevin McCarthy
Add helpers and iterate over the actx->idx instead of the BODY structure.
2017-03-26Remove redraw parameter from crypt send_menus.Kevin McCarthy
The parameter was used to notify the caller if the sign (a)s menu was invoked, which displayed the key selection menu. This is no longer necessary with the menu stack pop operation.
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-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).
2007-04-04Fix typos in CRYPT_BACKEND #ifs.Christoph Berg
2007-02-24PKA signature verification via GPGME, controlled by $crypt_use_pka.Moritz Schulte
2006-06-13typoRené Clerc
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-14Fix some S/MIME spelling inconsistencies.Bernd Ahlers
2005-08-11Add error results to mutt_body_handlers, and check them when doingBrendan Cully
decode-save. Closes: #1919.
2005-02-03Add config.h to the top of every C file that could possibly want it.Brendan Cully
Remove it from mutt.h
2005-01-28gpgme integration. See documentation for $crypt_use_gpgme,Werner Koch
and http://www.gnupg.org/aegypten2/.
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.
2003-01-21Fix a typo which broke pgp-extract-traditional.Thomas Roessler
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