Back to index

lightning-sunbird  0.9+nobinonly
devm.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Original Code is the Netscape security libraries.
00015  *
00016  * The Initial Developer of the Original Code is
00017  * Netscape Communications Corporation.
00018  * Portions created by the Initial Developer are Copyright (C) 1994-2000
00019  * the Initial Developer. All Rights Reserved.
00020  *
00021  * Contributor(s):
00022  *
00023  * Alternatively, the contents of this file may be used under the terms of
00024  * either the GNU General Public License Version 2 or later (the "GPL"), or
00025  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00026  * in which case the provisions of the GPL or the LGPL are applicable instead
00027  * of those above. If you wish to allow use of your version of this file only
00028  * under the terms of either the GPL or the LGPL, and not to allow others to
00029  * use your version of this file under the terms of the MPL, indicate your
00030  * decision by deleting the provisions above and replace them with the notice
00031  * and other provisions required by the GPL or the LGPL. If you do not delete
00032  * the provisions above, a recipient may use your version of this file under
00033  * the terms of any one of the MPL, the GPL or the LGPL.
00034  *
00035  * ***** END LICENSE BLOCK ***** */
00036 
00037 #ifndef DEVM_H
00038 #define DEVM_H
00039 
00040 #ifdef DEBUG
00041 static const char DEVM_CVS_ID[] = "@(#) $RCSfile: devm.h,v $ $Revision: 1.11 $ $Date: 2005/01/20 02:25:47 $";
00042 #endif /* DEBUG */
00043 
00044 #ifndef BASE_H
00045 #include "base.h"
00046 #endif /* BASE_H */
00047 
00048 #ifndef NSSCKT_H
00049 #include "nssckt.h"
00050 #endif /* NSSCKT_H */
00051 
00052 #ifndef DEV_H
00053 #include "dev.h"
00054 #endif /* DEV_H */
00055 
00056 #ifndef DEVTM_H
00057 #include "devtm.h"
00058 #endif /* DEVTM_H */
00059 
00060 PR_BEGIN_EXTERN_C
00061 
00062 /* Shortcut to cryptoki API functions. */
00063 #define CKAPI(epv) \
00064     ((CK_FUNCTION_LIST_PTR)(epv))
00065 
00066 NSS_EXTERN void
00067 nssDevice_AddRef
00068 (
00069  struct nssDeviceBaseStr *device
00070 );
00071 
00072 NSS_EXTERN PRBool
00073 nssDevice_Destroy
00074 (
00075  struct nssDeviceBaseStr *device
00076 );
00077 
00078 NSS_EXTERN PRBool
00079 nssModule_IsThreadSafe
00080 (
00081   NSSModule *module
00082 );
00083 
00084 NSS_EXTERN PRBool
00085 nssModule_IsInternal
00086 (
00087   NSSModule *mod
00088 );
00089 
00090 NSS_EXTERN PRBool
00091 nssModule_IsModuleDBOnly
00092 (
00093   NSSModule *mod
00094 );
00095 
00096 NSS_EXTERN void *
00097 nssModule_GetCryptokiEPV
00098 (
00099   NSSModule *mod
00100 );
00101 
00102 NSS_EXTERN NSSSlot *
00103 nssSlot_Create
00104 (
00105   CK_SLOT_ID slotId,
00106   NSSModule *parent
00107 );
00108 
00109 NSS_EXTERN void *
00110 nssSlot_GetCryptokiEPV
00111 (
00112   NSSSlot *slot
00113 );
00114 
00115 NSS_EXTERN NSSToken *
00116 nssToken_Create
00117 (
00118   CK_SLOT_ID slotID,
00119   NSSSlot *peer
00120 );
00121 
00122 NSS_EXTERN void *
00123 nssToken_GetCryptokiEPV
00124 (
00125   NSSToken *token
00126 );
00127 
00128 NSS_EXTERN nssSession *
00129 nssToken_GetDefaultSession
00130 (
00131   NSSToken *token
00132 );
00133 
00134 NSS_EXTERN PRBool
00135 nssToken_IsLoginRequired
00136 (
00137   NSSToken *token
00138 );
00139 
00140 NSS_EXTERN void
00141 nssToken_Remove
00142 (
00143   NSSToken *token
00144 );
00145 
00146 NSS_EXTERN nssCryptokiObject *
00147 nssCryptokiObject_Create
00148 (
00149   NSSToken *t, 
00150   nssSession *session,
00151   CK_OBJECT_HANDLE h
00152 );
00153 
00154 NSS_EXTERN nssTokenObjectCache *
00155 nssTokenObjectCache_Create
00156 (
00157   NSSToken *token,
00158   PRBool cacheCerts,
00159   PRBool cacheTrust,
00160   PRBool cacheCRLs
00161 );
00162 
00163 NSS_EXTERN void
00164 nssTokenObjectCache_Destroy
00165 (
00166   nssTokenObjectCache *cache
00167 );
00168 
00169 NSS_EXTERN void
00170 nssTokenObjectCache_Clear
00171 (
00172   nssTokenObjectCache *cache
00173 );
00174 
00175 NSS_EXTERN PRBool
00176 nssTokenObjectCache_HaveObjectClass
00177 (
00178   nssTokenObjectCache *cache,
00179   CK_OBJECT_CLASS objclass
00180 );
00181 
00182 NSS_EXTERN nssCryptokiObject **
00183 nssTokenObjectCache_FindObjectsByTemplate
00184 (
00185   nssTokenObjectCache *cache,
00186   CK_OBJECT_CLASS objclass,
00187   CK_ATTRIBUTE_PTR otemplate,
00188   CK_ULONG otlen,
00189   PRUint32 maximumOpt,
00190   PRStatus *statusOpt
00191 );
00192 
00193 NSS_EXTERN PRStatus
00194 nssTokenObjectCache_GetObjectAttributes
00195 (
00196   nssTokenObjectCache *cache,
00197   NSSArena *arenaOpt,
00198   nssCryptokiObject *object,
00199   CK_OBJECT_CLASS objclass,
00200   CK_ATTRIBUTE_PTR atemplate,
00201   CK_ULONG atlen
00202 );
00203 
00204 NSS_EXTERN PRStatus
00205 nssTokenObjectCache_ImportObject
00206 (
00207   nssTokenObjectCache *cache,
00208   nssCryptokiObject *object,
00209   CK_OBJECT_CLASS objclass,
00210   CK_ATTRIBUTE_PTR ot,
00211   CK_ULONG otlen
00212 );
00213 
00214 NSS_EXTERN void
00215 nssTokenObjectCache_RemoveObject
00216 (
00217   nssTokenObjectCache *cache,
00218   nssCryptokiObject *object
00219 );
00220 
00221 /* XXX allows peek back into token */
00222 NSS_EXTERN PRStatus
00223 nssToken_GetCachedObjectAttributes
00224 (
00225   NSSToken *token,
00226   NSSArena *arenaOpt,
00227   nssCryptokiObject *object,
00228   CK_OBJECT_CLASS objclass,
00229   CK_ATTRIBUTE_PTR atemplate,
00230   CK_ULONG atlen
00231 );
00232 
00233 /* PKCS#11 stores strings in a fixed-length buffer padded with spaces.  This
00234  * function gets the length of the actual string.
00235  */
00236 NSS_EXTERN PRUint32
00237 nssPKCS11String_Length
00238 (
00239   CK_CHAR *pkcs11str, 
00240   PRUint32 bufLen
00241 );
00242 
00243 PR_END_EXTERN_C
00244 
00245 #endif /* DEV_H */