PageRenderTime 259ms CodeModel.GetById 111ms app.highlight 10ms RepoModel.GetById 101ms app.codeStats 34ms

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