NeoMutt  2024-10-02-37-gfa9146
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
crypt_mod.c File Reference

Register crypto modules. More...

#include "config.h"
#include "mutt/lib.h"
#include "crypt_mod.h"
#include "lib.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...
 

Functions

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

Variables

static struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules)
 Linked list of crypto modules, e.g. CryptModSmimeClassic, CryptModPgpGpgme.
 

Detailed Description

Register crypto modules.

Authors
  • Pietro Cerutti
  • Richard Russon

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 crypt_mod.c.

Function Documentation

◆ STAILQ_HEAD()

STAILQ_HEAD ( CryptModuleList  ,
CryptModule   
)

◆ crypto_module_register()

void crypto_module_register ( const struct CryptModuleSpecs specs)

Register a new crypto module.

Parameters
specsAPI functions

Definition at line 54 of file crypt_mod.c.

55{
56 struct CryptModule *module = mutt_mem_calloc(1, sizeof(struct CryptModule));
57 module->specs = specs;
58 STAILQ_INSERT_HEAD(&CryptModules, module, entries);
59}
static struct CryptModuleList CryptModules
Linked list of crypto modules, e.g. CryptModSmimeClassic, CryptModPgpGpgme.
Definition: crypt_mod.c:48
void * mutt_mem_calloc(size_t nmemb, size_t size)
Allocate zeroed memory on the heap.
Definition: memory.c:51
#define STAILQ_INSERT_HEAD(head, elm, field)
Definition: queue.h:383
A crypto plugin module.
Definition: crypt_mod.c:41
const struct CryptModuleSpecs * specs
Crypto module definition.
Definition: crypt_mod.c:42
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ crypto_module_lookup()

const struct CryptModuleSpecs * crypto_module_lookup ( int  identifier)

Lookup a crypto module by name.

Parameters
identifierName, e.g. APPLICATION_PGP
Return values
ptrCrypto module

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

Definition at line 68 of file crypt_mod.c.

69{
70 const struct CryptModule *module = NULL;
71 STAILQ_FOREACH(module, &CryptModules, entries)
72 {
73 if (module->specs->identifier == identifier)
74 {
75 return module->specs;
76 }
77 }
78 return NULL;
79}
#define STAILQ_FOREACH(var, head, field)
Definition: queue.h:352
int identifier
Identifying bit.
Definition: crypt_mod.h:48
+ Here is the caller graph for this function:

◆ crypto_module_cleanup()

void crypto_module_cleanup ( void  )

Clean up the crypto modules.

Definition at line 84 of file crypt_mod.c.

85{
86 struct CryptModule *np = NULL, *tmp = NULL;
87 STAILQ_FOREACH_SAFE(np, &CryptModules, entries, tmp)
88 {
90 FREE(&np);
91 }
92}
#define FREE(x)
Definition: memory.h:45
#define STAILQ_REMOVE(head, elm, type, field)
Definition: queue.h:402
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition: queue.h:362
+ Here is the caller graph for this function:

Variable Documentation

◆ CryptModules

struct CryptModuleList CryptModules = STAILQ_HEAD_INITIALIZER(CryptModules)
static

Linked list of crypto modules, e.g. CryptModSmimeClassic, CryptModPgpGpgme.

Definition at line 48 of file crypt_mod.c.