security/nss/lib/libpkix/pkix/util/pkix_tools.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/security/nss/lib/libpkix/pkix/util/pkix_tools.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,1588 @@
     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 +/*
     1.8 + * pkix_tools.h
     1.9 + *
    1.10 + * Header for Utility Functions and Macros
    1.11 + *
    1.12 + */
    1.13 +
    1.14 +#ifndef _PKIX_TOOLS_H
    1.15 +#define _PKIX_TOOLS_H
    1.16 +
    1.17 +#include "pkix.h"
    1.18 +#include <stddef.h>
    1.19 +#include <stdio.h>
    1.20 +#include "secport.h"
    1.21 +#include "prlong.h"
    1.22 +
    1.23 +/* private PKIX system headers */
    1.24 +#include "pkix_basicconstraintschecker.h"
    1.25 +#include "pkix_buildresult.h"
    1.26 +#include "pkix_certchainchecker.h"
    1.27 +#include "pkix_certselector.h"
    1.28 +#include "pkix_comcertselparams.h"
    1.29 +#include "pkix_comcrlselparams.h"
    1.30 +#include "pkix_crlselector.h"
    1.31 +#include "pkix_error.h"
    1.32 +#include "pkix_expirationchecker.h"
    1.33 +#include "pkix_list.h"
    1.34 +#include "pkix_logger.h"
    1.35 +#include "pkix_namechainingchecker.h"
    1.36 +#include "pkix_nameconstraintschecker.h"
    1.37 +#include "pkix_policychecker.h"
    1.38 +#include "pkix_policynode.h"
    1.39 +#include "pkix_procparams.h"
    1.40 +#include "pkix_resourcelimits.h"
    1.41 +#include "pkix_revocationmethod.h"
    1.42 +#include "pkix_revocationchecker.h"
    1.43 +#include "pkix_crlchecker.h"
    1.44 +#include "pkix_ocspchecker.h"
    1.45 +#include "pkix_signaturechecker.h"
    1.46 +#include "pkix_store.h"
    1.47 +#include "pkix_targetcertchecker.h"
    1.48 +#include "pkix_validate.h"
    1.49 +#include "pkix_valresult.h"
    1.50 +#include "pkix_verifynode.h"
    1.51 +
    1.52 +#ifdef __cplusplus
    1.53 +extern "C" {
    1.54 +#endif
    1.55 +
    1.56 +typedef struct pkixStdVarsStr {
    1.57 +    const char        *aMyFuncName;
    1.58 +    PKIX_Error        *aPkixErrorResult;
    1.59 +    PKIX_Error        *aPkixTempResult;
    1.60 +    PKIX_Error        *aPkixReturnResult;
    1.61 +    PKIX_ERRORCODE     aPkixErrorCode;
    1.62 +    PKIX_Boolean       aPkixErrorReceived;
    1.63 +    PKIX_Boolean       aPkixTempErrorReceived;
    1.64 +    PKIX_ERRORCLASS    aPkixErrorClass;
    1.65 +    PKIX_UInt32        aPkixType;
    1.66 +    PKIX_PL_Object    *aLockedObject;
    1.67 +    PKIX_List         *aPkixErrorList;
    1.68 +} PKIX_StdVars;
    1.69 +
    1.70 +#ifdef PKIX_STDVARS_POINTER
    1.71 +#define myFuncName                  stdVars->aMyFuncName
    1.72 +#define pkixErrorResult             stdVars->aPkixErrorResult
    1.73 +#define pkixTempResult              stdVars->aPkixTempResult
    1.74 +#define pkixReturnResult            stdVars->aPkixReturnResult
    1.75 +#define pkixErrorCode               stdVars->aPkixErrorCode
    1.76 +#define pkixErrorReceived           stdVars->aPkixErrorReceived
    1.77 +#define pkixTempErrorReceived       stdVars->aPkixTempErrorReceived 
    1.78 +#define pkixErrorClass              stdVars->aPkixErrorClass
    1.79 +#define pkixType                    stdVars->aPkixType
    1.80 +#define lockedObject                stdVars->aLockedObject
    1.81 +#define pkixErrorList               stdVars->aPkixErrorList
    1.82 +#define stdVarsPtr                  stdVars
    1.83 +#else
    1.84 +#define myFuncName                  stdVars.aMyFuncName
    1.85 +#define pkixErrorResult             stdVars.aPkixErrorResult
    1.86 +#define pkixTempResult              stdVars.aPkixTempResult
    1.87 +#define pkixReturnResult            stdVars.aPkixReturnResult
    1.88 +#define pkixErrorCode               stdVars.aPkixErrorCode
    1.89 +#define pkixErrorReceived           stdVars.aPkixErrorReceived
    1.90 +#define pkixTempErrorReceived       stdVars.aPkixTempErrorReceived 
    1.91 +#define pkixErrorClass              stdVars.aPkixErrorClass
    1.92 +#define pkixType                    stdVars.aPkixType
    1.93 +#define lockedObject                stdVars.aLockedObject
    1.94 +#define pkixErrorList               stdVars.aPkixErrorList
    1.95 +#define stdVarsPtr                  &stdVars
    1.96 +#endif
    1.97 +
    1.98 +extern PKIX_Error * PKIX_DoReturn(PKIX_StdVars * stdVars, 
    1.99 +                                  PKIX_ERRORCLASS errClass, 
   1.100 +                                  PKIX_Boolean doLogger,
   1.101 +                                  void * plContext);
   1.102 +
   1.103 +extern PKIX_Error * PKIX_DoThrow(PKIX_StdVars * stdVars, 
   1.104 +                                 PKIX_ERRORCLASS errClass, 
   1.105 +                                 PKIX_ERRORCODE errCode,
   1.106 +                                 PKIX_ERRORCLASS overrideClass, 
   1.107 +                                 void * plContext);
   1.108 +
   1.109 +extern void PKIX_DoAddError(PKIX_StdVars * stdVars, 
   1.110 +                            PKIX_Error * error,
   1.111 +                            void * plContext);
   1.112 +
   1.113 +#ifdef PKIX_OBJECT_LEAK_TEST
   1.114 +extern PKIX_Error * pkix_CheckForGeneratedError(PKIX_StdVars * stdVars, 
   1.115 +                                                PKIX_ERRORCLASS errClass, 
   1.116 +                                                char * fnName,
   1.117 +                                                PKIX_Boolean *errorStateSet,
   1.118 +                                                void * plContext);
   1.119 +#endif /* PKIX_OBJECT_LEAK_TEST */
   1.120 +
   1.121 +extern const PKIX_StdVars zeroStdVars;
   1.122 +
   1.123 +extern PRLogModuleInfo *pkixLog;
   1.124 +
   1.125 +/*
   1.126 + * UTILITY MACROS
   1.127 + * Documentation for these common utility macros can be found in the
   1.128 + * Implementation Guidelines document (Section 4.3)
   1.129 + *
   1.130 + * In general, macros with multiple statements (or a single "if" statement)
   1.131 + * use the "do {<body>} while (0)" technique in order to convert the multiple
   1.132 + * statements into one statement, thus avoiding the dangling else problem.
   1.133 + * For macros which ALWAYS exit with a "return" or "goto", there is no
   1.134 + * need to use this technique (and it yields compiler warnings of "statement
   1.135 + * not reached"), so we just use "{<body>}" to group the statements together.
   1.136 + */
   1.137 +
   1.138 +#if !defined (PKIX_OBJECT_LEAK_TEST)
   1.139 +
   1.140 +#define PKIX_STD_VARS(funcName) \
   1.141 +    static const char cMyFuncName[] = {funcName}; \
   1.142 +    PKIX_StdVars      stdVars = zeroStdVars; \
   1.143 +    myFuncName = cMyFuncName
   1.144 +
   1.145 +
   1.146 +#else /* PKIX_OBJECT_LEAK_TEST */
   1.147 +
   1.148 +extern char **fnStackNameArr;
   1.149 +extern PKIX_UInt32 *fnStackInvCountArr;
   1.150 +extern PKIX_UInt32  stackPosition;
   1.151 +extern PKIX_Boolean noErrorState;
   1.152 +extern PKIX_Boolean errorGenerated;
   1.153 +extern PKIX_Boolean runningLeakTest;
   1.154 +extern PLHashTable *fnInvTable;
   1.155 +extern PKIX_UInt32 testStartFnStackPosition;
   1.156 +extern char *errorFnStackString;
   1.157 +
   1.158 +extern PLHashNumber PR_CALLBACK pkix_ErrorGen_Hash (const void *key);
   1.159 +
   1.160 +#define PKIX_STD_VARS(funcName) \
   1.161 +    static const char cMyFuncName[] = {funcName}; \
   1.162 +    PKIX_StdVars      stdVars = zeroStdVars; \
   1.163 +    PKIX_Boolean      errorSetFlag = PKIX_FALSE; \
   1.164 +    myFuncName = cMyFuncName; \
   1.165 +    if (runningLeakTest) { \
   1.166 +        if (fnStackNameArr) { \
   1.167 +            fnStackInvCountArr[stackPosition] += 1; \
   1.168 +            stackPosition += 1; \
   1.169 +            fnStackInvCountArr[stackPosition] = 0; \
   1.170 +            fnStackNameArr[stackPosition] = (char*)myFuncName; \
   1.171 +            fnStackNameArr[stackPosition + 1] = NULL; \
   1.172 +            PR_LOG(pkixLog, 5, \
   1.173 +                    ("%s%*s+> %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
   1.174 +                             stackPosition, " ", fnStackNameArr[stackPosition], \
   1.175 +                             stackPosition, myFuncName)); \
   1.176 +        } \
   1.177 +        do { \
   1.178 +            pkixErrorResult = pkix_CheckForGeneratedError(&stdVars, PKIX_MEM_ERROR, \
   1.179 +                                                          funcName, &errorSetFlag, \
   1.180 +                                                          plContext); \
   1.181 +            if (pkixErrorResult) { \
   1.182 +                 PR_LOG(pkixLog, 5, \
   1.183 +                    ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
   1.184 +                              stackPosition, " ", fnStackNameArr[stackPosition], \
   1.185 +                              stackPosition, myFuncName)); \
   1.186 +                 fnStackNameArr[stackPosition--] = NULL; \
   1.187 +                 if (errorSetFlag) { \
   1.188 +                       noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \
   1.189 +                 } \
   1.190 +                 return pkixErrorResult; \
   1.191 +            } \
   1.192 +        } while (0); \
   1.193 +    }
   1.194 +#endif /* PKIX_OBJECT_LEAK_TEST */
   1.195 +
   1.196 +#ifdef DEBUG
   1.197 +#define _PKIX_DEBUG_TRACE(cond, prefix, level) \
   1.198 +    do { \
   1.199 +	if (cond) { \
   1.200 +	    pkix_Logger_Check(pkixLoggersDebugTrace, myFuncName, \
   1.201 +	                      prefix, pkixType, level, plContext); \
   1.202 +	} \
   1.203 +    } while (0)
   1.204 +#else
   1.205 +#define _PKIX_DEBUG_TRACE(cond, prefix, level) 
   1.206 +#endif
   1.207 +
   1.208 +#define _PKIX_LOG_ERROR(code, level) \
   1.209 +    { \
   1.210 +	if (pkixLoggersErrors) { \
   1.211 +	    pkix_Logger_CheckWithCode(pkixLoggersErrors, code, \
   1.212 +	                      NULL, pkixType, level, plContext); \
   1.213 +	} \
   1.214 +    }
   1.215 +
   1.216 +#define PKIX_ENTER(type, funcName) \
   1.217 +    PKIX_STD_VARS(funcName); \
   1.218 +    pkixType = PKIX_ ## type ## _ERROR; \
   1.219 +    PKIX_DEBUG_ENTER(type); \
   1.220 +    _PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, ">>>", PKIX_LOGGER_LEVEL_TRACE);
   1.221 +
   1.222 +#define PKIX_ENTER_NO_LOGGER(type, funcName) \
   1.223 +    PKIX_STD_VARS(funcName); \
   1.224 +    pkixType = PKIX_ ## type ## _ERROR; \
   1.225 +    PKIX_DEBUG_ENTER(type);
   1.226 +
   1.227 +#define PKIX_DEBUG_ENTER(type) \
   1.228 +    PKIX_ ## type ## _DEBUG_ARG("( Entering %s).\n", myFuncName)
   1.229 +
   1.230 +#define PKIX_DEBUG_EXIT(type) \
   1.231 +    PKIX_ ## type ## _DEBUG_ARG("( Exiting %s).\n", myFuncName)
   1.232 +
   1.233 +#define PKIX_OBJECT_UNLOCK(obj) \
   1.234 +    do { \
   1.235 +	if (obj && lockedObject == (PKIX_PL_Object *)(obj)){ \
   1.236 +	    pkixTempResult = \
   1.237 +		    PKIX_PL_Object_Unlock \
   1.238 +		    ((PKIX_PL_Object *)(obj), plContext); \
   1.239 +	    if (pkixTempResult) { \
   1.240 +		PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
   1.241 +		pkixTempResult = NULL; \
   1.242 +	    } \
   1.243 +	    lockedObject = NULL; \
   1.244 +	} else { \
   1.245 +	    PORT_Assert(lockedObject == NULL); \
   1.246 +	} \
   1.247 +    } while (0)
   1.248 +
   1.249 +#define PKIX_DECREF(obj) \
   1.250 +    do { \
   1.251 +	if (obj){ \
   1.252 +	    pkixTempResult = PKIX_PL_Object_DecRef \
   1.253 +			((PKIX_PL_Object *)(obj), plContext); \
   1.254 +	    if (pkixTempResult) { \
   1.255 +		PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
   1.256 +		pkixTempResult = NULL; \
   1.257 +	    } \
   1.258 +	    obj = NULL; \
   1.259 +	} \
   1.260 +    } while (0)
   1.261 +
   1.262 +#define PKIX_THROW(type, descNum) \
   1.263 +    return PKIX_DoThrow(&stdVars, (PKIX_ ## type ## _ERROR), descNum, \
   1.264 +                        pkixErrorClass, plContext);
   1.265 +
   1.266 +#ifdef PKIX_OBJECT_LEAK_TEST
   1.267 +#define PKIX_RETURN(type) \
   1.268 +    if (runningLeakTest && fnStackNameArr) { \
   1.269 +        PR_LOG(pkixLog, 5, \
   1.270 +               ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
   1.271 +               stackPosition, " ", fnStackNameArr[stackPosition], \
   1.272 +               stackPosition, myFuncName)); \
   1.273 +        fnStackNameArr[stackPosition--] = NULL; \
   1.274 +        if (errorSetFlag) noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \
   1.275 +    } \
   1.276 +    return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext);
   1.277 +#else
   1.278 +#define PKIX_RETURN(type) \
   1.279 +    return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext);
   1.280 +#endif /* PKIX_OBJECT_LEAK_TEST */
   1.281 +
   1.282 +
   1.283 +#if defined(DEBUG) && !defined(DEBUG_nb95248)
   1.284 +#define PKIX_RETURN_NO_LOGGER(type) \
   1.285 +    { \
   1.286 +	PKIX_OBJECT_UNLOCK(lockedObject); \
   1.287 +	if ((pkixErrorReceived) || (pkixErrorResult) || pkixErrorList) \
   1.288 +	    PKIX_THROW(type, pkixErrorCode); \
   1.289 +	PKIX_DEBUG_EXIT(type); \
   1.290 +	return NULL; \
   1.291 +    }
   1.292 +#else
   1.293 +#define PKIX_RETURN_NO_LOGGER(type) \
   1.294 +    return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_FALSE, plContext);
   1.295 +#endif
   1.296 +
   1.297 +/* disable to disable ;-) */
   1.298 +/* #define WANT_TRACE_CHECK_FAILURES */
   1.299 +
   1.300 +#ifdef WANT_TRACE_CHECK_FAILURES
   1.301 +#define TRACE_CHECK_FAILURE(what, errorstring) \
   1.302 +    if (pkixLog) { \
   1.303 +      PR_LOG(pkixLog, PR_LOG_DEBUG, \
   1.304 +        ("====> [%s] failed: %s\n", #what, errorstring)); \
   1.305 +    }
   1.306 +#else
   1.307 +#define TRACE_CHECK_FAILURE(what, errorstring)
   1.308 +#endif
   1.309 +
   1.310 +#define PKIX_CHECK(func, descNum) \
   1.311 +    do { \
   1.312 +	pkixErrorResult = (func); \
   1.313 +	if (pkixErrorResult) { \
   1.314 +            TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
   1.315 +	    pkixErrorClass = pkixErrorResult->errClass; \
   1.316 +	    pkixErrorCode = descNum; \
   1.317 +	    goto cleanup; \
   1.318 +	} \
   1.319 +    } while (0)
   1.320 +
   1.321 +/* like PKIX_CHECK but without goto cleanup */
   1.322 +#define PKIX_CHECK_NO_GOTO(func, descNum) \
   1.323 +    do { \
   1.324 +	pkixErrorResult = (func); \
   1.325 +	if (pkixErrorResult) { \
   1.326 +            TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
   1.327 +	    pkixErrorClass = pkixErrorResult->errClass; \
   1.328 +	    pkixErrorCode = descNum; \
   1.329 +	} \
   1.330 +    } while (0)
   1.331 +
   1.332 +#define PKIX_CHECK_ONLY_FATAL(func, descNum) \
   1.333 +    do { \
   1.334 +	pkixTempErrorReceived = PKIX_FALSE; \
   1.335 +	pkixErrorResult = (func); \
   1.336 +	if (pkixErrorResult) { \
   1.337 +            TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
   1.338 +	    pkixTempErrorReceived = PKIX_TRUE; \
   1.339 +	    pkixErrorClass = pkixErrorResult->errClass; \
   1.340 +            if (pkixErrorClass == PKIX_FATAL_ERROR) { \
   1.341 +	         goto cleanup; \
   1.342 +	    } \
   1.343 +	    PKIX_DECREF(pkixErrorResult); \
   1.344 +	} \
   1.345 +    } while (0)
   1.346 +
   1.347 +#define PKIX_LOG_ERROR(descNum) \
   1.348 +    _PKIX_LOG_ERROR(descNum, PKIX_LOGGER_LEVEL_ERROR)
   1.349 +
   1.350 +#define PKIX_ERROR(descNum) \
   1.351 +    { \
   1.352 +	PKIX_LOG_ERROR(descNum) \
   1.353 +	pkixErrorReceived = PKIX_TRUE; \
   1.354 +	pkixErrorCode = descNum; \
   1.355 +	goto cleanup; \
   1.356 +    }
   1.357 +
   1.358 +#define PKIX_ERROR_ALLOC_ERROR() \
   1.359 +    { \
   1.360 +	PKIX_LOG_ERROR(PKIX_ALLOCERROR) \
   1.361 +	pkixErrorReceived = PKIX_TRUE; \
   1.362 +	pkixErrorResult = PKIX_ALLOC_ERROR(); \
   1.363 +	goto cleanup; \
   1.364 +    }
   1.365 +
   1.366 +#define PKIX_ERROR_FATAL(descNum) \
   1.367 +    { \
   1.368 +	pkixErrorReceived = PKIX_TRUE; \
   1.369 +	pkixErrorCode = descNum; \
   1.370 +	pkixErrorClass = PKIX_FATAL_ERROR; \
   1.371 +	_PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \
   1.372 +	goto cleanup; \
   1.373 +    }
   1.374 +
   1.375 +#define PKIX_CHECK_FATAL(func, descNum) \
   1.376 +    do { \
   1.377 +	pkixErrorResult = (func); \
   1.378 +	if (pkixErrorResult) { \
   1.379 +                TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
   1.380 +		pkixErrorReceived = PKIX_TRUE; \
   1.381 +		pkixErrorCode = descNum; \
   1.382 +		pkixErrorClass = PKIX_FATAL_ERROR; \
   1.383 +		_PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \
   1.384 +		goto fatal; \
   1.385 +	} \
   1.386 +    } while (0)
   1.387 +
   1.388 +#define PKIX_NULLCHECK_ONE(a) \
   1.389 +    do { \
   1.390 +	if ((a) == NULL){ \
   1.391 +	    pkixErrorReceived = PKIX_TRUE; \
   1.392 +	    pkixErrorCode = PKIX_NULLARGUMENT; \
   1.393 +	    PKIX_RETURN(FATAL); \
   1.394 +	} \
   1.395 +    } while (0)
   1.396 +
   1.397 +#define PKIX_NULLCHECK_TWO(a, b) \
   1.398 +    do { \
   1.399 +	if (((a) == NULL) || ((b) == NULL)){ \
   1.400 +	    pkixErrorReceived = PKIX_TRUE; \
   1.401 +	    pkixErrorCode = PKIX_NULLARGUMENT; \
   1.402 +	    PKIX_RETURN(FATAL); \
   1.403 +	} \
   1.404 +    } while (0)
   1.405 +
   1.406 +#define PKIX_NULLCHECK_THREE(a, b, c) \
   1.407 +    do { \
   1.408 +	if (((a) == NULL) || ((b) == NULL) || ((c) == NULL)){ \
   1.409 +	    pkixErrorReceived = PKIX_TRUE; \
   1.410 +	    pkixErrorCode = PKIX_NULLARGUMENT; \
   1.411 +	    PKIX_RETURN(FATAL); \
   1.412 +	} \
   1.413 +    } while (0)
   1.414 +
   1.415 +#define PKIX_NULLCHECK_FOUR(a, b, c, d) \
   1.416 +    do { \
   1.417 +	if (((a) == NULL) || ((b) == NULL) || \
   1.418 +	    ((c) == NULL) || ((d) == NULL)){ \
   1.419 +	    pkixErrorReceived = PKIX_TRUE; \
   1.420 +	    pkixErrorCode = PKIX_NULLARGUMENT; \
   1.421 +	    PKIX_RETURN(FATAL); \
   1.422 +	} \
   1.423 +    } while (0)
   1.424 +
   1.425 +#define PKIX_OBJECT_LOCK(obj) \
   1.426 +    do { \
   1.427 +	if (obj) { \
   1.428 +	    pkixTempResult = \
   1.429 +		PKIX_PL_Object_Lock((PKIX_PL_Object*)(obj), plContext); \
   1.430 +	    if (pkixTempResult) { \
   1.431 +		PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
   1.432 +		pkixTempResult = NULL; \
   1.433 +		pkixErrorCode = PKIX_OBJECTLOCKFAILED; \
   1.434 +		goto cleanup; \
   1.435 +	    } \
   1.436 +	    lockedObject = (PKIX_PL_Object *)(obj); \
   1.437 +	} \
   1.438 +    } while (0)
   1.439 +
   1.440 +#define PKIX_ERROR_CREATE(type, descNum, error) \
   1.441 +    { \
   1.442 +	pkixTempResult = (PKIX_Error*)pkix_Throw \
   1.443 +		(PKIX_ ## type ## _ERROR,  myFuncName, \
   1.444 +		descNum, PKIX_ ## type ## _ERROR, pkixErrorResult, \
   1.445 +		&error, plContext); \
   1.446 +	if (pkixTempResult) { \
   1.447 +	    error = pkixTempResult; \
   1.448 +	    pkixTempResult = NULL; \
   1.449 +	} \
   1.450 +    }
   1.451 +		
   1.452 +
   1.453 +#define PKIX_ERROR_RECEIVED \
   1.454 +    (pkixErrorReceived || pkixErrorResult || pkixTempErrorReceived || \
   1.455 +     pkixErrorList)
   1.456 +
   1.457 +#define PKIX_INCREF(obj) \
   1.458 +    do { \
   1.459 +	if (obj){ \
   1.460 +	    pkixTempResult = PKIX_PL_Object_IncRef \
   1.461 +			((PKIX_PL_Object *)(obj), plContext); \
   1.462 +	    if (pkixTempResult) { \
   1.463 +		PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \
   1.464 +		pkixTempResult = NULL; \
   1.465 +		goto cleanup; \
   1.466 +	    } \
   1.467 +	} \
   1.468 +    } while (0)
   1.469 +
   1.470 +#define PKIX_FREE(obj) \
   1.471 +    do { \
   1.472 +	if (obj) { \
   1.473 +	    pkixTempResult = PKIX_PL_Free((obj), plContext); \
   1.474 +	    if (pkixTempResult) { \
   1.475 +		PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \
   1.476 +		pkixTempResult = NULL; \
   1.477 +	    } \
   1.478 +	    obj = NULL; \
   1.479 +	} \
   1.480 +    } while (0)
   1.481 +
   1.482 +#define PKIX_EXACTLY_ONE_NULL(a, b) (((a) && !(b)) || ((b) && !(a)))
   1.483 +
   1.484 +/* DIGIT MACROS */
   1.485 +
   1.486 +#define PKIX_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
   1.487 +
   1.488 +#define PKIX_ISXDIGIT(c) \
   1.489 +    (PKIX_ISDIGIT(c) || ( (((c)|0x20) >= 'a') && (((c)|0x20) <= 'f') ))
   1.490 +
   1.491 +#define PKIX_TOSTRING(a, b, c, d) \
   1.492 +    do { \
   1.493 +	int descNum; \
   1.494 +	if ((a) != NULL) { \
   1.495 +	    pkixErrorResult =  \
   1.496 +		PKIX_PL_Object_ToString((PKIX_PL_Object *)(a), (b), (c)); \
   1.497 +	    descNum = (d); \
   1.498 +	} else { \
   1.499 +	    pkixErrorResult =  \
   1.500 +		PKIX_PL_String_Create(PKIX_ESCASCII, "(null)", 0, (b), (c)); \
   1.501 +	    descNum = PKIX_STRINGCREATEFAILED; \
   1.502 +	} \
   1.503 +	PKIX_CHECK(pkixErrorResult, descNum); \
   1.504 +    } while (0)
   1.505 +
   1.506 +#define PKIX_EQUALS(a, b, c, d, e) \
   1.507 +    do { \
   1.508 +	if ((a) != NULL && (b) != NULL) { \
   1.509 +	    PKIX_CHECK(PKIX_PL_Object_Equals\
   1.510 +			((PKIX_PL_Object *)(a), \
   1.511 +			(PKIX_PL_Object*)(b), \
   1.512 +			(c), \
   1.513 +			(d)), \
   1.514 +			(e)); \
   1.515 +	} else if ((a) == NULL && (b) == NULL) { \
   1.516 +	    *(c) = PKIX_TRUE; \
   1.517 +	} else { \
   1.518 +	    *(c) = PKIX_FALSE; \
   1.519 +	} \
   1.520 +    } while (0)
   1.521 +
   1.522 +#define PKIX_HASHCODE(a, b, c, d) \
   1.523 +    do { \
   1.524 +	if ((a) != NULL) { \
   1.525 +	    PKIX_CHECK(PKIX_PL_Object_Hashcode\
   1.526 +		((PKIX_PL_Object *)(a), (b), (c)), (d)); \
   1.527 +	} else { \
   1.528 +	    *(b) = 0; \
   1.529 +	} \
   1.530 +    } while (0)
   1.531 +
   1.532 +#define PKIX_DUPLICATE(a, b, c, d) \
   1.533 +    do { \
   1.534 +	if ((a) != NULL) { \
   1.535 +	    PKIX_CHECK(PKIX_PL_Object_Duplicate\
   1.536 +			((PKIX_PL_Object *)(a), \
   1.537 +			(PKIX_PL_Object **)(b), \
   1.538 +			(c)), \
   1.539 +			(d)); \
   1.540 +	} else { \
   1.541 +	    *(b) = (a); \
   1.542 +	} \
   1.543 +    } while (0)
   1.544 +
   1.545 +/*
   1.546 + * DEBUG MACROS
   1.547 + *
   1.548 + * Each type has an associated debug flag, which can
   1.549 + * be set on the compiler line using "-D<debugflag>". For convenience,
   1.550 + * "-DPKIX_DEBUGALL" turns on debug for all the components.
   1.551 + *
   1.552 + * If a type's debug flag is defined, then its two associated macros
   1.553 + * are defined: PKIX_type_DEBUG(expr) and PKIX_type_DEBUG_ARG(expr, arg),
   1.554 + * which call PKIX_DEBUG(expr) and PKIX_DEBUG_ARG(expr, arg) respectively,
   1.555 + * which, in turn, enable standard and consistently formatted output.
   1.556 + *
   1.557 + * If a type's debug flag is not defined, the two associated macros
   1.558 + * are defined as a NO-OP. As such, any PKIX_type_DEBUG or PKIX_type_DEBUG_ARG
   1.559 + * macros for an undefined type will be stripped from the code during
   1.560 + * pre-processing, thereby reducing code size.
   1.561 + */
   1.562 +
   1.563 +#ifdef PKIX_DEBUGALL
   1.564 +#define PKIX_REFCOUNTDEBUG                        1
   1.565 +#define PKIX_MEMDEBUG                             1
   1.566 +#define PKIX_MUTEXDEBUG                           1
   1.567 +#define PKIX_OBJECTDEBUG                          1
   1.568 +#define PKIX_STRINGDEBUG                          1
   1.569 +#define PKIX_OIDDEBUG                             1
   1.570 +#define PKIX_LISTDEBUG                            1
   1.571 +#define PKIX_ERRORDEBUG                           1
   1.572 +#define PKIX_BYTEARRAYDEBUG                       1
   1.573 +#define PKIX_RWLOCKDEBUG                          1
   1.574 +#define PKIX_BIGINTDEBUG                          1
   1.575 +#define PKIX_HASHTABLEDEBUG                       1
   1.576 +#define PKIX_X500NAMEDEBUG                        1
   1.577 +#define PKIX_GENERALNAMEDEBUG                     1
   1.578 +#define PKIX_PUBLICKEYDEBUG                       1
   1.579 +#define PKIX_CERTDEBUG                            1
   1.580 +#define PKIX_HTTPCLIENTDEBUG                      1
   1.581 +#define PKIX_DATEDEBUG                            1
   1.582 +#define PKIX_TRUSTANCHORDEBUG                     1
   1.583 +#define PKIX_PROCESSINGPARAMSDEBUG                1
   1.584 +#define PKIX_VALIDATEPARAMSDEBUG                  1
   1.585 +#define PKIX_VALIDATERESULTDEBUG                  1
   1.586 +#define PKIX_VALIDATEDEBUG                        1
   1.587 +#define PKIX_CERTCHAINCHECKERDEBUG                1
   1.588 +#define PKIX_REVOCATIONCHECKERDEBUG               1
   1.589 +#define PKIX_CERTSELECTORDEBUG                    1
   1.590 +#define PKIX_COMCERTSELPARAMSDEBUG                1
   1.591 +#define PKIX_TARGETCERTCHECKERSTATEDEBUG          1
   1.592 +#define PKIX_INITIALIZEPARAMSDEBUG                1
   1.593 +#define PKIX_CERTBASICCONSTRAINTSDEBUG            1
   1.594 +#define PKIX_CERTNAMECONSTRAINTSDEBUG             1
   1.595 +#define PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG 1
   1.596 +#define PKIX_SUBJALTNAMECHECKERSTATEDEBUG         1
   1.597 +
   1.598 +#define PKIX_CERTPOLICYQUALIFIERDEBUG             1
   1.599 +#define PKIX_CERTPOLICYINFODEBUG                  1
   1.600 +#define PKIX_CERTPOLICYNODEDEBUG                  1
   1.601 +#define PKIX_CERTPOLICYCHECKERSTATEDEBUG          1
   1.602 +#define PKIX_LIFECYCLEDEBUG                       1
   1.603 +#define PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG    1
   1.604 +#define PKIX_CRLDEBUG                             1
   1.605 +#define PKIX_CRLENTRYDEBUG                        1
   1.606 +#define PKIX_CRLSELECTORDEBUG                     1
   1.607 +#define PKIX_COMCRLSELPARAMSDEBUG                 1
   1.608 +#define PKIX_CERTSTOREDEBUG                       1
   1.609 +#define PKIX_COLLECTIONCERTSTORECONTEXTDEBUG      1
   1.610 +#define PKIX_DEFAULTCRLCHECKERSTATEDEBUG          1
   1.611 +#define PKIX_CERTPOLICYMAPDEBUG                   1
   1.612 +#define PKIX_BUILDDEBUG                           1
   1.613 +#define PKIX_BUILDRESULTDEBUG                     1
   1.614 +#define PKIX_FORWARDBUILDERSTATEDEBUG             1
   1.615 +#define PKIX_SIGNATURECHECKERSTATEDEBUG           1
   1.616 +#define PKIX_USERDEFINEDMODULESDEBUG              1
   1.617 +#define PKIX_CONTEXTDEBUG                         1
   1.618 +#define PKIX_DEFAULTREVOCATIONCHECKERDEBUG        1
   1.619 +#define PKIX_LDAPREQUESTDEBUG                     1
   1.620 +#define PKIX_LDAPRESPONSEDEBUG                    1
   1.621 +#define PKIX_LDAPCLIENTDEBUG                      1
   1.622 +#define PKIX_LDAPDEFAULTCLIENTDEBUG               1
   1.623 +#define PKIX_SOCKETDEBUG                          1
   1.624 +#define PKIX_RESOURCELIMITSDEBUG                  1
   1.625 +#define PKIX_LOGGERDEBUG                          1
   1.626 +#define PKIX_MONITORLOCKDEBUG                     1
   1.627 +#define PKIX_INFOACCESSDEBUG                      1
   1.628 +#define PKIX_AIAMGRDEBUG                          1
   1.629 +#define PKIX_OCSPCHECKERDEBUG                     1
   1.630 +#define PKIX_OCSPREQUESTDEBUG                     1
   1.631 +#define PKIX_OCSPRESPONSEDEBUG                    1
   1.632 +#define PKIX_HTTPDEFAULTCLIENTDEBUG               1
   1.633 +#define PKIX_HTTPCERTSTORECONTEXTDEBUG            1
   1.634 +#define PKIX_VERIFYNODEDEBUG                      1
   1.635 +#endif
   1.636 +
   1.637 +/*
   1.638 + * XXX Both PKIX_DEBUG and PKIX_DEBUG_ARG currently use printf.
   1.639 + * This needs to be replaced with Loggers.
   1.640 + */
   1.641 +
   1.642 +#ifdef DEBUG
   1.643 +#define PKIX_DEBUG(expr) \
   1.644 +    do { \
   1.645 +	_PKIX_DEBUG_TRACE(pkixLoggersErrors, expr, PKIX_LOGGER_LEVEL_DEBUG); \
   1.646 +	(void) fprintf(stderr, "(%s: ", myFuncName); \
   1.647 +        (void) fprintf(stderr, expr);                \
   1.648 +    } while (0)
   1.649 +#else
   1.650 +#define PKIX_DEBUG(expr)
   1.651 +#endif
   1.652 +
   1.653 +/* Logging doesn't support DEBUG with ARG: cannot convert control and arg */
   1.654 +#define PKIX_DEBUG_ARG(expr, arg) \
   1.655 +    do { \
   1.656 +	(void) printf("(%s: ", myFuncName); \
   1.657 +	(void) printf(expr, arg); \
   1.658 +    } while (0)
   1.659 +
   1.660 +#if PKIX_FATALDEBUG
   1.661 +#define PKIX_FATAL_DEBUG(expr) \
   1.662 +        PKIX_DEBUG(expr)
   1.663 +#define PKIX_FATAL_DEBUG_ARG(expr, arg) \
   1.664 +        PKIX_DEBUG_ARG(expr, arg)
   1.665 +#else
   1.666 +#define PKIX_FATAL_DEBUG(expr)
   1.667 +#define PKIX_FATAL_DEBUG_ARG(expr, arg)
   1.668 +#endif
   1.669 +
   1.670 +#if PKIX_REFCOUNTDEBUG
   1.671 +#define PKIX_REF_COUNT_DEBUG(expr) \
   1.672 +        PKIX_DEBUG(expr)
   1.673 +#define PKIX_REF_COUNT_DEBUG_ARG(expr, arg) \
   1.674 +        PKIX_DEBUG_ARG(expr, arg)
   1.675 +#else
   1.676 +#define PKIX_REF_COUNT_DEBUG(expr)
   1.677 +#define PKIX_REF_COUNT_DEBUG_ARG(expr, arg)
   1.678 +#endif
   1.679 +
   1.680 +#if PKIX_MEMDEBUG
   1.681 +#define PKIX_MEM_DEBUG(expr) \
   1.682 +        PKIX_DEBUG(expr)
   1.683 +#define PKIX_MEM_DEBUG_ARG(expr, arg) \
   1.684 +        PKIX_DEBUG_ARG(expr, arg)
   1.685 +#else
   1.686 +#define PKIX_MEM_DEBUG(expr)
   1.687 +#define PKIX_MEM_DEBUG_ARG(expr, arg)
   1.688 +#endif
   1.689 +
   1.690 +#if PKIX_MUTEXDEBUG
   1.691 +#define PKIX_MUTEX_DEBUG(expr) \
   1.692 +        PKIX_DEBUG(expr)
   1.693 +#define PKIX_MUTEX_DEBUG_ARG(expr, arg) \
   1.694 +        PKIX_DEBUG_ARG(expr, arg)
   1.695 +#else
   1.696 +#define PKIX_MUTEX_DEBUG(expr)
   1.697 +#define PKIX_MUTEX_DEBUG_ARG(expr, arg)
   1.698 +#endif
   1.699 +
   1.700 +#if PKIX_OBJECTDEBUG
   1.701 +#define PKIX_OBJECT_DEBUG(expr) \
   1.702 +        PKIX_DEBUG(expr)
   1.703 +#define PKIX_OBJECT_DEBUG_ARG(expr, arg) \
   1.704 +        PKIX_DEBUG_ARG(expr, arg)
   1.705 +#else
   1.706 +#define PKIX_OBJECT_DEBUG(expr)
   1.707 +#define PKIX_OBJECT_DEBUG_ARG(expr, arg)
   1.708 +#endif
   1.709 +
   1.710 +#if PKIX_ERRORDEBUG
   1.711 +#define PKIX_ERROR_DEBUG(expr) \
   1.712 +        PKIX_DEBUG(expr)
   1.713 +#define PKIX_ERROR_DEBUG_ARG(expr, arg) \
   1.714 +        PKIX_DEBUG_ARG(expr, arg)
   1.715 +#else
   1.716 +#define PKIX_ERROR_DEBUG(expr)
   1.717 +#define PKIX_ERROR_DEBUG_ARG(expr, arg)
   1.718 +#endif
   1.719 +
   1.720 +#if PKIX_STRINGDEBUG
   1.721 +#define PKIX_STRING_DEBUG(expr) \
   1.722 +        PKIX_DEBUG(expr)
   1.723 +#define PKIX_STRING_DEBUG_ARG(expr, arg) \
   1.724 +        PKIX_DEBUG_ARG(expr, arg)
   1.725 +#else
   1.726 +#define PKIX_STRING_DEBUG(expr)
   1.727 +#define PKIX_STRING_DEBUG_ARG(expr, arg)
   1.728 +#endif
   1.729 +
   1.730 +#if PKIX_OIDDEBUG
   1.731 +#define PKIX_OID_DEBUG(expr) \
   1.732 +        PKIX_DEBUG(expr)
   1.733 +#define PKIX_OID_DEBUG_ARG(expr, arg) \
   1.734 +        PKIX_DEBUG_ARG(expr, arg)
   1.735 +#else
   1.736 +#define PKIX_OID_DEBUG(expr)
   1.737 +#define PKIX_OID_DEBUG_ARG(expr, arg)
   1.738 +#endif
   1.739 +
   1.740 +#if PKIX_LISTDEBUG
   1.741 +#define PKIX_LIST_DEBUG(expr) \
   1.742 +        PKIX_DEBUG(expr)
   1.743 +#define PKIX_LIST_DEBUG_ARG(expr, arg) \
   1.744 +        PKIX_DEBUG_ARG(expr, arg)
   1.745 +#else
   1.746 +#define PKIX_LIST_DEBUG(expr)
   1.747 +#define PKIX_LIST_DEBUG_ARG(expr, arg)
   1.748 +#endif
   1.749 +
   1.750 +#if PKIX_RWLOCKDEBUG
   1.751 +#define PKIX_RWLOCK_DEBUG(expr) \
   1.752 +        PKIX_DEBUG(expr)
   1.753 +#define PKIX_RWLOCK_DEBUG_ARG(expr, arg) \
   1.754 +        PKIX_DEBUG_ARG(expr, arg)
   1.755 +#else
   1.756 +#define PKIX_RWLOCK_DEBUG(expr)
   1.757 +#define PKIX_RWLOCK_DEBUG_ARG(expr, arg)
   1.758 +#endif
   1.759 +
   1.760 +#if PKIX_BYTEARRAYDEBUG
   1.761 +#define PKIX_BYTEARRAY_DEBUG(expr) \
   1.762 +        PKIX_DEBUG(expr)
   1.763 +#define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg) \
   1.764 +        PKIX_DEBUG_ARG(expr, arg)
   1.765 +#else
   1.766 +#define PKIX_BYTEARRAY_DEBUG(expr)
   1.767 +#define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg)
   1.768 +#endif
   1.769 +
   1.770 +#if PKIX_HASHTABLEDEBUG
   1.771 +#define PKIX_HASHTABLE_DEBUG(expr) \
   1.772 +        PKIX_DEBUG(expr)
   1.773 +#define PKIX_HASHTABLE_DEBUG_ARG(expr, arg) \
   1.774 +        PKIX_DEBUG_ARG(expr, arg)
   1.775 +#else
   1.776 +#define PKIX_HASHTABLE_DEBUG(expr)
   1.777 +#define PKIX_HASHTABLE_DEBUG_ARG(expr, arg)
   1.778 +#endif
   1.779 +
   1.780 +#if PKIX_X500NAMEDEBUG
   1.781 +#define PKIX_X500NAME_DEBUG(expr) \
   1.782 +        PKIX_DEBUG(expr)
   1.783 +#define PKIX_X500NAME_DEBUG_ARG(expr, arg) \
   1.784 +        PKIX_DEBUG_ARG(expr, arg)
   1.785 +#else
   1.786 +#define PKIX_X500NAME_DEBUG(expr)
   1.787 +#define PKIX_X500NAME_DEBUG_ARG(expr, arg)
   1.788 +#endif
   1.789 +
   1.790 +#if PKIX_GENERALNAMEDEBUG
   1.791 +#define PKIX_GENERALNAME_DEBUG(expr) \
   1.792 +        PKIX_DEBUG(expr)
   1.793 +#define PKIX_GENERALNAME_DEBUG_ARG(expr, arg) \
   1.794 +        PKIX_DEBUG_ARG(expr, arg)
   1.795 +#else
   1.796 +#define PKIX_GENERALNAME_DEBUG(expr)
   1.797 +#define PKIX_GENERALNAME_DEBUG_ARG(expr, arg)
   1.798 +#endif
   1.799 +
   1.800 +#if PKIX_PUBLICKEYDEBUG
   1.801 +#define PKIX_PUBLICKEY_DEBUG(expr) \
   1.802 +        PKIX_DEBUG(expr)
   1.803 +#define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg) \
   1.804 +        PKIX_DEBUG_ARG(expr, arg)
   1.805 +#else
   1.806 +#define PKIX_PUBLICKEY_DEBUG(expr)
   1.807 +#define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg)
   1.808 +#endif
   1.809 +
   1.810 +#if PKIX_CERTDEBUG
   1.811 +#define PKIX_CERT_DEBUG(expr) \
   1.812 +        PKIX_DEBUG(expr)
   1.813 +#define PKIX_CERT_DEBUG_ARG(expr, arg) \
   1.814 +        PKIX_DEBUG_ARG(expr, arg)
   1.815 +#else
   1.816 +#define PKIX_CERT_DEBUG(expr)
   1.817 +#define PKIX_CERT_DEBUG_ARG(expr, arg)
   1.818 +#endif
   1.819 +
   1.820 +#if PKIX_CRLDPDEBUG
   1.821 +#define PKIX_CRLDP_DEBUG(expr) \
   1.822 +        PKIX_DEBUG(expr)
   1.823 +#define PKIX_CRLDP_DEBUG_ARG(expr, arg) \
   1.824 +        PKIX_DEBUG_ARG(expr, arg)
   1.825 +#else
   1.826 +#define PKIX_CRLDP_DEBUG(expr)
   1.827 +#define PKIX_CRLDP_DEBUG_ARG(expr, arg)
   1.828 +#endif
   1.829 +
   1.830 +#if PKIX_HTTPCLIENTDEBUG
   1.831 +#define PKIX_HTTPCLIENT_DEBUG(expr) \
   1.832 +        PKIX_DEBUG(expr)
   1.833 +#define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg) \
   1.834 +        PKIX_DEBUG_ARG(expr, arg)
   1.835 +#else
   1.836 +#define PKIX_HTTPCLIENT_DEBUG(expr)
   1.837 +#define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg)
   1.838 +#endif
   1.839 +
   1.840 +#if PKIX_BIGINTDEBUG
   1.841 +#define PKIX_BIGINT_DEBUG(expr) \
   1.842 +        PKIX_DEBUG(expr)
   1.843 +#define PKIX_BIGINT_DEBUG_ARG(expr, arg) \
   1.844 +        PKIX_DEBUG_ARG(expr, arg)
   1.845 +#else
   1.846 +#define PKIX_BIGINT_DEBUG(expr)
   1.847 +#define PKIX_BIGINT_DEBUG_ARG(expr, arg)
   1.848 +#endif
   1.849 +
   1.850 +#if PKIX_DATEDEBUG
   1.851 +#define PKIX_DATE_DEBUG(expr) \
   1.852 +        PKIX_DEBUG(expr)
   1.853 +#define PKIX_DATE_DEBUG_ARG(expr, arg) \
   1.854 +        PKIX_DEBUG_ARG(expr, arg)
   1.855 +#else
   1.856 +#define PKIX_DATE_DEBUG(expr)
   1.857 +#define PKIX_DATE_DEBUG_ARG(expr, arg)
   1.858 +#endif
   1.859 +
   1.860 +#if PKIX_TRUSTANCHORDEBUG
   1.861 +#define PKIX_TRUSTANCHOR_DEBUG(expr) \
   1.862 +        PKIX_DEBUG(expr)
   1.863 +#define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg) \
   1.864 +        PKIX_DEBUG_ARG(expr, arg)
   1.865 +#else
   1.866 +#define PKIX_TRUSTANCHOR_DEBUG(expr)
   1.867 +#define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg)
   1.868 +#endif
   1.869 +
   1.870 +#if PKIX_PROCESSINGPARAMSDEBUG
   1.871 +#define PKIX_PROCESSINGPARAMS_DEBUG(expr) \
   1.872 +        PKIX_DEBUG(expr)
   1.873 +#define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg) \
   1.874 +        PKIX_DEBUG_ARG(expr, arg)
   1.875 +#else
   1.876 +#define PKIX_PROCESSINGPARAMS_DEBUG(expr)
   1.877 +#define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg)
   1.878 +#endif
   1.879 +
   1.880 +#if PKIX_VALIDATEPARAMSDEBUG
   1.881 +#define PKIX_VALIDATEPARAMS_DEBUG(expr) \
   1.882 +        PKIX_DEBUG(expr)
   1.883 +#define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg) \
   1.884 +        PKIX_DEBUG_ARG(expr, arg)
   1.885 +#else
   1.886 +#define PKIX_VALIDATEPARAMS_DEBUG(expr)
   1.887 +#define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg)
   1.888 +#endif
   1.889 +
   1.890 +#if PKIX_VALIDATERESULTDEBUG
   1.891 +#define PKIX_VALIDATERESULT_DEBUG(expr) \
   1.892 +        PKIX_DEBUG(expr)
   1.893 +#define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg) \
   1.894 +        PKIX_DEBUG_ARG(expr, arg)
   1.895 +#else
   1.896 +#define PKIX_VALIDATERESULT_DEBUG(expr)
   1.897 +#define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg)
   1.898 +#endif
   1.899 +
   1.900 +#if PKIX_VALIDATEDEBUG
   1.901 +#define PKIX_VALIDATE_DEBUG(expr) \
   1.902 +        PKIX_DEBUG(expr)
   1.903 +#define PKIX_VALIDATE_DEBUG_ARG(expr, arg) \
   1.904 +        PKIX_DEBUG_ARG(expr, arg)
   1.905 +#else
   1.906 +#define PKIX_VALIDATE_DEBUG(expr)
   1.907 +#define PKIX_VALIDATE_DEBUG_ARG(expr, arg)
   1.908 +#endif
   1.909 +
   1.910 +#if PKIX_BUILDDEBUG
   1.911 +#define PKIX_BUILD_DEBUG(expr) \
   1.912 +        PKIX_DEBUG(expr)
   1.913 +#define PKIX_BUILD_DEBUG_ARG(expr, arg) \
   1.914 +        PKIX_DEBUG_ARG(expr, arg)
   1.915 +#else
   1.916 +#define PKIX_BUILD_DEBUG(expr)
   1.917 +#define PKIX_BUILD_DEBUG_ARG(expr, arg)
   1.918 +#endif
   1.919 +
   1.920 +#if PKIX_CERTCHAINCHECKERDEBUG
   1.921 +#define PKIX_CERTCHAINCHECKER_DEBUG(expr) \
   1.922 +        PKIX_DEBUG(expr)
   1.923 +#define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg) \
   1.924 +        PKIX_DEBUG_ARG(expr, arg)
   1.925 +#else
   1.926 +#define PKIX_CERTCHAINCHECKER_DEBUG(expr)
   1.927 +#define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg)
   1.928 +#endif
   1.929 +
   1.930 +#if PKIX_REVOCATIONCHECKERDEBUG
   1.931 +#define PKIX_REVOCATIONCHECKER_DEBUG(expr) \
   1.932 +        PKIX_DEBUG(expr)
   1.933 +#define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \
   1.934 +        PKIX_DEBUG_ARG(expr, arg)
   1.935 +#else
   1.936 +#define PKIX_REVOCATIONCHECKER_DEBUG(expr)
   1.937 +#define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg)
   1.938 +#endif
   1.939 +
   1.940 +#if PKIX_REVOCATIONMETHODDEBUG
   1.941 +#define PKIX_REVOCATIONMETHOD_DEBUG(expr) \
   1.942 +        PKIX_DEBUG(expr)
   1.943 +#define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg) \
   1.944 +        PKIX_DEBUG_ARG(expr, arg)
   1.945 +#else
   1.946 +#define PKIX_REVOCATIONMETHOD_DEBUG(expr)
   1.947 +#define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg)
   1.948 +#endif
   1.949 +
   1.950 +#if PKIX_CERTSELECTORDEBUG
   1.951 +#define PKIX_CERTSELECTOR_DEBUG(expr) \
   1.952 +        PKIX_DEBUG(expr)
   1.953 +#define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg) \
   1.954 +        PKIX_DEBUG_ARG(expr, arg)
   1.955 +#else
   1.956 +#define PKIX_CERTSELECTOR_DEBUG(expr)
   1.957 +#define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg)
   1.958 +#endif
   1.959 +
   1.960 +#if PKIX_COMCERTSELPARAMSDEBUG
   1.961 +#define PKIX_COMCERTSELPARAMS_DEBUG(expr) \
   1.962 +        PKIX_DEBUG(expr)
   1.963 +#define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg) \
   1.964 +        PKIX_DEBUG_ARG(expr, arg)
   1.965 +#else
   1.966 +#define PKIX_COMCERTSELPARAMS_DEBUG(expr)
   1.967 +#define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg)
   1.968 +#endif
   1.969 +
   1.970 +#if PKIX_TARGETCERTCHECKERSTATEDEBUG
   1.971 +#define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr) \
   1.972 +        PKIX_DEBUG(expr)
   1.973 +#define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg) \
   1.974 +        PKIX_DEBUG_ARG(expr, arg)
   1.975 +#else
   1.976 +#define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr)
   1.977 +#define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg)
   1.978 +#endif
   1.979 +
   1.980 +#if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG
   1.981 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \
   1.982 +        PKIX_DEBUG(expr)
   1.983 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
   1.984 +        PKIX_DEBUG_ARG(expr, arg)
   1.985 +#else
   1.986 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr)
   1.987 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
   1.988 +#endif
   1.989 +
   1.990 +#if PKIX_INITIALIZEPARAMSDEBUG
   1.991 +#define PKIX_INITIALIZEPARAMS_DEBUG(expr) \
   1.992 +        PKIX_DEBUG(expr)
   1.993 +#define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg) \
   1.994 +        PKIX_DEBUG_ARG(expr, arg)
   1.995 +#else
   1.996 +#define PKIX_INITIALIZEPARAMS_DEBUG(expr)
   1.997 +#define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg)
   1.998 +#endif
   1.999 +
  1.1000 +#if PKIX_CERTBASICCONSTRAINTSDEBUG
  1.1001 +#define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr) \
  1.1002 +        PKIX_DEBUG(expr)
  1.1003 +#define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg) \
  1.1004 +        PKIX_DEBUG_ARG(expr, arg)
  1.1005 +#else
  1.1006 +#define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr)
  1.1007 +#define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg)
  1.1008 +#endif
  1.1009 +
  1.1010 +#if PKIX_CERTNAMECONSTRAINTSDEBUG
  1.1011 +#define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr) \
  1.1012 +        PKIX_DEBUG(expr)
  1.1013 +#define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg) \
  1.1014 +        PKIX_DEBUG_ARG(expr, arg)
  1.1015 +#else
  1.1016 +#define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr)
  1.1017 +#define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg)
  1.1018 +#endif
  1.1019 +
  1.1020 +#if PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG
  1.1021 +#define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr) \
  1.1022 +        PKIX_DEBUG(expr)
  1.1023 +#define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
  1.1024 +        PKIX_DEBUG_ARG(expr, arg)
  1.1025 +#else
  1.1026 +#define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr)
  1.1027 +#define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
  1.1028 +#endif
  1.1029 +
  1.1030 +#if PKIX_SUBJALTNAMECHECKERSTATEDEBUG
  1.1031 +#define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr) \
  1.1032 +        PKIX_DEBUG(expr)
  1.1033 +#define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg) \
  1.1034 +        PKIX_DEBUG_ARG(expr, arg)
  1.1035 +#else
  1.1036 +#define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr)
  1.1037 +#define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg)
  1.1038 +#endif
  1.1039 +
  1.1040 +#if PKIX_CERTPOLICYQUALIFIERDEBUG
  1.1041 +#define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr) \
  1.1042 +        PKIX_DEBUG(expr)
  1.1043 +#define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg) \
  1.1044 +        PKIX_DEBUG_ARG(expr, arg)
  1.1045 +#else
  1.1046 +#define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr)
  1.1047 +#define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg)
  1.1048 +#endif
  1.1049 +
  1.1050 +#if PKIX_CERTPOLICYINFODEBUG
  1.1051 +#define PKIX_CERTPOLICYINFO_DEBUG(expr) \
  1.1052 +        PKIX_DEBUG(expr)
  1.1053 +#define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg) \
  1.1054 +        PKIX_DEBUG_ARG(expr, arg)
  1.1055 +#else
  1.1056 +#define PKIX_CERTPOLICYINFO_DEBUG(expr)
  1.1057 +#define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg)
  1.1058 +#endif
  1.1059 +
  1.1060 +#if PKIX_CERTPOLICYNODEDEBUG
  1.1061 +#define PKIX_CERTPOLICYNODE_DEBUG(expr) \
  1.1062 +        PKIX_DEBUG(expr)
  1.1063 +#define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg) \
  1.1064 +        PKIX_DEBUG_ARG(expr, arg)
  1.1065 +#else
  1.1066 +#define PKIX_CERTPOLICYNODE_DEBUG(expr)
  1.1067 +#define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg)
  1.1068 +#endif
  1.1069 +
  1.1070 +#if PKIX_CERTPOLICYCHECKERSTATEDEBUG
  1.1071 +#define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr) \
  1.1072 +        PKIX_DEBUG(expr)
  1.1073 +#define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg) \
  1.1074 +        PKIX_DEBUG_ARG(expr, arg)
  1.1075 +#else
  1.1076 +#define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr)
  1.1077 +#define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg)
  1.1078 +#endif
  1.1079 +
  1.1080 +#if PKIX_LIFECYCLEDEBUG
  1.1081 +#define PKIX_LIFECYCLE_DEBUG(expr) \
  1.1082 +        PKIX_DEBUG(expr)
  1.1083 +#define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg) \
  1.1084 +        PKIX_DEBUG_ARG(expr, arg)
  1.1085 +#else
  1.1086 +#define PKIX_LIFECYCLE_DEBUG(expr)
  1.1087 +#define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg)
  1.1088 +#endif
  1.1089 +
  1.1090 +#if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG
  1.1091 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \
  1.1092 +        PKIX_DEBUG(expr)
  1.1093 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
  1.1094 +        PKIX_DEBUG_ARG(expr, arg)
  1.1095 +#else
  1.1096 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr)
  1.1097 +#define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
  1.1098 +#endif
  1.1099 +
  1.1100 +#if PKIX_CRLDEBUG
  1.1101 +#define PKIX_CRL_DEBUG(expr) \
  1.1102 +        PKIX_DEBUG(expr)
  1.1103 +#define PKIX_CRL_DEBUG_ARG(expr, arg) \
  1.1104 +        PKIX_DEBUG_ARG(expr, arg)
  1.1105 +#else
  1.1106 +#define PKIX_CRL_DEBUG(expr)
  1.1107 +#define PKIX_CRL_DEBUG_ARG(expr, arg)
  1.1108 +#endif
  1.1109 +
  1.1110 +#if PKIX_CRLENTRYDEBUG
  1.1111 +#define PKIX_CRLENTRY_DEBUG(expr) \
  1.1112 +        PKIX_DEBUG(expr)
  1.1113 +#define PKIX_CRLENTRY_DEBUG_ARG(expr, arg) \
  1.1114 +        PKIX_DEBUG_ARG(expr, arg)
  1.1115 +#else
  1.1116 +#define PKIX_CRLENTRY_DEBUG(expr)
  1.1117 +#define PKIX_CRLENTRY_DEBUG_ARG(expr, arg)
  1.1118 +#endif
  1.1119 +
  1.1120 +#if PKIX_CRLSELECTORDEBUG
  1.1121 +#define PKIX_CRLSELECTOR_DEBUG(expr) \
  1.1122 +        PKIX_DEBUG(expr)
  1.1123 +#define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg) \
  1.1124 +        PKIX_DEBUG_ARG(expr, arg)
  1.1125 +#else
  1.1126 +#define PKIX_CRLSELECTOR_DEBUG(expr)
  1.1127 +#define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg)
  1.1128 +#endif
  1.1129 +
  1.1130 +#if PKIX_COMCRLSELPARAMSDEBUG
  1.1131 +#define PKIX_COMCRLSELPARAMS_DEBUG(expr) \
  1.1132 +        PKIX_DEBUG(expr)
  1.1133 +#define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg) \
  1.1134 +        PKIX_DEBUG_ARG(expr, arg)
  1.1135 +#else
  1.1136 +#define PKIX_COMCRLSELPARAMS_DEBUG(expr)
  1.1137 +#define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg)
  1.1138 +#endif
  1.1139 +
  1.1140 +#if PKIX_CERTSTOREDEBUG
  1.1141 +#define PKIX_CERTSTORE_DEBUG(expr) \
  1.1142 +        PKIX_DEBUG(expr)
  1.1143 +#define PKIX_CERTSTORE_DEBUG_ARG(expr, arg) \
  1.1144 +        PKIX_DEBUG_ARG(expr, arg)
  1.1145 +#else
  1.1146 +#define PKIX_CERTSTORE_DEBUG(expr)
  1.1147 +#define PKIX_CERTSTORE_DEBUG_ARG(expr, arg)
  1.1148 +#endif
  1.1149 +
  1.1150 +#if PKIX_COLLECTIONCERTSTORECONTEXTDEBUG
  1.1151 +#define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr) \
  1.1152 +        PKIX_DEBUG(expr)
  1.1153 +#define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \
  1.1154 +        PKIX_DEBUG_ARG(expr, arg)
  1.1155 +#else
  1.1156 +#define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr)
  1.1157 +#define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg)
  1.1158 +#endif
  1.1159 +
  1.1160 +#if PKIX_CRLCHECKERDEBUG
  1.1161 +#define PKIX_CRLCHECKER_DEBUG(expr) \
  1.1162 +        PKIX_DEBUG(expr)
  1.1163 +#define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg) \
  1.1164 +        PKIX_DEBUG_ARG(expr, arg)
  1.1165 +#else
  1.1166 +#define PKIX_CRLCHECKER_DEBUG(expr)
  1.1167 +#define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg)
  1.1168 +#endif
  1.1169 +
  1.1170 +#if PKIX_CERTPOLICYMAPDEBUG
  1.1171 +#define PKIX_CERTPOLICYMAP_DEBUG(expr) \
  1.1172 +        PKIX_DEBUG(expr)
  1.1173 +#define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg) \
  1.1174 +        PKIX_DEBUG_ARG(expr, arg)
  1.1175 +#else
  1.1176 +#define PKIX_CERTPOLICYMAP_DEBUG(expr)
  1.1177 +#define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg)
  1.1178 +#endif
  1.1179 +
  1.1180 +#if PKIX_BUILDRESULTDEBUG
  1.1181 +#define PKIX_BUILDRESULT_DEBUG(expr) \
  1.1182 +        PKIX_DEBUG(expr)
  1.1183 +#define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg) \
  1.1184 +        PKIX_DEBUG_ARG(expr, arg)
  1.1185 +#else
  1.1186 +#define PKIX_BUILDRESULT_DEBUG(expr)
  1.1187 +#define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg)
  1.1188 +#endif
  1.1189 +
  1.1190 +#if PKIX_FORWARDBUILDERSTATEDEBUG
  1.1191 +#define PKIX_FORWARDBUILDERSTATE_DEBUG(expr) \
  1.1192 +        PKIX_DEBUG(expr)
  1.1193 +#define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg) \
  1.1194 +        PKIX_DEBUG_ARG(expr, arg)
  1.1195 +#else
  1.1196 +#define PKIX_FORWARDBUILDERSTATE_DEBUG(expr)
  1.1197 +#define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg)
  1.1198 +#endif
  1.1199 +
  1.1200 +#if PKIX_SIGNATURECHECKERSTATEDEBUG
  1.1201 +#define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr) \
  1.1202 +        PKIX_DEBUG(expr)
  1.1203 +#define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg) \
  1.1204 +        PKIX_DEBUG_ARG(expr, arg)
  1.1205 +#else
  1.1206 +#define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr)
  1.1207 +#define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg)
  1.1208 +#endif
  1.1209 +
  1.1210 +#if PKIX_USERDEFINEDMODULESDEBUG
  1.1211 +#define PKIX_USERDEFINEDMODULES_DEBUG(expr) \
  1.1212 +        PKIX_DEBUG(expr)
  1.1213 +#define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg) \
  1.1214 +        PKIX_DEBUG_ARG(expr, arg)
  1.1215 +#else
  1.1216 +#define PKIX_USERDEFINEDMODULES_DEBUG(expr)
  1.1217 +#define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg)
  1.1218 +#endif
  1.1219 +
  1.1220 +#if PKIX_CONTEXTDEBUG
  1.1221 +#define PKIX_CONTEXT_DEBUG(expr) \
  1.1222 +        PKIX_DEBUG(expr)
  1.1223 +#define PKIX_CONTEXT_DEBUG_ARG(expr, arg) \
  1.1224 +        PKIX_DEBUG_ARG(expr, arg)
  1.1225 +#else
  1.1226 +#define PKIX_CONTEXT_DEBUG(expr)
  1.1227 +#define PKIX_CONTEXT_DEBUG_ARG(expr, arg)
  1.1228 +#endif
  1.1229 +
  1.1230 +#if PKIX_REVOCATIONCHECKERDEBUG
  1.1231 +#define PKIX_REVOCATIONCHECKER_DEBUG(expr) \
  1.1232 +        PKIX_DEBUG(expr)
  1.1233 +#define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \
  1.1234 +        PKIX_DEBUG_ARG(expr, arg)
  1.1235 +#else
  1.1236 +#define PKIX_REVOCATIONCHECKER_DEBUG(expr)
  1.1237 +#define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg)
  1.1238 +#endif
  1.1239 +
  1.1240 +#if PKIX_LDAPREQUESTDEBUG
  1.1241 +#define PKIX_LDAPREQUEST_DEBUG(expr) \
  1.1242 +        PKIX_DEBUG(expr)
  1.1243 +#define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg) \
  1.1244 +        PKIX_DEBUG_ARG(expr, arg)
  1.1245 +#else
  1.1246 +#define PKIX_LDAPREQUEST_DEBUG(expr)
  1.1247 +#define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg)
  1.1248 +#endif
  1.1249 +
  1.1250 +#if PKIX_LDAPRESPONSEDEBUG
  1.1251 +#define PKIX_LDAPRESPONSE_DEBUG(expr) \
  1.1252 +        PKIX_DEBUG(expr)
  1.1253 +#define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg) \
  1.1254 +        PKIX_DEBUG_ARG(expr, arg)
  1.1255 +#else
  1.1256 +#define PKIX_LDAPRESPONSE_DEBUG(expr)
  1.1257 +#define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg)
  1.1258 +#endif
  1.1259 +
  1.1260 +#if PKIX_LDAPCLIENTDEBUG
  1.1261 +#define PKIX_LDAPCLIENT_DEBUG(expr) \
  1.1262 +        PKIX_DEBUG(expr)
  1.1263 +#define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg) \
  1.1264 +        PKIX_DEBUG_ARG(expr, arg)
  1.1265 +#else
  1.1266 +#define PKIX_LDAPCLIENT_DEBUG(expr)
  1.1267 +#define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg)
  1.1268 +#endif
  1.1269 +
  1.1270 +#if PKIX_LDAPDEFAULTCLIENTDEBUG
  1.1271 +#define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr) \
  1.1272 +        PKIX_DEBUG(expr)
  1.1273 +#define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \
  1.1274 +        PKIX_DEBUG_ARG(expr, arg)
  1.1275 +#else
  1.1276 +#define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr)
  1.1277 +#define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg)
  1.1278 +#endif
  1.1279 +
  1.1280 +#if PKIX_SOCKETDEBUG
  1.1281 +#define PKIX_SOCKET_DEBUG(expr) \
  1.1282 +        PKIX_DEBUG(expr)
  1.1283 +#define PKIX_SOCKET_DEBUG_ARG(expr, arg) \
  1.1284 +        PKIX_DEBUG_ARG(expr, arg)
  1.1285 +#else
  1.1286 +#define PKIX_SOCKET_DEBUG(expr)
  1.1287 +#define PKIX_SOCKET_DEBUG_ARG(expr, arg)
  1.1288 +#endif
  1.1289 +
  1.1290 +#if PKIX_RESOURCELIMITSDEBUG
  1.1291 +#define PKIX_RESOURCELIMITS_DEBUG(expr) \
  1.1292 +        PKIX_DEBUG(expr)
  1.1293 +#define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg) \
  1.1294 +        PKIX_DEBUG_ARG(expr, arg)
  1.1295 +#else
  1.1296 +#define PKIX_RESOURCELIMITS_DEBUG(expr)
  1.1297 +#define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg)
  1.1298 +#endif
  1.1299 +
  1.1300 +#if PKIX_LOGGERDEBUG
  1.1301 +#define PKIX_LOGGER_DEBUG(expr) \
  1.1302 +        PKIX_DEBUG(expr)
  1.1303 +#define PKIX_LOGGER_DEBUG_ARG(expr, arg) \
  1.1304 +        PKIX_DEBUG_ARG(expr, arg)
  1.1305 +#else
  1.1306 +#define PKIX_LOGGER_DEBUG(expr)
  1.1307 +#define PKIX_LOGGER_DEBUG_ARG(expr, arg)
  1.1308 +#endif
  1.1309 +
  1.1310 +#if PKIX_MONITORLOCKDEBUG
  1.1311 +#define PKIX_MONITORLOCK_DEBUG(expr) \
  1.1312 +        PKIX_DEBUG(expr)
  1.1313 +#define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg) \
  1.1314 +        PKIX_DEBUG_ARG(expr, arg)
  1.1315 +#else
  1.1316 +#define PKIX_MONITORLOCK_DEBUG(expr)
  1.1317 +#define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg)
  1.1318 +#endif
  1.1319 +
  1.1320 +#if PKIX_INFOACCESSDEBUG
  1.1321 +#define PKIX_INFOACCESS_DEBUG(expr) \
  1.1322 +        PKIX_DEBUG(expr)
  1.1323 +#define PKIX_INFOACCESS_DEBUG_ARG(expr, arg) \
  1.1324 +        PKIX_DEBUG_ARG(expr, arg)
  1.1325 +#else
  1.1326 +#define PKIX_INFOACCESS_DEBUG(expr)
  1.1327 +#define PKIX_INFOACCESS_DEBUG_ARG(expr, arg)
  1.1328 +#endif
  1.1329 +
  1.1330 +#if PKIX_AIAMGRDEBUG
  1.1331 +#define PKIX_AIAMGR_DEBUG(expr) \
  1.1332 +        PKIX_DEBUG(expr)
  1.1333 +#define PKIX_AIAMGR_DEBUG_ARG(expr, arg) \
  1.1334 +        PKIX_DEBUG_ARG(expr, arg)
  1.1335 +#else
  1.1336 +#define PKIX_AIAMGR_DEBUG(expr)
  1.1337 +#define PKIX_AIAMGR_DEBUG_ARG(expr, arg)
  1.1338 +#endif
  1.1339 +
  1.1340 +#if PKIX_OCSPCHECKERDEBUG
  1.1341 +#define PKIX_OCSPCHECKER_DEBUG(expr) \
  1.1342 +        PKIX_DEBUG(expr)
  1.1343 +#define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg) \
  1.1344 +        PKIX_DEBUG_ARG(expr, arg)
  1.1345 +#else
  1.1346 +#define PKIX_OCSPCHECKER_DEBUG(expr)
  1.1347 +#define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg)
  1.1348 +#endif
  1.1349 +
  1.1350 +#if PKIX_OCSPCERTIDDEBUG
  1.1351 +#define PKIX_OCSPCERTID_DEBUG(expr) \
  1.1352 +        PKIX_DEBUG(expr)
  1.1353 +#define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg) \
  1.1354 +        PKIX_DEBUG_ARG(expr, arg)
  1.1355 +#else
  1.1356 +#define PKIX_OCSPCERTID_DEBUG(expr)
  1.1357 +#define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg)
  1.1358 +#endif
  1.1359 +
  1.1360 +#if PKIX_OCSPREQUESTDEBUG
  1.1361 +#define PKIX_OCSPREQUEST_DEBUG(expr) \
  1.1362 +        PKIX_DEBUG(expr)
  1.1363 +#define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg) \
  1.1364 +        PKIX_DEBUG_ARG(expr, arg)
  1.1365 +#else
  1.1366 +#define PKIX_OCSPREQUEST_DEBUG(expr)
  1.1367 +#define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg)
  1.1368 +#endif
  1.1369 +
  1.1370 +#if PKIX_OCSPRESPONSEDEBUG
  1.1371 +#define PKIX_OCSPRESPONSE_DEBUG(expr) \
  1.1372 +        PKIX_DEBUG(expr)
  1.1373 +#define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg) \
  1.1374 +        PKIX_DEBUG_ARG(expr, arg)
  1.1375 +#else
  1.1376 +#define PKIX_OCSPRESPONSE_DEBUG(expr)
  1.1377 +#define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg)
  1.1378 +#endif
  1.1379 +
  1.1380 +#if PKIX_HTTPDEFAULTCLIENTDEBUG
  1.1381 +#define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr) \
  1.1382 +        PKIX_DEBUG(expr)
  1.1383 +#define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \
  1.1384 +        PKIX_DEBUG_ARG(expr, arg)
  1.1385 +#else
  1.1386 +#define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr)
  1.1387 +#define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg)
  1.1388 +#endif
  1.1389 +
  1.1390 +#if PKIX_HTTPCERTSTORECONTEXTDEBUG
  1.1391 +#define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr) \
  1.1392 +        PKIX_DEBUG(expr)
  1.1393 +#define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \
  1.1394 +        PKIX_DEBUG_ARG(expr, arg)
  1.1395 +#else
  1.1396 +#define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr)
  1.1397 +#define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg)
  1.1398 +#endif
  1.1399 +
  1.1400 +#if PKIX_VERIFYNODEDEBUG
  1.1401 +#define PKIX_VERIFYNODE_DEBUG(expr) \
  1.1402 +        PKIX_DEBUG(expr)
  1.1403 +#define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg) \
  1.1404 +        PKIX_DEBUG_ARG(expr, arg)
  1.1405 +#else
  1.1406 +#define PKIX_VERIFYNODE_DEBUG(expr)
  1.1407 +#define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg)
  1.1408 +#endif
  1.1409 +
  1.1410 +#if PKIX_EKUCHECKER
  1.1411 +#define PKIX_EKUCHECKER_DEBUG(expr) \
  1.1412 +        PKIX_DEBUG(expr)
  1.1413 +#define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg) \
  1.1414 +        PKIX_DEBUG_ARG(expr, arg)
  1.1415 +#else
  1.1416 +#define PKIX_EKUCHECKER_DEBUG(expr)
  1.1417 +#define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg)
  1.1418 +#endif
  1.1419 +
  1.1420 +#if PKIX_CERTVFYPKIXDEBUG
  1.1421 +#define PKIX_CERTVFYPKIX_DEBUG(expr) \
  1.1422 +        PKIX_DEBUG(expr)
  1.1423 +#define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg) \
  1.1424 +        PKIX_DEBUG_ARG(expr, arg)
  1.1425 +#else
  1.1426 +#define PKIX_CERTVFYPKIX_DEBUG(expr)
  1.1427 +#define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg)
  1.1428 +#endif
  1.1429 +
  1.1430 +/*
  1.1431 + * All object types register themselves with the system using a
  1.1432 + * pkix_ClassTable_Entry, which consists of a set of functions for that
  1.1433 + * type and an ASCII string (char *) which is used by the default
  1.1434 + * ToStringCallback (if necessary). System types register themselves directly
  1.1435 + * when their respective PKIX_"type"_RegisterSelf functions are called.
  1.1436 + * User-defined types can be registered using PKIX_PL_Object_RegisterType.
  1.1437 + * (see comments in pkix_pl_system.h)
  1.1438 + */
  1.1439 +
  1.1440 +typedef struct pkix_ClassTable_EntryStruct pkix_ClassTable_Entry;
  1.1441 +struct pkix_ClassTable_EntryStruct {
  1.1442 +        char *description;
  1.1443 +        PKIX_Int32 objCounter;
  1.1444 +        PKIX_Int32 typeObjectSize;
  1.1445 +        PKIX_PL_DestructorCallback destructor;
  1.1446 +        PKIX_PL_EqualsCallback equalsFunction;
  1.1447 +        PKIX_PL_HashcodeCallback hashcodeFunction;
  1.1448 +        PKIX_PL_ToStringCallback toStringFunction;
  1.1449 +        PKIX_PL_ComparatorCallback comparator;
  1.1450 +        PKIX_PL_DuplicateCallback duplicateFunction;
  1.1451 +};
  1.1452 +
  1.1453 +/*
  1.1454 + * PKIX_ERRORCLASSNAMES is an array of strings, with each string holding a
  1.1455 + * descriptive name for an error code. This is used by the default
  1.1456 + * PKIX_PL_Error_ToString function.
  1.1457 + */
  1.1458 +extern const char *PKIX_ERRORCLASSNAMES[PKIX_NUMERRORCLASSES];
  1.1459 +
  1.1460 +#define MAX_STACK_DEPTH         1000
  1.1461 +
  1.1462 +extern PRLogModuleInfo *pkixLog;
  1.1463 +
  1.1464 +#define PKIX_MAGIC_HEADER           LL_INIT(0xFEEDC0FF, 0xEEFACADE)
  1.1465 +#define PKIX_MAGIC_HEADER_DESTROYED LL_INIT(0xBAADF00D, 0xDEADBEEF)
  1.1466 +
  1.1467 +/* see source file for function documentation */
  1.1468 +
  1.1469 +PKIX_Error *
  1.1470 +pkix_IsCertSelfIssued(
  1.1471 +        PKIX_PL_Cert *cert,
  1.1472 +        PKIX_Boolean *pSelfIssued,
  1.1473 +        void *plContext);
  1.1474 +
  1.1475 +PKIX_Error *
  1.1476 +pkix_Throw(
  1.1477 +        PKIX_ERRORCLASS errClass,
  1.1478 +        const char *funcName,
  1.1479 +        PKIX_ERRORCODE errorTextCode,
  1.1480 +        PKIX_ERRORCLASS overrideClass,
  1.1481 +        PKIX_Error *cause,
  1.1482 +        PKIX_Error **pError,
  1.1483 +        void *plContext);
  1.1484 +
  1.1485 +PKIX_Error *
  1.1486 +pkix_CheckTypes(
  1.1487 +        PKIX_PL_Object *first,
  1.1488 +        PKIX_PL_Object *second,
  1.1489 +        PKIX_UInt32 type,
  1.1490 +        void *plContext);
  1.1491 +
  1.1492 +PKIX_Error *
  1.1493 +pkix_CheckType(
  1.1494 +        PKIX_PL_Object *object,
  1.1495 +        PKIX_UInt32 type,
  1.1496 +        void *plContext);
  1.1497 +
  1.1498 +PKIX_Error *
  1.1499 +pkix_hash(
  1.1500 +        const unsigned char *bytes,
  1.1501 +        PKIX_UInt32 length,
  1.1502 +        PKIX_UInt32 *hash,
  1.1503 +        void *plContext);
  1.1504 +
  1.1505 +PKIX_Error *
  1.1506 +pkix_duplicateImmutable(
  1.1507 +        PKIX_PL_Object *object,
  1.1508 +        PKIX_PL_Object **pNewObject,
  1.1509 +        void *plContext);
  1.1510 +
  1.1511 +PKIX_UInt32
  1.1512 +pkix_countArray(void **array);
  1.1513 +
  1.1514 +PKIX_UInt32
  1.1515 +pkix_hex2i(char c);
  1.1516 +
  1.1517 +char
  1.1518 +pkix_i2hex(char c);
  1.1519 +
  1.1520 +PKIX_Boolean
  1.1521 +pkix_isPlaintext(unsigned char c, PKIX_Boolean debug);
  1.1522 +
  1.1523 +PKIX_Error *
  1.1524 +pkix_CacheCertChain_Lookup(
  1.1525 +        PKIX_PL_Cert* targetCert,
  1.1526 +        PKIX_List* anchors,
  1.1527 +        PKIX_PL_Date *testDate,
  1.1528 +        PKIX_Boolean *pFound,
  1.1529 +        PKIX_BuildResult **pBuildResult,
  1.1530 +        void *plContext);
  1.1531 +
  1.1532 +PKIX_Error *
  1.1533 +pkix_CacheCertChain_Remove(
  1.1534 +        PKIX_PL_Cert* targetCert,
  1.1535 +        PKIX_List* anchors,
  1.1536 +        void *plContext);
  1.1537 +
  1.1538 +PKIX_Error *
  1.1539 +pkix_CacheCertChain_Add(
  1.1540 +        PKIX_PL_Cert* targetCert,
  1.1541 +        PKIX_List* anchors,
  1.1542 +        PKIX_PL_Date *validityDate,
  1.1543 +        PKIX_BuildResult *buildResult,
  1.1544 +        void *plContext);
  1.1545 +
  1.1546 +PKIX_Error *
  1.1547 +pkix_CacheCert_Lookup(
  1.1548 +        PKIX_CertStore *store,
  1.1549 +        PKIX_ComCertSelParams *certSelParams,
  1.1550 +        PKIX_PL_Date *testDate,
  1.1551 +        PKIX_Boolean *pFound,
  1.1552 +        PKIX_List** pCerts,
  1.1553 +        void *plContext);
  1.1554 +
  1.1555 +PKIX_Error *
  1.1556 +pkix_CacheCert_Add(
  1.1557 +        PKIX_CertStore *store,
  1.1558 +        PKIX_ComCertSelParams *certSelParams,
  1.1559 +        PKIX_List* certs,
  1.1560 +        void *plContext);
  1.1561 +
  1.1562 +PKIX_Error *
  1.1563 +pkix_CacheCrlEntry_Lookup(
  1.1564 +        PKIX_CertStore *store,
  1.1565 +        PKIX_PL_X500Name *certIssuer,
  1.1566 +        PKIX_PL_BigInt *certSerialNumber,
  1.1567 +        PKIX_Boolean *pFound,
  1.1568 +        PKIX_List** pCrlEntryList,
  1.1569 +        void *plContext);
  1.1570 +
  1.1571 +PKIX_Error *
  1.1572 +pkix_CacheCrlEntry_Add(
  1.1573 +        PKIX_CertStore *store,
  1.1574 +        PKIX_PL_X500Name *certIssuer,
  1.1575 +        PKIX_PL_BigInt *certSerialNumber,
  1.1576 +        PKIX_List* crlEntryList,
  1.1577 +        void *plContext);
  1.1578 +
  1.1579 +#ifdef PR_LOGGING
  1.1580 +void
  1.1581 +pkix_trace_dump_cert(
  1.1582 +        const char *info, 
  1.1583 +        PKIX_PL_Cert *cert, 
  1.1584 +        void *plContext);
  1.1585 +#endif
  1.1586 +
  1.1587 +#ifdef __cplusplus
  1.1588 +}
  1.1589 +#endif
  1.1590 +
  1.1591 +#endif /* _PKIX_TOOLS_H */

mercurial