| File: | root/firefox-clang/security/nss/lib/pk11wrap/secmodti.h |
| Warning: | line 29, column 8 Excessive padding in 'struct PK11SlotInfoStr' (32 padding bytes, where 0 is optimal). Optimal fields order: functionList, module, flags, session, sessionLock, slotID, defaultFlags, freeListLock, freeSymKeysWithSessionHead, freeSymKeysHead, authTime, wrapMechanism, refKeys, mechanismList, cert_array, RSAInfoFlags, nssTokenLock, nssToken, profileList, validationFIPSFlags, tokenInfo, needTest, isPerm, isHW, isInternal, disabled, reason, readOnly, needLogin, hasRandom, defRWSession, isThreadSafe, refCount, keyCount, maxKeyCount, askpw, timeout, minPassword, maxPassword, flagState, mechanismCount, array_size, cert_count, hasRootCerts, hasRootTrust, hasRSAInfo, protectedAuthPath, isActiveCard, lastState, lastLoginCheck, profileCount, series, flagSeries, wrapKey, serial, token_name, slot_name, mechanismBits, consider reordering the fields or adding explicit padding members |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 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 | |
| 9 | #ifndef _SECMODTI_H_1 |
| 10 | #define _SECMODTI_H_1 1 |
| 11 | #include "prmon.h" |
| 12 | #include "prtypes.h" |
| 13 | #include "secmodt.h" |
| 14 | #include "pkcs11t.h" |
| 15 | |
| 16 | #include "nssdevt.h" |
| 17 | |
| 18 | /* internal data structures */ |
| 19 | |
| 20 | /* Traverse slots callback */ |
| 21 | typedef struct pk11TraverseSlotStr { |
| 22 | SECStatus (*callback)(PK11SlotInfo *, CK_OBJECT_HANDLE, void *); |
| 23 | void *callbackArg; |
| 24 | CK_ATTRIBUTE *findTemplate; |
| 25 | int templateCount; |
| 26 | } pk11TraverseSlot; |
| 27 | |
| 28 | /* represent a pkcs#11 slot reference counted. */ |
| 29 | struct PK11SlotInfoStr { |
Excessive padding in 'struct PK11SlotInfoStr' (32 padding bytes, where 0 is optimal). Optimal fields order: functionList, module, flags, session, sessionLock, slotID, defaultFlags, freeListLock, freeSymKeysWithSessionHead, freeSymKeysHead, authTime, wrapMechanism, refKeys, mechanismList, cert_array, RSAInfoFlags, nssTokenLock, nssToken, profileList, validationFIPSFlags, tokenInfo, needTest, isPerm, isHW, isInternal, disabled, reason, readOnly, needLogin, hasRandom, defRWSession, isThreadSafe, refCount, keyCount, maxKeyCount, askpw, timeout, minPassword, maxPassword, flagState, mechanismCount, array_size, cert_count, hasRootCerts, hasRootTrust, hasRSAInfo, protectedAuthPath, isActiveCard, lastState, lastLoginCheck, profileCount, series, flagSeries, wrapKey, serial, token_name, slot_name, mechanismBits, consider reordering the fields or adding explicit padding members | |
| 30 | /* the PKCS11 function list for this slot */ |
| 31 | void *functionList; |
| 32 | SECMODModule *module; /* our parent module */ |
| 33 | /* Boolean to indicate the current state of this slot */ |
| 34 | PRBool needTest; /* Has this slot been tested for Export complience */ |
| 35 | PRBool isPerm; /* is this slot a permanment device */ |
| 36 | PRBool isHW; /* is this slot a hardware device */ |
| 37 | PRBool isInternal; /* is this slot one of our internal PKCS #11 devices */ |
| 38 | PRBool disabled; /* is this slot disabled... */ |
| 39 | PK11DisableReasons reason; /* Why this slot is disabled */ |
| 40 | PRBool readOnly; /* is the token in this slot read-only */ |
| 41 | PRBool needLogin; /* does the token of the type that needs |
| 42 | * authentication (still true even if token is logged |
| 43 | * in) */ |
| 44 | PRBool hasRandom; /* can this token generated random numbers */ |
| 45 | PRBool defRWSession; /* is the default session RW (we open our default |
| 46 | * session rw if the token can only handle one session |
| 47 | * at a time. */ |
| 48 | PRBool isThreadSafe; /* copied from the module */ |
| 49 | /* The actual flags (many of which are distilled into the above PRBools) */ |
| 50 | CK_FLAGS flags; /* flags from PKCS #11 token Info */ |
| 51 | /* a default session handle to do quick and dirty functions */ |
| 52 | CK_SESSION_HANDLE session; |
| 53 | PRLock *sessionLock; /* lock for this session */ |
| 54 | /* our ID */ |
| 55 | CK_SLOT_ID slotID; |
| 56 | /* persistant flags saved from startup to startup */ |
| 57 | unsigned long defaultFlags; |
| 58 | /* keep track of who is using us so we don't accidently get freed while |
| 59 | * still in use */ |
| 60 | PRInt32 refCount; /* to be in/decremented by atomic calls ONLY! */ |
| 61 | |
| 62 | // freeListLock protects freeSymKeysWithSessionHead, freeSymKeysHead, |
| 63 | // keyCount, and maxKeyCount. |
| 64 | PRLock *freeListLock; |
| 65 | PK11SymKey *freeSymKeysWithSessionHead; |
| 66 | PK11SymKey *freeSymKeysHead; |
| 67 | int keyCount; |
| 68 | int maxKeyCount; |
| 69 | |
| 70 | /* Password control functions for this slot. many of these are only |
| 71 | * active if the appropriate flag is on in defaultFlags */ |
| 72 | int askpw; /* what our password options are */ |
| 73 | int timeout; /* If we're ask_timeout, what is our timeout time is |
| 74 | * seconds */ |
| 75 | PRTime authTime; /* when were we last authenticated */ |
| 76 | int minPassword; /* smallest legal password */ |
| 77 | int maxPassword; /* largest legal password */ |
| 78 | PRUint16 series; /* break up the slot info into various groups of |
| 79 | * inserted tokens so that keys and certs can be |
| 80 | * invalidated */ |
| 81 | PRUint16 flagSeries; /* record the last series for the last event |
| 82 | * returned for this slot */ |
| 83 | PRBool flagState; /* record the state of the last event returned for this |
| 84 | * slot. */ |
| 85 | PRUint16 wrapKey; /* current wrapping key for SSL master secrets */ |
| 86 | CK_MECHANISM_TYPE wrapMechanism; |
| 87 | /* current wrapping mechanism for current wrapKey */ |
| 88 | CK_OBJECT_HANDLE refKeys[1]; /* array of existing wrapping keys for */ |
| 89 | CK_MECHANISM_TYPE *mechanismList; /* list of mechanism supported by this |
| 90 | * token */ |
| 91 | int mechanismCount; |
| 92 | /* cache the certificates stored on the token of this slot */ |
| 93 | CERTCertificate **cert_array; |
| 94 | int array_size; |
| 95 | int cert_count; |
| 96 | char serial[16]; |
| 97 | /* since these are odd sizes, keep them last. They are odd sizes to |
| 98 | * allow them to become null terminated strings */ |
| 99 | char slot_name[65]; |
| 100 | char token_name[33]; |
| 101 | PRBool hasRootCerts; |
| 102 | PRBool hasRootTrust; |
| 103 | PRBool hasRSAInfo; |
| 104 | CK_FLAGS RSAInfoFlags; |
| 105 | PRBool protectedAuthPath; |
| 106 | PRBool isActiveCard; |
| 107 | unsigned int lastState; |
| 108 | |
| 109 | /* nssTokenLock protects nssToken and lastLoginCheck */ |
| 110 | PRLock *nssTokenLock; |
| 111 | NSSToken *nssToken; |
| 112 | PRIntervalTime lastLoginCheck; |
| 113 | |
| 114 | /* the tokeninfo struct */ |
| 115 | CK_TOKEN_INFO tokenInfo; |
| 116 | /* fast mechanism lookup */ |
| 117 | char mechanismBits[256]; |
| 118 | CK_PROFILE_ID *profileList; |
| 119 | int profileCount; |
| 120 | CK_FLAGS validationFIPSFlags; |
| 121 | }; |
| 122 | |
| 123 | /* Symetric Key structure. Reference Counted */ |
| 124 | struct PK11SymKeyStr { |
| 125 | CK_MECHANISM_TYPE type; /* type of operation this key was created for*/ |
| 126 | CK_OBJECT_HANDLE objectID; /* object id of this key in the slot */ |
| 127 | PK11SlotInfo *slot; /* Slot this key is loaded into */ |
| 128 | void *cx; /* window context in case we need to loggin */ |
| 129 | PK11SymKey *next; |
| 130 | PRBool owner; |
| 131 | SECItem data; /* raw key data if available */ |
| 132 | CK_SESSION_HANDLE session; |
| 133 | PRBool sessionOwner; |
| 134 | PRInt32 refCount; /* number of references to this key */ |
| 135 | int size; /* key size in bytes */ |
| 136 | PK11Origin origin; /* where this key came from |
| 137 | * (see def in secmodt.h) */ |
| 138 | PK11SymKey *parent; /* potential owner key of the session */ |
| 139 | PRUint16 series; /* break up the slot info into various groups |
| 140 | * of inserted tokens so that keys and certs |
| 141 | * can be invalidated */ |
| 142 | void *userData; /* random data the application can attach to |
| 143 | * this key */ |
| 144 | PK11FreeDataFunc freeFunc; /* function to free the user data */ |
| 145 | }; |
| 146 | |
| 147 | /* |
| 148 | * hold a hash, encryption or signing context for multi-part operations. |
| 149 | * hold enough information so that multiple contexts can be interleaved |
| 150 | * if necessary. ... Not RefCounted. |
| 151 | */ |
| 152 | struct PK11ContextStr { |
| 153 | CK_ATTRIBUTE_TYPE operation; /* type of operation this context is |
| 154 | * doing (CKA_ENCRYPT, CKA_SIGN, |
| 155 | * CKA_HASH, etc.) */ |
| 156 | PK11SymKey *key; /* symetric key for this context */ |
| 157 | CK_OBJECT_HANDLE objectID; /* object handle to key */ |
| 158 | PK11SlotInfo *slot; /* slot this context is using */ |
| 159 | CK_SESSION_HANDLE session; /* session this context is using */ |
| 160 | PRLock *sessionLock; /* lock before accessing a PKCS #11 |
| 161 | * session */ |
| 162 | PRBool ownSession; /* do we own the session? */ |
| 163 | void *pwArg; /* applicaton specific passwd arg */ |
| 164 | void *savedData; /* save data when we are |
| 165 | * multiplexing on a single context */ |
| 166 | unsigned long savedLength; /* length of the saved context */ |
| 167 | SECItem *param; /* mechanism parameters used to |
| 168 | * build this context */ |
| 169 | PRBool init; /* this contexted been initialized? */ |
| 170 | CK_MECHANISM_TYPE type; /* what is the PKCS #11 this context |
| 171 | * is representing (usually what |
| 172 | * algorithm is being used |
| 173 | * (CKM_RSA_PKCS, CKM_DES, CKM_SHA, |
| 174 | * etc. */ |
| 175 | PRBool fortezzaHack; /* Fortezza SSL has some special |
| 176 | * non-standard semantics*/ |
| 177 | PRBool simulate_message; /* We are initializing a message |
| 178 | * interface but the underlying |
| 179 | * PKCS #11 module does not support |
| 180 | * it. We simulate the interface with |
| 181 | * the PCKS #11 v2 interface */ |
| 182 | CK_MECHANISM_TYPE simulate_mechanism; /* The mechanism we are simulating */ |
| 183 | PRUint64 ivCounter; /* iv counter for simulated message */ |
| 184 | PRUint64 ivMaxCount; /* total number of IVs valid for |
| 185 | * this key */ |
| 186 | unsigned long ivLen; /* length of the iv in bytes */ |
| 187 | unsigned int ivFixedBits; /* number of bits not generated |
| 188 | * for the iv */ |
| 189 | CK_GENERATOR_FUNCTION ivGen; /* PKCS #11 iv generator value */ |
| 190 | }; |
| 191 | |
| 192 | /* |
| 193 | * structure to hold a pointer to a unique PKCS #11 object |
| 194 | * (pointer to the slot and the object id). |
| 195 | */ |
| 196 | struct PK11GenericObjectStr { |
| 197 | PK11GenericObject *prev; |
| 198 | PK11GenericObject *next; |
| 199 | PK11SlotInfo *slot; |
| 200 | CK_OBJECT_HANDLE objectID; |
| 201 | PRBool owner; |
| 202 | }; |
| 203 | |
| 204 | #define MAX_TEMPL_ATTRS16 16 /* maximum attributes in template */ |
| 205 | |
| 206 | /* This mask includes all CK_FLAGs with an equivalent CKA_ attribute. */ |
| 207 | #define CKF_KEY_OPERATION_FLAGS0x000e7b00UL 0x000e7b00UL |
| 208 | |
| 209 | #endif /* _SECMODTI_H_ */ |