security/nss/lib/ckfw/capi/cinst.c

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:2ed097907625
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 #include "ckcapi.h"
6
7 /*
8 * ckcapi/cinstance.c
9 *
10 * This file implements the NSSCKMDInstance object for the
11 * "capi" cryptoki module.
12 */
13
14 /*
15 * NSSCKMDInstance methods
16 */
17
18 static CK_ULONG
19 ckcapi_mdInstance_GetNSlots
20 (
21 NSSCKMDInstance *mdInstance,
22 NSSCKFWInstance *fwInstance,
23 CK_RV *pError
24 )
25 {
26 return (CK_ULONG)1;
27 }
28
29 static CK_VERSION
30 ckcapi_mdInstance_GetCryptokiVersion
31 (
32 NSSCKMDInstance *mdInstance,
33 NSSCKFWInstance *fwInstance
34 )
35 {
36 return nss_ckcapi_CryptokiVersion;
37 }
38
39 static NSSUTF8 *
40 ckcapi_mdInstance_GetManufacturerID
41 (
42 NSSCKMDInstance *mdInstance,
43 NSSCKFWInstance *fwInstance,
44 CK_RV *pError
45 )
46 {
47 return (NSSUTF8 *)nss_ckcapi_ManufacturerID;
48 }
49
50 static NSSUTF8 *
51 ckcapi_mdInstance_GetLibraryDescription
52 (
53 NSSCKMDInstance *mdInstance,
54 NSSCKFWInstance *fwInstance,
55 CK_RV *pError
56 )
57 {
58 return (NSSUTF8 *)nss_ckcapi_LibraryDescription;
59 }
60
61 static CK_VERSION
62 ckcapi_mdInstance_GetLibraryVersion
63 (
64 NSSCKMDInstance *mdInstance,
65 NSSCKFWInstance *fwInstance
66 )
67 {
68 return nss_ckcapi_LibraryVersion;
69 }
70
71 static CK_RV
72 ckcapi_mdInstance_GetSlots
73 (
74 NSSCKMDInstance *mdInstance,
75 NSSCKFWInstance *fwInstance,
76 NSSCKMDSlot *slots[]
77 )
78 {
79 slots[0] = (NSSCKMDSlot *)&nss_ckcapi_mdSlot;
80 return CKR_OK;
81 }
82
83 static CK_BBOOL
84 ckcapi_mdInstance_ModuleHandlesSessionObjects
85 (
86 NSSCKMDInstance *mdInstance,
87 NSSCKFWInstance *fwInstance
88 )
89 {
90 /* we don't want to allow any session object creation, at least
91 * until we can investigate whether or not we can use those objects
92 */
93 return CK_TRUE;
94 }
95
96 NSS_IMPLEMENT_DATA const NSSCKMDInstance
97 nss_ckcapi_mdInstance = {
98 (void *)NULL, /* etc */
99 NULL, /* Initialize */
100 NULL, /* Finalize */
101 ckcapi_mdInstance_GetNSlots,
102 ckcapi_mdInstance_GetCryptokiVersion,
103 ckcapi_mdInstance_GetManufacturerID,
104 ckcapi_mdInstance_GetLibraryDescription,
105 ckcapi_mdInstance_GetLibraryVersion,
106 ckcapi_mdInstance_ModuleHandlesSessionObjects,
107 /*NULL, /* HandleSessionObjects */
108 ckcapi_mdInstance_GetSlots,
109 NULL, /* WaitForSlotEvent */
110 (void *)NULL /* null terminator */
111 };

mercurial