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: /* michael@0: * pkix_tools.h michael@0: * michael@0: * Header for Utility Functions and Macros michael@0: * michael@0: */ michael@0: michael@0: #ifndef _PKIX_TOOLS_H michael@0: #define _PKIX_TOOLS_H michael@0: michael@0: #include "pkix.h" michael@0: #include michael@0: #include michael@0: #include "secport.h" michael@0: #include "prlong.h" michael@0: michael@0: /* private PKIX system headers */ michael@0: #include "pkix_basicconstraintschecker.h" michael@0: #include "pkix_buildresult.h" michael@0: #include "pkix_certchainchecker.h" michael@0: #include "pkix_certselector.h" michael@0: #include "pkix_comcertselparams.h" michael@0: #include "pkix_comcrlselparams.h" michael@0: #include "pkix_crlselector.h" michael@0: #include "pkix_error.h" michael@0: #include "pkix_expirationchecker.h" michael@0: #include "pkix_list.h" michael@0: #include "pkix_logger.h" michael@0: #include "pkix_namechainingchecker.h" michael@0: #include "pkix_nameconstraintschecker.h" michael@0: #include "pkix_policychecker.h" michael@0: #include "pkix_policynode.h" michael@0: #include "pkix_procparams.h" michael@0: #include "pkix_resourcelimits.h" michael@0: #include "pkix_revocationmethod.h" michael@0: #include "pkix_revocationchecker.h" michael@0: #include "pkix_crlchecker.h" michael@0: #include "pkix_ocspchecker.h" michael@0: #include "pkix_signaturechecker.h" michael@0: #include "pkix_store.h" michael@0: #include "pkix_targetcertchecker.h" michael@0: #include "pkix_validate.h" michael@0: #include "pkix_valresult.h" michael@0: #include "pkix_verifynode.h" michael@0: michael@0: #ifdef __cplusplus michael@0: extern "C" { michael@0: #endif michael@0: michael@0: typedef struct pkixStdVarsStr { michael@0: const char *aMyFuncName; michael@0: PKIX_Error *aPkixErrorResult; michael@0: PKIX_Error *aPkixTempResult; michael@0: PKIX_Error *aPkixReturnResult; michael@0: PKIX_ERRORCODE aPkixErrorCode; michael@0: PKIX_Boolean aPkixErrorReceived; michael@0: PKIX_Boolean aPkixTempErrorReceived; michael@0: PKIX_ERRORCLASS aPkixErrorClass; michael@0: PKIX_UInt32 aPkixType; michael@0: PKIX_PL_Object *aLockedObject; michael@0: PKIX_List *aPkixErrorList; michael@0: } PKIX_StdVars; michael@0: michael@0: #ifdef PKIX_STDVARS_POINTER michael@0: #define myFuncName stdVars->aMyFuncName michael@0: #define pkixErrorResult stdVars->aPkixErrorResult michael@0: #define pkixTempResult stdVars->aPkixTempResult michael@0: #define pkixReturnResult stdVars->aPkixReturnResult michael@0: #define pkixErrorCode stdVars->aPkixErrorCode michael@0: #define pkixErrorReceived stdVars->aPkixErrorReceived michael@0: #define pkixTempErrorReceived stdVars->aPkixTempErrorReceived michael@0: #define pkixErrorClass stdVars->aPkixErrorClass michael@0: #define pkixType stdVars->aPkixType michael@0: #define lockedObject stdVars->aLockedObject michael@0: #define pkixErrorList stdVars->aPkixErrorList michael@0: #define stdVarsPtr stdVars michael@0: #else michael@0: #define myFuncName stdVars.aMyFuncName michael@0: #define pkixErrorResult stdVars.aPkixErrorResult michael@0: #define pkixTempResult stdVars.aPkixTempResult michael@0: #define pkixReturnResult stdVars.aPkixReturnResult michael@0: #define pkixErrorCode stdVars.aPkixErrorCode michael@0: #define pkixErrorReceived stdVars.aPkixErrorReceived michael@0: #define pkixTempErrorReceived stdVars.aPkixTempErrorReceived michael@0: #define pkixErrorClass stdVars.aPkixErrorClass michael@0: #define pkixType stdVars.aPkixType michael@0: #define lockedObject stdVars.aLockedObject michael@0: #define pkixErrorList stdVars.aPkixErrorList michael@0: #define stdVarsPtr &stdVars michael@0: #endif michael@0: michael@0: extern PKIX_Error * PKIX_DoReturn(PKIX_StdVars * stdVars, michael@0: PKIX_ERRORCLASS errClass, michael@0: PKIX_Boolean doLogger, michael@0: void * plContext); michael@0: michael@0: extern PKIX_Error * PKIX_DoThrow(PKIX_StdVars * stdVars, michael@0: PKIX_ERRORCLASS errClass, michael@0: PKIX_ERRORCODE errCode, michael@0: PKIX_ERRORCLASS overrideClass, michael@0: void * plContext); michael@0: michael@0: extern void PKIX_DoAddError(PKIX_StdVars * stdVars, michael@0: PKIX_Error * error, michael@0: void * plContext); michael@0: michael@0: #ifdef PKIX_OBJECT_LEAK_TEST michael@0: extern PKIX_Error * pkix_CheckForGeneratedError(PKIX_StdVars * stdVars, michael@0: PKIX_ERRORCLASS errClass, michael@0: char * fnName, michael@0: PKIX_Boolean *errorStateSet, michael@0: void * plContext); michael@0: #endif /* PKIX_OBJECT_LEAK_TEST */ michael@0: michael@0: extern const PKIX_StdVars zeroStdVars; michael@0: michael@0: extern PRLogModuleInfo *pkixLog; michael@0: michael@0: /* michael@0: * UTILITY MACROS michael@0: * Documentation for these common utility macros can be found in the michael@0: * Implementation Guidelines document (Section 4.3) michael@0: * michael@0: * In general, macros with multiple statements (or a single "if" statement) michael@0: * use the "do {} while (0)" technique in order to convert the multiple michael@0: * statements into one statement, thus avoiding the dangling else problem. michael@0: * For macros which ALWAYS exit with a "return" or "goto", there is no michael@0: * need to use this technique (and it yields compiler warnings of "statement michael@0: * not reached"), so we just use "{}" to group the statements together. michael@0: */ michael@0: michael@0: #if !defined (PKIX_OBJECT_LEAK_TEST) michael@0: michael@0: #define PKIX_STD_VARS(funcName) \ michael@0: static const char cMyFuncName[] = {funcName}; \ michael@0: PKIX_StdVars stdVars = zeroStdVars; \ michael@0: myFuncName = cMyFuncName michael@0: michael@0: michael@0: #else /* PKIX_OBJECT_LEAK_TEST */ michael@0: michael@0: extern char **fnStackNameArr; michael@0: extern PKIX_UInt32 *fnStackInvCountArr; michael@0: extern PKIX_UInt32 stackPosition; michael@0: extern PKIX_Boolean noErrorState; michael@0: extern PKIX_Boolean errorGenerated; michael@0: extern PKIX_Boolean runningLeakTest; michael@0: extern PLHashTable *fnInvTable; michael@0: extern PKIX_UInt32 testStartFnStackPosition; michael@0: extern char *errorFnStackString; michael@0: michael@0: extern PLHashNumber PR_CALLBACK pkix_ErrorGen_Hash (const void *key); michael@0: michael@0: #define PKIX_STD_VARS(funcName) \ michael@0: static const char cMyFuncName[] = {funcName}; \ michael@0: PKIX_StdVars stdVars = zeroStdVars; \ michael@0: PKIX_Boolean errorSetFlag = PKIX_FALSE; \ michael@0: myFuncName = cMyFuncName; \ michael@0: if (runningLeakTest) { \ michael@0: if (fnStackNameArr) { \ michael@0: fnStackInvCountArr[stackPosition] += 1; \ michael@0: stackPosition += 1; \ michael@0: fnStackInvCountArr[stackPosition] = 0; \ michael@0: fnStackNameArr[stackPosition] = (char*)myFuncName; \ michael@0: fnStackNameArr[stackPosition + 1] = NULL; \ michael@0: PR_LOG(pkixLog, 5, \ michael@0: ("%s%*s+> %s(%d) - %s\n", (errorGenerated ? "*" : " "), \ michael@0: stackPosition, " ", fnStackNameArr[stackPosition], \ michael@0: stackPosition, myFuncName)); \ michael@0: } \ michael@0: do { \ michael@0: pkixErrorResult = pkix_CheckForGeneratedError(&stdVars, PKIX_MEM_ERROR, \ michael@0: funcName, &errorSetFlag, \ michael@0: plContext); \ michael@0: if (pkixErrorResult) { \ michael@0: PR_LOG(pkixLog, 5, \ michael@0: ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \ michael@0: stackPosition, " ", fnStackNameArr[stackPosition], \ michael@0: stackPosition, myFuncName)); \ michael@0: fnStackNameArr[stackPosition--] = NULL; \ michael@0: if (errorSetFlag) { \ michael@0: noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \ michael@0: } \ michael@0: return pkixErrorResult; \ michael@0: } \ michael@0: } while (0); \ michael@0: } michael@0: #endif /* PKIX_OBJECT_LEAK_TEST */ michael@0: michael@0: #ifdef DEBUG michael@0: #define _PKIX_DEBUG_TRACE(cond, prefix, level) \ michael@0: do { \ michael@0: if (cond) { \ michael@0: pkix_Logger_Check(pkixLoggersDebugTrace, myFuncName, \ michael@0: prefix, pkixType, level, plContext); \ michael@0: } \ michael@0: } while (0) michael@0: #else michael@0: #define _PKIX_DEBUG_TRACE(cond, prefix, level) michael@0: #endif michael@0: michael@0: #define _PKIX_LOG_ERROR(code, level) \ michael@0: { \ michael@0: if (pkixLoggersErrors) { \ michael@0: pkix_Logger_CheckWithCode(pkixLoggersErrors, code, \ michael@0: NULL, pkixType, level, plContext); \ michael@0: } \ michael@0: } michael@0: michael@0: #define PKIX_ENTER(type, funcName) \ michael@0: PKIX_STD_VARS(funcName); \ michael@0: pkixType = PKIX_ ## type ## _ERROR; \ michael@0: PKIX_DEBUG_ENTER(type); \ michael@0: _PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, ">>>", PKIX_LOGGER_LEVEL_TRACE); michael@0: michael@0: #define PKIX_ENTER_NO_LOGGER(type, funcName) \ michael@0: PKIX_STD_VARS(funcName); \ michael@0: pkixType = PKIX_ ## type ## _ERROR; \ michael@0: PKIX_DEBUG_ENTER(type); michael@0: michael@0: #define PKIX_DEBUG_ENTER(type) \ michael@0: PKIX_ ## type ## _DEBUG_ARG("( Entering %s).\n", myFuncName) michael@0: michael@0: #define PKIX_DEBUG_EXIT(type) \ michael@0: PKIX_ ## type ## _DEBUG_ARG("( Exiting %s).\n", myFuncName) michael@0: michael@0: #define PKIX_OBJECT_UNLOCK(obj) \ michael@0: do { \ michael@0: if (obj && lockedObject == (PKIX_PL_Object *)(obj)){ \ michael@0: pkixTempResult = \ michael@0: PKIX_PL_Object_Unlock \ michael@0: ((PKIX_PL_Object *)(obj), plContext); \ michael@0: if (pkixTempResult) { \ michael@0: PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \ michael@0: pkixTempResult = NULL; \ michael@0: } \ michael@0: lockedObject = NULL; \ michael@0: } else { \ michael@0: PORT_Assert(lockedObject == NULL); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_DECREF(obj) \ michael@0: do { \ michael@0: if (obj){ \ michael@0: pkixTempResult = PKIX_PL_Object_DecRef \ michael@0: ((PKIX_PL_Object *)(obj), plContext); \ michael@0: if (pkixTempResult) { \ michael@0: PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \ michael@0: pkixTempResult = NULL; \ michael@0: } \ michael@0: obj = NULL; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_THROW(type, descNum) \ michael@0: return PKIX_DoThrow(&stdVars, (PKIX_ ## type ## _ERROR), descNum, \ michael@0: pkixErrorClass, plContext); michael@0: michael@0: #ifdef PKIX_OBJECT_LEAK_TEST michael@0: #define PKIX_RETURN(type) \ michael@0: if (runningLeakTest && fnStackNameArr) { \ michael@0: PR_LOG(pkixLog, 5, \ michael@0: ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \ michael@0: stackPosition, " ", fnStackNameArr[stackPosition], \ michael@0: stackPosition, myFuncName)); \ michael@0: fnStackNameArr[stackPosition--] = NULL; \ michael@0: if (errorSetFlag) noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \ michael@0: } \ michael@0: return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext); michael@0: #else michael@0: #define PKIX_RETURN(type) \ michael@0: return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext); michael@0: #endif /* PKIX_OBJECT_LEAK_TEST */ michael@0: michael@0: michael@0: #if defined(DEBUG) && !defined(DEBUG_nb95248) michael@0: #define PKIX_RETURN_NO_LOGGER(type) \ michael@0: { \ michael@0: PKIX_OBJECT_UNLOCK(lockedObject); \ michael@0: if ((pkixErrorReceived) || (pkixErrorResult) || pkixErrorList) \ michael@0: PKIX_THROW(type, pkixErrorCode); \ michael@0: PKIX_DEBUG_EXIT(type); \ michael@0: return NULL; \ michael@0: } michael@0: #else michael@0: #define PKIX_RETURN_NO_LOGGER(type) \ michael@0: return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_FALSE, plContext); michael@0: #endif michael@0: michael@0: /* disable to disable ;-) */ michael@0: /* #define WANT_TRACE_CHECK_FAILURES */ michael@0: michael@0: #ifdef WANT_TRACE_CHECK_FAILURES michael@0: #define TRACE_CHECK_FAILURE(what, errorstring) \ michael@0: if (pkixLog) { \ michael@0: PR_LOG(pkixLog, PR_LOG_DEBUG, \ michael@0: ("====> [%s] failed: %s\n", #what, errorstring)); \ michael@0: } michael@0: #else michael@0: #define TRACE_CHECK_FAILURE(what, errorstring) michael@0: #endif michael@0: michael@0: #define PKIX_CHECK(func, descNum) \ michael@0: do { \ michael@0: pkixErrorResult = (func); \ michael@0: if (pkixErrorResult) { \ michael@0: TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \ michael@0: pkixErrorClass = pkixErrorResult->errClass; \ michael@0: pkixErrorCode = descNum; \ michael@0: goto cleanup; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: /* like PKIX_CHECK but without goto cleanup */ michael@0: #define PKIX_CHECK_NO_GOTO(func, descNum) \ michael@0: do { \ michael@0: pkixErrorResult = (func); \ michael@0: if (pkixErrorResult) { \ michael@0: TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \ michael@0: pkixErrorClass = pkixErrorResult->errClass; \ michael@0: pkixErrorCode = descNum; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_CHECK_ONLY_FATAL(func, descNum) \ michael@0: do { \ michael@0: pkixTempErrorReceived = PKIX_FALSE; \ michael@0: pkixErrorResult = (func); \ michael@0: if (pkixErrorResult) { \ michael@0: TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \ michael@0: pkixTempErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorClass = pkixErrorResult->errClass; \ michael@0: if (pkixErrorClass == PKIX_FATAL_ERROR) { \ michael@0: goto cleanup; \ michael@0: } \ michael@0: PKIX_DECREF(pkixErrorResult); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_LOG_ERROR(descNum) \ michael@0: _PKIX_LOG_ERROR(descNum, PKIX_LOGGER_LEVEL_ERROR) michael@0: michael@0: #define PKIX_ERROR(descNum) \ michael@0: { \ michael@0: PKIX_LOG_ERROR(descNum) \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = descNum; \ michael@0: goto cleanup; \ michael@0: } michael@0: michael@0: #define PKIX_ERROR_ALLOC_ERROR() \ michael@0: { \ michael@0: PKIX_LOG_ERROR(PKIX_ALLOCERROR) \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorResult = PKIX_ALLOC_ERROR(); \ michael@0: goto cleanup; \ michael@0: } michael@0: michael@0: #define PKIX_ERROR_FATAL(descNum) \ michael@0: { \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = descNum; \ michael@0: pkixErrorClass = PKIX_FATAL_ERROR; \ michael@0: _PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \ michael@0: goto cleanup; \ michael@0: } michael@0: michael@0: #define PKIX_CHECK_FATAL(func, descNum) \ michael@0: do { \ michael@0: pkixErrorResult = (func); \ michael@0: if (pkixErrorResult) { \ michael@0: TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = descNum; \ michael@0: pkixErrorClass = PKIX_FATAL_ERROR; \ michael@0: _PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \ michael@0: goto fatal; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_NULLCHECK_ONE(a) \ michael@0: do { \ michael@0: if ((a) == NULL){ \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = PKIX_NULLARGUMENT; \ michael@0: PKIX_RETURN(FATAL); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_NULLCHECK_TWO(a, b) \ michael@0: do { \ michael@0: if (((a) == NULL) || ((b) == NULL)){ \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = PKIX_NULLARGUMENT; \ michael@0: PKIX_RETURN(FATAL); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_NULLCHECK_THREE(a, b, c) \ michael@0: do { \ michael@0: if (((a) == NULL) || ((b) == NULL) || ((c) == NULL)){ \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = PKIX_NULLARGUMENT; \ michael@0: PKIX_RETURN(FATAL); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_NULLCHECK_FOUR(a, b, c, d) \ michael@0: do { \ michael@0: if (((a) == NULL) || ((b) == NULL) || \ michael@0: ((c) == NULL) || ((d) == NULL)){ \ michael@0: pkixErrorReceived = PKIX_TRUE; \ michael@0: pkixErrorCode = PKIX_NULLARGUMENT; \ michael@0: PKIX_RETURN(FATAL); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_OBJECT_LOCK(obj) \ michael@0: do { \ michael@0: if (obj) { \ michael@0: pkixTempResult = \ michael@0: PKIX_PL_Object_Lock((PKIX_PL_Object*)(obj), plContext); \ michael@0: if (pkixTempResult) { \ michael@0: PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \ michael@0: pkixTempResult = NULL; \ michael@0: pkixErrorCode = PKIX_OBJECTLOCKFAILED; \ michael@0: goto cleanup; \ michael@0: } \ michael@0: lockedObject = (PKIX_PL_Object *)(obj); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_ERROR_CREATE(type, descNum, error) \ michael@0: { \ michael@0: pkixTempResult = (PKIX_Error*)pkix_Throw \ michael@0: (PKIX_ ## type ## _ERROR, myFuncName, \ michael@0: descNum, PKIX_ ## type ## _ERROR, pkixErrorResult, \ michael@0: &error, plContext); \ michael@0: if (pkixTempResult) { \ michael@0: error = pkixTempResult; \ michael@0: pkixTempResult = NULL; \ michael@0: } \ michael@0: } michael@0: michael@0: michael@0: #define PKIX_ERROR_RECEIVED \ michael@0: (pkixErrorReceived || pkixErrorResult || pkixTempErrorReceived || \ michael@0: pkixErrorList) michael@0: michael@0: #define PKIX_INCREF(obj) \ michael@0: do { \ michael@0: if (obj){ \ michael@0: pkixTempResult = PKIX_PL_Object_IncRef \ michael@0: ((PKIX_PL_Object *)(obj), plContext); \ michael@0: if (pkixTempResult) { \ michael@0: PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \ michael@0: pkixTempResult = NULL; \ michael@0: goto cleanup; \ michael@0: } \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_FREE(obj) \ michael@0: do { \ michael@0: if (obj) { \ michael@0: pkixTempResult = PKIX_PL_Free((obj), plContext); \ michael@0: if (pkixTempResult) { \ michael@0: PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \ michael@0: pkixTempResult = NULL; \ michael@0: } \ michael@0: obj = NULL; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_EXACTLY_ONE_NULL(a, b) (((a) && !(b)) || ((b) && !(a))) michael@0: michael@0: /* DIGIT MACROS */ michael@0: michael@0: #define PKIX_ISDIGIT(c) (((c) >= '0') && ((c) <= '9')) michael@0: michael@0: #define PKIX_ISXDIGIT(c) \ michael@0: (PKIX_ISDIGIT(c) || ( (((c)|0x20) >= 'a') && (((c)|0x20) <= 'f') )) michael@0: michael@0: #define PKIX_TOSTRING(a, b, c, d) \ michael@0: do { \ michael@0: int descNum; \ michael@0: if ((a) != NULL) { \ michael@0: pkixErrorResult = \ michael@0: PKIX_PL_Object_ToString((PKIX_PL_Object *)(a), (b), (c)); \ michael@0: descNum = (d); \ michael@0: } else { \ michael@0: pkixErrorResult = \ michael@0: PKIX_PL_String_Create(PKIX_ESCASCII, "(null)", 0, (b), (c)); \ michael@0: descNum = PKIX_STRINGCREATEFAILED; \ michael@0: } \ michael@0: PKIX_CHECK(pkixErrorResult, descNum); \ michael@0: } while (0) michael@0: michael@0: #define PKIX_EQUALS(a, b, c, d, e) \ michael@0: do { \ michael@0: if ((a) != NULL && (b) != NULL) { \ michael@0: PKIX_CHECK(PKIX_PL_Object_Equals\ michael@0: ((PKIX_PL_Object *)(a), \ michael@0: (PKIX_PL_Object*)(b), \ michael@0: (c), \ michael@0: (d)), \ michael@0: (e)); \ michael@0: } else if ((a) == NULL && (b) == NULL) { \ michael@0: *(c) = PKIX_TRUE; \ michael@0: } else { \ michael@0: *(c) = PKIX_FALSE; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_HASHCODE(a, b, c, d) \ michael@0: do { \ michael@0: if ((a) != NULL) { \ michael@0: PKIX_CHECK(PKIX_PL_Object_Hashcode\ michael@0: ((PKIX_PL_Object *)(a), (b), (c)), (d)); \ michael@0: } else { \ michael@0: *(b) = 0; \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: #define PKIX_DUPLICATE(a, b, c, d) \ michael@0: do { \ michael@0: if ((a) != NULL) { \ michael@0: PKIX_CHECK(PKIX_PL_Object_Duplicate\ michael@0: ((PKIX_PL_Object *)(a), \ michael@0: (PKIX_PL_Object **)(b), \ michael@0: (c)), \ michael@0: (d)); \ michael@0: } else { \ michael@0: *(b) = (a); \ michael@0: } \ michael@0: } while (0) michael@0: michael@0: /* michael@0: * DEBUG MACROS michael@0: * michael@0: * Each type has an associated debug flag, which can michael@0: * be set on the compiler line using "-D". For convenience, michael@0: * "-DPKIX_DEBUGALL" turns on debug for all the components. michael@0: * michael@0: * If a type's debug flag is defined, then its two associated macros michael@0: * are defined: PKIX_type_DEBUG(expr) and PKIX_type_DEBUG_ARG(expr, arg), michael@0: * which call PKIX_DEBUG(expr) and PKIX_DEBUG_ARG(expr, arg) respectively, michael@0: * which, in turn, enable standard and consistently formatted output. michael@0: * michael@0: * If a type's debug flag is not defined, the two associated macros michael@0: * are defined as a NO-OP. As such, any PKIX_type_DEBUG or PKIX_type_DEBUG_ARG michael@0: * macros for an undefined type will be stripped from the code during michael@0: * pre-processing, thereby reducing code size. michael@0: */ michael@0: michael@0: #ifdef PKIX_DEBUGALL michael@0: #define PKIX_REFCOUNTDEBUG 1 michael@0: #define PKIX_MEMDEBUG 1 michael@0: #define PKIX_MUTEXDEBUG 1 michael@0: #define PKIX_OBJECTDEBUG 1 michael@0: #define PKIX_STRINGDEBUG 1 michael@0: #define PKIX_OIDDEBUG 1 michael@0: #define PKIX_LISTDEBUG 1 michael@0: #define PKIX_ERRORDEBUG 1 michael@0: #define PKIX_BYTEARRAYDEBUG 1 michael@0: #define PKIX_RWLOCKDEBUG 1 michael@0: #define PKIX_BIGINTDEBUG 1 michael@0: #define PKIX_HASHTABLEDEBUG 1 michael@0: #define PKIX_X500NAMEDEBUG 1 michael@0: #define PKIX_GENERALNAMEDEBUG 1 michael@0: #define PKIX_PUBLICKEYDEBUG 1 michael@0: #define PKIX_CERTDEBUG 1 michael@0: #define PKIX_HTTPCLIENTDEBUG 1 michael@0: #define PKIX_DATEDEBUG 1 michael@0: #define PKIX_TRUSTANCHORDEBUG 1 michael@0: #define PKIX_PROCESSINGPARAMSDEBUG 1 michael@0: #define PKIX_VALIDATEPARAMSDEBUG 1 michael@0: #define PKIX_VALIDATERESULTDEBUG 1 michael@0: #define PKIX_VALIDATEDEBUG 1 michael@0: #define PKIX_CERTCHAINCHECKERDEBUG 1 michael@0: #define PKIX_REVOCATIONCHECKERDEBUG 1 michael@0: #define PKIX_CERTSELECTORDEBUG 1 michael@0: #define PKIX_COMCERTSELPARAMSDEBUG 1 michael@0: #define PKIX_TARGETCERTCHECKERSTATEDEBUG 1 michael@0: #define PKIX_INITIALIZEPARAMSDEBUG 1 michael@0: #define PKIX_CERTBASICCONSTRAINTSDEBUG 1 michael@0: #define PKIX_CERTNAMECONSTRAINTSDEBUG 1 michael@0: #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG 1 michael@0: #define PKIX_SUBJALTNAMECHECKERSTATEDEBUG 1 michael@0: michael@0: #define PKIX_CERTPOLICYQUALIFIERDEBUG 1 michael@0: #define PKIX_CERTPOLICYINFODEBUG 1 michael@0: #define PKIX_CERTPOLICYNODEDEBUG 1 michael@0: #define PKIX_CERTPOLICYCHECKERSTATEDEBUG 1 michael@0: #define PKIX_LIFECYCLEDEBUG 1 michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG 1 michael@0: #define PKIX_CRLDEBUG 1 michael@0: #define PKIX_CRLENTRYDEBUG 1 michael@0: #define PKIX_CRLSELECTORDEBUG 1 michael@0: #define PKIX_COMCRLSELPARAMSDEBUG 1 michael@0: #define PKIX_CERTSTOREDEBUG 1 michael@0: #define PKIX_COLLECTIONCERTSTORECONTEXTDEBUG 1 michael@0: #define PKIX_DEFAULTCRLCHECKERSTATEDEBUG 1 michael@0: #define PKIX_CERTPOLICYMAPDEBUG 1 michael@0: #define PKIX_BUILDDEBUG 1 michael@0: #define PKIX_BUILDRESULTDEBUG 1 michael@0: #define PKIX_FORWARDBUILDERSTATEDEBUG 1 michael@0: #define PKIX_SIGNATURECHECKERSTATEDEBUG 1 michael@0: #define PKIX_USERDEFINEDMODULESDEBUG 1 michael@0: #define PKIX_CONTEXTDEBUG 1 michael@0: #define PKIX_DEFAULTREVOCATIONCHECKERDEBUG 1 michael@0: #define PKIX_LDAPREQUESTDEBUG 1 michael@0: #define PKIX_LDAPRESPONSEDEBUG 1 michael@0: #define PKIX_LDAPCLIENTDEBUG 1 michael@0: #define PKIX_LDAPDEFAULTCLIENTDEBUG 1 michael@0: #define PKIX_SOCKETDEBUG 1 michael@0: #define PKIX_RESOURCELIMITSDEBUG 1 michael@0: #define PKIX_LOGGERDEBUG 1 michael@0: #define PKIX_MONITORLOCKDEBUG 1 michael@0: #define PKIX_INFOACCESSDEBUG 1 michael@0: #define PKIX_AIAMGRDEBUG 1 michael@0: #define PKIX_OCSPCHECKERDEBUG 1 michael@0: #define PKIX_OCSPREQUESTDEBUG 1 michael@0: #define PKIX_OCSPRESPONSEDEBUG 1 michael@0: #define PKIX_HTTPDEFAULTCLIENTDEBUG 1 michael@0: #define PKIX_HTTPCERTSTORECONTEXTDEBUG 1 michael@0: #define PKIX_VERIFYNODEDEBUG 1 michael@0: #endif michael@0: michael@0: /* michael@0: * XXX Both PKIX_DEBUG and PKIX_DEBUG_ARG currently use printf. michael@0: * This needs to be replaced with Loggers. michael@0: */ michael@0: michael@0: #ifdef DEBUG michael@0: #define PKIX_DEBUG(expr) \ michael@0: do { \ michael@0: _PKIX_DEBUG_TRACE(pkixLoggersErrors, expr, PKIX_LOGGER_LEVEL_DEBUG); \ michael@0: (void) fprintf(stderr, "(%s: ", myFuncName); \ michael@0: (void) fprintf(stderr, expr); \ michael@0: } while (0) michael@0: #else michael@0: #define PKIX_DEBUG(expr) michael@0: #endif michael@0: michael@0: /* Logging doesn't support DEBUG with ARG: cannot convert control and arg */ michael@0: #define PKIX_DEBUG_ARG(expr, arg) \ michael@0: do { \ michael@0: (void) printf("(%s: ", myFuncName); \ michael@0: (void) printf(expr, arg); \ michael@0: } while (0) michael@0: michael@0: #if PKIX_FATALDEBUG michael@0: #define PKIX_FATAL_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_FATAL_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_FATAL_DEBUG(expr) michael@0: #define PKIX_FATAL_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_REFCOUNTDEBUG michael@0: #define PKIX_REF_COUNT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_REF_COUNT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_REF_COUNT_DEBUG(expr) michael@0: #define PKIX_REF_COUNT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_MEMDEBUG michael@0: #define PKIX_MEM_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_MEM_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_MEM_DEBUG(expr) michael@0: #define PKIX_MEM_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_MUTEXDEBUG michael@0: #define PKIX_MUTEX_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_MUTEX_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_MUTEX_DEBUG(expr) michael@0: #define PKIX_MUTEX_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OBJECTDEBUG michael@0: #define PKIX_OBJECT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OBJECT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OBJECT_DEBUG(expr) michael@0: #define PKIX_OBJECT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_ERRORDEBUG michael@0: #define PKIX_ERROR_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_ERROR_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_ERROR_DEBUG(expr) michael@0: #define PKIX_ERROR_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_STRINGDEBUG michael@0: #define PKIX_STRING_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_STRING_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_STRING_DEBUG(expr) michael@0: #define PKIX_STRING_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OIDDEBUG michael@0: #define PKIX_OID_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OID_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OID_DEBUG(expr) michael@0: #define PKIX_OID_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LISTDEBUG michael@0: #define PKIX_LIST_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LIST_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LIST_DEBUG(expr) michael@0: #define PKIX_LIST_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_RWLOCKDEBUG michael@0: #define PKIX_RWLOCK_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_RWLOCK_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_RWLOCK_DEBUG(expr) michael@0: #define PKIX_RWLOCK_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BYTEARRAYDEBUG michael@0: #define PKIX_BYTEARRAY_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BYTEARRAY_DEBUG(expr) michael@0: #define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_HASHTABLEDEBUG michael@0: #define PKIX_HASHTABLE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_HASHTABLE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_HASHTABLE_DEBUG(expr) michael@0: #define PKIX_HASHTABLE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_X500NAMEDEBUG michael@0: #define PKIX_X500NAME_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_X500NAME_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_X500NAME_DEBUG(expr) michael@0: #define PKIX_X500NAME_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_GENERALNAMEDEBUG michael@0: #define PKIX_GENERALNAME_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_GENERALNAME_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_GENERALNAME_DEBUG(expr) michael@0: #define PKIX_GENERALNAME_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_PUBLICKEYDEBUG michael@0: #define PKIX_PUBLICKEY_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_PUBLICKEY_DEBUG(expr) michael@0: #define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTDEBUG michael@0: #define PKIX_CERT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERT_DEBUG(expr) michael@0: #define PKIX_CERT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CRLDPDEBUG michael@0: #define PKIX_CRLDP_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CRLDP_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CRLDP_DEBUG(expr) michael@0: #define PKIX_CRLDP_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_HTTPCLIENTDEBUG michael@0: #define PKIX_HTTPCLIENT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_HTTPCLIENT_DEBUG(expr) michael@0: #define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BIGINTDEBUG michael@0: #define PKIX_BIGINT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BIGINT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BIGINT_DEBUG(expr) michael@0: #define PKIX_BIGINT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_DATEDEBUG michael@0: #define PKIX_DATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_DATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_DATE_DEBUG(expr) michael@0: #define PKIX_DATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_TRUSTANCHORDEBUG michael@0: #define PKIX_TRUSTANCHOR_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_TRUSTANCHOR_DEBUG(expr) michael@0: #define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_PROCESSINGPARAMSDEBUG michael@0: #define PKIX_PROCESSINGPARAMS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_PROCESSINGPARAMS_DEBUG(expr) michael@0: #define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_VALIDATEPARAMSDEBUG michael@0: #define PKIX_VALIDATEPARAMS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_VALIDATEPARAMS_DEBUG(expr) michael@0: #define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_VALIDATERESULTDEBUG michael@0: #define PKIX_VALIDATERESULT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_VALIDATERESULT_DEBUG(expr) michael@0: #define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_VALIDATEDEBUG michael@0: #define PKIX_VALIDATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_VALIDATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_VALIDATE_DEBUG(expr) michael@0: #define PKIX_VALIDATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BUILDDEBUG michael@0: #define PKIX_BUILD_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BUILD_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BUILD_DEBUG(expr) michael@0: #define PKIX_BUILD_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTCHAINCHECKERDEBUG michael@0: #define PKIX_CERTCHAINCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTCHAINCHECKER_DEBUG(expr) michael@0: #define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_REVOCATIONCHECKERDEBUG michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG(expr) michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_REVOCATIONMETHODDEBUG michael@0: #define PKIX_REVOCATIONMETHOD_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_REVOCATIONMETHOD_DEBUG(expr) michael@0: #define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTSELECTORDEBUG michael@0: #define PKIX_CERTSELECTOR_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTSELECTOR_DEBUG(expr) michael@0: #define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_COMCERTSELPARAMSDEBUG michael@0: #define PKIX_COMCERTSELPARAMS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_COMCERTSELPARAMS_DEBUG(expr) michael@0: #define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_TARGETCERTCHECKERSTATEDEBUG michael@0: #define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_INITIALIZEPARAMSDEBUG michael@0: #define PKIX_INITIALIZEPARAMS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_INITIALIZEPARAMS_DEBUG(expr) michael@0: #define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTBASICCONSTRAINTSDEBUG michael@0: #define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr) michael@0: #define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTNAMECONSTRAINTSDEBUG michael@0: #define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr) michael@0: #define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG michael@0: #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_SUBJALTNAMECHECKERSTATEDEBUG michael@0: #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTPOLICYQUALIFIERDEBUG michael@0: #define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTPOLICYINFODEBUG michael@0: #define PKIX_CERTPOLICYINFO_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTPOLICYINFO_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTPOLICYNODEDEBUG michael@0: #define PKIX_CERTPOLICYNODE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTPOLICYNODE_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTPOLICYCHECKERSTATEDEBUG michael@0: #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LIFECYCLEDEBUG michael@0: #define PKIX_LIFECYCLE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LIFECYCLE_DEBUG(expr) michael@0: #define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CRLDEBUG michael@0: #define PKIX_CRL_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CRL_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CRL_DEBUG(expr) michael@0: #define PKIX_CRL_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CRLENTRYDEBUG michael@0: #define PKIX_CRLENTRY_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CRLENTRY_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CRLENTRY_DEBUG(expr) michael@0: #define PKIX_CRLENTRY_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CRLSELECTORDEBUG michael@0: #define PKIX_CRLSELECTOR_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CRLSELECTOR_DEBUG(expr) michael@0: #define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_COMCRLSELPARAMSDEBUG michael@0: #define PKIX_COMCRLSELPARAMS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_COMCRLSELPARAMS_DEBUG(expr) michael@0: #define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTSTOREDEBUG michael@0: #define PKIX_CERTSTORE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTSTORE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTSTORE_DEBUG(expr) michael@0: #define PKIX_CERTSTORE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_COLLECTIONCERTSTORECONTEXTDEBUG michael@0: #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr) michael@0: #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CRLCHECKERDEBUG michael@0: #define PKIX_CRLCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CRLCHECKER_DEBUG(expr) michael@0: #define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTPOLICYMAPDEBUG michael@0: #define PKIX_CERTPOLICYMAP_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTPOLICYMAP_DEBUG(expr) michael@0: #define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_BUILDRESULTDEBUG michael@0: #define PKIX_BUILDRESULT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_BUILDRESULT_DEBUG(expr) michael@0: #define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_FORWARDBUILDERSTATEDEBUG michael@0: #define PKIX_FORWARDBUILDERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_FORWARDBUILDERSTATE_DEBUG(expr) michael@0: #define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_SIGNATURECHECKERSTATEDEBUG michael@0: #define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr) michael@0: #define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_USERDEFINEDMODULESDEBUG michael@0: #define PKIX_USERDEFINEDMODULES_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_USERDEFINEDMODULES_DEBUG(expr) michael@0: #define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CONTEXTDEBUG michael@0: #define PKIX_CONTEXT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CONTEXT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CONTEXT_DEBUG(expr) michael@0: #define PKIX_CONTEXT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_REVOCATIONCHECKERDEBUG michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG(expr) michael@0: #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LDAPREQUESTDEBUG michael@0: #define PKIX_LDAPREQUEST_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LDAPREQUEST_DEBUG(expr) michael@0: #define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LDAPRESPONSEDEBUG michael@0: #define PKIX_LDAPRESPONSE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LDAPRESPONSE_DEBUG(expr) michael@0: #define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LDAPCLIENTDEBUG michael@0: #define PKIX_LDAPCLIENT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LDAPCLIENT_DEBUG(expr) michael@0: #define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LDAPDEFAULTCLIENTDEBUG michael@0: #define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr) michael@0: #define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_SOCKETDEBUG michael@0: #define PKIX_SOCKET_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_SOCKET_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_SOCKET_DEBUG(expr) michael@0: #define PKIX_SOCKET_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_RESOURCELIMITSDEBUG michael@0: #define PKIX_RESOURCELIMITS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_RESOURCELIMITS_DEBUG(expr) michael@0: #define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_LOGGERDEBUG michael@0: #define PKIX_LOGGER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_LOGGER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_LOGGER_DEBUG(expr) michael@0: #define PKIX_LOGGER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_MONITORLOCKDEBUG michael@0: #define PKIX_MONITORLOCK_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_MONITORLOCK_DEBUG(expr) michael@0: #define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_INFOACCESSDEBUG michael@0: #define PKIX_INFOACCESS_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_INFOACCESS_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_INFOACCESS_DEBUG(expr) michael@0: #define PKIX_INFOACCESS_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_AIAMGRDEBUG michael@0: #define PKIX_AIAMGR_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_AIAMGR_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_AIAMGR_DEBUG(expr) michael@0: #define PKIX_AIAMGR_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OCSPCHECKERDEBUG michael@0: #define PKIX_OCSPCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OCSPCHECKER_DEBUG(expr) michael@0: #define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OCSPCERTIDDEBUG michael@0: #define PKIX_OCSPCERTID_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OCSPCERTID_DEBUG(expr) michael@0: #define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OCSPREQUESTDEBUG michael@0: #define PKIX_OCSPREQUEST_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OCSPREQUEST_DEBUG(expr) michael@0: #define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_OCSPRESPONSEDEBUG michael@0: #define PKIX_OCSPRESPONSE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_OCSPRESPONSE_DEBUG(expr) michael@0: #define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_HTTPDEFAULTCLIENTDEBUG michael@0: #define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr) michael@0: #define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_HTTPCERTSTORECONTEXTDEBUG michael@0: #define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr) michael@0: #define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_VERIFYNODEDEBUG michael@0: #define PKIX_VERIFYNODE_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_VERIFYNODE_DEBUG(expr) michael@0: #define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_EKUCHECKER michael@0: #define PKIX_EKUCHECKER_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_EKUCHECKER_DEBUG(expr) michael@0: #define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: #if PKIX_CERTVFYPKIXDEBUG michael@0: #define PKIX_CERTVFYPKIX_DEBUG(expr) \ michael@0: PKIX_DEBUG(expr) michael@0: #define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg) \ michael@0: PKIX_DEBUG_ARG(expr, arg) michael@0: #else michael@0: #define PKIX_CERTVFYPKIX_DEBUG(expr) michael@0: #define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg) michael@0: #endif michael@0: michael@0: /* michael@0: * All object types register themselves with the system using a michael@0: * pkix_ClassTable_Entry, which consists of a set of functions for that michael@0: * type and an ASCII string (char *) which is used by the default michael@0: * ToStringCallback (if necessary). System types register themselves directly michael@0: * when their respective PKIX_"type"_RegisterSelf functions are called. michael@0: * User-defined types can be registered using PKIX_PL_Object_RegisterType. michael@0: * (see comments in pkix_pl_system.h) michael@0: */ michael@0: michael@0: typedef struct pkix_ClassTable_EntryStruct pkix_ClassTable_Entry; michael@0: struct pkix_ClassTable_EntryStruct { michael@0: char *description; michael@0: PKIX_Int32 objCounter; michael@0: PKIX_Int32 typeObjectSize; michael@0: PKIX_PL_DestructorCallback destructor; michael@0: PKIX_PL_EqualsCallback equalsFunction; michael@0: PKIX_PL_HashcodeCallback hashcodeFunction; michael@0: PKIX_PL_ToStringCallback toStringFunction; michael@0: PKIX_PL_ComparatorCallback comparator; michael@0: PKIX_PL_DuplicateCallback duplicateFunction; michael@0: }; michael@0: michael@0: /* michael@0: * PKIX_ERRORCLASSNAMES is an array of strings, with each string holding a michael@0: * descriptive name for an error code. This is used by the default michael@0: * PKIX_PL_Error_ToString function. michael@0: */ michael@0: extern const char *PKIX_ERRORCLASSNAMES[PKIX_NUMERRORCLASSES]; michael@0: michael@0: #define MAX_STACK_DEPTH 1000 michael@0: michael@0: extern PRLogModuleInfo *pkixLog; michael@0: michael@0: #define PKIX_MAGIC_HEADER LL_INIT(0xFEEDC0FF, 0xEEFACADE) michael@0: #define PKIX_MAGIC_HEADER_DESTROYED LL_INIT(0xBAADF00D, 0xDEADBEEF) michael@0: michael@0: /* see source file for function documentation */ michael@0: michael@0: PKIX_Error * michael@0: pkix_IsCertSelfIssued( michael@0: PKIX_PL_Cert *cert, michael@0: PKIX_Boolean *pSelfIssued, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_Throw( michael@0: PKIX_ERRORCLASS errClass, michael@0: const char *funcName, michael@0: PKIX_ERRORCODE errorTextCode, michael@0: PKIX_ERRORCLASS overrideClass, michael@0: PKIX_Error *cause, michael@0: PKIX_Error **pError, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CheckTypes( michael@0: PKIX_PL_Object *first, michael@0: PKIX_PL_Object *second, michael@0: PKIX_UInt32 type, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CheckType( michael@0: PKIX_PL_Object *object, michael@0: PKIX_UInt32 type, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_hash( michael@0: const unsigned char *bytes, michael@0: PKIX_UInt32 length, michael@0: PKIX_UInt32 *hash, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_duplicateImmutable( michael@0: PKIX_PL_Object *object, michael@0: PKIX_PL_Object **pNewObject, michael@0: void *plContext); michael@0: michael@0: PKIX_UInt32 michael@0: pkix_countArray(void **array); michael@0: michael@0: PKIX_UInt32 michael@0: pkix_hex2i(char c); michael@0: michael@0: char michael@0: pkix_i2hex(char c); michael@0: michael@0: PKIX_Boolean michael@0: pkix_isPlaintext(unsigned char c, PKIX_Boolean debug); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCertChain_Lookup( michael@0: PKIX_PL_Cert* targetCert, michael@0: PKIX_List* anchors, michael@0: PKIX_PL_Date *testDate, michael@0: PKIX_Boolean *pFound, michael@0: PKIX_BuildResult **pBuildResult, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCertChain_Remove( michael@0: PKIX_PL_Cert* targetCert, michael@0: PKIX_List* anchors, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCertChain_Add( michael@0: PKIX_PL_Cert* targetCert, michael@0: PKIX_List* anchors, michael@0: PKIX_PL_Date *validityDate, michael@0: PKIX_BuildResult *buildResult, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCert_Lookup( michael@0: PKIX_CertStore *store, michael@0: PKIX_ComCertSelParams *certSelParams, michael@0: PKIX_PL_Date *testDate, michael@0: PKIX_Boolean *pFound, michael@0: PKIX_List** pCerts, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCert_Add( michael@0: PKIX_CertStore *store, michael@0: PKIX_ComCertSelParams *certSelParams, michael@0: PKIX_List* certs, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCrlEntry_Lookup( michael@0: PKIX_CertStore *store, michael@0: PKIX_PL_X500Name *certIssuer, michael@0: PKIX_PL_BigInt *certSerialNumber, michael@0: PKIX_Boolean *pFound, michael@0: PKIX_List** pCrlEntryList, michael@0: void *plContext); michael@0: michael@0: PKIX_Error * michael@0: pkix_CacheCrlEntry_Add( michael@0: PKIX_CertStore *store, michael@0: PKIX_PL_X500Name *certIssuer, michael@0: PKIX_PL_BigInt *certSerialNumber, michael@0: PKIX_List* crlEntryList, michael@0: void *plContext); michael@0: michael@0: #ifdef PR_LOGGING michael@0: void michael@0: pkix_trace_dump_cert( michael@0: const char *info, michael@0: PKIX_PL_Cert *cert, michael@0: void *plContext); michael@0: #endif michael@0: michael@0: #ifdef __cplusplus michael@0: } michael@0: #endif michael@0: michael@0: #endif /* _PKIX_TOOLS_H */