2 * Copyright notice from original mutt:
3 * Copyright (C) 2003 Werner Koch <wk@gnupg.org>
4 * Copyright (C) 2004 g10 Code GmbH
6 * This file is part of mutt-ng, see http://www.muttng.org/.
7 * It's licensed under the GNU General Public License,
8 * please see the file GPL in the top level source directory.
12 This file dispatches the generic crypto functions to the
13 implemented backend or provides dummy stubs. Note, that some
14 generic functions are handled in crypt.c.
17 /* Note: This file has been changed to make use of the new module
18 system. Consequently there's a 1:1 mapping between the functions
19 contained in this file and the functions implemented by the crypto
22 #include <lib-lib/lib-lib.h>
26 #include "crypt-gpgme.h"
28 #define CRYPT_MOD_CALL_CHECK(identifier, func) \
29 ((crypt_mod_##identifier##_gpgme).func)
31 #define CRYPT_MOD_CALL(identifier, func) \
32 (*((crypt_mod_##identifier##_gpgme).func))
35 struct crypt_module_specs crypt_mod_SMIME_gpgme = {
36 NULL, /* encrypted_handler */
38 NULL, /* pgp_make_key_attachment */
39 NULL, /* pgp_invoke_getkeys */
41 NULL, /* smime_getkeys */
42 smime_gpgme_build_smime_entity,
45 struct crypt_module_specs crypt_mod_PGP_gpgme = {
46 pgp_gpgme_encrypted_handler,
49 NULL, /* pgp_make_key_attachment, */
50 NULL, /* pgp_invoke_getkeys */
52 NULL, /* smime_getkeys */
53 NULL, /* smime_build_smime_entity */
59 /* MIME handler for an PGP/MIME encrypted message. */
60 int crypt_pgp_encrypted_handler (BODY * a, STATE * s)
62 if (CRYPT_MOD_CALL_CHECK (PGP, encrypted_handler))
63 return (CRYPT_MOD_CALL (PGP, encrypted_handler)) (a, s);
67 /* fixme: needs documentation. */
68 void crypt_pgp_invoke_getkeys (address_t * addr)
70 if (CRYPT_MOD_CALL_CHECK (PGP, pgp_invoke_getkeys))
71 (CRYPT_MOD_CALL (PGP, pgp_invoke_getkeys)) (addr);
74 /* Generate a PGP public key attachment. */
75 BODY *crypt_pgp_make_key_attachment (char *tempf)
77 if (CRYPT_MOD_CALL_CHECK (PGP, pgp_make_key_attachment))
78 return (CRYPT_MOD_CALL (PGP, pgp_make_key_attachment)) (tempf);
85 /* fixme: Needs documentation. */
86 void crypt_smime_getkeys (ENVELOPE * env)
88 if (CRYPT_MOD_CALL_CHECK (SMIME, smime_getkeys))
89 (CRYPT_MOD_CALL (SMIME, smime_getkeys)) (env);
92 /* fixme: needs documentation. */
93 BODY *crypt_smime_build_smime_entity (BODY * a, char *certlist)
95 if (CRYPT_MOD_CALL_CHECK (SMIME, smime_build_smime_entity))
96 return (CRYPT_MOD_CALL (SMIME, smime_build_smime_entity)) (a, certlist);