X-Git-Url: http://git.madism.org/?a=blobdiff_plain;f=lib-crypt%2Fcryptglue.c;h=904e4bb1efa55d3e5fc25f5087ac56e7ffd60fe3;hb=1e73e3243b4a748ee98b58f6f2512a14785bb36d;hp=151cbad867c3365b7cf78c39e23096ad7ee83649;hpb=4761fa78a6dfc9437caa6e6e0aac806e50e01c83;p=apps%2Fmadmutt.git diff --git a/lib-crypt/cryptglue.c b/lib-crypt/cryptglue.c index 151cbad..904e4bb 100644 --- a/lib-crypt/cryptglue.c +++ b/lib-crypt/cryptglue.c @@ -19,72 +19,68 @@ contained in this file and the functions implemented by the crypto modules. */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include +#include #include "mutt.h" #include "crypt.h" - - -#include "crypt-mod.h" - -/* - Generic -*/ - -extern struct crypt_module_specs crypt_mod_pgp_classic; -extern struct crypt_module_specs crypt_mod_smime_classic; - -#ifdef CRYPT_BACKEND_GPGME -extern struct crypt_module_specs crypt_mod_pgp_gpgme; -extern struct crypt_module_specs crypt_mod_smime_gpgme; -#endif +#include "crypt-gpgme.h" + +struct crypt_module_specs crypt_mod_SMIME_gpgme = { + smime_gpgme_init, + smime_gpgme_decrypt_mime, + smime_gpgme_application_handler, + NULL, /* encrypted_handler */ + smime_gpgme_findkeys, + smime_gpgme_sign_message, + smime_gpgme_verify_one, + smime_gpgme_send_menu, + + NULL, /* pgp_encrypt_message */ + NULL, /* pgp_make_key_attachment */ + NULL, /* pgp_check_traditional */ + NULL, /* pgp_traditional_encryptsign */ + NULL, /* pgp_invoke_getkeys */ + NULL, /* pgp_invoke_import */ + NULL, /* pgp_extract_keys_from_attachment_list */ + + NULL, /* smime_getkeys */ + smime_gpgme_verify_sender, + smime_gpgme_build_smime_entity, + NULL, /* smime_invoke_import */ +}; + +struct crypt_module_specs crypt_mod_PGP_gpgme = { + pgp_gpgme_init, + pgp_gpgme_decrypt_mime, + pgp_gpgme_application_handler, + pgp_gpgme_encrypted_handler, + pgp_gpgme_findkeys, + pgp_gpgme_sign_message, + pgp_gpgme_verify_one, + pgp_gpgme_send_menu, + + /* PGP specific. */ + pgp_gpgme_encrypt_message, + NULL, /* pgp_make_key_attachment, */ + pgp_gpgme_check_traditional, + NULL, /* pgp_traditional_encryptsign */ + NULL, /* pgp_invoke_getkeys */ + pgp_gpgme_invoke_import, /* pgp_invoke_import */ + pgp_gpgme_from_attachment_list, + /* pgp_extract_keys_from_attachment_list */ + + NULL, /* smime_getkeys */ + NULL, /* smime_verify_sender */ + NULL, /* smime_build_smime_entity */ + NULL, /* smime_invoke_import */ +}; void crypt_init (void) { - if ( -#ifdef CRYPT_BACKEND_GPGME - (!option (OPTCRYPTUSEGPGME)) -#else - 1 -#endif - ) - crypto_module_register (&crypt_mod_pgp_classic); - - if ( -#ifdef CRYPT_BACKEND_GPGME - (!option (OPTCRYPTUSEGPGME)) -#else - 1 -#endif - ) - crypto_module_register (&crypt_mod_smime_classic); - - if (option (OPTCRYPTUSEGPGME)) { -#ifdef CRYPT_BACKEND_GPGME - crypto_module_register (&crypt_mod_pgp_gpgme); - crypto_module_register (&crypt_mod_smime_gpgme); -#else - mutt_message (_("\"crypt_use_gpgme\" set" - " but not build with GPGME support.")); - if (mutt_any_key_to_continue (NULL) == -1) - mutt_exit (1); -#endif - } - -#if defined CRYPT_BACKEND_CLASSIG_PGP || defined CRYPT_BACKEND_CLASSIG_SMIME || defined CRYPT_BACKEND_GPGME - if (CRYPT_MOD_CALL_CHECK (PGP, init)) - (CRYPT_MOD_CALL (PGP, init)) (); - - if (CRYPT_MOD_CALL_CHECK (SMIME, init)) - (CRYPT_MOD_CALL (SMIME, init)) (); -#endif + (CRYPT_MOD_CALL(PGP, init))(); + (CRYPT_MOD_CALL(SMIME, init))(); } - /* Show a message that a backend will be invoked. */ void crypt_invoke_message (int type) { @@ -95,31 +91,9 @@ void crypt_invoke_message (int type) mutt_message _("Invoking S/MIME..."); } } - - - -/* - - PGP - -*/ - - -/* Reset a PGP passphrase */ -void crypt_pgp_void_passphrase (void) -{ - if (CRYPT_MOD_CALL_CHECK (PGP, void_passphrase)) - (CRYPT_MOD_CALL (PGP, void_passphrase)) (); -} - -int crypt_pgp_valid_passphrase (void) -{ - if (CRYPT_MOD_CALL_CHECK (PGP, valid_passphrase)) - return (CRYPT_MOD_CALL (PGP, valid_passphrase)) (); - return 0; -} +/* PGP */ /* Decrypt a PGP/MIME message. */ int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d) @@ -254,21 +228,6 @@ void crypt_pgp_extract_keys_from_attachment_list (FILE * fp, int tag, */ -/* Reset an SMIME passphrase */ -void crypt_smime_void_passphrase (void) -{ - if (CRYPT_MOD_CALL_CHECK (SMIME, void_passphrase)) - (CRYPT_MOD_CALL (SMIME, void_passphrase)) (); -} - -int crypt_smime_valid_passphrase (void) -{ - if (CRYPT_MOD_CALL_CHECK (SMIME, valid_passphrase)) - return (CRYPT_MOD_CALL (SMIME, valid_passphrase)) (); - - return 0; -} - /* Decrypt am S/MIME message. */ int crypt_smime_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d) { @@ -286,14 +245,6 @@ int crypt_smime_application_smime_handler (BODY * m, STATE * s) return (-1); } -/* MIME handler for an PGP/MIME encrypted message. */ -int crypt_smime_encrypted_handler (BODY * a, STATE * s) -{ - if (CRYPT_MOD_CALL_CHECK (SMIME, encrypted_handler)) - return (CRYPT_MOD_CALL (SMIME, encrypted_handler)) (a, s); - return (-1); -} - /* fixme: Needs documentation. */ void crypt_smime_getkeys (ENVELOPE * env) {