-
-#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
-
-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
-}
-
-
-/* Show a message that a backend will be invoked. */
-void crypt_invoke_message (int type)
-{
- if (type & APPLICATION_PGP) {
- mutt_message _("Invoking PGP...");
- }
- else if (type & APPLICATION_SMIME) {
- mutt_message _("Invoking S/MIME...");
- }
-}
-\f
-
-
-/*
-
- 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;
-}
-
-
-/* Decrypt a PGP/MIME message. */
-int crypt_pgp_decrypt_mime (FILE * a, FILE ** b, BODY * c, BODY ** d)
-{
- if (CRYPT_MOD_CALL_CHECK (PGP, decrypt_mime))
- return (CRYPT_MOD_CALL (PGP, decrypt_mime)) (a, b, c, d);
-
- return -1;
-}
-
-/* MIME handler for the application/pgp content-type. */
-int crypt_pgp_application_pgp_handler (BODY * m, STATE * s)
-{
- if (CRYPT_MOD_CALL_CHECK (PGP, application_handler))
- return (CRYPT_MOD_CALL (PGP, application_handler)) (m, s);
- return (-1);
-}
-
-/* MIME handler for an PGP/MIME encrypted message. */
-int crypt_pgp_encrypted_handler (BODY * a, STATE * s)
-{
- if (CRYPT_MOD_CALL_CHECK (PGP, encrypted_handler))
- return (CRYPT_MOD_CALL (PGP, encrypted_handler)) (a, s);
- return (-1);
-}