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 | |
michael@0 | 5 | #ifndef _PKCS11N_H_ |
michael@0 | 6 | #define _PKCS11N_H_ |
michael@0 | 7 | |
michael@0 | 8 | /* |
michael@0 | 9 | * pkcs11n.h |
michael@0 | 10 | * |
michael@0 | 11 | * This file contains the NSS-specific type definitions for Cryptoki |
michael@0 | 12 | * (PKCS#11). |
michael@0 | 13 | */ |
michael@0 | 14 | |
michael@0 | 15 | /* |
michael@0 | 16 | * NSSCK_VENDOR_NSS |
michael@0 | 17 | * |
michael@0 | 18 | * Cryptoki reserves the high half of all the number spaces for |
michael@0 | 19 | * vendor-defined use. I'd like to keep all of our NSS- |
michael@0 | 20 | * specific values together, but not in the oh-so-obvious |
michael@0 | 21 | * 0x80000001, 0x80000002, etc. area. So I've picked an offset, |
michael@0 | 22 | * and constructed values for the beginnings of our spaces. |
michael@0 | 23 | * |
michael@0 | 24 | * Note that some "historical" Netscape values don't fall within |
michael@0 | 25 | * this range. |
michael@0 | 26 | */ |
michael@0 | 27 | #define NSSCK_VENDOR_NSS 0x4E534350 /* NSCP */ |
michael@0 | 28 | |
michael@0 | 29 | /* |
michael@0 | 30 | * NSS-defined object classes |
michael@0 | 31 | * |
michael@0 | 32 | */ |
michael@0 | 33 | #define CKO_NSS (CKO_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 34 | |
michael@0 | 35 | #define CKO_NSS_CRL (CKO_NSS + 1) |
michael@0 | 36 | #define CKO_NSS_SMIME (CKO_NSS + 2) |
michael@0 | 37 | #define CKO_NSS_TRUST (CKO_NSS + 3) |
michael@0 | 38 | #define CKO_NSS_BUILTIN_ROOT_LIST (CKO_NSS + 4) |
michael@0 | 39 | #define CKO_NSS_NEWSLOT (CKO_NSS + 5) |
michael@0 | 40 | #define CKO_NSS_DELSLOT (CKO_NSS + 6) |
michael@0 | 41 | |
michael@0 | 42 | |
michael@0 | 43 | /* |
michael@0 | 44 | * NSS-defined key types |
michael@0 | 45 | * |
michael@0 | 46 | */ |
michael@0 | 47 | #define CKK_NSS (CKK_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 48 | |
michael@0 | 49 | #define CKK_NSS_PKCS8 (CKK_NSS + 1) |
michael@0 | 50 | |
michael@0 | 51 | #define CKK_NSS_JPAKE_ROUND1 (CKK_NSS + 2) |
michael@0 | 52 | #define CKK_NSS_JPAKE_ROUND2 (CKK_NSS + 3) |
michael@0 | 53 | |
michael@0 | 54 | /* |
michael@0 | 55 | * NSS-defined certificate types |
michael@0 | 56 | * |
michael@0 | 57 | */ |
michael@0 | 58 | #define CKC_NSS (CKC_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 59 | |
michael@0 | 60 | /* FAKE PKCS #11 defines */ |
michael@0 | 61 | #define CKA_DIGEST 0x81000000L |
michael@0 | 62 | #define CKA_FLAGS_ONLY 0 /* CKA_CLASS */ |
michael@0 | 63 | |
michael@0 | 64 | /* |
michael@0 | 65 | * NSS-defined object attributes |
michael@0 | 66 | * |
michael@0 | 67 | */ |
michael@0 | 68 | #define CKA_NSS (CKA_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 69 | |
michael@0 | 70 | #define CKA_NSS_URL (CKA_NSS + 1) |
michael@0 | 71 | #define CKA_NSS_EMAIL (CKA_NSS + 2) |
michael@0 | 72 | #define CKA_NSS_SMIME_INFO (CKA_NSS + 3) |
michael@0 | 73 | #define CKA_NSS_SMIME_TIMESTAMP (CKA_NSS + 4) |
michael@0 | 74 | #define CKA_NSS_PKCS8_SALT (CKA_NSS + 5) |
michael@0 | 75 | #define CKA_NSS_PASSWORD_CHECK (CKA_NSS + 6) |
michael@0 | 76 | #define CKA_NSS_EXPIRES (CKA_NSS + 7) |
michael@0 | 77 | #define CKA_NSS_KRL (CKA_NSS + 8) |
michael@0 | 78 | |
michael@0 | 79 | #define CKA_NSS_PQG_COUNTER (CKA_NSS + 20) |
michael@0 | 80 | #define CKA_NSS_PQG_SEED (CKA_NSS + 21) |
michael@0 | 81 | #define CKA_NSS_PQG_H (CKA_NSS + 22) |
michael@0 | 82 | #define CKA_NSS_PQG_SEED_BITS (CKA_NSS + 23) |
michael@0 | 83 | #define CKA_NSS_MODULE_SPEC (CKA_NSS + 24) |
michael@0 | 84 | #define CKA_NSS_OVERRIDE_EXTENSIONS (CKA_NSS + 25) |
michael@0 | 85 | |
michael@0 | 86 | #define CKA_NSS_JPAKE_SIGNERID (CKA_NSS + 26) |
michael@0 | 87 | #define CKA_NSS_JPAKE_PEERID (CKA_NSS + 27) |
michael@0 | 88 | #define CKA_NSS_JPAKE_GX1 (CKA_NSS + 28) |
michael@0 | 89 | #define CKA_NSS_JPAKE_GX2 (CKA_NSS + 29) |
michael@0 | 90 | #define CKA_NSS_JPAKE_GX3 (CKA_NSS + 30) |
michael@0 | 91 | #define CKA_NSS_JPAKE_GX4 (CKA_NSS + 31) |
michael@0 | 92 | #define CKA_NSS_JPAKE_X2 (CKA_NSS + 32) |
michael@0 | 93 | #define CKA_NSS_JPAKE_X2S (CKA_NSS + 33) |
michael@0 | 94 | |
michael@0 | 95 | /* |
michael@0 | 96 | * Trust attributes: |
michael@0 | 97 | * |
michael@0 | 98 | * If trust goes standard, these probably will too. So I'll |
michael@0 | 99 | * put them all in one place. |
michael@0 | 100 | */ |
michael@0 | 101 | |
michael@0 | 102 | #define CKA_TRUST (CKA_NSS + 0x2000) |
michael@0 | 103 | |
michael@0 | 104 | /* "Usage" key information */ |
michael@0 | 105 | #define CKA_TRUST_DIGITAL_SIGNATURE (CKA_TRUST + 1) |
michael@0 | 106 | #define CKA_TRUST_NON_REPUDIATION (CKA_TRUST + 2) |
michael@0 | 107 | #define CKA_TRUST_KEY_ENCIPHERMENT (CKA_TRUST + 3) |
michael@0 | 108 | #define CKA_TRUST_DATA_ENCIPHERMENT (CKA_TRUST + 4) |
michael@0 | 109 | #define CKA_TRUST_KEY_AGREEMENT (CKA_TRUST + 5) |
michael@0 | 110 | #define CKA_TRUST_KEY_CERT_SIGN (CKA_TRUST + 6) |
michael@0 | 111 | #define CKA_TRUST_CRL_SIGN (CKA_TRUST + 7) |
michael@0 | 112 | |
michael@0 | 113 | /* "Purpose" trust information */ |
michael@0 | 114 | #define CKA_TRUST_SERVER_AUTH (CKA_TRUST + 8) |
michael@0 | 115 | #define CKA_TRUST_CLIENT_AUTH (CKA_TRUST + 9) |
michael@0 | 116 | #define CKA_TRUST_CODE_SIGNING (CKA_TRUST + 10) |
michael@0 | 117 | #define CKA_TRUST_EMAIL_PROTECTION (CKA_TRUST + 11) |
michael@0 | 118 | #define CKA_TRUST_IPSEC_END_SYSTEM (CKA_TRUST + 12) |
michael@0 | 119 | #define CKA_TRUST_IPSEC_TUNNEL (CKA_TRUST + 13) |
michael@0 | 120 | #define CKA_TRUST_IPSEC_USER (CKA_TRUST + 14) |
michael@0 | 121 | #define CKA_TRUST_TIME_STAMPING (CKA_TRUST + 15) |
michael@0 | 122 | #define CKA_TRUST_STEP_UP_APPROVED (CKA_TRUST + 16) |
michael@0 | 123 | |
michael@0 | 124 | #define CKA_CERT_SHA1_HASH (CKA_TRUST + 100) |
michael@0 | 125 | #define CKA_CERT_MD5_HASH (CKA_TRUST + 101) |
michael@0 | 126 | |
michael@0 | 127 | /* NSS trust stuff */ |
michael@0 | 128 | |
michael@0 | 129 | /* HISTORICAL: define used to pass in the database key for DSA private keys */ |
michael@0 | 130 | #define CKA_NETSCAPE_DB 0xD5A0DB00L |
michael@0 | 131 | #define CKA_NETSCAPE_TRUST 0x80000001L |
michael@0 | 132 | |
michael@0 | 133 | /* FAKE PKCS #11 defines */ |
michael@0 | 134 | #define CKM_FAKE_RANDOM 0x80000efeUL |
michael@0 | 135 | #define CKM_INVALID_MECHANISM 0xffffffffUL |
michael@0 | 136 | |
michael@0 | 137 | /* |
michael@0 | 138 | * NSS-defined crypto mechanisms |
michael@0 | 139 | * |
michael@0 | 140 | */ |
michael@0 | 141 | #define CKM_NSS (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 142 | |
michael@0 | 143 | #define CKM_NSS_AES_KEY_WRAP (CKM_NSS + 1) |
michael@0 | 144 | #define CKM_NSS_AES_KEY_WRAP_PAD (CKM_NSS + 2) |
michael@0 | 145 | |
michael@0 | 146 | /* HKDF key derivation mechanisms. See CK_NSS_HKDFParams for documentation. */ |
michael@0 | 147 | #define CKM_NSS_HKDF_SHA1 (CKM_NSS + 3) |
michael@0 | 148 | #define CKM_NSS_HKDF_SHA256 (CKM_NSS + 4) |
michael@0 | 149 | #define CKM_NSS_HKDF_SHA384 (CKM_NSS + 5) |
michael@0 | 150 | #define CKM_NSS_HKDF_SHA512 (CKM_NSS + 6) |
michael@0 | 151 | |
michael@0 | 152 | /* J-PAKE round 1 key generation mechanisms. |
michael@0 | 153 | * |
michael@0 | 154 | * Required template attributes: CKA_PRIME, CKA_SUBPRIME, CKA_BASE, |
michael@0 | 155 | * CKA_NSS_JPAKE_SIGNERID |
michael@0 | 156 | * Output key type: CKK_NSS_JPAKE_ROUND1 |
michael@0 | 157 | * Output key class: CKO_PRIVATE_KEY |
michael@0 | 158 | * Parameter type: CK_NSS_JPAKERound1Params |
michael@0 | 159 | * |
michael@0 | 160 | */ |
michael@0 | 161 | #define CKM_NSS_JPAKE_ROUND1_SHA1 (CKM_NSS + 7) |
michael@0 | 162 | #define CKM_NSS_JPAKE_ROUND1_SHA256 (CKM_NSS + 8) |
michael@0 | 163 | #define CKM_NSS_JPAKE_ROUND1_SHA384 (CKM_NSS + 9) |
michael@0 | 164 | #define CKM_NSS_JPAKE_ROUND1_SHA512 (CKM_NSS + 10) |
michael@0 | 165 | |
michael@0 | 166 | /* J-PAKE round 2 key derivation mechanisms. |
michael@0 | 167 | * |
michael@0 | 168 | * Required template attributes: CKA_NSS_JPAKE_PEERID |
michael@0 | 169 | * Input key type: CKK_NSS_JPAKE_ROUND1 |
michael@0 | 170 | * Output key type: CKK_NSS_JPAKE_ROUND2 |
michael@0 | 171 | * Output key class: CKO_PRIVATE_KEY |
michael@0 | 172 | * Parameter type: CK_NSS_JPAKERound2Params |
michael@0 | 173 | */ |
michael@0 | 174 | #define CKM_NSS_JPAKE_ROUND2_SHA1 (CKM_NSS + 11) |
michael@0 | 175 | #define CKM_NSS_JPAKE_ROUND2_SHA256 (CKM_NSS + 12) |
michael@0 | 176 | #define CKM_NSS_JPAKE_ROUND2_SHA384 (CKM_NSS + 13) |
michael@0 | 177 | #define CKM_NSS_JPAKE_ROUND2_SHA512 (CKM_NSS + 14) |
michael@0 | 178 | |
michael@0 | 179 | /* J-PAKE final key material derivation mechanisms |
michael@0 | 180 | * |
michael@0 | 181 | * Input key type: CKK_NSS_JPAKE_ROUND2 |
michael@0 | 182 | * Output key type: CKK_GENERIC_SECRET |
michael@0 | 183 | * Output key class: CKO_SECRET_KEY |
michael@0 | 184 | * Parameter type: CK_NSS_JPAKEFinalParams |
michael@0 | 185 | * |
michael@0 | 186 | * You must apply a KDF (e.g. CKM_NSS_HKDF_*) to resultant keying material |
michael@0 | 187 | * to get a key with uniformly distributed bits. |
michael@0 | 188 | */ |
michael@0 | 189 | #define CKM_NSS_JPAKE_FINAL_SHA1 (CKM_NSS + 15) |
michael@0 | 190 | #define CKM_NSS_JPAKE_FINAL_SHA256 (CKM_NSS + 16) |
michael@0 | 191 | #define CKM_NSS_JPAKE_FINAL_SHA384 (CKM_NSS + 17) |
michael@0 | 192 | #define CKM_NSS_JPAKE_FINAL_SHA512 (CKM_NSS + 18) |
michael@0 | 193 | |
michael@0 | 194 | /* Constant-time MAC mechanisms: |
michael@0 | 195 | * |
michael@0 | 196 | * These operations verify a padded, MAC-then-encrypt block of data in |
michael@0 | 197 | * constant-time. Because of the order of operations, the padding bytes are not |
michael@0 | 198 | * protected by the MAC. However, disclosing the value of the padding bytes |
michael@0 | 199 | * gives an attacker the ability to decrypt ciphertexts. Such disclosure can be |
michael@0 | 200 | * as subtle as taking slightly less time to perform the MAC when the padding |
michael@0 | 201 | * is one byte longer. See https://www.isg.rhul.ac.uk/tls/ |
michael@0 | 202 | * |
michael@0 | 203 | * CKM_NSS_HMAC_CONSTANT_TIME: performs an HMAC authentication. |
michael@0 | 204 | * CKM_NSS_SSL3_MAC_CONSTANT_TIME: performs an authentication with SSLv3 MAC. |
michael@0 | 205 | * |
michael@0 | 206 | * Parameter type: CK_NSS_MAC_CONSTANT_TIME_PARAMS |
michael@0 | 207 | */ |
michael@0 | 208 | #define CKM_NSS_HMAC_CONSTANT_TIME (CKM_NSS + 19) |
michael@0 | 209 | #define CKM_NSS_SSL3_MAC_CONSTANT_TIME (CKM_NSS + 20) |
michael@0 | 210 | |
michael@0 | 211 | /* TLS 1.2 mechanisms */ |
michael@0 | 212 | #define CKM_NSS_TLS_PRF_GENERAL_SHA256 (CKM_NSS + 21) |
michael@0 | 213 | #define CKM_NSS_TLS_MASTER_KEY_DERIVE_SHA256 (CKM_NSS + 22) |
michael@0 | 214 | #define CKM_NSS_TLS_KEY_AND_MAC_DERIVE_SHA256 (CKM_NSS + 23) |
michael@0 | 215 | #define CKM_NSS_TLS_MASTER_KEY_DERIVE_DH_SHA256 (CKM_NSS + 24) |
michael@0 | 216 | |
michael@0 | 217 | /* |
michael@0 | 218 | * HISTORICAL: |
michael@0 | 219 | * Do not attempt to use these. They are only used by NETSCAPE's internal |
michael@0 | 220 | * PKCS #11 interface. Most of these are place holders for other mechanism |
michael@0 | 221 | * and will change in the future. |
michael@0 | 222 | */ |
michael@0 | 223 | #define CKM_NETSCAPE_PBE_SHA1_DES_CBC 0x80000002UL |
michael@0 | 224 | #define CKM_NETSCAPE_PBE_SHA1_TRIPLE_DES_CBC 0x80000003UL |
michael@0 | 225 | #define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC2_CBC 0x80000004UL |
michael@0 | 226 | #define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC2_CBC 0x80000005UL |
michael@0 | 227 | #define CKM_NETSCAPE_PBE_SHA1_40_BIT_RC4 0x80000006UL |
michael@0 | 228 | #define CKM_NETSCAPE_PBE_SHA1_128_BIT_RC4 0x80000007UL |
michael@0 | 229 | #define CKM_NETSCAPE_PBE_SHA1_FAULTY_3DES_CBC 0x80000008UL |
michael@0 | 230 | #define CKM_NETSCAPE_PBE_SHA1_HMAC_KEY_GEN 0x80000009UL |
michael@0 | 231 | #define CKM_NETSCAPE_PBE_MD5_HMAC_KEY_GEN 0x8000000aUL |
michael@0 | 232 | #define CKM_NETSCAPE_PBE_MD2_HMAC_KEY_GEN 0x8000000bUL |
michael@0 | 233 | |
michael@0 | 234 | #define CKM_TLS_PRF_GENERAL 0x80000373UL |
michael@0 | 235 | |
michael@0 | 236 | typedef struct CK_NSS_JPAKEPublicValue { |
michael@0 | 237 | CK_BYTE * pGX; |
michael@0 | 238 | CK_ULONG ulGXLen; |
michael@0 | 239 | CK_BYTE * pGV; |
michael@0 | 240 | CK_ULONG ulGVLen; |
michael@0 | 241 | CK_BYTE * pR; |
michael@0 | 242 | CK_ULONG ulRLen; |
michael@0 | 243 | } CK_NSS_JPAKEPublicValue; |
michael@0 | 244 | |
michael@0 | 245 | typedef struct CK_NSS_JPAKERound1Params { |
michael@0 | 246 | CK_NSS_JPAKEPublicValue gx1; /* out */ |
michael@0 | 247 | CK_NSS_JPAKEPublicValue gx2; /* out */ |
michael@0 | 248 | } CK_NSS_JPAKERound1Params; |
michael@0 | 249 | |
michael@0 | 250 | typedef struct CK_NSS_JPAKERound2Params { |
michael@0 | 251 | CK_BYTE * pSharedKey; /* in */ |
michael@0 | 252 | CK_ULONG ulSharedKeyLen; /* in */ |
michael@0 | 253 | CK_NSS_JPAKEPublicValue gx3; /* in */ |
michael@0 | 254 | CK_NSS_JPAKEPublicValue gx4; /* in */ |
michael@0 | 255 | CK_NSS_JPAKEPublicValue A; /* out */ |
michael@0 | 256 | } CK_NSS_JPAKERound2Params; |
michael@0 | 257 | |
michael@0 | 258 | typedef struct CK_NSS_JPAKEFinalParams { |
michael@0 | 259 | CK_NSS_JPAKEPublicValue B; /* in */ |
michael@0 | 260 | } CK_NSS_JPAKEFinalParams; |
michael@0 | 261 | |
michael@0 | 262 | /* macAlg: the MAC algorithm to use. This determines the hash function used in |
michael@0 | 263 | * the HMAC/SSLv3 MAC calculations. |
michael@0 | 264 | * ulBodyTotalLen: the total length of the data, including padding bytes and |
michael@0 | 265 | * padding length. |
michael@0 | 266 | * pHeader: points to a block of data that contains additional data to |
michael@0 | 267 | * authenticate. For TLS this includes the sequence number etc. For SSLv3, |
michael@0 | 268 | * this also includes the initial padding bytes. |
michael@0 | 269 | * |
michael@0 | 270 | * NOTE: the softoken's implementation of CKM_NSS_HMAC_CONSTANT_TIME and |
michael@0 | 271 | * CKM_NSS_SSL3_MAC_CONSTANT_TIME requires that the sum of ulBodyTotalLen |
michael@0 | 272 | * and ulHeaderLen be much smaller than 2^32 / 8 bytes because it uses an |
michael@0 | 273 | * unsigned int variable to represent the length in bits. This should not |
michael@0 | 274 | * be a problem because the SSL/TLS protocol limits the size of an SSL |
michael@0 | 275 | * record to something considerably less than 2^32 bytes. |
michael@0 | 276 | */ |
michael@0 | 277 | typedef struct CK_NSS_MAC_CONSTANT_TIME_PARAMS { |
michael@0 | 278 | CK_MECHANISM_TYPE macAlg; /* in */ |
michael@0 | 279 | CK_ULONG ulBodyTotalLen; /* in */ |
michael@0 | 280 | CK_BYTE * pHeader; /* in */ |
michael@0 | 281 | CK_ULONG ulHeaderLen; /* in */ |
michael@0 | 282 | } CK_NSS_MAC_CONSTANT_TIME_PARAMS; |
michael@0 | 283 | |
michael@0 | 284 | /* |
michael@0 | 285 | * NSS-defined return values |
michael@0 | 286 | * |
michael@0 | 287 | */ |
michael@0 | 288 | #define CKR_NSS (CKM_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 289 | |
michael@0 | 290 | #define CKR_NSS_CERTDB_FAILED (CKR_NSS + 1) |
michael@0 | 291 | #define CKR_NSS_KEYDB_FAILED (CKR_NSS + 2) |
michael@0 | 292 | |
michael@0 | 293 | /* Mandatory parameter for the CKM_NSS_HKDF_* key deriviation mechanisms. |
michael@0 | 294 | See RFC 5869. |
michael@0 | 295 | |
michael@0 | 296 | bExtract: If set, HKDF-Extract will be applied to the input key. If |
michael@0 | 297 | the optional salt is given, it is used; otherwise, the salt is |
michael@0 | 298 | set to a sequence of zeros equal in length to the HMAC output. |
michael@0 | 299 | If bExpand is not set, then the key template given to |
michael@0 | 300 | C_DeriveKey must indicate an output key size less than or equal |
michael@0 | 301 | to the output size of the HMAC. |
michael@0 | 302 | |
michael@0 | 303 | bExpand: If set, HKDF-Expand will be applied to the input key (if |
michael@0 | 304 | bExtract is not set) or to the result of HKDF-Extract (if |
michael@0 | 305 | bExtract is set). Any info given in the optional pInfo field will |
michael@0 | 306 | be included in the calculation. |
michael@0 | 307 | |
michael@0 | 308 | The size of the output key must be specified in the template passed to |
michael@0 | 309 | C_DeriveKey. |
michael@0 | 310 | */ |
michael@0 | 311 | typedef struct CK_NSS_HKDFParams { |
michael@0 | 312 | CK_BBOOL bExtract; |
michael@0 | 313 | CK_BYTE_PTR pSalt; |
michael@0 | 314 | CK_ULONG ulSaltLen; |
michael@0 | 315 | CK_BBOOL bExpand; |
michael@0 | 316 | CK_BYTE_PTR pInfo; |
michael@0 | 317 | CK_ULONG ulInfoLen; |
michael@0 | 318 | } CK_NSS_HKDFParams; |
michael@0 | 319 | |
michael@0 | 320 | /* |
michael@0 | 321 | * Trust info |
michael@0 | 322 | * |
michael@0 | 323 | * This isn't part of the Cryptoki standard (yet), so I'm putting |
michael@0 | 324 | * all the definitions here. Some of this would move to nssckt.h |
michael@0 | 325 | * if trust info were made part of the standard. In view of this |
michael@0 | 326 | * possibility, I'm putting my (NSS) values in the NSS |
michael@0 | 327 | * vendor space, like everything else. |
michael@0 | 328 | */ |
michael@0 | 329 | |
michael@0 | 330 | typedef CK_ULONG CK_TRUST; |
michael@0 | 331 | |
michael@0 | 332 | /* The following trust types are defined: */ |
michael@0 | 333 | #define CKT_VENDOR_DEFINED 0x80000000 |
michael@0 | 334 | |
michael@0 | 335 | #define CKT_NSS (CKT_VENDOR_DEFINED|NSSCK_VENDOR_NSS) |
michael@0 | 336 | |
michael@0 | 337 | /* If trust goes standard, these'll probably drop out of vendor space. */ |
michael@0 | 338 | #define CKT_NSS_TRUSTED (CKT_NSS + 1) |
michael@0 | 339 | #define CKT_NSS_TRUSTED_DELEGATOR (CKT_NSS + 2) |
michael@0 | 340 | #define CKT_NSS_MUST_VERIFY_TRUST (CKT_NSS + 3) |
michael@0 | 341 | #define CKT_NSS_NOT_TRUSTED (CKT_NSS + 10) |
michael@0 | 342 | #define CKT_NSS_TRUST_UNKNOWN (CKT_NSS + 5) /* default */ |
michael@0 | 343 | |
michael@0 | 344 | /* |
michael@0 | 345 | * These may well remain NSS-specific; I'm only using them |
michael@0 | 346 | * to cache resolution data. |
michael@0 | 347 | */ |
michael@0 | 348 | #define CKT_NSS_VALID_DELEGATOR (CKT_NSS + 11) |
michael@0 | 349 | |
michael@0 | 350 | |
michael@0 | 351 | /* |
michael@0 | 352 | * old definitions. They still exist, but the plain meaning of the |
michael@0 | 353 | * labels have never been accurate to what was really implemented. |
michael@0 | 354 | * The new labels correctly reflect what the values effectively mean. |
michael@0 | 355 | */ |
michael@0 | 356 | #if defined(__GNUC__) && (__GNUC__ > 3) |
michael@0 | 357 | /* make GCC warn when we use these #defines */ |
michael@0 | 358 | /* |
michael@0 | 359 | * This is really painful because GCC doesn't allow us to mark random |
michael@0 | 360 | * #defines as deprecated. We can only mark the following: |
michael@0 | 361 | * functions, variables, and types. |
michael@0 | 362 | * const variables will create extra storage for everyone including this |
michael@0 | 363 | * header file, so it's undesirable. |
michael@0 | 364 | * functions could be inlined to prevent storage creation, but will fail |
michael@0 | 365 | * when constant values are expected (like switch statements). |
michael@0 | 366 | * enum types do not seem to pay attention to the deprecated attribute. |
michael@0 | 367 | * |
michael@0 | 368 | * That leaves typedefs. We declare new types that we then deprecate, then |
michael@0 | 369 | * cast the resulting value to the deprecated type in the #define, thus |
michael@0 | 370 | * producting the warning when the #define is used. |
michael@0 | 371 | */ |
michael@0 | 372 | #if (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) |
michael@0 | 373 | /* The mac doesn't like the friendlier deprecate messages. I'm assuming this |
michael@0 | 374 | * is a gcc version issue rather than mac or ppc specific */ |
michael@0 | 375 | typedef CK_TRUST __CKT_NSS_UNTRUSTED __attribute__((deprecated)); |
michael@0 | 376 | typedef CK_TRUST __CKT_NSS_VALID __attribute__ ((deprecated)); |
michael@0 | 377 | typedef CK_TRUST __CKT_NSS_MUST_VERIFY __attribute__((deprecated)); |
michael@0 | 378 | #else |
michael@0 | 379 | /* when possible, get a full deprecation warning. This works on gcc 4.5 |
michael@0 | 380 | * it may work on earlier versions of gcc */ |
michael@0 | 381 | typedef CK_TRUST __CKT_NSS_UNTRUSTED __attribute__((deprecated |
michael@0 | 382 | ("CKT_NSS_UNTRUSTED really means CKT_NSS_MUST_VERIFY_TRUST"))); |
michael@0 | 383 | typedef CK_TRUST __CKT_NSS_VALID __attribute__ ((deprecated |
michael@0 | 384 | ("CKT_NSS_VALID really means CKT_NSS_NOT_TRUSTED"))); |
michael@0 | 385 | typedef CK_TRUST __CKT_NSS_MUST_VERIFY __attribute__((deprecated |
michael@0 | 386 | ("CKT_NSS_MUST_VERIFY really functions as CKT_NSS_TRUST_UNKNOWN"))); |
michael@0 | 387 | #endif |
michael@0 | 388 | #define CKT_NSS_UNTRUSTED ((__CKT_NSS_UNTRUSTED)CKT_NSS_MUST_VERIFY_TRUST) |
michael@0 | 389 | #define CKT_NSS_VALID ((__CKT_NSS_VALID) CKT_NSS_NOT_TRUSTED) |
michael@0 | 390 | /* keep the old value for compatibility reasons*/ |
michael@0 | 391 | #define CKT_NSS_MUST_VERIFY ((__CKT_NSS_MUST_VERIFY)(CKT_NSS +4)) |
michael@0 | 392 | #else |
michael@0 | 393 | #ifdef _WIN32 |
michael@0 | 394 | /* This magic gets the windows compiler to give us a deprecation |
michael@0 | 395 | * warning */ |
michael@0 | 396 | #pragma deprecated(CKT_NSS_UNTRUSTED, CKT_NSS_MUST_VERIFY, CKT_NSS_VALID) |
michael@0 | 397 | #endif |
michael@0 | 398 | /* CKT_NSS_UNTRUSTED really means CKT_NSS_MUST_VERIFY_TRUST */ |
michael@0 | 399 | #define CKT_NSS_UNTRUSTED CKT_NSS_MUST_VERIFY_TRUST |
michael@0 | 400 | /* CKT_NSS_VALID really means CKT_NSS_NOT_TRUSTED */ |
michael@0 | 401 | #define CKT_NSS_VALID CKT_NSS_NOT_TRUSTED |
michael@0 | 402 | /* CKT_NSS_MUST_VERIFY was always treated as CKT_NSS_TRUST_UNKNOWN */ |
michael@0 | 403 | #define CKT_NSS_MUST_VERIFY (CKT_NSS + 4) /*really means trust unknown*/ |
michael@0 | 404 | #endif |
michael@0 | 405 | |
michael@0 | 406 | /* don't leave old programs in a lurch just yet, give them the old NETSCAPE |
michael@0 | 407 | * synonym */ |
michael@0 | 408 | #define CKO_NETSCAPE_CRL CKO_NSS_CRL |
michael@0 | 409 | #define CKO_NETSCAPE_SMIME CKO_NSS_SMIME |
michael@0 | 410 | #define CKO_NETSCAPE_TRUST CKO_NSS_TRUST |
michael@0 | 411 | #define CKO_NETSCAPE_BUILTIN_ROOT_LIST CKO_NSS_BUILTIN_ROOT_LIST |
michael@0 | 412 | #define CKO_NETSCAPE_NEWSLOT CKO_NSS_NEWSLOT |
michael@0 | 413 | #define CKO_NETSCAPE_DELSLOT CKO_NSS_DELSLOT |
michael@0 | 414 | #define CKK_NETSCAPE_PKCS8 CKK_NSS_PKCS8 |
michael@0 | 415 | #define CKA_NETSCAPE_URL CKA_NSS_URL |
michael@0 | 416 | #define CKA_NETSCAPE_EMAIL CKA_NSS_EMAIL |
michael@0 | 417 | #define CKA_NETSCAPE_SMIME_INFO CKA_NSS_SMIME_INFO |
michael@0 | 418 | #define CKA_NETSCAPE_SMIME_TIMESTAMP CKA_NSS_SMIME_TIMESTAMP |
michael@0 | 419 | #define CKA_NETSCAPE_PKCS8_SALT CKA_NSS_PKCS8_SALT |
michael@0 | 420 | #define CKA_NETSCAPE_PASSWORD_CHECK CKA_NSS_PASSWORD_CHECK |
michael@0 | 421 | #define CKA_NETSCAPE_EXPIRES CKA_NSS_EXPIRES |
michael@0 | 422 | #define CKA_NETSCAPE_KRL CKA_NSS_KRL |
michael@0 | 423 | #define CKA_NETSCAPE_PQG_COUNTER CKA_NSS_PQG_COUNTER |
michael@0 | 424 | #define CKA_NETSCAPE_PQG_SEED CKA_NSS_PQG_SEED |
michael@0 | 425 | #define CKA_NETSCAPE_PQG_H CKA_NSS_PQG_H |
michael@0 | 426 | #define CKA_NETSCAPE_PQG_SEED_BITS CKA_NSS_PQG_SEED_BITS |
michael@0 | 427 | #define CKA_NETSCAPE_MODULE_SPEC CKA_NSS_MODULE_SPEC |
michael@0 | 428 | #define CKM_NETSCAPE_AES_KEY_WRAP CKM_NSS_AES_KEY_WRAP |
michael@0 | 429 | #define CKM_NETSCAPE_AES_KEY_WRAP_PAD CKM_NSS_AES_KEY_WRAP_PAD |
michael@0 | 430 | #define CKR_NETSCAPE_CERTDB_FAILED CKR_NSS_CERTDB_FAILED |
michael@0 | 431 | #define CKR_NETSCAPE_KEYDB_FAILED CKR_NSS_KEYDB_FAILED |
michael@0 | 432 | |
michael@0 | 433 | #define CKT_NETSCAPE_TRUSTED CKT_NSS_TRUSTED |
michael@0 | 434 | #define CKT_NETSCAPE_TRUSTED_DELEGATOR CKT_NSS_TRUSTED_DELEGATOR |
michael@0 | 435 | #define CKT_NETSCAPE_UNTRUSTED CKT_NSS_UNTRUSTED |
michael@0 | 436 | #define CKT_NETSCAPE_MUST_VERIFY CKT_NSS_MUST_VERIFY |
michael@0 | 437 | #define CKT_NETSCAPE_TRUST_UNKNOWN CKT_NSS_TRUST_UNKNOWN |
michael@0 | 438 | #define CKT_NETSCAPE_VALID CKT_NSS_VALID |
michael@0 | 439 | #define CKT_NETSCAPE_VALID_DELEGATOR CKT_NSS_VALID_DELEGATOR |
michael@0 | 440 | |
michael@0 | 441 | /* |
michael@0 | 442 | * These are not really PKCS #11 values specifically. They are the 'loadable' |
michael@0 | 443 | * module spec NSS uses. The are available for others to use as well, but not |
michael@0 | 444 | * part of the formal PKCS #11 spec. |
michael@0 | 445 | * |
michael@0 | 446 | * The function 'FIND' returns an array of PKCS #11 initialization strings |
michael@0 | 447 | * The function 'ADD' takes a PKCS #11 initialization string and stores it. |
michael@0 | 448 | * The function 'DEL' takes a 'name= library=' value and deletes the associated |
michael@0 | 449 | * string. |
michael@0 | 450 | * The function 'RELEASE' frees the array returned by 'FIND' |
michael@0 | 451 | */ |
michael@0 | 452 | #define SECMOD_MODULE_DB_FUNCTION_FIND 0 |
michael@0 | 453 | #define SECMOD_MODULE_DB_FUNCTION_ADD 1 |
michael@0 | 454 | #define SECMOD_MODULE_DB_FUNCTION_DEL 2 |
michael@0 | 455 | #define SECMOD_MODULE_DB_FUNCTION_RELEASE 3 |
michael@0 | 456 | typedef char ** (PR_CALLBACK *SECMODModuleDBFunc)(unsigned long function, |
michael@0 | 457 | char *parameters, void *moduleSpec); |
michael@0 | 458 | |
michael@0 | 459 | /* softoken slot ID's */ |
michael@0 | 460 | #define SFTK_MIN_USER_SLOT_ID 4 |
michael@0 | 461 | #define SFTK_MAX_USER_SLOT_ID 100 |
michael@0 | 462 | #define SFTK_MIN_FIPS_USER_SLOT_ID 101 |
michael@0 | 463 | #define SFTK_MAX_FIPS_USER_SLOT_ID 127 |
michael@0 | 464 | |
michael@0 | 465 | |
michael@0 | 466 | #endif /* _PKCS11N_H_ */ |