/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. #ifndef DEVM_H
  37. #define DEVM_H
  38. #ifdef DEBUG
  39. static const char DEVM_CVS_ID[] = "@(#) $RCSfile: devm.h,v $ $Revision: 1.12 $ $Date: 2010/01/08 02:00:58 $";
  40. #endif /* DEBUG */
  41. #ifndef BASE_H
  42. #include "base.h"
  43. #endif /* BASE_H */
  44. #ifndef DEV_H
  45. #include "dev.h"
  46. #endif /* DEV_H */
  47. #ifndef DEVTM_H
  48. #include "devtm.h"
  49. #endif /* DEVTM_H */
  50. PR_BEGIN_EXTERN_C
  51. /* Shortcut to cryptoki API functions. */
  52. #define CKAPI(epv) \
  53. ((CK_FUNCTION_LIST_PTR)(epv))
  54. NSS_EXTERN void
  55. nssDevice_AddRef
  56. (
  57. struct nssDeviceBaseStr *device
  58. );
  59. NSS_EXTERN PRBool
  60. nssDevice_Destroy
  61. (
  62. struct nssDeviceBaseStr *device
  63. );
  64. NSS_EXTERN PRBool
  65. nssModule_IsThreadSafe
  66. (
  67. NSSModule *module
  68. );
  69. NSS_EXTERN PRBool
  70. nssModule_IsInternal
  71. (
  72. NSSModule *mod
  73. );
  74. NSS_EXTERN PRBool
  75. nssModule_IsModuleDBOnly
  76. (
  77. NSSModule *mod
  78. );
  79. NSS_EXTERN void *
  80. nssModule_GetCryptokiEPV
  81. (
  82. NSSModule *mod
  83. );
  84. NSS_EXTERN NSSSlot *
  85. nssSlot_Create
  86. (
  87. CK_SLOT_ID slotId,
  88. NSSModule *parent
  89. );
  90. NSS_EXTERN void *
  91. nssSlot_GetCryptokiEPV
  92. (
  93. NSSSlot *slot
  94. );
  95. NSS_EXTERN NSSToken *
  96. nssToken_Create
  97. (
  98. CK_SLOT_ID slotID,
  99. NSSSlot *peer
  100. );
  101. NSS_EXTERN void *
  102. nssToken_GetCryptokiEPV
  103. (
  104. NSSToken *token
  105. );
  106. NSS_EXTERN nssSession *
  107. nssToken_GetDefaultSession
  108. (
  109. NSSToken *token
  110. );
  111. NSS_EXTERN PRBool
  112. nssToken_IsLoginRequired
  113. (
  114. NSSToken *token
  115. );
  116. NSS_EXTERN void
  117. nssToken_Remove
  118. (
  119. NSSToken *token
  120. );
  121. NSS_EXTERN nssCryptokiObject *
  122. nssCryptokiObject_Create
  123. (
  124. NSSToken *t,
  125. nssSession *session,
  126. CK_OBJECT_HANDLE h
  127. );
  128. NSS_EXTERN nssTokenObjectCache *
  129. nssTokenObjectCache_Create
  130. (
  131. NSSToken *token,
  132. PRBool cacheCerts,
  133. PRBool cacheTrust,
  134. PRBool cacheCRLs
  135. );
  136. NSS_EXTERN void
  137. nssTokenObjectCache_Destroy
  138. (
  139. nssTokenObjectCache *cache
  140. );
  141. NSS_EXTERN void
  142. nssTokenObjectCache_Clear
  143. (
  144. nssTokenObjectCache *cache
  145. );
  146. NSS_EXTERN PRBool
  147. nssTokenObjectCache_HaveObjectClass
  148. (
  149. nssTokenObjectCache *cache,
  150. CK_OBJECT_CLASS objclass
  151. );
  152. NSS_EXTERN nssCryptokiObject **
  153. nssTokenObjectCache_FindObjectsByTemplate
  154. (
  155. nssTokenObjectCache *cache,
  156. CK_OBJECT_CLASS objclass,
  157. CK_ATTRIBUTE_PTR otemplate,
  158. CK_ULONG otlen,
  159. PRUint32 maximumOpt,
  160. PRStatus *statusOpt
  161. );
  162. NSS_EXTERN PRStatus
  163. nssTokenObjectCache_GetObjectAttributes
  164. (
  165. nssTokenObjectCache *cache,
  166. NSSArena *arenaOpt,
  167. nssCryptokiObject *object,
  168. CK_OBJECT_CLASS objclass,
  169. CK_ATTRIBUTE_PTR atemplate,
  170. CK_ULONG atlen
  171. );
  172. NSS_EXTERN PRStatus
  173. nssTokenObjectCache_ImportObject
  174. (
  175. nssTokenObjectCache *cache,
  176. nssCryptokiObject *object,
  177. CK_OBJECT_CLASS objclass,
  178. CK_ATTRIBUTE_PTR ot,
  179. CK_ULONG otlen
  180. );
  181. NSS_EXTERN void
  182. nssTokenObjectCache_RemoveObject
  183. (
  184. nssTokenObjectCache *cache,
  185. nssCryptokiObject *object
  186. );
  187. /* XXX allows peek back into token */
  188. NSS_EXTERN PRStatus
  189. nssToken_GetCachedObjectAttributes
  190. (
  191. NSSToken *token,
  192. NSSArena *arenaOpt,
  193. nssCryptokiObject *object,
  194. CK_OBJECT_CLASS objclass,
  195. CK_ATTRIBUTE_PTR atemplate,
  196. CK_ULONG atlen
  197. );
  198. /* PKCS#11 stores strings in a fixed-length buffer padded with spaces. This
  199. * function gets the length of the actual string.
  200. */
  201. NSS_EXTERN PRUint32
  202. nssPKCS11String_Length
  203. (
  204. CK_CHAR *pkcs11str,
  205. PRUint32 bufLen
  206. );
  207. PR_END_EXTERN_C
  208. #endif /* DEV_H */