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 UTILPARS_T_H |
michael@0 | 5 | #define UTILPARS_T_H 1 |
michael@0 | 6 | #include "pkcs11t.h" |
michael@0 | 7 | |
michael@0 | 8 | /* |
michael@0 | 9 | * macros to handle parsing strings of blank sparated arguments. |
michael@0 | 10 | * Several NSSUTIL_HANDLE_STRING() macros should be places one after another with no intervening |
michael@0 | 11 | * code. The first ones have precedence over the later ones. The last Macro should be |
michael@0 | 12 | * NSSUTIL_HANDLE_FINAL_ARG. |
michael@0 | 13 | * |
michael@0 | 14 | * param is the input parameters. On exit param will point to the next parameter to parse. If the |
michael@0 | 15 | * last paramter has been returned, param points to a null byte (*param = '0'); |
michael@0 | 16 | * target is the location to store any data aquired from the parameter. Caller is responsible to free this data. |
michael@0 | 17 | * value is the string value of the parameter. |
michael@0 | 18 | * command is any commands you need to run to help process the parameter's data. |
michael@0 | 19 | */ |
michael@0 | 20 | #define NSSUTIL_HANDLE_STRING_ARG(param,target,value,command) \ |
michael@0 | 21 | if (PORT_Strncasecmp(param,value,sizeof(value)-1) == 0) { \ |
michael@0 | 22 | param += sizeof(value)-1; \ |
michael@0 | 23 | if (target) PORT_Free(target); \ |
michael@0 | 24 | target = NSSUTIL_ArgFetchValue(param,&next); \ |
michael@0 | 25 | param += next; \ |
michael@0 | 26 | command ;\ |
michael@0 | 27 | } else |
michael@0 | 28 | |
michael@0 | 29 | #define NSSUTIL_HANDLE_FINAL_ARG(param) \ |
michael@0 | 30 | { param = NSSUTIL_ArgSkipParameter(param); } param = NSSUTIL_ArgStrip(param); |
michael@0 | 31 | |
michael@0 | 32 | #define NSSUTIL_PATH_SEPARATOR "/" |
michael@0 | 33 | |
michael@0 | 34 | /* default module configuration strings */ |
michael@0 | 35 | #define NSSUTIL_DEFAULT_INTERNAL_INIT1 \ |
michael@0 | 36 | "library= name=\"NSS Internal PKCS #11 Module\" parameters=" |
michael@0 | 37 | #define NSSUTIL_DEFAULT_INTERNAL_INIT2 \ |
michael@0 | 38 | " NSS=\"Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={" |
michael@0 | 39 | #define NSSUTIL_DEFAULT_INTERNAL_INIT3 \ |
michael@0 | 40 | " askpw=any timeout=30})\"" |
michael@0 | 41 | #define NSSUTIL_DEFAULT_SFTKN_FLAGS \ |
michael@0 | 42 | "slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]" |
michael@0 | 43 | |
michael@0 | 44 | #define NSSUTIL_DEFAULT_CIPHER_ORDER 0 |
michael@0 | 45 | #define NSSUTIL_DEFAULT_TRUST_ORDER 50 |
michael@0 | 46 | #define NSSUTIL_ARG_ESCAPE '\\' |
michael@0 | 47 | |
michael@0 | 48 | |
michael@0 | 49 | /* hold slot default flags until we initialize a slot. This structure is only |
michael@0 | 50 | * useful between the time we define a module (either by hand or from the |
michael@0 | 51 | * database) and the time the module is loaded. Not reference counted */ |
michael@0 | 52 | struct NSSUTILPreSlotInfoStr { |
michael@0 | 53 | CK_SLOT_ID slotID; /* slot these flags are for */ |
michael@0 | 54 | unsigned long defaultFlags; /* bit mask of default implementation this slot |
michael@0 | 55 | * provides */ |
michael@0 | 56 | int askpw; /* slot specific password bits */ |
michael@0 | 57 | long timeout; /* slot specific timeout value */ |
michael@0 | 58 | char hasRootCerts; /* is this the root cert PKCS #11 module? */ |
michael@0 | 59 | char hasRootTrust; /* is this the root cert PKCS #11 module? */ |
michael@0 | 60 | int reserved0[2]; |
michael@0 | 61 | void *reserved1[2]; |
michael@0 | 62 | }; |
michael@0 | 63 | |
michael@0 | 64 | |
michael@0 | 65 | /* |
michael@0 | 66 | * private functions for softoken. |
michael@0 | 67 | */ |
michael@0 | 68 | typedef enum { |
michael@0 | 69 | NSS_DB_TYPE_NONE= 0, |
michael@0 | 70 | NSS_DB_TYPE_SQL, |
michael@0 | 71 | NSS_DB_TYPE_EXTERN, |
michael@0 | 72 | NSS_DB_TYPE_LEGACY, |
michael@0 | 73 | NSS_DB_TYPE_MULTIACCESS |
michael@0 | 74 | } NSSDBType; |
michael@0 | 75 | |
michael@0 | 76 | #endif /* UTILPARS_T_H */ |