michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef UTILPARS_T_H michael@0: #define UTILPARS_T_H 1 michael@0: #include "pkcs11t.h" michael@0: michael@0: /* michael@0: * macros to handle parsing strings of blank sparated arguments. michael@0: * Several NSSUTIL_HANDLE_STRING() macros should be places one after another with no intervening michael@0: * code. The first ones have precedence over the later ones. The last Macro should be michael@0: * NSSUTIL_HANDLE_FINAL_ARG. michael@0: * michael@0: * param is the input parameters. On exit param will point to the next parameter to parse. If the michael@0: * last paramter has been returned, param points to a null byte (*param = '0'); michael@0: * target is the location to store any data aquired from the parameter. Caller is responsible to free this data. michael@0: * value is the string value of the parameter. michael@0: * command is any commands you need to run to help process the parameter's data. michael@0: */ michael@0: #define NSSUTIL_HANDLE_STRING_ARG(param,target,value,command) \ michael@0: if (PORT_Strncasecmp(param,value,sizeof(value)-1) == 0) { \ michael@0: param += sizeof(value)-1; \ michael@0: if (target) PORT_Free(target); \ michael@0: target = NSSUTIL_ArgFetchValue(param,&next); \ michael@0: param += next; \ michael@0: command ;\ michael@0: } else michael@0: michael@0: #define NSSUTIL_HANDLE_FINAL_ARG(param) \ michael@0: { param = NSSUTIL_ArgSkipParameter(param); } param = NSSUTIL_ArgStrip(param); michael@0: michael@0: #define NSSUTIL_PATH_SEPARATOR "/" michael@0: michael@0: /* default module configuration strings */ michael@0: #define NSSUTIL_DEFAULT_INTERNAL_INIT1 \ michael@0: "library= name=\"NSS Internal PKCS #11 Module\" parameters=" michael@0: #define NSSUTIL_DEFAULT_INTERNAL_INIT2 \ michael@0: " NSS=\"Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={" michael@0: #define NSSUTIL_DEFAULT_INTERNAL_INIT3 \ michael@0: " askpw=any timeout=30})\"" michael@0: #define NSSUTIL_DEFAULT_SFTKN_FLAGS \ michael@0: "slotFlags=[RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]" michael@0: michael@0: #define NSSUTIL_DEFAULT_CIPHER_ORDER 0 michael@0: #define NSSUTIL_DEFAULT_TRUST_ORDER 50 michael@0: #define NSSUTIL_ARG_ESCAPE '\\' michael@0: michael@0: michael@0: /* hold slot default flags until we initialize a slot. This structure is only michael@0: * useful between the time we define a module (either by hand or from the michael@0: * database) and the time the module is loaded. Not reference counted */ michael@0: struct NSSUTILPreSlotInfoStr { michael@0: CK_SLOT_ID slotID; /* slot these flags are for */ michael@0: unsigned long defaultFlags; /* bit mask of default implementation this slot michael@0: * provides */ michael@0: int askpw; /* slot specific password bits */ michael@0: long timeout; /* slot specific timeout value */ michael@0: char hasRootCerts; /* is this the root cert PKCS #11 module? */ michael@0: char hasRootTrust; /* is this the root cert PKCS #11 module? */ michael@0: int reserved0[2]; michael@0: void *reserved1[2]; michael@0: }; michael@0: michael@0: michael@0: /* michael@0: * private functions for softoken. michael@0: */ michael@0: typedef enum { michael@0: NSS_DB_TYPE_NONE= 0, michael@0: NSS_DB_TYPE_SQL, michael@0: NSS_DB_TYPE_EXTERN, michael@0: NSS_DB_TYPE_LEGACY, michael@0: NSS_DB_TYPE_MULTIACCESS michael@0: } NSSDBType; michael@0: michael@0: #endif /* UTILPARS_T_H */