NeoMutt  2025-12-11-911-gd8d604
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 "core/lib.h"
#include "crypt_mod.h"
#include "lib.h"
#include "module_data.h"
+ Include dependency graph for crypt_mod.c:

Go to the source code of this file.

Functions

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

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

◆ crypto_module_register()

void crypto_module_register ( const struct CryptModuleSpecs * specs)

Register a new crypto module.

Parameters
specsAPI functions

Definition at line 41 of file crypt_mod.c.

42{
44 struct CryptModule *module = MUTT_MEM_CALLOC(1, struct CryptModule);
45 module->specs = specs;
46 STAILQ_INSERT_HEAD(&mod_data->crypt_modules, module, entries);
47}
#define MUTT_MEM_CALLOC(n, type)
Definition memory.h:52
@ MODULE_ID_NCRYPT
ModuleNcrypt, Ncrypt
Definition module_api.h:80
void * neomutt_get_module_data(struct NeoMutt *n, enum ModuleId id)
Get the private data for a Module.
Definition neomutt.c:663
#define STAILQ_INSERT_HEAD(head, elm, field)
Definition queue.h:421
A crypto plugin module.
Definition crypt_mod.h:315
Ncrypt private Module data.
Definition module_data.h:38
struct CryptModuleList crypt_modules
Linked list of crypto modules.
Definition module_data.h:48
Container for Accounts, Notifications.
Definition neomutt.h:41
+ 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 ( struct NcryptModuleData * mod_data,
int identifier )

Lookup a crypto module by name.

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

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

Definition at line 57 of file crypt_mod.c.

58{
59 const struct CryptModule *module = NULL;
60 STAILQ_FOREACH(module, &mod_data->crypt_modules, entries)
61 {
62 if (module->specs->identifier == identifier)
63 {
64 return module->specs;
65 }
66 }
67 return NULL;
68}
#define STAILQ_FOREACH(var, head, field)
Definition queue.h:390
int identifier
Identifying bit.
Definition crypt_mod.h:49
const struct CryptModuleSpecs * specs
Crypto module definition.
Definition crypt_mod.h:316
+ Here is the caller graph for this function:

◆ crypto_module_cleanup()

void crypto_module_cleanup ( struct NcryptModuleData * mod_data)

Clean up the crypto modules.

Parameters
mod_dataNcrypt module data

Definition at line 74 of file crypt_mod.c.

75{
76 struct CryptModule *np = NULL, *tmp = NULL;
77 STAILQ_FOREACH_SAFE(np, &mod_data->crypt_modules, entries, tmp)
78 {
79 STAILQ_REMOVE(&mod_data->crypt_modules, np, CryptModule, entries);
80 FREE(&np);
81 }
82}
#define FREE(x)
Free memory and set the pointer to NULL.
Definition memory.h:68
#define STAILQ_REMOVE(head, elm, type, field)
Definition queue.h:441
#define STAILQ_FOREACH_SAFE(var, head, field, tvar)
Definition queue.h:400
+ Here is the caller graph for this function: