NeoMutt  2021-02-05-666-ge300cd
Teaching an old dog new tricks
DOXYGEN
cryptglue.c File Reference

Wrapper around crypto functions. More...

#include "config.h"
#include <stdbool.h>
#include <stdio.h>
#include "mutt/lib.h"
#include "core/lib.h"
#include "cryptglue.h"
#include "lib.h"
#include "crypt_mod.h"
#include "config/lib.h"
#include "email/lib.h"
#include "autocrypt/lib.h"
#include "crypt_gpgme.h"
#include "options.h"
+ Include dependency graph for cryptglue.c:

Go to the source code of this file.

Macros

#define CRYPT_MOD_CALL_CHECK(identifier, func)
 
#define CRYPT_MOD_CALL(identifier, func)   (*(crypto_module_lookup(APPLICATION_##identifier))->func)
 

Functions

void crypt_init (void)
 Initialise the crypto backends. More...
 
void crypt_cleanup (void)
 Clean up backend. More...
 
void crypt_invoke_message (SecurityFlags type)
 Display an informative message. More...
 
bool crypt_has_module_backend (SecurityFlags type)
 Is there a crypto backend for a given type? More...
 
void crypt_pgp_void_passphrase (void)
 Wrapper for CryptModuleSpecs::void_passphrase() More...
 
bool crypt_pgp_valid_passphrase (void)
 Wrapper for CryptModuleSpecs::valid_passphrase() More...
 
int crypt_pgp_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
 Wrapper for CryptModuleSpecs::decrypt_mime() More...
 
int crypt_pgp_application_handler (struct Body *b, struct State *s)
 Wrapper for CryptModuleSpecs::application_handler() More...
 
int crypt_pgp_encrypted_handler (struct Body *b, struct State *s)
 Wrapper for CryptModuleSpecs::encrypted_handler() More...
 
void crypt_pgp_invoke_getkeys (struct Address *addr)
 Wrapper for CryptModuleSpecs::pgp_invoke_getkeys() More...
 
bool crypt_pgp_check_traditional (FILE *fp, struct Body *b, bool just_one)
 Wrapper for CryptModuleSpecs::pgp_check_traditional() More...
 
struct Bodycrypt_pgp_traditional_encryptsign (struct Body *a, SecurityFlags flags, char *keylist)
 Wrapper for CryptModuleSpecs::pgp_traditional_encryptsign() More...
 
struct Bodycrypt_pgp_make_key_attachment (void)
 Wrapper for CryptModuleSpecs::pgp_make_key_attachment() More...
 
char * crypt_pgp_find_keys (struct AddressList *addrlist, bool oppenc_mode)
 Wrapper for CryptModuleSpecs::find_keys() More...
 
struct Bodycrypt_pgp_sign_message (struct Body *a, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::sign_message() More...
 
struct Bodycrypt_pgp_encrypt_message (struct Mailbox *m, struct Email *e, struct Body *a, char *keylist, int sign, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::pgp_encrypt_message() More...
 
void crypt_pgp_invoke_import (const char *fname)
 Wrapper for CryptModuleSpecs::pgp_invoke_import() More...
 
int crypt_pgp_verify_one (struct Body *sigbdy, struct State *s, const char *tempf)
 Wrapper for CryptModuleSpecs::verify_one() More...
 
SecurityFlags crypt_pgp_send_menu (struct Mailbox *m, struct Email *e)
 Wrapper for CryptModuleSpecs::send_menu() More...
 
void crypt_pgp_extract_key_from_attachment (FILE *fp, struct Body *top)
 Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment() More...
 
void crypt_pgp_set_sender (const char *sender)
 Wrapper for CryptModuleSpecs::set_sender() More...
 
void crypt_smime_void_passphrase (void)
 Wrapper for CryptModuleSpecs::void_passphrase() More...
 
bool crypt_smime_valid_passphrase (void)
 Wrapper for CryptModuleSpecs::valid_passphrase() More...
 
int crypt_smime_decrypt_mime (FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
 Wrapper for CryptModuleSpecs::decrypt_mime() More...
 
int crypt_smime_application_handler (struct Body *b, struct State *s)
 Wrapper for CryptModuleSpecs::application_handler() More...
 
void crypt_smime_getkeys (struct Envelope *env)
 Wrapper for CryptModuleSpecs::smime_getkeys() More...
 
int crypt_smime_verify_sender (struct Mailbox *m, struct Email *e, struct Message *msg)
 Wrapper for CryptModuleSpecs::smime_verify_sender() More...
 
char * crypt_smime_find_keys (struct AddressList *addrlist, bool oppenc_mode)
 Wrapper for CryptModuleSpecs::find_keys() More...
 
struct Bodycrypt_smime_sign_message (struct Body *a, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::sign_message() More...
 
struct Bodycrypt_smime_build_smime_entity (struct Body *a, char *certlist)
 Wrapper for CryptModuleSpecs::smime_build_smime_entity() More...
 
void crypt_smime_invoke_import (const char *infile, const char *mailbox)
 Wrapper for CryptModuleSpecs::smime_invoke_import() More...
 
int crypt_smime_verify_one (struct Body *sigbdy, struct State *s, const char *tempf)
 Wrapper for CryptModuleSpecs::verify_one() More...
 
SecurityFlags crypt_smime_send_menu (struct Mailbox *m, struct Email *e)
 Wrapper for CryptModuleSpecs::send_menu() More...
 
void crypt_smime_set_sender (const char *sender)
 Wrapper for CryptModuleSpecs::set_sender() More...
 

Variables

struct CryptModuleSpecs CryptModPgpClassic
 CLI PGP - Implements CryptModuleSpecs. More...
 
struct CryptModuleSpecs CryptModSmimeClassic
 CLI SMIME - Implements CryptModuleSpecs. More...
 
struct CryptModuleSpecs CryptModPgpGpgme
 GPGME PGP - Implements CryptModuleSpecs. More...
 
struct CryptModuleSpecs CryptModSmimeGpgme
 GPGME SMIME - Implements CryptModuleSpecs. More...
 

Detailed Description

Wrapper around crypto functions.

Authors
  • Werner Koch
  • g10 Code GmbH
  • Pietro Cerutti

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file cryptglue.c.

Macro Definition Documentation

◆ CRYPT_MOD_CALL_CHECK

#define CRYPT_MOD_CALL_CHECK (   identifier,
  func 
)
Value:
(crypto_module_lookup(APPLICATION_##identifier) && \
(crypto_module_lookup(APPLICATION_##identifier))->func)
struct CryptModuleSpecs * crypto_module_lookup(int identifier)
Lookup a crypto module by name.
Definition: crypt_mod.c:65

Definition at line 80 of file cryptglue.c.

◆ CRYPT_MOD_CALL

#define CRYPT_MOD_CALL (   identifier,
  func 
)    (*(crypto_module_lookup(APPLICATION_##identifier))->func)

Definition at line 86 of file cryptglue.c.

Function Documentation

◆ crypt_init()

void crypt_init ( void  )

Initialise the crypto backends.

This calls CryptModuleSpecs::init()

Definition at line 94 of file cryptglue.c.

95 {
96 #ifdef CRYPT_BACKEND_GPGME
97  const bool c_crypt_use_gpgme =
98  cs_subset_bool(NeoMutt->sub, "crypt_use_gpgme");
99 #endif
100 #ifdef CRYPT_BACKEND_CLASSIC_PGP
101  if (
102 #ifdef CRYPT_BACKEND_GPGME
103  (!c_crypt_use_gpgme)
104 #else
105  1
106 #endif
107  )
109 #endif
110 
111 #ifdef CRYPT_BACKEND_CLASSIC_SMIME
112  if (
113 #ifdef CRYPT_BACKEND_GPGME
114  (!c_crypt_use_gpgme)
115 #else
116  1
117 #endif
118  )
120 #endif
121 
122 #ifdef CRYPT_BACKEND_GPGME
123  if (c_crypt_use_gpgme)
124  {
127  }
128 #endif
129 
130 #if defined(CRYPT_BACKEND_CLASSIC_PGP) || \
131  defined(CRYPT_BACKEND_CLASSIC_SMIME) || defined(CRYPT_BACKEND_GPGME)
132  if (CRYPT_MOD_CALL_CHECK(PGP, init))
133  CRYPT_MOD_CALL(PGP, init)();
134 
135  if (CRYPT_MOD_CALL_CHECK(SMIME, init))
136  CRYPT_MOD_CALL(SMIME, init)();
137 #endif
138 }
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
void crypto_module_register(struct CryptModuleSpecs *specs)
Register a new crypto module.
Definition: crypt_mod.c:51
Container for Accounts, Notifications.
Definition: neomutt.h:36
struct CryptModuleSpecs CryptModSmimeClassic
CLI SMIME - Implements CryptModuleSpecs.
struct CryptModuleSpecs CryptModPgpClassic
CLI PGP - Implements CryptModuleSpecs.
struct CryptModuleSpecs CryptModPgpGpgme
GPGME PGP - Implements CryptModuleSpecs.
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
struct CryptModuleSpecs CryptModSmimeGpgme
GPGME SMIME - Implements CryptModuleSpecs.
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_cleanup()

void crypt_cleanup ( void  )

Clean up backend.

Definition at line 143 of file cryptglue.c.

144 {
145  if (CRYPT_MOD_CALL_CHECK(PGP, cleanup))
146  (CRYPT_MOD_CALL(PGP, cleanup))();
147 
148  if (CRYPT_MOD_CALL_CHECK(SMIME, cleanup))
149  (CRYPT_MOD_CALL(SMIME, cleanup))();
150 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_invoke_message()

void crypt_invoke_message ( SecurityFlags  type)

Display an informative message.

Parameters
typeCrypto type, see SecurityFlags

Show a message that a backend will be invoked.

Definition at line 158 of file cryptglue.c.

159 {
160  if (((WithCrypto & APPLICATION_PGP) != 0) && (type & APPLICATION_PGP))
161  mutt_message(_("Invoking PGP..."));
162  else if (((WithCrypto & APPLICATION_SMIME) != 0) && (type & APPLICATION_SMIME))
163  mutt_message(_("Invoking S/MIME..."));
164 }
#define WithCrypto
Definition: lib.h:113
#define _(a)
Definition: message.h:28
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:88
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:87
#define mutt_message(...)
Definition: logging.h:87
+ Here is the caller graph for this function:

◆ crypt_has_module_backend()

bool crypt_has_module_backend ( SecurityFlags  type)

Is there a crypto backend for a given type?

Parameters
typeCrypto type, see SecurityFlags
Return values
trueBackend is present
falseBackend is not present

Definition at line 172 of file cryptglue.c.

173 {
174  if (((WithCrypto & APPLICATION_PGP) != 0) && (type & APPLICATION_PGP) &&
175  crypto_module_lookup(APPLICATION_PGP))
176  {
177  return true;
178  }
179 
180  if (((WithCrypto & APPLICATION_SMIME) != 0) && (type & APPLICATION_SMIME) &&
181  crypto_module_lookup(APPLICATION_SMIME))
182  {
183  return true;
184  }
185 
186  return false;
187 }
#define WithCrypto
Definition: lib.h:113
#define APPLICATION_SMIME
Use SMIME to encrypt/sign.
Definition: lib.h:88
#define APPLICATION_PGP
Use PGP to encrypt/sign.
Definition: lib.h:87
struct CryptModuleSpecs * crypto_module_lookup(int identifier)
Lookup a crypto module by name.
Definition: crypt_mod.c:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_void_passphrase()

void crypt_pgp_void_passphrase ( void  )

Wrapper for CryptModuleSpecs::void_passphrase()

Definition at line 192 of file cryptglue.c.

193 {
194  if (CRYPT_MOD_CALL_CHECK(PGP, void_passphrase))
195  CRYPT_MOD_CALL(PGP, void_passphrase)();
196 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_valid_passphrase()

bool crypt_pgp_valid_passphrase ( void  )

Wrapper for CryptModuleSpecs::valid_passphrase()

Definition at line 201 of file cryptglue.c.

202 {
203  if (CRYPT_MOD_CALL_CHECK(PGP, valid_passphrase))
204  return CRYPT_MOD_CALL(PGP, valid_passphrase)();
205 
206  return false;
207 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_decrypt_mime()

int crypt_pgp_decrypt_mime ( FILE *  fp_in,
FILE **  fp_out,
struct Body b,
struct Body **  cur 
)

Wrapper for CryptModuleSpecs::decrypt_mime()

Definition at line 212 of file cryptglue.c.

213 {
214 #ifdef USE_AUTOCRYPT
215  const bool c_autocrypt = cs_subset_bool(NeoMutt->sub, "autocrypt");
216  if (c_autocrypt)
217  {
218  OptAutocryptGpgme = true;
219  int result = pgp_gpgme_decrypt_mime(fp_in, fp_out, b, cur);
220  OptAutocryptGpgme = false;
221  if (result == 0)
222  {
223  b->is_autocrypt = true;
224  return result;
225  }
226  }
227 #endif
228 
229  if (CRYPT_MOD_CALL_CHECK(PGP, decrypt_mime))
230  return CRYPT_MOD_CALL(PGP, decrypt_mime)(fp_in, fp_out, b, cur);
231 
232  return -1;
233 }
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
int pgp_gpgme_decrypt_mime(FILE *fp_in, FILE **fp_out, struct Body *b, struct Body **cur)
Implements CryptModuleSpecs::decrypt_mime() -.
Definition: crypt_gpgme.c:2208
bool is_autocrypt
Flag autocrypt-decrypted messages for replying.
Definition: body.h:80
WHERE bool OptAutocryptGpgme
(pseudo) use Autocrypt context inside ncrypt/crypt_gpgme.c
Definition: options.h:33
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
Container for Accounts, Notifications.
Definition: neomutt.h:36
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_application_handler()

int crypt_pgp_application_handler ( struct Body b,
struct State s 
)

Wrapper for CryptModuleSpecs::application_handler()

Implements handler_t

Definition at line 240 of file cryptglue.c.

241 {
242  if (CRYPT_MOD_CALL_CHECK(PGP, application_handler))
243  return CRYPT_MOD_CALL(PGP, application_handler)(b, s);
244 
245  return -1;
246 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_encrypted_handler()

int crypt_pgp_encrypted_handler ( struct Body b,
struct State s 
)

Wrapper for CryptModuleSpecs::encrypted_handler()

Implements handler_t

Definition at line 253 of file cryptglue.c.

254 {
255 #ifdef USE_AUTOCRYPT
256  const bool c_autocrypt = cs_subset_bool(NeoMutt->sub, "autocrypt");
257  if (c_autocrypt)
258  {
259  OptAutocryptGpgme = true;
260  int result = pgp_gpgme_encrypted_handler(b, s);
261  OptAutocryptGpgme = false;
262  if (result == 0)
263  {
264  b->is_autocrypt = true;
265  return result;
266  }
267  }
268 #endif
269 
270  if (CRYPT_MOD_CALL_CHECK(PGP, encrypted_handler))
271  return CRYPT_MOD_CALL(PGP, encrypted_handler)(b, s);
272 
273  return -1;
274 }
bool cs_subset_bool(const struct ConfigSubset *sub, const char *name)
Get a boolean config item by name.
Definition: helpers.c:73
int pgp_gpgme_encrypted_handler(struct Body *a, struct State *s)
Implements CryptModuleSpecs::encrypted_handler() -This handler is passed the application/octet-stream...
Definition: crypt_gpgme.c:3061
bool is_autocrypt
Flag autocrypt-decrypted messages for replying.
Definition: body.h:80
WHERE bool OptAutocryptGpgme
(pseudo) use Autocrypt context inside ncrypt/crypt_gpgme.c
Definition: options.h:33
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
Container for Accounts, Notifications.
Definition: neomutt.h:36
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
struct ConfigSubset * sub
Inherited config items.
Definition: neomutt.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_invoke_getkeys()

void crypt_pgp_invoke_getkeys ( struct Address addr)

Wrapper for CryptModuleSpecs::pgp_invoke_getkeys()

Definition at line 279 of file cryptglue.c.

280 {
281  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_invoke_getkeys))
282  CRYPT_MOD_CALL(PGP, pgp_invoke_getkeys)(addr);
283 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_check_traditional()

bool crypt_pgp_check_traditional ( FILE *  fp,
struct Body b,
bool  just_one 
)

Wrapper for CryptModuleSpecs::pgp_check_traditional()

Definition at line 288 of file cryptglue.c.

289 {
290  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_check_traditional))
291  return CRYPT_MOD_CALL(PGP, pgp_check_traditional)(fp, b, just_one);
292 
293  return false;
294 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_traditional_encryptsign()

struct Body* crypt_pgp_traditional_encryptsign ( struct Body a,
SecurityFlags  flags,
char *  keylist 
)

Wrapper for CryptModuleSpecs::pgp_traditional_encryptsign()

Definition at line 299 of file cryptglue.c.

300 {
301  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_traditional_encryptsign))
302  return CRYPT_MOD_CALL(PGP, pgp_traditional_encryptsign)(a, flags, keylist);
303 
304  return NULL;
305 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_make_key_attachment()

struct Body* crypt_pgp_make_key_attachment ( void  )

Wrapper for CryptModuleSpecs::pgp_make_key_attachment()

Definition at line 310 of file cryptglue.c.

311 {
312  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_make_key_attachment))
313  return CRYPT_MOD_CALL(PGP, pgp_make_key_attachment)();
314 
315  return NULL;
316 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_find_keys()

char* crypt_pgp_find_keys ( struct AddressList *  addrlist,
bool  oppenc_mode 
)

Wrapper for CryptModuleSpecs::find_keys()

Definition at line 321 of file cryptglue.c.

322 {
324  return CRYPT_MOD_CALL(PGP, find_keys)(addrlist, oppenc_mode);
325 
326  return NULL;
327 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
static char * find_keys(struct AddressList *addrlist, unsigned int app, bool oppenc_mode)
Find keys of the recipients of the message.
Definition: crypt_gpgme.c:3826
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_sign_message()

struct Body* crypt_pgp_sign_message ( struct Body a,
const struct AddressList *  from 
)

Wrapper for CryptModuleSpecs::sign_message()

Definition at line 332 of file cryptglue.c.

333 {
335  return CRYPT_MOD_CALL(PGP, sign_message)(a, from);
336 
337  return NULL;
338 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
static struct Body * sign_message(struct Body *a, const struct AddressList *from, bool use_smime)
Sign a message.
Definition: crypt_gpgme.c:1257
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_encrypt_message()

struct Body* crypt_pgp_encrypt_message ( struct Mailbox m,
struct Email e,
struct Body a,
char *  keylist,
int  sign,
const struct AddressList *  from 
)

Wrapper for CryptModuleSpecs::pgp_encrypt_message()

Definition at line 343 of file cryptglue.c.

346 {
347 #ifdef USE_AUTOCRYPT
348  if (e->security & SEC_AUTOCRYPT)
349  {
351  return NULL;
352 
353  OptAutocryptGpgme = true;
354  struct Body *result = pgp_gpgme_encrypt_message(a, keylist, sign, from);
355  OptAutocryptGpgme = false;
356 
357  return result;
358  }
359 #endif
360 
361  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_encrypt_message))
362  return CRYPT_MOD_CALL(PGP, pgp_encrypt_message)(a, keylist, sign, from);
363 
364  return NULL;
365 }
WHERE bool OptAutocryptGpgme
(pseudo) use Autocrypt context inside ncrypt/crypt_gpgme.c
Definition: options.h:33
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition: lib.h:84
The body of an email.
Definition: body.h:34
int mutt_autocrypt_set_sign_as_default_key(struct Mailbox *m, struct Email *e)
Set the Autocrypt default key for signing.
Definition: autocrypt.c:712
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
struct Body * pgp_gpgme_encrypt_message(struct Body *a, char *keylist, bool sign, const struct AddressList *from)
Implements CryptModuleSpecs::pgp_encrypt_message() -.
Definition: crypt_gpgme.c:1395
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib...
Definition: email.h:39
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_invoke_import()

void crypt_pgp_invoke_import ( const char *  fname)

Wrapper for CryptModuleSpecs::pgp_invoke_import()

Definition at line 370 of file cryptglue.c.

371 {
372  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_invoke_import))
373  CRYPT_MOD_CALL(PGP, pgp_invoke_import)(fname);
374 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_verify_one()

int crypt_pgp_verify_one ( struct Body sigbdy,
struct State s,
const char *  tempf 
)

Wrapper for CryptModuleSpecs::verify_one()

Definition at line 379 of file cryptglue.c.

380 {
382  return CRYPT_MOD_CALL(PGP, verify_one)(sigbdy, s, tempf);
383 
384  return -1;
385 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile, bool is_smime)
Do the actual verification step.
Definition: crypt_gpgme.c:1902
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_send_menu()

SecurityFlags crypt_pgp_send_menu ( struct Mailbox m,
struct Email e 
)

Wrapper for CryptModuleSpecs::send_menu()

Definition at line 390 of file cryptglue.c.

391 {
392  if (CRYPT_MOD_CALL_CHECK(PGP, send_menu))
393  return CRYPT_MOD_CALL(PGP, send_menu)(m, e);
394 
395  return 0;
396 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_extract_key_from_attachment()

void crypt_pgp_extract_key_from_attachment ( FILE *  fp,
struct Body top 
)

Wrapper for CryptModuleSpecs::pgp_extract_key_from_attachment()

Definition at line 401 of file cryptglue.c.

402 {
403  if (CRYPT_MOD_CALL_CHECK(PGP, pgp_extract_key_from_attachment))
404  CRYPT_MOD_CALL(PGP, pgp_extract_key_from_attachment)(fp, top);
405 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_pgp_set_sender()

void crypt_pgp_set_sender ( const char *  sender)

Wrapper for CryptModuleSpecs::set_sender()

Definition at line 410 of file cryptglue.c.

411 {
412  if (CRYPT_MOD_CALL_CHECK(PGP, set_sender))
413  CRYPT_MOD_CALL(PGP, set_sender)(sender);
414 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_void_passphrase()

void crypt_smime_void_passphrase ( void  )

Wrapper for CryptModuleSpecs::void_passphrase()

Definition at line 419 of file cryptglue.c.

420 {
421  if (CRYPT_MOD_CALL_CHECK(SMIME, void_passphrase))
422  CRYPT_MOD_CALL(SMIME, void_passphrase)();
423 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_valid_passphrase()

bool crypt_smime_valid_passphrase ( void  )

Wrapper for CryptModuleSpecs::valid_passphrase()

Definition at line 428 of file cryptglue.c.

429 {
430  if (CRYPT_MOD_CALL_CHECK(SMIME, valid_passphrase))
431  return CRYPT_MOD_CALL(SMIME, valid_passphrase)();
432 
433  return false;
434 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_decrypt_mime()

int crypt_smime_decrypt_mime ( FILE *  fp_in,
FILE **  fp_out,
struct Body b,
struct Body **  cur 
)

Wrapper for CryptModuleSpecs::decrypt_mime()

Definition at line 439 of file cryptglue.c.

440 {
441  if (CRYPT_MOD_CALL_CHECK(SMIME, decrypt_mime))
442  return CRYPT_MOD_CALL(SMIME, decrypt_mime)(fp_in, fp_out, b, cur);
443 
444  return -1;
445 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_application_handler()

int crypt_smime_application_handler ( struct Body b,
struct State s 
)

Wrapper for CryptModuleSpecs::application_handler()

Implements handler_t

Definition at line 452 of file cryptglue.c.

453 {
454  if (CRYPT_MOD_CALL_CHECK(SMIME, application_handler))
455  return CRYPT_MOD_CALL(SMIME, application_handler)(b, s);
456 
457  return -1;
458 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_getkeys()

void crypt_smime_getkeys ( struct Envelope env)

Wrapper for CryptModuleSpecs::smime_getkeys()

Definition at line 463 of file cryptglue.c.

464 {
465  if (CRYPT_MOD_CALL_CHECK(SMIME, smime_getkeys))
466  CRYPT_MOD_CALL(SMIME, smime_getkeys)(env);
467 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_verify_sender()

int crypt_smime_verify_sender ( struct Mailbox m,
struct Email e,
struct Message msg 
)

Wrapper for CryptModuleSpecs::smime_verify_sender()

Definition at line 472 of file cryptglue.c.

473 {
474  if (CRYPT_MOD_CALL_CHECK(SMIME, smime_verify_sender))
475  return CRYPT_MOD_CALL(SMIME, smime_verify_sender)(m, e, msg);
476 
477  return 1;
478 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_find_keys()

char* crypt_smime_find_keys ( struct AddressList *  addrlist,
bool  oppenc_mode 
)

Wrapper for CryptModuleSpecs::find_keys()

Definition at line 483 of file cryptglue.c.

484 {
485  if (CRYPT_MOD_CALL_CHECK(SMIME, find_keys))
486  return CRYPT_MOD_CALL(SMIME, find_keys)(addrlist, oppenc_mode);
487 
488  return NULL;
489 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
static char * find_keys(struct AddressList *addrlist, unsigned int app, bool oppenc_mode)
Find keys of the recipients of the message.
Definition: crypt_gpgme.c:3826
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_smime_sign_message()

struct Body* crypt_smime_sign_message ( struct Body a,
const struct AddressList *  from 
)

Wrapper for CryptModuleSpecs::sign_message()

Definition at line 494 of file cryptglue.c.

495 {
497  return CRYPT_MOD_CALL(SMIME, sign_message)(a, from);
498 
499  return NULL;
500 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
static struct Body * sign_message(struct Body *a, const struct AddressList *from, bool use_smime)
Sign a message.
Definition: crypt_gpgme.c:1257
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_smime_build_smime_entity()

struct Body* crypt_smime_build_smime_entity ( struct Body a,
char *  certlist 
)

Wrapper for CryptModuleSpecs::smime_build_smime_entity()

Definition at line 505 of file cryptglue.c.

506 {
507  if (CRYPT_MOD_CALL_CHECK(SMIME, smime_build_smime_entity))
508  return CRYPT_MOD_CALL(SMIME, smime_build_smime_entity)(a, certlist);
509 
510  return NULL;
511 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_invoke_import()

void crypt_smime_invoke_import ( const char *  infile,
const char *  mailbox 
)

Wrapper for CryptModuleSpecs::smime_invoke_import()

Definition at line 516 of file cryptglue.c.

517 {
518  if (CRYPT_MOD_CALL_CHECK(SMIME, smime_invoke_import))
519  CRYPT_MOD_CALL(SMIME, smime_invoke_import)(infile, mailbox);
520 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_verify_one()

int crypt_smime_verify_one ( struct Body sigbdy,
struct State s,
const char *  tempf 
)

Wrapper for CryptModuleSpecs::verify_one()

Definition at line 525 of file cryptglue.c.

526 {
527  if (CRYPT_MOD_CALL_CHECK(SMIME, verify_one))
528  return CRYPT_MOD_CALL(SMIME, verify_one)(sigbdy, s, tempf);
529 
530  return -1;
531 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
static int verify_one(struct Body *sigbdy, struct State *s, const char *tempfile, bool is_smime)
Do the actual verification step.
Definition: crypt_gpgme.c:1902
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_smime_send_menu()

SecurityFlags crypt_smime_send_menu ( struct Mailbox m,
struct Email e 
)

Wrapper for CryptModuleSpecs::send_menu()

Definition at line 536 of file cryptglue.c.

537 {
538  if (CRYPT_MOD_CALL_CHECK(SMIME, send_menu))
539  return CRYPT_MOD_CALL(SMIME, send_menu)(m, e);
540 
541  return 0;
542 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

◆ crypt_smime_set_sender()

void crypt_smime_set_sender ( const char *  sender)

Wrapper for CryptModuleSpecs::set_sender()

Definition at line 547 of file cryptglue.c.

548 {
549  if (CRYPT_MOD_CALL_CHECK(SMIME, set_sender))
550  CRYPT_MOD_CALL(SMIME, set_sender)(sender);
551 }
#define CRYPT_MOD_CALL(identifier, func)
Definition: cryptglue.c:86
#define CRYPT_MOD_CALL_CHECK(identifier, func)
Definition: cryptglue.c:80
+ Here is the caller graph for this function:

Variable Documentation

◆ CryptModPgpClassic

struct CryptModuleSpecs CryptModPgpClassic

CLI PGP - Implements CryptModuleSpecs.

Definition at line 43 of file crypt_mod_pgp_classic.c.

◆ CryptModSmimeClassic

struct CryptModuleSpecs CryptModSmimeClassic

CLI SMIME - Implements CryptModuleSpecs.

Definition at line 57 of file crypt_mod_smime_classic.c.

◆ CryptModPgpGpgme

struct CryptModuleSpecs CryptModPgpGpgme

GPGME PGP - Implements CryptModuleSpecs.

Definition at line 59 of file crypt_mod_pgp_gpgme.c.

◆ CryptModSmimeGpgme

struct CryptModuleSpecs CryptModSmimeGpgme

GPGME SMIME - Implements CryptModuleSpecs.

Definition at line 59 of file crypt_mod_smime_gpgme.c.