LMDB  1.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
LMDB Encryption Helper API

Helpers for setting up encryption. More...

Data Structures

struct  MDB_crypto_funcs
 A structure for dynamically loaded crypto modules. More...
 

Typedefs

typedef int( MDB_str2key_func )(const char *passwd, MDB_val *key)
 A function for converting a string into an encryption key.
 
typedef MDB_crypto_funcs *( MDB_crypto_hooks )(void)
 The function that returns the MDB_crypto_funcs structure.
 

Functions

void * mdb_modload (const char *file, const char *symname, MDB_crypto_funcs **mcf_ptr, char **errmsg)
 Load a dynamically loadable module.
 
void mdb_modunload (void *handle)
 Unload a dynamically loaded module.
 
void mdb_modsetup (MDB_env *env, MDB_crypto_funcs *mcf_ptr, const char *passphrase)
 Set an environment to use the given crypto functions.
 

Detailed Description

Helpers for setting up encryption.


Data Structure Documentation

struct MDB_crypto_funcs

A structure for dynamically loaded crypto modules.

This is the information that the command line tools expect in order to operate on encrypted or checksummed environments.

Data Fields

MDB_str2key_funcmcf_str2key
 
MDB_enc_funcmcf_encfunc
 
MDB_sum_funcmcf_sumfunc
 
int mcf_keysize
 
int mcf_esumsize
 
int mcf_sumsize
 

Field Documentation

int MDB_crypto_funcs::mcf_keysize

The size of an encryption key, in bytes

int MDB_crypto_funcs::mcf_esumsize

The size of the MAC, for authenticated encryption

int MDB_crypto_funcs::mcf_sumsize

The size of the checksum, for plain checksums

Typedef Documentation

typedef int( MDB_str2key_func)(const char *passwd, MDB_val *key)

A function for converting a string into an encryption key.

Parameters
[in]passwdThe string to be converted.
[in,out]keyThe resulting key. The caller must provide the space for the key.
Returns
0 on success, non-zero on failure.
typedef MDB_crypto_funcs*( MDB_crypto_hooks)(void)

The function that returns the MDB_crypto_funcs structure.

The command line tools expect this function to be named "MDB_crypto". It must be exported by the dynamic module so that the tools can use it.

Returns
A pointer to a MDB_crypto_funcs structure.

Function Documentation

void* mdb_modload ( const char *  file,
const char *  symname,
MDB_crypto_funcs **  mcf_ptr,
char **  errmsg 
)

Load a dynamically loadable module.

Parameters
[in]fileThe pathname of the module to load.
[in]symnameThe name of a symbol to resolve in the module.
[out]mcf_ptrThe crypto hooks returned from the module.
[out]errmsgMessages for any errors from trying to load the module.
Returns
The handle to the loadable module that can be unloaded by mdb_modunload(), or NULL if loading failed.
void mdb_modunload ( void *  handle)

Unload a dynamically loaded module.

All environments that used the functions in the module must be closed before unloading the module.

Parameters
[in]handleThe handle returned by mdb_modload().
void mdb_modsetup ( MDB_env env,
MDB_crypto_funcs mcf_ptr,
const char *  passphrase 
)

Set an environment to use the given crypto functions.

This is just a wrapper around mdb_env_set_encrypt() to ease use of dynamically loaded crypto functions.

Parameters
[in]envAn environment handle returned by mdb_env_create()
[in]mcf_ptrThe crypto hooks retrieved by mdb_modload().
[in]passphraseThe secret used to generate the encryption key for the environment.