Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | #ifndef _SECMODT_H_ |
michael@0 | 5 | #define _SECMODT_H_ 1 |
michael@0 | 6 | |
michael@0 | 7 | #include "nssrwlkt.h" |
michael@0 | 8 | #include "nssilckt.h" |
michael@0 | 9 | #include "secoid.h" |
michael@0 | 10 | #include "secasn1.h" |
michael@0 | 11 | #include "pkcs11t.h" |
michael@0 | 12 | #include "utilmodt.h" |
michael@0 | 13 | |
michael@0 | 14 | SEC_BEGIN_PROTOS |
michael@0 | 15 | |
michael@0 | 16 | /* find a better home for these... */ |
michael@0 | 17 | extern const SEC_ASN1Template SECKEY_PointerToEncryptedPrivateKeyInfoTemplate[]; |
michael@0 | 18 | SEC_ASN1_CHOOSER_DECLARE(SECKEY_PointerToEncryptedPrivateKeyInfoTemplate) |
michael@0 | 19 | extern const SEC_ASN1Template SECKEY_EncryptedPrivateKeyInfoTemplate[]; |
michael@0 | 20 | SEC_ASN1_CHOOSER_DECLARE(SECKEY_EncryptedPrivateKeyInfoTemplate) |
michael@0 | 21 | extern const SEC_ASN1Template SECKEY_PrivateKeyInfoTemplate[]; |
michael@0 | 22 | SEC_ASN1_CHOOSER_DECLARE(SECKEY_PrivateKeyInfoTemplate) |
michael@0 | 23 | extern const SEC_ASN1Template SECKEY_PointerToPrivateKeyInfoTemplate[]; |
michael@0 | 24 | SEC_ASN1_CHOOSER_DECLARE(SECKEY_PointerToPrivateKeyInfoTemplate) |
michael@0 | 25 | |
michael@0 | 26 | SEC_END_PROTOS |
michael@0 | 27 | |
michael@0 | 28 | /* PKCS11 needs to be included */ |
michael@0 | 29 | typedef struct SECMODModuleStr SECMODModule; |
michael@0 | 30 | typedef struct SECMODModuleListStr SECMODModuleList; |
michael@0 | 31 | typedef NSSRWLock SECMODListLock; |
michael@0 | 32 | typedef struct PK11SlotInfoStr PK11SlotInfo; /* defined in secmodti.h */ |
michael@0 | 33 | typedef struct NSSUTILPreSlotInfoStr PK11PreSlotInfo; /* defined in secmodti.h */ |
michael@0 | 34 | typedef struct PK11SymKeyStr PK11SymKey; /* defined in secmodti.h */ |
michael@0 | 35 | typedef struct PK11ContextStr PK11Context; /* defined in secmodti.h */ |
michael@0 | 36 | typedef struct PK11SlotListStr PK11SlotList; |
michael@0 | 37 | typedef struct PK11SlotListElementStr PK11SlotListElement; |
michael@0 | 38 | typedef struct PK11RSAGenParamsStr PK11RSAGenParams; |
michael@0 | 39 | typedef unsigned long SECMODModuleID; |
michael@0 | 40 | typedef struct PK11DefaultArrayEntryStr PK11DefaultArrayEntry; |
michael@0 | 41 | typedef struct PK11GenericObjectStr PK11GenericObject; |
michael@0 | 42 | typedef void (*PK11FreeDataFunc)(void *); |
michael@0 | 43 | |
michael@0 | 44 | struct SECMODModuleStr { |
michael@0 | 45 | PLArenaPool *arena; |
michael@0 | 46 | PRBool internal; /* true of internally linked modules, false |
michael@0 | 47 | * for the loaded modules */ |
michael@0 | 48 | PRBool loaded; /* Set to true if module has been loaded */ |
michael@0 | 49 | PRBool isFIPS; /* Set to true if module is finst internal */ |
michael@0 | 50 | char *dllName; /* name of the shared library which implements |
michael@0 | 51 | * this module */ |
michael@0 | 52 | char *commonName; /* name of the module to display to the user */ |
michael@0 | 53 | void *library; /* pointer to the library. opaque. used only by |
michael@0 | 54 | * pk11load.c */ |
michael@0 | 55 | void *functionList; /* The PKCS #11 function table */ |
michael@0 | 56 | PZLock *refLock; /* only used pk11db.c */ |
michael@0 | 57 | int refCount; /* Module reference count */ |
michael@0 | 58 | PK11SlotInfo **slots; /* array of slot points attached to this mod*/ |
michael@0 | 59 | int slotCount; /* count of slot in above array */ |
michael@0 | 60 | PK11PreSlotInfo *slotInfo; /* special info about slots default settings */ |
michael@0 | 61 | int slotInfoCount; /* count */ |
michael@0 | 62 | SECMODModuleID moduleID; /* ID so we can find this module again */ |
michael@0 | 63 | PRBool isThreadSafe; |
michael@0 | 64 | unsigned long ssl[2]; /* SSL cipher enable flags */ |
michael@0 | 65 | char *libraryParams; /* Module specific parameters */ |
michael@0 | 66 | void *moduleDBFunc; /* function to return module configuration data*/ |
michael@0 | 67 | SECMODModule *parent; /* module that loaded us */ |
michael@0 | 68 | PRBool isCritical; /* This module must load successfully */ |
michael@0 | 69 | PRBool isModuleDB; /* this module has lists of PKCS #11 modules */ |
michael@0 | 70 | PRBool moduleDBOnly; /* this module only has lists of PKCS #11 modules */ |
michael@0 | 71 | int trustOrder; /* order for this module's certificate trust rollup */ |
michael@0 | 72 | int cipherOrder; /* order for cipher operations */ |
michael@0 | 73 | unsigned long evControlMask; /* control the running and shutdown of slot |
michael@0 | 74 | * events (SECMOD_WaitForAnyTokenEvent) */ |
michael@0 | 75 | CK_VERSION cryptokiVersion; /* version of this library */ |
michael@0 | 76 | }; |
michael@0 | 77 | |
michael@0 | 78 | /* evControlMask flags */ |
michael@0 | 79 | /* |
michael@0 | 80 | * These bits tell the current state of a SECMOD_WaitForAnyTokenEvent. |
michael@0 | 81 | * |
michael@0 | 82 | * SECMOD_WAIT_PKCS11_EVENT - we're waiting in the PKCS #11 module in |
michael@0 | 83 | * C_WaitForSlotEvent(). |
michael@0 | 84 | * SECMOD_WAIT_SIMULATED_EVENT - we're waiting in the NSS simulation code |
michael@0 | 85 | * which polls for token insertion and removal events. |
michael@0 | 86 | * SECMOD_END_WAIT - SECMOD_CancelWait has been called while the module is |
michael@0 | 87 | * waiting in SECMOD_WaitForAnyTokenEvent. SECMOD_WaitForAnyTokenEvent |
michael@0 | 88 | * should return immediately to it's caller. |
michael@0 | 89 | */ |
michael@0 | 90 | #define SECMOD_END_WAIT 0x01 |
michael@0 | 91 | #define SECMOD_WAIT_SIMULATED_EVENT 0x02 |
michael@0 | 92 | #define SECMOD_WAIT_PKCS11_EVENT 0x04 |
michael@0 | 93 | |
michael@0 | 94 | struct SECMODModuleListStr { |
michael@0 | 95 | SECMODModuleList *next; |
michael@0 | 96 | SECMODModule *module; |
michael@0 | 97 | }; |
michael@0 | 98 | |
michael@0 | 99 | struct PK11SlotListStr { |
michael@0 | 100 | PK11SlotListElement *head; |
michael@0 | 101 | PK11SlotListElement *tail; |
michael@0 | 102 | PZLock *lock; |
michael@0 | 103 | }; |
michael@0 | 104 | |
michael@0 | 105 | struct PK11SlotListElementStr { |
michael@0 | 106 | PK11SlotListElement *next; |
michael@0 | 107 | PK11SlotListElement *prev; |
michael@0 | 108 | PK11SlotInfo *slot; |
michael@0 | 109 | int refCount; |
michael@0 | 110 | }; |
michael@0 | 111 | |
michael@0 | 112 | struct PK11RSAGenParamsStr { |
michael@0 | 113 | int keySizeInBits; |
michael@0 | 114 | unsigned long pe; |
michael@0 | 115 | }; |
michael@0 | 116 | |
michael@0 | 117 | typedef enum { |
michael@0 | 118 | PK11CertListUnique = 0, /* get one instance of all certs */ |
michael@0 | 119 | PK11CertListUser = 1, /* get all instances of user certs */ |
michael@0 | 120 | PK11CertListRootUnique = 2, /* get one instance of CA certs without a private key. |
michael@0 | 121 | * deprecated. Use PK11CertListCAUnique |
michael@0 | 122 | */ |
michael@0 | 123 | PK11CertListCA = 3, /* get all instances of CA certs */ |
michael@0 | 124 | PK11CertListCAUnique = 4, /* get one instance of CA certs */ |
michael@0 | 125 | PK11CertListUserUnique = 5, /* get one instance of user certs */ |
michael@0 | 126 | PK11CertListAll = 6 /* get all instances of all certs */ |
michael@0 | 127 | } PK11CertListType; |
michael@0 | 128 | |
michael@0 | 129 | /* |
michael@0 | 130 | * Entry into the array which lists all the legal bits for the default flags |
michael@0 | 131 | * in the slot, their definition, and the PKCS #11 mechanism they represent. |
michael@0 | 132 | * Always statically allocated. |
michael@0 | 133 | */ |
michael@0 | 134 | struct PK11DefaultArrayEntryStr { |
michael@0 | 135 | const char *name; |
michael@0 | 136 | unsigned long flag; |
michael@0 | 137 | unsigned long mechanism; /* this is a long so we don't include the |
michael@0 | 138 | * whole pkcs 11 world to use this header */ |
michael@0 | 139 | }; |
michael@0 | 140 | |
michael@0 | 141 | /* |
michael@0 | 142 | * PK11AttrFlags |
michael@0 | 143 | * |
michael@0 | 144 | * A 32-bit bitmask of PK11_ATTR_XXX flags |
michael@0 | 145 | */ |
michael@0 | 146 | typedef PRUint32 PK11AttrFlags; |
michael@0 | 147 | |
michael@0 | 148 | /* |
michael@0 | 149 | * PK11_ATTR_XXX |
michael@0 | 150 | * |
michael@0 | 151 | * The following PK11_ATTR_XXX bitflags are used to specify |
michael@0 | 152 | * PKCS #11 object attributes that have Boolean values. Some NSS |
michael@0 | 153 | * functions have a "PK11AttrFlags attrFlags" parameter whose value |
michael@0 | 154 | * is the logical OR of these bitflags. NSS use these bitflags on |
michael@0 | 155 | * private keys or secret keys. Some of these bitflags also apply |
michael@0 | 156 | * to the public keys associated with the private keys. |
michael@0 | 157 | * |
michael@0 | 158 | * For each PKCS #11 object attribute, we need two bitflags to |
michael@0 | 159 | * specify not only "true" and "false" but also "default". For |
michael@0 | 160 | * example, PK11_ATTR_PRIVATE and PK11_ATTR_PUBLIC control the |
michael@0 | 161 | * CKA_PRIVATE attribute. If PK11_ATTR_PRIVATE is set, we add |
michael@0 | 162 | * { CKA_PRIVATE, &cktrue, sizeof(CK_BBOOL) } |
michael@0 | 163 | * to the template. If PK11_ATTR_PUBLIC is set, we add |
michael@0 | 164 | * { CKA_PRIVATE, &ckfalse, sizeof(CK_BBOOL) } |
michael@0 | 165 | * to the template. If neither flag is set, we don't add any |
michael@0 | 166 | * CKA_PRIVATE entry to the template. |
michael@0 | 167 | */ |
michael@0 | 168 | |
michael@0 | 169 | /* |
michael@0 | 170 | * Attributes for PKCS #11 storage objects, which include not only |
michael@0 | 171 | * keys but also certificates and domain parameters. |
michael@0 | 172 | */ |
michael@0 | 173 | |
michael@0 | 174 | /* |
michael@0 | 175 | * PK11_ATTR_TOKEN |
michael@0 | 176 | * PK11_ATTR_SESSION |
michael@0 | 177 | * |
michael@0 | 178 | * These two flags determine whether the object is a token or |
michael@0 | 179 | * session object. |
michael@0 | 180 | * |
michael@0 | 181 | * These two flags are related and cannot both be set. |
michael@0 | 182 | * If the PK11_ATTR_TOKEN flag is set, the object is a token |
michael@0 | 183 | * object. If the PK11_ATTR_SESSION flag is set, the object is |
michael@0 | 184 | * a session object. If neither flag is set, the object is *by |
michael@0 | 185 | * default* a session object. |
michael@0 | 186 | * |
michael@0 | 187 | * These two flags specify the value of the PKCS #11 CKA_TOKEN |
michael@0 | 188 | * attribute. |
michael@0 | 189 | */ |
michael@0 | 190 | #define PK11_ATTR_TOKEN 0x00000001L |
michael@0 | 191 | #define PK11_ATTR_SESSION 0x00000002L |
michael@0 | 192 | |
michael@0 | 193 | /* |
michael@0 | 194 | * PK11_ATTR_PRIVATE |
michael@0 | 195 | * PK11_ATTR_PUBLIC |
michael@0 | 196 | * |
michael@0 | 197 | * These two flags determine whether the object is a private or |
michael@0 | 198 | * public object. A user may not access a private object until the |
michael@0 | 199 | * user has authenticated to the token. |
michael@0 | 200 | * |
michael@0 | 201 | * These two flags are related and cannot both be set. |
michael@0 | 202 | * If the PK11_ATTR_PRIVATE flag is set, the object is a private |
michael@0 | 203 | * object. If the PK11_ATTR_PUBLIC flag is set, the object is a |
michael@0 | 204 | * public object. If neither flag is set, it is token-specific |
michael@0 | 205 | * whether the object is private or public. |
michael@0 | 206 | * |
michael@0 | 207 | * These two flags specify the value of the PKCS #11 CKA_PRIVATE |
michael@0 | 208 | * attribute. NSS only uses this attribute on private and secret |
michael@0 | 209 | * keys, so public keys created by NSS get the token-specific |
michael@0 | 210 | * default value of the CKA_PRIVATE attribute. |
michael@0 | 211 | */ |
michael@0 | 212 | #define PK11_ATTR_PRIVATE 0x00000004L |
michael@0 | 213 | #define PK11_ATTR_PUBLIC 0x00000008L |
michael@0 | 214 | |
michael@0 | 215 | /* |
michael@0 | 216 | * PK11_ATTR_MODIFIABLE |
michael@0 | 217 | * PK11_ATTR_UNMODIFIABLE |
michael@0 | 218 | * |
michael@0 | 219 | * These two flags determine whether the object is modifiable or |
michael@0 | 220 | * read-only. |
michael@0 | 221 | * |
michael@0 | 222 | * These two flags are related and cannot both be set. |
michael@0 | 223 | * If the PK11_ATTR_MODIFIABLE flag is set, the object can be |
michael@0 | 224 | * modified. If the PK11_ATTR_UNMODIFIABLE flag is set, the object |
michael@0 | 225 | * is read-only. If neither flag is set, the object is *by default* |
michael@0 | 226 | * modifiable. |
michael@0 | 227 | * |
michael@0 | 228 | * These two flags specify the value of the PKCS #11 CKA_MODIFIABLE |
michael@0 | 229 | * attribute. |
michael@0 | 230 | */ |
michael@0 | 231 | #define PK11_ATTR_MODIFIABLE 0x00000010L |
michael@0 | 232 | #define PK11_ATTR_UNMODIFIABLE 0x00000020L |
michael@0 | 233 | |
michael@0 | 234 | /* Attributes for PKCS #11 key objects. */ |
michael@0 | 235 | |
michael@0 | 236 | /* |
michael@0 | 237 | * PK11_ATTR_SENSITIVE |
michael@0 | 238 | * PK11_ATTR_INSENSITIVE |
michael@0 | 239 | * |
michael@0 | 240 | * These two flags are related and cannot both be set. |
michael@0 | 241 | * If the PK11_ATTR_SENSITIVE flag is set, the key is sensitive. |
michael@0 | 242 | * If the PK11_ATTR_INSENSITIVE flag is set, the key is not |
michael@0 | 243 | * sensitive. If neither flag is set, it is token-specific whether |
michael@0 | 244 | * the key is sensitive or not. |
michael@0 | 245 | * |
michael@0 | 246 | * If a key is sensitive, certain attributes of the key cannot be |
michael@0 | 247 | * revealed in plaintext outside the token. |
michael@0 | 248 | * |
michael@0 | 249 | * This flag specifies the value of the PKCS #11 CKA_SENSITIVE |
michael@0 | 250 | * attribute. Although the default value of the CKA_SENSITIVE |
michael@0 | 251 | * attribute for secret keys is CK_FALSE per PKCS #11, some FIPS |
michael@0 | 252 | * tokens set the default value to CK_TRUE because only CK_TRUE |
michael@0 | 253 | * is allowed. So in practice the default value of this attribute |
michael@0 | 254 | * is token-specific, hence the need for two bitflags. |
michael@0 | 255 | */ |
michael@0 | 256 | #define PK11_ATTR_SENSITIVE 0x00000040L |
michael@0 | 257 | #define PK11_ATTR_INSENSITIVE 0x00000080L |
michael@0 | 258 | |
michael@0 | 259 | /* |
michael@0 | 260 | * PK11_ATTR_EXTRACTABLE |
michael@0 | 261 | * PK11_ATTR_UNEXTRACTABLE |
michael@0 | 262 | * |
michael@0 | 263 | * These two flags are related and cannot both be set. |
michael@0 | 264 | * If the PK11_ATTR_EXTRACTABLE flag is set, the key is extractable |
michael@0 | 265 | * and can be wrapped. If the PK11_ATTR_UNEXTRACTABLE flag is set, |
michael@0 | 266 | * the key is not extractable, and certain attributes of the key |
michael@0 | 267 | * cannot be revealed in plaintext outside the token (just like a |
michael@0 | 268 | * sensitive key). If neither flag is set, it is token-specific |
michael@0 | 269 | * whether the key is extractable or not. |
michael@0 | 270 | * |
michael@0 | 271 | * These two flags specify the value of the PKCS #11 CKA_EXTRACTABLE |
michael@0 | 272 | * attribute. |
michael@0 | 273 | */ |
michael@0 | 274 | #define PK11_ATTR_EXTRACTABLE 0x00000100L |
michael@0 | 275 | #define PK11_ATTR_UNEXTRACTABLE 0x00000200L |
michael@0 | 276 | |
michael@0 | 277 | /* Cryptographic module types */ |
michael@0 | 278 | #define SECMOD_EXTERNAL 0 /* external module */ |
michael@0 | 279 | #define SECMOD_INTERNAL 1 /* internal default module */ |
michael@0 | 280 | #define SECMOD_FIPS 2 /* internal fips module */ |
michael@0 | 281 | |
michael@0 | 282 | /* default module configuration strings */ |
michael@0 | 283 | #define SECMOD_SLOT_FLAGS "slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]" |
michael@0 | 284 | |
michael@0 | 285 | #define SECMOD_MAKE_NSS_FLAGS(fips,slot) \ |
michael@0 | 286 | "Flags=internal,critical" fips " slotparams=(" #slot "={" SECMOD_SLOT_FLAGS "})" |
michael@0 | 287 | |
michael@0 | 288 | #define SECMOD_INT_NAME "NSS Internal PKCS #11 Module" |
michael@0 | 289 | #define SECMOD_INT_FLAGS SECMOD_MAKE_NSS_FLAGS("",1) |
michael@0 | 290 | #define SECMOD_FIPS_NAME "NSS Internal FIPS PKCS #11 Module" |
michael@0 | 291 | #define SECMOD_FIPS_FLAGS SECMOD_MAKE_NSS_FLAGS(",fips",3) |
michael@0 | 292 | |
michael@0 | 293 | /* |
michael@0 | 294 | * What is the origin of a given Key. Normally this doesn't matter, but |
michael@0 | 295 | * the fortezza code needs to know if it needs to invoke the SSL3 fortezza |
michael@0 | 296 | * hack. |
michael@0 | 297 | */ |
michael@0 | 298 | typedef enum { |
michael@0 | 299 | PK11_OriginNULL = 0, /* There is not key, it's a null SymKey */ |
michael@0 | 300 | PK11_OriginDerive = 1, /* Key was derived from some other key */ |
michael@0 | 301 | PK11_OriginGenerated = 2, /* Key was generated (also PBE keys) */ |
michael@0 | 302 | PK11_OriginFortezzaHack = 3,/* Key was marked for fortezza hack */ |
michael@0 | 303 | PK11_OriginUnwrap = 4 /* Key was unwrapped or decrypted */ |
michael@0 | 304 | } PK11Origin; |
michael@0 | 305 | |
michael@0 | 306 | /* PKCS #11 disable reasons */ |
michael@0 | 307 | typedef enum { |
michael@0 | 308 | PK11_DIS_NONE = 0, |
michael@0 | 309 | PK11_DIS_USER_SELECTED = 1, |
michael@0 | 310 | PK11_DIS_COULD_NOT_INIT_TOKEN = 2, |
michael@0 | 311 | PK11_DIS_TOKEN_VERIFY_FAILED = 3, |
michael@0 | 312 | PK11_DIS_TOKEN_NOT_PRESENT = 4 |
michael@0 | 313 | } PK11DisableReasons; |
michael@0 | 314 | |
michael@0 | 315 | /* types of PKCS #11 objects |
michael@0 | 316 | * used to identify which NSS data structure is |
michael@0 | 317 | * passed to the PK11_Raw* functions. Types map as follows: |
michael@0 | 318 | * PK11_TypeGeneric PK11GenericObject * |
michael@0 | 319 | * PK11_TypePrivKey SECKEYPrivateKey * |
michael@0 | 320 | * PK11_TypePubKey SECKEYPublicKey * |
michael@0 | 321 | * PK11_TypeSymKey PK11SymKey * |
michael@0 | 322 | * PK11_TypeCert CERTCertificate * (currently not used). |
michael@0 | 323 | */ |
michael@0 | 324 | typedef enum { |
michael@0 | 325 | PK11_TypeGeneric = 0, |
michael@0 | 326 | PK11_TypePrivKey = 1, |
michael@0 | 327 | PK11_TypePubKey = 2, |
michael@0 | 328 | PK11_TypeCert = 3, |
michael@0 | 329 | PK11_TypeSymKey = 4 |
michael@0 | 330 | } PK11ObjectType; |
michael@0 | 331 | |
michael@0 | 332 | |
michael@0 | 333 | |
michael@0 | 334 | /* function pointer type for password callback function. |
michael@0 | 335 | * This type is passed in to PK11_SetPasswordFunc() |
michael@0 | 336 | */ |
michael@0 | 337 | typedef char *(PR_CALLBACK *PK11PasswordFunc)(PK11SlotInfo *slot, PRBool retry, void *arg); |
michael@0 | 338 | typedef PRBool (PR_CALLBACK *PK11VerifyPasswordFunc)(PK11SlotInfo *slot, void *arg); |
michael@0 | 339 | typedef PRBool (PR_CALLBACK *PK11IsLoggedInFunc)(PK11SlotInfo *slot, void *arg); |
michael@0 | 340 | |
michael@0 | 341 | /* |
michael@0 | 342 | * Special strings the password callback function can return only if |
michael@0 | 343 | * the slot is an protected auth path slot. |
michael@0 | 344 | */ |
michael@0 | 345 | #define PK11_PW_RETRY "RETRY" /* an failed attempt to authenticate |
michael@0 | 346 | * has already been made, just retry |
michael@0 | 347 | * the operation */ |
michael@0 | 348 | #define PK11_PW_AUTHENTICATED "AUTH" /* a successful attempt to authenticate |
michael@0 | 349 | * has completed. Continue without |
michael@0 | 350 | * another call to C_Login */ |
michael@0 | 351 | /* All other non-null values mean that that NSS could call C_Login to force |
michael@0 | 352 | * the authentication. The following define is to aid applications in |
michael@0 | 353 | * documenting that is what it's trying to do */ |
michael@0 | 354 | #define PK11_PW_TRY "TRY" /* Default: a prompt has been presented |
michael@0 | 355 | * to the user, initiate a C_Login |
michael@0 | 356 | * to authenticate the token */ |
michael@0 | 357 | |
michael@0 | 358 | /* |
michael@0 | 359 | * PKCS #11 key structures |
michael@0 | 360 | */ |
michael@0 | 361 | |
michael@0 | 362 | /* |
michael@0 | 363 | ** Attributes |
michael@0 | 364 | */ |
michael@0 | 365 | struct SECKEYAttributeStr { |
michael@0 | 366 | SECItem attrType; |
michael@0 | 367 | SECItem **attrValue; |
michael@0 | 368 | }; |
michael@0 | 369 | typedef struct SECKEYAttributeStr SECKEYAttribute; |
michael@0 | 370 | |
michael@0 | 371 | /* |
michael@0 | 372 | ** A PKCS#8 private key info object |
michael@0 | 373 | */ |
michael@0 | 374 | struct SECKEYPrivateKeyInfoStr { |
michael@0 | 375 | PLArenaPool *arena; |
michael@0 | 376 | SECItem version; |
michael@0 | 377 | SECAlgorithmID algorithm; |
michael@0 | 378 | SECItem privateKey; |
michael@0 | 379 | SECKEYAttribute **attributes; |
michael@0 | 380 | }; |
michael@0 | 381 | typedef struct SECKEYPrivateKeyInfoStr SECKEYPrivateKeyInfo; |
michael@0 | 382 | |
michael@0 | 383 | /* |
michael@0 | 384 | ** A PKCS#8 private key info object |
michael@0 | 385 | */ |
michael@0 | 386 | struct SECKEYEncryptedPrivateKeyInfoStr { |
michael@0 | 387 | PLArenaPool *arena; |
michael@0 | 388 | SECAlgorithmID algorithm; |
michael@0 | 389 | SECItem encryptedData; |
michael@0 | 390 | }; |
michael@0 | 391 | typedef struct SECKEYEncryptedPrivateKeyInfoStr SECKEYEncryptedPrivateKeyInfo; |
michael@0 | 392 | |
michael@0 | 393 | /* |
michael@0 | 394 | * token removal detection |
michael@0 | 395 | */ |
michael@0 | 396 | typedef enum { |
michael@0 | 397 | PK11TokenNotRemovable = 0, |
michael@0 | 398 | PK11TokenPresent = 1, |
michael@0 | 399 | PK11TokenChanged = 2, |
michael@0 | 400 | PK11TokenRemoved = 3 |
michael@0 | 401 | } PK11TokenStatus; |
michael@0 | 402 | |
michael@0 | 403 | typedef enum { |
michael@0 | 404 | PK11TokenRemovedOrChangedEvent = 0, |
michael@0 | 405 | PK11TokenPresentEvent = 1 |
michael@0 | 406 | } PK11TokenEvent; |
michael@0 | 407 | |
michael@0 | 408 | /* |
michael@0 | 409 | * CRL Import Flags |
michael@0 | 410 | */ |
michael@0 | 411 | #define CRL_IMPORT_DEFAULT_OPTIONS 0x00000000 |
michael@0 | 412 | #define CRL_IMPORT_BYPASS_CHECKS 0x00000001 |
michael@0 | 413 | |
michael@0 | 414 | |
michael@0 | 415 | /* |
michael@0 | 416 | * Merge Error Log |
michael@0 | 417 | */ |
michael@0 | 418 | typedef struct PK11MergeLogStr PK11MergeLog; |
michael@0 | 419 | typedef struct PK11MergeLogNodeStr PK11MergeLogNode; |
michael@0 | 420 | |
michael@0 | 421 | /* These need to be global, leave some open fields so we can 'expand' |
michael@0 | 422 | * these without breaking binary compatibility */ |
michael@0 | 423 | struct PK11MergeLogNodeStr { |
michael@0 | 424 | PK11MergeLogNode *next; /* next entry in the list */ |
michael@0 | 425 | PK11MergeLogNode *prev; /* last entry in the list */ |
michael@0 | 426 | PK11GenericObject *object; /* object that failed */ |
michael@0 | 427 | int error; /* what the error was */ |
michael@0 | 428 | CK_RV reserved1; |
michael@0 | 429 | unsigned long reserved2; /* future flags */ |
michael@0 | 430 | unsigned long reserved3; /* future scalar */ |
michael@0 | 431 | void *reserved4; /* future pointer */ |
michael@0 | 432 | void *reserved5; /* future expansion pointer */ |
michael@0 | 433 | }; |
michael@0 | 434 | |
michael@0 | 435 | struct PK11MergeLogStr { |
michael@0 | 436 | PK11MergeLogNode *head; |
michael@0 | 437 | PK11MergeLogNode *tail; |
michael@0 | 438 | PLArenaPool *arena; |
michael@0 | 439 | int version; |
michael@0 | 440 | unsigned long reserved1; |
michael@0 | 441 | unsigned long reserved2; |
michael@0 | 442 | unsigned long reserved3; |
michael@0 | 443 | void *reserverd4; |
michael@0 | 444 | void *reserverd5; |
michael@0 | 445 | }; |
michael@0 | 446 | |
michael@0 | 447 | |
michael@0 | 448 | #endif /*_SECMODT_H_ */ |