NeoMutt  2021-02-05-89-gabe350
Teaching an old dog new tricks
crypt_mod.c File Reference
#include "config.h"
#include "mutt/lib.h"
#include "crypt_mod.h"
+ Include dependency graph for crypt_mod.c:

Go to the source code of this file.

Data Structures

struct  CryptModule
 A crypto plugin module. More...


 STAILQ_HEAD (CryptModuleList, CryptModule)
void crypto_module_register (struct CryptModuleSpecs *specs)
 Register a new crypto module. More...
struct CryptModuleSpecscrypto_module_lookup (int identifier)
 Lookup a crypto module by name. More...
void crypto_module_free (void)
 Clean up the crypto modules. More...


static struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules)

Detailed Description

Register crypto modules

  • g10 Code GmbH

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

Definition in file crypt_mod.c.

Function Documentation


STAILQ_HEAD ( CryptModuleList  ,

◆ crypto_module_register()

void crypto_module_register ( struct CryptModuleSpecs specs)

Register a new crypto module.

specsAPI functions

Definition at line 51 of file crypt_mod.c.

52 {
53  struct CryptModule *module = mutt_mem_calloc(1, sizeof(struct CryptModule));
54  module->specs = specs;
55  STAILQ_INSERT_HEAD(&CryptModules, module, entries);
56 }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypto_module_lookup()

struct CryptModuleSpecs* crypto_module_lookup ( int  identifier)

Lookup a crypto module by name.

identifierName, e.g. APPLICATION_PGP
Return values
ptrCrypto module

This function is usually used via the CRYPT_MOD_CALL[_CHECK] macros.

Definition at line 65 of file crypt_mod.c.

66 {
67  struct CryptModule *module = NULL;
68  STAILQ_FOREACH(module, &CryptModules, entries)
69  {
70  if (module->specs->identifier == identifier)
71  {
72  return module->specs;
73  }
74  }
75  return NULL;
76 }
+ Here is the caller graph for this function:

◆ crypto_module_free()

void crypto_module_free ( void  )

Clean up the crypto modules.

Definition at line 81 of file crypt_mod.c.

82 {
83  struct CryptModule *np = NULL, *tmp = NULL;
84  STAILQ_FOREACH_SAFE(np, &CryptModules, entries, tmp)
85  {
86  STAILQ_REMOVE(&CryptModules, np, CryptModule, entries);
87  FREE(&np);
88  }
89 }
+ Here is the caller graph for this function:

Variable Documentation

◆ CryptModules

struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules)

Definition at line 45 of file crypt_mod.c.

void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:50
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:399
static struct CryptModuleList CryptModules
Definition: crypt_mod.c:45
#define FREE(x)
Definition: memory.h:40
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:349
#define STAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:380
struct CryptModuleSpecs * specs
Crypto module definition.
Definition: crypt_mod.c:40
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:359
int identifier
Identifying bit.
Definition: crypt_mod.h:46
A crypto plugin module.
Definition: crypt_mod.c:38