PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/gecko_api/include/secmod.h

http://firefox-mac-pdf.googlecode.com/
C Header | 179 lines | 80 code | 24 blank | 75 comment | 0 complexity | 3f8d0dc179b8eaeed9d3cb33a80067a3 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 _SECMOD_H_
  37. #define _SEDMOD_H_
  38. #include "seccomon.h"
  39. #include "secmodt.h"
  40. #include "prinrval.h"
  41. /* These mechanisms flags are visible to all other libraries. */
  42. /* They must be converted to internal SECMOD_*_FLAG */
  43. /* if used inside the functions of the security library */
  44. #define PUBLIC_MECH_RSA_FLAG 0x00000001ul
  45. #define PUBLIC_MECH_DSA_FLAG 0x00000002ul
  46. #define PUBLIC_MECH_RC2_FLAG 0x00000004ul
  47. #define PUBLIC_MECH_RC4_FLAG 0x00000008ul
  48. #define PUBLIC_MECH_DES_FLAG 0x00000010ul
  49. #define PUBLIC_MECH_DH_FLAG 0x00000020ul
  50. #define PUBLIC_MECH_FORTEZZA_FLAG 0x00000040ul
  51. #define PUBLIC_MECH_RC5_FLAG 0x00000080ul
  52. #define PUBLIC_MECH_SHA1_FLAG 0x00000100ul
  53. #define PUBLIC_MECH_MD5_FLAG 0x00000200ul
  54. #define PUBLIC_MECH_MD2_FLAG 0x00000400ul
  55. #define PUBLIC_MECH_SSL_FLAG 0x00000800ul
  56. #define PUBLIC_MECH_TLS_FLAG 0x00001000ul
  57. #define PUBLIC_MECH_AES_FLAG 0x00002000ul
  58. #define PUBLIC_MECH_SHA256_FLAG 0x00004000ul
  59. #define PUBLIC_MECH_SHA512_FLAG 0x00008000ul
  60. #define PUBLIC_MECH_CAMELLIA_FLAG 0x00010000ul
  61. #define PUBLIC_MECH_RANDOM_FLAG 0x08000000ul
  62. #define PUBLIC_MECH_FRIENDLY_FLAG 0x10000000ul
  63. #define PUBLIC_OWN_PW_DEFAULTS 0X20000000ul
  64. #define PUBLIC_DISABLE_FLAG 0x40000000ul
  65. /* warning: reserved means reserved */
  66. #define PUBLIC_MECH_RESERVED_FLAGS 0x87FF0000ul
  67. /* These cipher flags are visible to all other libraries, */
  68. /* But they must be converted before used in functions */
  69. /* withing the security module */
  70. #define PUBLIC_CIPHER_FORTEZZA_FLAG 0x00000001ul
  71. /* warning: reserved means reserved */
  72. #define PUBLIC_CIPHER_RESERVED_FLAGS 0xFFFFFFFEul
  73. SEC_BEGIN_PROTOS
  74. /*
  75. * the following functions are going to be depricated in NSS 4.0 in
  76. * favor of the new stan functions.
  77. */
  78. /* Initialization */
  79. extern SECMODModule *SECMOD_LoadModule(char *moduleSpec,SECMODModule *parent,
  80. PRBool recurse);
  81. extern SECMODModule *SECMOD_LoadUserModule(char *moduleSpec,SECMODModule *parent,
  82. PRBool recurse);
  83. SECStatus SECMOD_UnloadUserModule(SECMODModule *mod);
  84. SECMODModule * SECMOD_CreateModule(const char *lib, const char *name,
  85. const char *param, const char *nss);
  86. /* Module Management */
  87. char **SECMOD_GetModuleSpecList(SECMODModule *module);
  88. SECStatus SECMOD_FreeModuleSpecList(SECMODModule *module,char **moduleSpecList);
  89. /* protoypes */
  90. /* Get a list of active PKCS #11 modules */
  91. extern SECMODModuleList *SECMOD_GetDefaultModuleList(void);
  92. /* Get a list of defined but not loaded PKCS #11 modules */
  93. extern SECMODModuleList *SECMOD_GetDeadModuleList(void);
  94. /* Get a list of Modules which define PKCS #11 modules to load */
  95. extern SECMODModuleList *SECMOD_GetDBModuleList(void);
  96. /* lock to protect all three module lists above */
  97. extern SECMODListLock *SECMOD_GetDefaultModuleListLock(void);
  98. extern SECStatus SECMOD_UpdateModule(SECMODModule *module);
  99. /* lock management */
  100. extern void SECMOD_GetReadLock(SECMODListLock *);
  101. extern void SECMOD_ReleaseReadLock(SECMODListLock *);
  102. /* Operate on modules by name */
  103. extern SECMODModule *SECMOD_FindModule(const char *name);
  104. extern SECStatus SECMOD_DeleteModule(const char *name, int *type);
  105. extern SECStatus SECMOD_DeleteModuleEx(const char * name,
  106. SECMODModule *mod,
  107. int *type,
  108. PRBool permdb);
  109. extern SECStatus SECMOD_DeleteInternalModule(const char *name);
  110. extern PRBool SECMOD_CanDeleteInternalModule(void);
  111. extern SECStatus SECMOD_AddNewModule(const char* moduleName,
  112. const char* dllPath,
  113. unsigned long defaultMechanismFlags,
  114. unsigned long cipherEnableFlags);
  115. extern SECStatus SECMOD_AddNewModuleEx(const char* moduleName,
  116. const char* dllPath,
  117. unsigned long defaultMechanismFlags,
  118. unsigned long cipherEnableFlags,
  119. char* modparms,
  120. char* nssparms);
  121. /* database/memory management */
  122. extern SECMODModule *SECMOD_GetInternalModule(void);
  123. extern SECMODModule *SECMOD_ReferenceModule(SECMODModule *module);
  124. extern void SECMOD_DestroyModule(SECMODModule *module);
  125. extern PK11SlotInfo *SECMOD_LookupSlot(SECMODModuleID module,
  126. unsigned long slotID);
  127. extern PK11SlotInfo *SECMOD_FindSlot(SECMODModule *module,const char *name);
  128. /* Funtion reports true if at least one of the modules */
  129. /* of modType has been installed */
  130. PRBool SECMOD_IsModulePresent( unsigned long int pubCipherEnableFlags );
  131. /* Functions used to convert between internal & public representation
  132. * of Mechanism Flags and Cipher Enable Flags */
  133. extern unsigned long SECMOD_PubMechFlagstoInternal(unsigned long publicFlags);
  134. extern unsigned long SECMOD_PubCipherFlagstoInternal(unsigned long publicFlags);
  135. PRBool SECMOD_HasRemovableSlots(SECMODModule *mod);
  136. PK11SlotInfo *SECMOD_WaitForAnyTokenEvent(SECMODModule *mod,
  137. unsigned long flags, PRIntervalTime latency);
  138. /*
  139. * Warning: the SECMOD_CancelWait function is highly destructive, potentially
  140. * finalizing the module 'mod' (causing inprogress operations to fail,
  141. * and session key material to disappear). It should only be called when
  142. * shutting down the module.
  143. */
  144. SECStatus SECMOD_CancelWait(SECMODModule *mod);
  145. /*
  146. * check to see if the module has added new slots. PKCS 11 v2.20 allows for
  147. * modules to add new slots, but never remove them. Slots not be added between
  148. * a call to C_GetSlotLlist(Flag, NULL, &count) and the corresponding
  149. * C_GetSlotList(flag, &data, &count) so that the array doesn't accidently
  150. * grow on the caller. It is permissible for the slots to increase between
  151. * corresponding calls with NULL to get the size.
  152. */
  153. SECStatus SECMOD_UpdateSlotList(SECMODModule *mod);
  154. SEC_END_PROTOS
  155. #endif