SECTION:p11-kit : Modules : Module loading and initializing
PKCS#11 modules are used by crypto libraries and applications to access crypto objects (like keys and certificates) and to perform crypto operations.
In order for applications to behave consistently with regard to the user's installed PKCS#11 modules, each module must be registered so that applications or libraries know that they should load it.
The functions here provide support for initializing registered modules. The p11_kit_initialize_registered() function should be used to load and initialize the registered modules. When done, the p11_kit_finalize_registered() function should be used to release those modules and associated resources.
In addition p11_kit_registered_option() can be used to access other parts of the module configuration.
When multiple consumers of a module (such as libraries or applications) are in the same process, coordination of the initialization and finalization of PKCS#11 modules is required. The functions here automatically provide initialization reference counting to make this work.
If a consumer wishes to load an arbitrary PKCS#11 module that's not registered, that module should be initialized with p11_kit_initialize_module() and finalized with p11_kit_finalize_module(). The module's own
C_Finalize methods should not be called directly.
Modules are represented by a pointer to their
CK_FUNCTION_LIST entry points. This means that callers can load modules elsewhere, using dlopen() for example, and then still use these methods on them.