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

Register crypto modules. More...

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

Go to the source code of this file.

Data Structures

struct  CryptModuleSpecs
 
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 (struct NcryptModuleData *mod_data, int identifier)
 Lookup a crypto module by name.
 

Detailed Description

Register crypto modules.

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

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 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: