PageRenderTime 29ms CodeModel.GetById 1ms app.highlight 20ms RepoModel.GetById 2ms app.codeStats 0ms

/security/nss/lib/dev/devm.h

http://github.com/zpao/v8monkey
C Header | 241 lines | 168 code | 33 blank | 40 comment | 0 complexity | 4ff3c1e3c8f4d2073925c8e6b18e5731 MD5 | raw file
  1/* ***** BEGIN LICENSE BLOCK *****
  2 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  3 *
  4 * The contents of this file are subject to the Mozilla Public License Version
  5 * 1.1 (the "License"); you may not use this file except in compliance with
  6 * the License. You may obtain a copy of the License at
  7 * http://www.mozilla.org/MPL/
  8 *
  9 * Software distributed under the License is distributed on an "AS IS" basis,
 10 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 11 * for the specific language governing rights and limitations under the
 12 * License.
 13 *
 14 * The Original Code is the Netscape security libraries.
 15 *
 16 * The Initial Developer of the Original Code is
 17 * Netscape Communications Corporation.
 18 * Portions created by the Initial Developer are Copyright (C) 1994-2000
 19 * the Initial Developer. All Rights Reserved.
 20 *
 21 * Contributor(s):
 22 *
 23 * Alternatively, the contents of this file may be used under the terms of
 24 * either the GNU General Public License Version 2 or later (the "GPL"), or
 25 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 26 * in which case the provisions of the GPL or the LGPL are applicable instead
 27 * of those above. If you wish to allow use of your version of this file only
 28 * under the terms of either the GPL or the LGPL, and not to allow others to
 29 * use your version of this file under the terms of the MPL, indicate your
 30 * decision by deleting the provisions above and replace them with the notice
 31 * and other provisions required by the GPL or the LGPL. If you do not delete
 32 * the provisions above, a recipient may use your version of this file under
 33 * the terms of any one of the MPL, the GPL or the LGPL.
 34 *
 35 * ***** END LICENSE BLOCK ***** */
 36
 37#ifndef DEVM_H
 38#define DEVM_H
 39
 40#ifdef DEBUG
 41static const char DEVM_CVS_ID[] = "@(#) $RCSfile: devm.h,v $ $Revision: 1.12 $ $Date: 2010/01/08 02:00:58 $";
 42#endif /* DEBUG */
 43
 44#ifndef BASE_H
 45#include "base.h"
 46#endif /* BASE_H */
 47
 48#ifndef DEV_H
 49#include "dev.h"
 50#endif /* DEV_H */
 51
 52#ifndef DEVTM_H
 53#include "devtm.h"
 54#endif /* DEVTM_H */
 55
 56PR_BEGIN_EXTERN_C
 57
 58/* Shortcut to cryptoki API functions. */
 59#define CKAPI(epv) \
 60    ((CK_FUNCTION_LIST_PTR)(epv))
 61
 62NSS_EXTERN void
 63nssDevice_AddRef
 64(
 65 struct nssDeviceBaseStr *device
 66);
 67
 68NSS_EXTERN PRBool
 69nssDevice_Destroy
 70(
 71 struct nssDeviceBaseStr *device
 72);
 73
 74NSS_EXTERN PRBool
 75nssModule_IsThreadSafe
 76(
 77  NSSModule *module
 78);
 79
 80NSS_EXTERN PRBool
 81nssModule_IsInternal
 82(
 83  NSSModule *mod
 84);
 85
 86NSS_EXTERN PRBool
 87nssModule_IsModuleDBOnly
 88(
 89  NSSModule *mod
 90);
 91
 92NSS_EXTERN void *
 93nssModule_GetCryptokiEPV
 94(
 95  NSSModule *mod
 96);
 97
 98NSS_EXTERN NSSSlot *
 99nssSlot_Create
100(
101  CK_SLOT_ID slotId,
102  NSSModule *parent
103);
104
105NSS_EXTERN void *
106nssSlot_GetCryptokiEPV
107(
108  NSSSlot *slot
109);
110
111NSS_EXTERN NSSToken *
112nssToken_Create
113(
114  CK_SLOT_ID slotID,
115  NSSSlot *peer
116);
117
118NSS_EXTERN void *
119nssToken_GetCryptokiEPV
120(
121  NSSToken *token
122);
123
124NSS_EXTERN nssSession *
125nssToken_GetDefaultSession
126(
127  NSSToken *token
128);
129
130NSS_EXTERN PRBool
131nssToken_IsLoginRequired
132(
133  NSSToken *token
134);
135
136NSS_EXTERN void
137nssToken_Remove
138(
139  NSSToken *token
140);
141
142NSS_EXTERN nssCryptokiObject *
143nssCryptokiObject_Create
144(
145  NSSToken *t, 
146  nssSession *session,
147  CK_OBJECT_HANDLE h
148);
149
150NSS_EXTERN nssTokenObjectCache *
151nssTokenObjectCache_Create
152(
153  NSSToken *token,
154  PRBool cacheCerts,
155  PRBool cacheTrust,
156  PRBool cacheCRLs
157);
158
159NSS_EXTERN void
160nssTokenObjectCache_Destroy
161(
162  nssTokenObjectCache *cache
163);
164
165NSS_EXTERN void
166nssTokenObjectCache_Clear
167(
168  nssTokenObjectCache *cache
169);
170
171NSS_EXTERN PRBool
172nssTokenObjectCache_HaveObjectClass
173(
174  nssTokenObjectCache *cache,
175  CK_OBJECT_CLASS objclass
176);
177
178NSS_EXTERN nssCryptokiObject **
179nssTokenObjectCache_FindObjectsByTemplate
180(
181  nssTokenObjectCache *cache,
182  CK_OBJECT_CLASS objclass,
183  CK_ATTRIBUTE_PTR otemplate,
184  CK_ULONG otlen,
185  PRUint32 maximumOpt,
186  PRStatus *statusOpt
187);
188
189NSS_EXTERN PRStatus
190nssTokenObjectCache_GetObjectAttributes
191(
192  nssTokenObjectCache *cache,
193  NSSArena *arenaOpt,
194  nssCryptokiObject *object,
195  CK_OBJECT_CLASS objclass,
196  CK_ATTRIBUTE_PTR atemplate,
197  CK_ULONG atlen
198);
199
200NSS_EXTERN PRStatus
201nssTokenObjectCache_ImportObject
202(
203  nssTokenObjectCache *cache,
204  nssCryptokiObject *object,
205  CK_OBJECT_CLASS objclass,
206  CK_ATTRIBUTE_PTR ot,
207  CK_ULONG otlen
208);
209
210NSS_EXTERN void
211nssTokenObjectCache_RemoveObject
212(
213  nssTokenObjectCache *cache,
214  nssCryptokiObject *object
215);
216
217/* XXX allows peek back into token */
218NSS_EXTERN PRStatus
219nssToken_GetCachedObjectAttributes
220(
221  NSSToken *token,
222  NSSArena *arenaOpt,
223  nssCryptokiObject *object,
224  CK_OBJECT_CLASS objclass,
225  CK_ATTRIBUTE_PTR atemplate,
226  CK_ULONG atlen
227);
228
229/* PKCS#11 stores strings in a fixed-length buffer padded with spaces.  This
230 * function gets the length of the actual string.
231 */
232NSS_EXTERN PRUint32
233nssPKCS11String_Length
234(
235  CK_CHAR *pkcs11str, 
236  PRUint32 bufLen
237);
238
239PR_END_EXTERN_C
240
241#endif /* DEV_H */