1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/nss/lib/util/utilparst.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,76 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 +#ifndef UTILPARS_T_H 1.8 +#define UTILPARS_T_H 1 1.9 +#include "pkcs11t.h" 1.10 + 1.11 +/* 1.12 + * macros to handle parsing strings of blank sparated arguments. 1.13 + * Several NSSUTIL_HANDLE_STRING() macros should be places one after another with no intervening 1.14 + * code. The first ones have precedence over the later ones. The last Macro should be 1.15 + * NSSUTIL_HANDLE_FINAL_ARG. 1.16 + * 1.17 + * param is the input parameters. On exit param will point to the next parameter to parse. If the 1.18 + * last paramter has been returned, param points to a null byte (*param = '0'); 1.19 + * target is the location to store any data aquired from the parameter. Caller is responsible to free this data. 1.20 + * value is the string value of the parameter. 1.21 + * command is any commands you need to run to help process the parameter's data. 1.22 + */ 1.23 +#define NSSUTIL_HANDLE_STRING_ARG(param,target,value,command) \ 1.24 + if (PORT_Strncasecmp(param,value,sizeof(value)-1) == 0) { \ 1.25 + param += sizeof(value)-1; \ 1.26 + if (target) PORT_Free(target); \ 1.27 + target = NSSUTIL_ArgFetchValue(param,&next); \ 1.28 + param += next; \ 1.29 + command ;\ 1.30 + } else 1.31 + 1.32 +#define NSSUTIL_HANDLE_FINAL_ARG(param) \ 1.33 + { param = NSSUTIL_ArgSkipParameter(param); } param = NSSUTIL_ArgStrip(param); 1.34 + 1.35 +#define NSSUTIL_PATH_SEPARATOR "/" 1.36 + 1.37 +/* default module configuration strings */ 1.38 +#define NSSUTIL_DEFAULT_INTERNAL_INIT1 \ 1.39 + "library= name=\"NSS Internal PKCS #11 Module\" parameters=" 1.40 +#define NSSUTIL_DEFAULT_INTERNAL_INIT2 \ 1.41 + " NSS=\"Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={" 1.42 +#define NSSUTIL_DEFAULT_INTERNAL_INIT3 \ 1.43 + " askpw=any timeout=30})\"" 1.44 +#define NSSUTIL_DEFAULT_SFTKN_FLAGS \ 1.45 + "slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]" 1.46 + 1.47 +#define NSSUTIL_DEFAULT_CIPHER_ORDER 0 1.48 +#define NSSUTIL_DEFAULT_TRUST_ORDER 50 1.49 +#define NSSUTIL_ARG_ESCAPE '\\' 1.50 + 1.51 + 1.52 +/* hold slot default flags until we initialize a slot. This structure is only 1.53 + * useful between the time we define a module (either by hand or from the 1.54 + * database) and the time the module is loaded. Not reference counted */ 1.55 +struct NSSUTILPreSlotInfoStr { 1.56 + CK_SLOT_ID slotID; /* slot these flags are for */ 1.57 + unsigned long defaultFlags; /* bit mask of default implementation this slot 1.58 + * provides */ 1.59 + int askpw; /* slot specific password bits */ 1.60 + long timeout; /* slot specific timeout value */ 1.61 + char hasRootCerts; /* is this the root cert PKCS #11 module? */ 1.62 + char hasRootTrust; /* is this the root cert PKCS #11 module? */ 1.63 + int reserved0[2]; 1.64 + void *reserved1[2]; 1.65 +}; 1.66 + 1.67 + 1.68 +/* 1.69 + * private functions for softoken. 1.70 + */ 1.71 +typedef enum { 1.72 + NSS_DB_TYPE_NONE= 0, 1.73 + NSS_DB_TYPE_SQL, 1.74 + NSS_DB_TYPE_EXTERN, 1.75 + NSS_DB_TYPE_LEGACY, 1.76 + NSS_DB_TYPE_MULTIACCESS 1.77 +} NSSDBType; 1.78 + 1.79 +#endif /* UTILPARS_T_H */