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