tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

utilparst.h (3424B)


      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)                                               \
     24            PORT_Free(target);                                    \
     25        target = NSSUTIL_ArgFetchValue(param, &next);             \
     26        param += next;                                            \
     27        command;                                                  \
     28    } else
     29 
     30 #define NSSUTIL_HANDLE_FINAL_ARG(param)          \
     31    {                                            \
     32        param = NSSUTIL_ArgSkipParameter(param); \
     33    }                                            \
     34    param = NSSUTIL_ArgStrip(param);
     35 
     36 #define NSSUTIL_PATH_SEPARATOR "/"
     37 
     38 /* default module configuration strings */
     39 #define NSSUTIL_DEFAULT_INTERNAL_INIT1 \
     40    "library= name=\"NSS Internal PKCS #11 Module\" parameters="
     41 #define NSSUTIL_DEFAULT_INTERNAL_INIT2 \
     42    " NSS=\"Flags=internal,critical trustOrder=75 cipherOrder=100 slotParams=(1={"
     43 #define NSSUTIL_DEFAULT_INTERNAL_INIT3 \
     44    " askpw=any timeout=30})\""
     45 #define NSSUTIL_DEFAULT_SFTKN_FLAGS \
     46    "slotFlags=[ECC,RSA,DSA,DH,RC2,RC4,DES,RANDOM,SHA1,MD5,MD2,SSL,TLS,AES,Camellia,SEED,SHA256,SHA512]"
     47 
     48 #define NSSUTIL_DEFAULT_CIPHER_ORDER 0
     49 #define NSSUTIL_DEFAULT_TRUST_ORDER 50
     50 #define NSSUTIL_ARG_ESCAPE '\\'
     51 
     52 /* hold slot default flags until we initialize a slot. This structure is only
     53 * useful between the time we define a module (either by hand or from the
     54 * database) and the time the module is loaded. Not reference counted  */
     55 struct NSSUTILPreSlotInfoStr {
     56    CK_SLOT_ID slotID;          /* slot these flags are for */
     57    unsigned long defaultFlags; /* bit mask of default implementation this slot
     58                                 * provides */
     59    int askpw;                  /* slot specific password bits */
     60    long timeout;               /* slot specific timeout value */
     61    char hasRootCerts;          /* is this the root cert PKCS #11 module? */
     62    char hasRootTrust;          /* is this the root cert PKCS #11 module? */
     63    int reserved0[2];
     64    void *reserved1[2];
     65 };
     66 
     67 /*
     68 * private functions for softoken.
     69 */
     70 typedef enum {
     71    NSS_DB_TYPE_NONE = 0,
     72    NSS_DB_TYPE_SQL,
     73    NSS_DB_TYPE_EXTERN,
     74    NSS_DB_TYPE_LEGACY,
     75    NSS_DB_TYPE_MULTIACCESS
     76 } NSSDBType;
     77 
     78 #endif /* UTILPARS_T_H */