| Server IP : 121.121.20.254 / Your IP : 216.73.216.146 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Program Files/Git/usr/share/gtk-doc/html/p11-kit/ |
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>Sharing PKCS#11 modules: p11-kit</title> <meta name="generator" content="DocBook XSL Stylesheets Vsnapshot"> <link rel="home" href="index.html" title="p11-kit"> <link rel="up" href="index.html" title="p11-kit"> <link rel="prev" href="config-files.html" title="Configuration Files"> <link rel="next" href="sharing-managed.html" title="Managed modules"> <meta name="generator" content="GTK-Doc V1.34.0 (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="5"><tr valign="middle"> <td width="100%" align="left" class="shortcuts"></td> <td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td> <td><img src="up-insensitive.png" width="16" height="16" border="0"></td> <td><a accesskey="p" href="config-files.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td> <td><a accesskey="n" href="sharing-managed.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td> </tr></table> <div class="chapter"> <div class="titlepage"><div><div><h1 class="title"> <a name="sharing"></a>Sharing PKCS#11 modules</h1></div></div></div> <div class="toc"><dl class="toc"> <dt><span class="section"><a href="sharing.html#sharing-problem">Multiple consumers of PKCS#11 in a process</a></span></dt> <dt><span class="section"><a href="sharing-managed.html">Managed modules</a></span></dt> </dl></div> <div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="sharing-problem"></a>Multiple consumers of PKCS#11 in a process</h2></div></div></div> <p>As more and more applications and libraries use PKCS#11 we run into a very basic problem. The PKCS#11 modules cannot be initialized and finalized properly without coordination between the various consumers. </p> <p>An example: An application might use GnuTLS for TLS connections, and use libgcr for display of certificates. Both of these want to load (and initialize) the same PKCS#11 modules. There are many places where this situation occurs, including large applications like Evolution which due to their dependencies end up using both NSS and GnuTLS.</p> <p>Consumer A loads a PKCS#11 module and uses the module's C_Initialize function to initialize it, which works as expected. When consumer B initializes the module (also using C_Initialize), the error code <code class="literal">CKR_CRYPTOKI_ALREADY_INITIALIZED</code> is correctly returned. This is normal PKCS#11 specification defined behavior for when a module is initialized twice in the same process. If consumer B is aware of this situation they may choose to ignore this error code.</p> <p>However when the consumer A is done with its use of the PKCS#11 module it finalizes the module using the module's C_Finalize function. This is expected of a well behaved PKCS#11 consumer. This then causes errors and/or crashes for consumer B, which cannot know that the module has now been finalized out from underneath it.</p> <p>It is necessary for the two consumers to coordinate their initialization and finalization in some fashion. In <code class="literal">p11-kit</code> we provide this coordination in a loosely coupled, backwards compatible, and flexible way.</p> </div> </div> <div class="footer"> <hr>Generated by GTK-Doc V1.34.0</div> </body> </html>