comparison nss/lib/pk11wrap/secmodi.h @ 0:1e5118fa0cb1

This is NSS with a Cmake Buildsyste To compile a static NSS library for Windows we've used the Chromium-NSS fork and added a Cmake buildsystem to compile it statically for Windows. See README.chromium for chromium changes and README.trustbridge for our modifications.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 28 Jul 2014 10:47:06 +0200
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:1e5118fa0cb1
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
4 /*
5 * Internal header file included only by files in pkcs11 dir, or in
6 * pkcs11 specific client and server files.
7 */
8 #ifndef _SECMODI_H_
9 #define _SECMODI_H_ 1
10 #include "pkcs11.h"
11 #include "nssilock.h"
12 #include "secoidt.h"
13 #include "secdert.h"
14 #include "certt.h"
15 #include "secmodt.h"
16 #include "keyt.h"
17
18 SEC_BEGIN_PROTOS
19
20 /* proto-types */
21 extern SECStatus SECMOD_DeletePermDB(SECMODModule *module);
22 extern SECStatus SECMOD_AddPermDB(SECMODModule *module);
23 extern SECStatus SECMOD_Shutdown(void);
24 void nss_DumpModuleLog(void);
25
26 extern int secmod_PrivateModuleCount;
27
28 extern void SECMOD_Init(void);
29 SECStatus secmod_ModuleInit(SECMODModule *mod, SECMODModule **oldModule,
30 PRBool* alreadyLoaded);
31
32 /* list managment */
33 extern SECStatus SECMOD_AddModuleToList(SECMODModule *newModule);
34 extern SECStatus SECMOD_AddModuleToDBOnlyList(SECMODModule *newModule);
35 extern SECStatus SECMOD_AddModuleToUnloadList(SECMODModule *newModule);
36 extern void SECMOD_RemoveList(SECMODModuleList **,SECMODModuleList *);
37 extern void SECMOD_AddList(SECMODModuleList *,SECMODModuleList *,SECMODListLock *);
38 extern SECMODListLock *SECMOD_NewListLock(void);
39 extern void SECMOD_DestroyListLock(SECMODListLock *);
40 extern void SECMOD_GetWriteLock(SECMODListLock *);
41 extern void SECMOD_ReleaseWriteLock(SECMODListLock *);
42
43 /* Operate on modules by name */
44 extern SECMODModule *SECMOD_FindModuleByID(SECMODModuleID);
45 extern SECMODModule *secmod_FindModuleByFuncPtr(void *funcPtr);
46
47 /* database/memory management */
48 extern SECMODModuleList *SECMOD_NewModuleListElement(void);
49 extern SECMODModuleList *SECMOD_DestroyModuleListElement(SECMODModuleList *);
50 extern void SECMOD_DestroyModuleList(SECMODModuleList *);
51 extern SECStatus SECMOD_AddModule(SECMODModule *newModule);
52
53 extern unsigned long SECMOD_InternaltoPubCipherFlags(unsigned long internalFlags);
54
55 /* Library functions */
56 SECStatus secmod_LoadPKCS11Module(SECMODModule *, SECMODModule **oldModule);
57 SECStatus SECMOD_UnloadModule(SECMODModule *);
58 void SECMOD_SetInternalModule(SECMODModule *);
59 PRBool secmod_IsInternalKeySlot(SECMODModule *);
60 void secmod_SetInternalKeySlotFlag(SECMODModule *mod, PRBool val);
61
62
63 /* tools for checking if we are loading the same database twice */
64 typedef struct SECMODConfigListStr SECMODConfigList;
65 /* collect all the databases in a given spec */
66 SECMODConfigList *secmod_GetConfigList(PRBool isFIPS, char *spec, int *count);
67 /* see is a spec matches a database on the list */
68 PRBool secmod_MatchConfigList(char *spec,
69 SECMODConfigList *conflist, int count);
70 /* free our list of databases */
71 void secmod_FreeConfigList(SECMODConfigList *conflist, int count);
72
73 /* parsing parameters */
74 /* returned char * must be freed by caller with PORT_Free */
75 /* children and ids are null terminated arrays which must be freed with
76 * secmod_FreeChildren */
77 char *secmod_ParseModuleSpecForTokens(PRBool convert,
78 PRBool isFIPS,
79 char *moduleSpec,
80 char ***children,
81 CK_SLOT_ID **ids);
82 void secmod_FreeChildren(char **children, CK_SLOT_ID *ids);
83 char *secmod_MkAppendTokensList(PLArenaPool *arena, char *origModuleSpec,
84 char *newModuleSpec, CK_SLOT_ID newID,
85 char **children, CK_SLOT_ID *ids);
86
87
88 void SECMOD_SlotDestroyModule(SECMODModule *module, PRBool fromSlot);
89 CK_RV pk11_notify(CK_SESSION_HANDLE session, CK_NOTIFICATION event,
90 CK_VOID_PTR pdata);
91 void pk11_SignedToUnsigned(CK_ATTRIBUTE *attrib);
92 CK_OBJECT_HANDLE pk11_FindObjectByTemplate(PK11SlotInfo *slot,
93 CK_ATTRIBUTE *inTemplate,int tsize);
94 CK_OBJECT_HANDLE *pk11_FindObjectsByTemplate(PK11SlotInfo *slot,
95 CK_ATTRIBUTE *inTemplate,int tsize, int *objCount);
96
97 #define PK11_GETTAB(x) ((CK_FUNCTION_LIST_PTR)((x)->functionList))
98 #define PK11_SETATTRS(x,id,v,l) (x)->type = (id); \
99 (x)->pValue=(v); (x)->ulValueLen = (l);
100 SECStatus PK11_CreateNewObject(PK11SlotInfo *slot, CK_SESSION_HANDLE session,
101 const CK_ATTRIBUTE *theTemplate, int count,
102 PRBool token, CK_OBJECT_HANDLE *objectID);
103
104 SECStatus pbe_PK11AlgidToParam(SECAlgorithmID *algid,SECItem *mech);
105 SECStatus PBE_PK11ParamToAlgid(SECOidTag algTag, SECItem *param,
106 PLArenaPool *arena, SECAlgorithmID *algId);
107
108 PK11SymKey *pk11_TokenKeyGenWithFlagsAndKeyType(PK11SlotInfo *slot,
109 CK_MECHANISM_TYPE type, SECItem *param, CK_KEY_TYPE keyType,
110 int keySize, SECItem *keyId, CK_FLAGS opFlags,
111 PK11AttrFlags attrFlags, void *wincx);
112
113 CK_MECHANISM_TYPE pk11_GetPBECryptoMechanism(SECAlgorithmID *algid,
114 SECItem **param, SECItem *pwd, PRBool faulty3DES);
115
116
117
118 extern void pk11sdr_Init(void);
119 extern void pk11sdr_Shutdown(void);
120
121 /*
122 * Private to pk11wrap.
123 */
124
125 PRBool pk11_LoginStillRequired(PK11SlotInfo *slot, void *wincx);
126 CK_SESSION_HANDLE pk11_GetNewSession(PK11SlotInfo *slot, PRBool *owner);
127 void pk11_CloseSession(PK11SlotInfo *slot, CK_SESSION_HANDLE sess, PRBool own);
128 PK11SymKey *pk11_ForceSlot(PK11SymKey *symKey, CK_MECHANISM_TYPE type,
129 CK_ATTRIBUTE_TYPE operation);
130 /* Convert key operation flags to PKCS #11 attributes. */
131 unsigned int pk11_OpFlagsToAttributes(CK_FLAGS flags,
132 CK_ATTRIBUTE *attrs, CK_BBOOL *ckTrue);
133 /* Check for bad (conflicting) attribute flags */
134 PRBool pk11_BadAttrFlags(PK11AttrFlags attrFlags);
135 /* Convert key attribute flags to PKCS #11 attributes. */
136 unsigned int pk11_AttrFlagsToAttributes(PK11AttrFlags attrFlags,
137 CK_ATTRIBUTE *attrs, CK_BBOOL *ckTrue, CK_BBOOL *ckFalse);
138 PRBool pk11_FindAttrInTemplate(CK_ATTRIBUTE *attr, unsigned int numAttrs,
139 CK_ATTRIBUTE_TYPE target);
140
141 CK_MECHANISM_TYPE pk11_mapWrapKeyType(KeyType keyType);
142 PK11SymKey *pk11_KeyExchange(PK11SlotInfo *slot, CK_MECHANISM_TYPE type,
143 CK_ATTRIBUTE_TYPE operation, CK_FLAGS flags, PRBool isPerm,
144 PK11SymKey *symKey);
145
146 PRBool pk11_HandleTrustObject(PK11SlotInfo *slot, CERTCertificate *cert,
147 CERTCertTrust *trust);
148 CK_OBJECT_HANDLE pk11_FindPubKeyByAnyCert(CERTCertificate *cert,
149 PK11SlotInfo **slot, void *wincx);
150 SECStatus pk11_AuthenticateUnfriendly(PK11SlotInfo *slot, PRBool loadCerts,
151 void *wincx);
152 int PK11_NumberObjectsFor(PK11SlotInfo *slot, CK_ATTRIBUTE *findTemplate,
153 int templateCount);
154 SECItem *pk11_GetLowLevelKeyFromHandle(PK11SlotInfo *slot,
155 CK_OBJECT_HANDLE handle);
156 SECStatus PK11_TraverseSlot(PK11SlotInfo *slot, void *arg);
157 CK_OBJECT_HANDLE pk11_FindPrivateKeyFromCertID(PK11SlotInfo *slot,
158 SECItem *keyID);
159 SECKEYPrivateKey *PK11_MakePrivKey(PK11SlotInfo *slot, KeyType keyType,
160 PRBool isTemp, CK_OBJECT_HANDLE privID, void *wincx);
161 CERTCertificate *PK11_MakeCertFromHandle(PK11SlotInfo *slot,
162 CK_OBJECT_HANDLE certID, CK_ATTRIBUTE *privateLabel);
163
164 SECItem *pk11_GenerateNewParamWithKeyLen(CK_MECHANISM_TYPE type, int keyLen);
165 SECItem *pk11_ParamFromIVWithLen(CK_MECHANISM_TYPE type,
166 SECItem *iv, int keyLen);
167
168 SEC_END_PROTOS
169
170 #endif
171
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)