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