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