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