NeoMutt  2025-12-11-911-gd8d604
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
cryptglue.h File Reference

Wrapper around crypto functions. More...

#include <stdbool.h>
#include "lib.h"
+ Include dependency graph for cryptglue.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

struct Bodycrypt_pgp_encrypt_message (struct Email *e, struct Body *b, char *keylist, int sign, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::pgp_encrypt_message()
 
char * crypt_pgp_find_keys (struct AddressList *al, bool oppenc_mode)
 Wrapper for CryptModuleSpecs::find_keys()
 
void crypt_pgp_invoke_import (const char *fname)
 Wrapper for CryptModuleSpecs::pgp_invoke_import()
 
void crypt_pgp_set_sender (const char *sender)
 Wrapper for CryptModuleSpecs::set_sender()
 
struct Bodycrypt_pgp_sign_message (struct Body *b, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::sign_message()
 
struct Bodycrypt_pgp_traditional_encryptsign (struct Body *b, SecurityFlags flags, char *keylist)
 Wrapper for CryptModuleSpecs::pgp_traditional_encryptsign()
 
bool crypt_pgp_valid_passphrase (void)
 Wrapper for CryptModuleSpecs::valid_passphrase()
 
int crypt_pgp_verify_one (struct Body *b, struct State *state, const char *tempf)
 Wrapper for CryptModuleSpecs::verify_one()
 
void crypt_pgp_void_passphrase (void)
 Wrapper for CryptModuleSpecs::void_passphrase()
 
struct Bodycrypt_smime_build_smime_entity (struct Body *b, char *certlist)
 Wrapper for CryptModuleSpecs::smime_build_smime_entity()
 
char * crypt_smime_find_keys (struct AddressList *al, bool oppenc_mode)
 Wrapper for CryptModuleSpecs::find_keys()
 
void crypt_smime_invoke_import (const char *infile, const char *mailbox)
 Wrapper for CryptModuleSpecs::smime_invoke_import()
 
void crypt_smime_set_sender (const char *sender)
 Wrapper for CryptModuleSpecs::set_sender()
 
struct Bodycrypt_smime_sign_message (struct Body *b, const struct AddressList *from)
 Wrapper for CryptModuleSpecs::sign_message()
 
bool crypt_smime_valid_passphrase (void)
 Wrapper for CryptModuleSpecs::valid_passphrase()
 
int crypt_smime_verify_one (struct Body *b, struct State *state, const char *tempf)
 Wrapper for CryptModuleSpecs::verify_one()
 
void crypt_smime_void_passphrase (void)
 Wrapper for CryptModuleSpecs::void_passphrase()
 

Detailed Description

Wrapper around crypto functions.

Authors
  • Richard Russon
  • 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.h.

Function Documentation

◆ crypt_pgp_encrypt_message()

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

Wrapper for CryptModuleSpecs::pgp_encrypt_message()

Definition at line 391 of file cryptglue.c.

393{
394#ifdef USE_AUTOCRYPT
395 if (e->security & SEC_AUTOCRYPT)
396 {
398 return NULL;
399
400 OptAutocryptGpgme = true;
401 struct Body *result = pgp_gpgme_encrypt_message(b, keylist, sign, from);
402 OptAutocryptGpgme = false;
403
404 return result;
405 }
406#endif
407
409 ASSERT(mod_data);
410
411 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, pgp_encrypt_message))
412 return CRYPT_MOD_CALL(mod_data, PGP, pgp_encrypt_message)(b, keylist, sign, from);
413
414 return NULL;
415}
int mutt_autocrypt_set_sign_as_default_key(struct Email *e)
Set the Autocrypt default key for signing.
Definition autocrypt.c:717
#define CRYPT_MOD_CALL(mod_data, identifier, func)
Definition cryptglue.c:91
#define CRYPT_MOD_CALL_CHECK(mod_data, identifier, func)
Definition cryptglue.c:85
bool OptAutocryptGpgme
(pseudo) use Autocrypt context inside ncrypt/crypt_gpgme.c
Definition globals.c:44
struct Body * pgp_gpgme_encrypt_message(struct Body *b, char *keylist, bool sign, const struct AddressList *from)
PGP encrypt an email - Implements CryptModuleSpecs::pgp_encrypt_message() -.
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
Definition module_api.h:80
@ SEC_AUTOCRYPT
(Autocrypt) Message will be, or was Autocrypt encrypt+signed
Definition lib.h:101
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
#define ASSERT(COND)
Definition signal2.h:59
The body of an email.
Definition body.h:36
SecurityFlags security
bit 0-10: flags, bit 11,12: application, bit 13: traditional pgp See: ncrypt/lib.h pgplib....
Definition email.h:43
Ncrypt private Module data.
Definition module_data.h:38
Container for Accounts, Notifications.
Definition neomutt.h:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_find_keys()

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

Wrapper for CryptModuleSpecs::find_keys()

Definition at line 363 of file cryptglue.c.

364{
366 ASSERT(mod_data);
367
368 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, find_keys))
369 return CRYPT_MOD_CALL(mod_data, PGP, find_keys)(addrlist, oppenc_mode);
370
371 return NULL;
372}
static char * find_keys(const struct AddressList *addrlist, unsigned int app, bool oppenc_mode)
Find keys of the recipients of the message.
+ 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 420 of file cryptglue.c.

421{
423 ASSERT(mod_data);
424
425 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, pgp_invoke_import))
426 CRYPT_MOD_CALL(mod_data, PGP, pgp_invoke_import)(fname);
427}
+ Here is the call graph for this function:
+ 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 472 of file cryptglue.c.

473{
475 ASSERT(mod_data);
476
477 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, set_sender))
478 CRYPT_MOD_CALL(mod_data, PGP, set_sender)(sender);
479}
+ 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 * b,
const struct AddressList * from )

Wrapper for CryptModuleSpecs::sign_message()

Definition at line 377 of file cryptglue.c.

378{
380 ASSERT(mod_data);
381
382 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, sign_message))
383 return CRYPT_MOD_CALL(mod_data, PGP, sign_message)(b, from);
384
385 return NULL;
386}
static struct Body * sign_message(struct Body *b, const struct AddressList *from, bool use_smime)
Sign a message.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_traditional_encryptsign()

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

Wrapper for CryptModuleSpecs::pgp_traditional_encryptsign()

Definition at line 335 of file cryptglue.c.

336{
338 ASSERT(mod_data);
339
340 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, pgp_traditional_encryptsign))
341 return CRYPT_MOD_CALL(mod_data, PGP, pgp_traditional_encryptsign)(b, flags, keylist);
342
343 return NULL;
344}
+ Here is the call graph for this function:
+ 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 223 of file cryptglue.c.

224{
226 ASSERT(mod_data);
227
228 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, valid_passphrase))
229 return CRYPT_MOD_CALL(mod_data, PGP, valid_passphrase)();
230
231 return false;
232}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_pgp_verify_one()

int crypt_pgp_verify_one ( struct Body * b,
struct State * state,
const char * tempf )

Wrapper for CryptModuleSpecs::verify_one()

Definition at line 432 of file cryptglue.c.

433{
435 ASSERT(mod_data);
436
437 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, verify_one))
438 return CRYPT_MOD_CALL(mod_data, PGP, verify_one)(b, state, tempf);
439
440 return -1;
441}
static int verify_one(struct Body *b, struct State *state, const char *tempfile, bool is_smime)
Do the actual verification step.
+ 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 211 of file cryptglue.c.

212{
214 ASSERT(mod_data);
215
216 if (CRYPT_MOD_CALL_CHECK(mod_data, PGP, void_passphrase))
217 CRYPT_MOD_CALL(mod_data, PGP, void_passphrase)();
218}
+ 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 * b,
char * certlist )

Wrapper for CryptModuleSpecs::smime_build_smime_entity()

Definition at line 592 of file cryptglue.c.

593{
595 ASSERT(mod_data);
596
597 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, smime_build_smime_entity))
598 return CRYPT_MOD_CALL(mod_data, SMIME, smime_build_smime_entity)(b, certlist);
599
600 return NULL;
601}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_smime_find_keys()

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

Wrapper for CryptModuleSpecs::find_keys()

Definition at line 564 of file cryptglue.c.

565{
567 ASSERT(mod_data);
568
569 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, find_keys))
570 return CRYPT_MOD_CALL(mod_data, SMIME, find_keys)(addrlist, oppenc_mode);
571
572 return NULL;
573}
+ Here is the call graph for this function:
+ 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 606 of file cryptglue.c.

607{
609 ASSERT(mod_data);
610
611 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, smime_invoke_import))
612 CRYPT_MOD_CALL(mod_data, SMIME, smime_invoke_import)(infile, mailbox);
613}
+ Here is the call graph for this function:
+ 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 646 of file cryptglue.c.

647{
649 ASSERT(mod_data);
650
651 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, set_sender))
652 CRYPT_MOD_CALL(mod_data, SMIME, set_sender)(sender);
653}
+ 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 * b,
const struct AddressList * from )

Wrapper for CryptModuleSpecs::sign_message()

Definition at line 578 of file cryptglue.c.

579{
581 ASSERT(mod_data);
582
583 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, sign_message))
584 return CRYPT_MOD_CALL(mod_data, SMIME, sign_message)(b, from);
585
586 return NULL;
587}
+ Here is the call graph for this function:
+ 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 496 of file cryptglue.c.

497{
499 ASSERT(mod_data);
500
501 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, valid_passphrase))
502 return CRYPT_MOD_CALL(mod_data, SMIME, valid_passphrase)();
503
504 return false;
505}
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypt_smime_verify_one()

int crypt_smime_verify_one ( struct Body * b,
struct State * state,
const char * tempf )

Wrapper for CryptModuleSpecs::verify_one()

Definition at line 618 of file cryptglue.c.

619{
621 ASSERT(mod_data);
622
623 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, verify_one))
624 return CRYPT_MOD_CALL(mod_data, SMIME, verify_one)(b, state, tempf);
625
626 return -1;
627}
+ Here is the call graph for this function:
+ 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 484 of file cryptglue.c.

485{
487 ASSERT(mod_data);
488
489 if (CRYPT_MOD_CALL_CHECK(mod_data, SMIME, void_passphrase))
490 CRYPT_MOD_CALL(mod_data, SMIME, void_passphrase)();
491}
+ Here is the call graph for this function:
+ Here is the caller graph for this function: