OLD | NEW |
| (Empty) |
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 #ifndef DEVT_H | |
6 #define DEVT_H | |
7 | |
8 #ifdef DEBUG | |
9 static const char DEVT_CVS_ID[] = "@(#) $RCSfile: devt.h,v $ $Revision: 1.26 $ $
Date: 2012/04/25 14:49:42 $"; | |
10 #endif /* DEBUG */ | |
11 | |
12 /* | |
13 * devt.h | |
14 * | |
15 * This file contains definitions for the low-level cryptoki devices. | |
16 */ | |
17 | |
18 #ifndef NSSBASET_H | |
19 #include "nssbaset.h" | |
20 #endif /* NSSBASET_H */ | |
21 | |
22 #ifndef NSSPKIT_H | |
23 #include "nsspkit.h" | |
24 #endif /* NSSPKIT_H */ | |
25 | |
26 #ifndef NSSDEVT_H | |
27 #include "nssdevt.h" | |
28 #endif /* NSSDEVT_H */ | |
29 | |
30 #ifndef BASET_H | |
31 #include "baset.h" | |
32 #endif /* BASET_H */ | |
33 | |
34 #include "secmodt.h" | |
35 | |
36 PR_BEGIN_EXTERN_C | |
37 | |
38 typedef struct nssSessionStr nssSession; | |
39 | |
40 /* XXX until NSSTokenStr is moved */ | |
41 struct nssDeviceBaseStr | |
42 { | |
43 NSSArena *arena; | |
44 PZLock *lock; | |
45 PRInt32 refCount; | |
46 NSSUTF8 *name; | |
47 PRUint32 flags; | |
48 }; | |
49 | |
50 typedef struct nssTokenObjectCacheStr nssTokenObjectCache; | |
51 | |
52 /* XXX until devobject.c goes away */ | |
53 struct NSSTokenStr | |
54 { | |
55 struct nssDeviceBaseStr base; | |
56 NSSSlot *slot; /* Parent (or peer, if you will) */ | |
57 CK_FLAGS ckFlags; /* from CK_TOKEN_INFO.flags */ | |
58 PRUint32 flags; | |
59 void *epv; | |
60 nssSession *defaultSession; | |
61 NSSTrustDomain *trustDomain; | |
62 PRIntervalTime lastTime; | |
63 nssTokenObjectCache *cache; | |
64 PK11SlotInfo *pk11slot; | |
65 }; | |
66 | |
67 typedef enum { | |
68 nssSlotAskPasswordTimes_FirstTime = 0, | |
69 nssSlotAskPasswordTimes_EveryTime = 1, | |
70 nssSlotAskPasswordTimes_Timeout = 2 | |
71 } | |
72 nssSlotAskPasswordTimes; | |
73 | |
74 struct nssSlotAuthInfoStr | |
75 { | |
76 PRTime lastLogin; | |
77 nssSlotAskPasswordTimes askTimes; | |
78 PRIntervalTime askPasswordTimeout; | |
79 }; | |
80 | |
81 struct NSSSlotStr | |
82 { | |
83 struct nssDeviceBaseStr base; | |
84 NSSModule *module; /* Parent */ | |
85 NSSToken *token; /* Peer */ | |
86 CK_SLOT_ID slotID; | |
87 CK_FLAGS ckFlags; /* from CK_SLOT_INFO.flags */ | |
88 struct nssSlotAuthInfoStr authInfo; | |
89 PRIntervalTime lastTokenPing; | |
90 PZLock *lock; | |
91 void *epv; | |
92 PK11SlotInfo *pk11slot; | |
93 }; | |
94 | |
95 struct nssSessionStr | |
96 { | |
97 PZLock *lock; | |
98 CK_SESSION_HANDLE handle; | |
99 NSSSlot *slot; | |
100 PRBool isRW; | |
101 PRBool ownLock; | |
102 }; | |
103 | |
104 typedef enum { | |
105 NSSCertificateType_Unknown = 0, | |
106 NSSCertificateType_PKIX = 1 | |
107 } NSSCertificateType; | |
108 | |
109 typedef enum { | |
110 nssTrustLevel_Unknown = 0, | |
111 nssTrustLevel_NotTrusted = 1, | |
112 nssTrustLevel_Trusted = 2, | |
113 nssTrustLevel_TrustedDelegator = 3, | |
114 nssTrustLevel_MustVerify = 4, | |
115 nssTrustLevel_ValidDelegator = 5 | |
116 } nssTrustLevel; | |
117 | |
118 typedef struct nssCryptokiInstanceStr nssCryptokiInstance; | |
119 | |
120 struct nssCryptokiInstanceStr | |
121 { | |
122 CK_OBJECT_HANDLE handle; | |
123 NSSToken *token; | |
124 PRBool isTokenObject; | |
125 NSSUTF8 *label; | |
126 }; | |
127 | |
128 typedef struct nssCryptokiInstanceStr nssCryptokiObject; | |
129 | |
130 typedef struct nssTokenCertSearchStr nssTokenCertSearch; | |
131 | |
132 typedef enum { | |
133 nssTokenSearchType_AllObjects = 0, | |
134 nssTokenSearchType_SessionOnly = 1, | |
135 nssTokenSearchType_TokenOnly = 2, | |
136 nssTokenSearchType_TokenForced = 3 | |
137 } nssTokenSearchType; | |
138 | |
139 struct nssTokenCertSearchStr | |
140 { | |
141 nssTokenSearchType searchType; | |
142 PRStatus (* callback)(NSSCertificate *c, void *arg); | |
143 void *cbarg; | |
144 nssList *cached; | |
145 /* TODO: add a cache query callback if the list would be large | |
146 * (traversal) | |
147 */ | |
148 }; | |
149 | |
150 struct nssSlotListStr; | |
151 typedef struct nssSlotListStr nssSlotList; | |
152 | |
153 struct NSSAlgorithmAndParametersStr | |
154 { | |
155 CK_MECHANISM mechanism; | |
156 }; | |
157 | |
158 PR_END_EXTERN_C | |
159 | |
160 #endif /* DEVT_H */ | |
OLD | NEW |