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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4 /*
michael@0 5 * pkix_tools.h
michael@0 6 *
michael@0 7 * Header for Utility Functions and Macros
michael@0 8 *
michael@0 9 */
michael@0 10
michael@0 11 #ifndef _PKIX_TOOLS_H
michael@0 12 #define _PKIX_TOOLS_H
michael@0 13
michael@0 14 #include "pkix.h"
michael@0 15 #include <stddef.h>
michael@0 16 #include <stdio.h>
michael@0 17 #include "secport.h"
michael@0 18 #include "prlong.h"
michael@0 19
michael@0 20 /* private PKIX system headers */
michael@0 21 #include "pkix_basicconstraintschecker.h"
michael@0 22 #include "pkix_buildresult.h"
michael@0 23 #include "pkix_certchainchecker.h"
michael@0 24 #include "pkix_certselector.h"
michael@0 25 #include "pkix_comcertselparams.h"
michael@0 26 #include "pkix_comcrlselparams.h"
michael@0 27 #include "pkix_crlselector.h"
michael@0 28 #include "pkix_error.h"
michael@0 29 #include "pkix_expirationchecker.h"
michael@0 30 #include "pkix_list.h"
michael@0 31 #include "pkix_logger.h"
michael@0 32 #include "pkix_namechainingchecker.h"
michael@0 33 #include "pkix_nameconstraintschecker.h"
michael@0 34 #include "pkix_policychecker.h"
michael@0 35 #include "pkix_policynode.h"
michael@0 36 #include "pkix_procparams.h"
michael@0 37 #include "pkix_resourcelimits.h"
michael@0 38 #include "pkix_revocationmethod.h"
michael@0 39 #include "pkix_revocationchecker.h"
michael@0 40 #include "pkix_crlchecker.h"
michael@0 41 #include "pkix_ocspchecker.h"
michael@0 42 #include "pkix_signaturechecker.h"
michael@0 43 #include "pkix_store.h"
michael@0 44 #include "pkix_targetcertchecker.h"
michael@0 45 #include "pkix_validate.h"
michael@0 46 #include "pkix_valresult.h"
michael@0 47 #include "pkix_verifynode.h"
michael@0 48
michael@0 49 #ifdef __cplusplus
michael@0 50 extern "C" {
michael@0 51 #endif
michael@0 52
michael@0 53 typedef struct pkixStdVarsStr {
michael@0 54 const char *aMyFuncName;
michael@0 55 PKIX_Error *aPkixErrorResult;
michael@0 56 PKIX_Error *aPkixTempResult;
michael@0 57 PKIX_Error *aPkixReturnResult;
michael@0 58 PKIX_ERRORCODE aPkixErrorCode;
michael@0 59 PKIX_Boolean aPkixErrorReceived;
michael@0 60 PKIX_Boolean aPkixTempErrorReceived;
michael@0 61 PKIX_ERRORCLASS aPkixErrorClass;
michael@0 62 PKIX_UInt32 aPkixType;
michael@0 63 PKIX_PL_Object *aLockedObject;
michael@0 64 PKIX_List *aPkixErrorList;
michael@0 65 } PKIX_StdVars;
michael@0 66
michael@0 67 #ifdef PKIX_STDVARS_POINTER
michael@0 68 #define myFuncName stdVars->aMyFuncName
michael@0 69 #define pkixErrorResult stdVars->aPkixErrorResult
michael@0 70 #define pkixTempResult stdVars->aPkixTempResult
michael@0 71 #define pkixReturnResult stdVars->aPkixReturnResult
michael@0 72 #define pkixErrorCode stdVars->aPkixErrorCode
michael@0 73 #define pkixErrorReceived stdVars->aPkixErrorReceived
michael@0 74 #define pkixTempErrorReceived stdVars->aPkixTempErrorReceived
michael@0 75 #define pkixErrorClass stdVars->aPkixErrorClass
michael@0 76 #define pkixType stdVars->aPkixType
michael@0 77 #define lockedObject stdVars->aLockedObject
michael@0 78 #define pkixErrorList stdVars->aPkixErrorList
michael@0 79 #define stdVarsPtr stdVars
michael@0 80 #else
michael@0 81 #define myFuncName stdVars.aMyFuncName
michael@0 82 #define pkixErrorResult stdVars.aPkixErrorResult
michael@0 83 #define pkixTempResult stdVars.aPkixTempResult
michael@0 84 #define pkixReturnResult stdVars.aPkixReturnResult
michael@0 85 #define pkixErrorCode stdVars.aPkixErrorCode
michael@0 86 #define pkixErrorReceived stdVars.aPkixErrorReceived
michael@0 87 #define pkixTempErrorReceived stdVars.aPkixTempErrorReceived
michael@0 88 #define pkixErrorClass stdVars.aPkixErrorClass
michael@0 89 #define pkixType stdVars.aPkixType
michael@0 90 #define lockedObject stdVars.aLockedObject
michael@0 91 #define pkixErrorList stdVars.aPkixErrorList
michael@0 92 #define stdVarsPtr &stdVars
michael@0 93 #endif
michael@0 94
michael@0 95 extern PKIX_Error * PKIX_DoReturn(PKIX_StdVars * stdVars,
michael@0 96 PKIX_ERRORCLASS errClass,
michael@0 97 PKIX_Boolean doLogger,
michael@0 98 void * plContext);
michael@0 99
michael@0 100 extern PKIX_Error * PKIX_DoThrow(PKIX_StdVars * stdVars,
michael@0 101 PKIX_ERRORCLASS errClass,
michael@0 102 PKIX_ERRORCODE errCode,
michael@0 103 PKIX_ERRORCLASS overrideClass,
michael@0 104 void * plContext);
michael@0 105
michael@0 106 extern void PKIX_DoAddError(PKIX_StdVars * stdVars,
michael@0 107 PKIX_Error * error,
michael@0 108 void * plContext);
michael@0 109
michael@0 110 #ifdef PKIX_OBJECT_LEAK_TEST
michael@0 111 extern PKIX_Error * pkix_CheckForGeneratedError(PKIX_StdVars * stdVars,
michael@0 112 PKIX_ERRORCLASS errClass,
michael@0 113 char * fnName,
michael@0 114 PKIX_Boolean *errorStateSet,
michael@0 115 void * plContext);
michael@0 116 #endif /* PKIX_OBJECT_LEAK_TEST */
michael@0 117
michael@0 118 extern const PKIX_StdVars zeroStdVars;
michael@0 119
michael@0 120 extern PRLogModuleInfo *pkixLog;
michael@0 121
michael@0 122 /*
michael@0 123 * UTILITY MACROS
michael@0 124 * Documentation for these common utility macros can be found in the
michael@0 125 * Implementation Guidelines document (Section 4.3)
michael@0 126 *
michael@0 127 * In general, macros with multiple statements (or a single "if" statement)
michael@0 128 * use the "do {<body>} while (0)" technique in order to convert the multiple
michael@0 129 * statements into one statement, thus avoiding the dangling else problem.
michael@0 130 * For macros which ALWAYS exit with a "return" or "goto", there is no
michael@0 131 * need to use this technique (and it yields compiler warnings of "statement
michael@0 132 * not reached"), so we just use "{<body>}" to group the statements together.
michael@0 133 */
michael@0 134
michael@0 135 #if !defined (PKIX_OBJECT_LEAK_TEST)
michael@0 136
michael@0 137 #define PKIX_STD_VARS(funcName) \
michael@0 138 static const char cMyFuncName[] = {funcName}; \
michael@0 139 PKIX_StdVars stdVars = zeroStdVars; \
michael@0 140 myFuncName = cMyFuncName
michael@0 141
michael@0 142
michael@0 143 #else /* PKIX_OBJECT_LEAK_TEST */
michael@0 144
michael@0 145 extern char **fnStackNameArr;
michael@0 146 extern PKIX_UInt32 *fnStackInvCountArr;
michael@0 147 extern PKIX_UInt32 stackPosition;
michael@0 148 extern PKIX_Boolean noErrorState;
michael@0 149 extern PKIX_Boolean errorGenerated;
michael@0 150 extern PKIX_Boolean runningLeakTest;
michael@0 151 extern PLHashTable *fnInvTable;
michael@0 152 extern PKIX_UInt32 testStartFnStackPosition;
michael@0 153 extern char *errorFnStackString;
michael@0 154
michael@0 155 extern PLHashNumber PR_CALLBACK pkix_ErrorGen_Hash (const void *key);
michael@0 156
michael@0 157 #define PKIX_STD_VARS(funcName) \
michael@0 158 static const char cMyFuncName[] = {funcName}; \
michael@0 159 PKIX_StdVars stdVars = zeroStdVars; \
michael@0 160 PKIX_Boolean errorSetFlag = PKIX_FALSE; \
michael@0 161 myFuncName = cMyFuncName; \
michael@0 162 if (runningLeakTest) { \
michael@0 163 if (fnStackNameArr) { \
michael@0 164 fnStackInvCountArr[stackPosition] += 1; \
michael@0 165 stackPosition += 1; \
michael@0 166 fnStackInvCountArr[stackPosition] = 0; \
michael@0 167 fnStackNameArr[stackPosition] = (char*)myFuncName; \
michael@0 168 fnStackNameArr[stackPosition + 1] = NULL; \
michael@0 169 PR_LOG(pkixLog, 5, \
michael@0 170 ("%s%*s+> %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
michael@0 171 stackPosition, " ", fnStackNameArr[stackPosition], \
michael@0 172 stackPosition, myFuncName)); \
michael@0 173 } \
michael@0 174 do { \
michael@0 175 pkixErrorResult = pkix_CheckForGeneratedError(&stdVars, PKIX_MEM_ERROR, \
michael@0 176 funcName, &errorSetFlag, \
michael@0 177 plContext); \
michael@0 178 if (pkixErrorResult) { \
michael@0 179 PR_LOG(pkixLog, 5, \
michael@0 180 ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
michael@0 181 stackPosition, " ", fnStackNameArr[stackPosition], \
michael@0 182 stackPosition, myFuncName)); \
michael@0 183 fnStackNameArr[stackPosition--] = NULL; \
michael@0 184 if (errorSetFlag) { \
michael@0 185 noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \
michael@0 186 } \
michael@0 187 return pkixErrorResult; \
michael@0 188 } \
michael@0 189 } while (0); \
michael@0 190 }
michael@0 191 #endif /* PKIX_OBJECT_LEAK_TEST */
michael@0 192
michael@0 193 #ifdef DEBUG
michael@0 194 #define _PKIX_DEBUG_TRACE(cond, prefix, level) \
michael@0 195 do { \
michael@0 196 if (cond) { \
michael@0 197 pkix_Logger_Check(pkixLoggersDebugTrace, myFuncName, \
michael@0 198 prefix, pkixType, level, plContext); \
michael@0 199 } \
michael@0 200 } while (0)
michael@0 201 #else
michael@0 202 #define _PKIX_DEBUG_TRACE(cond, prefix, level)
michael@0 203 #endif
michael@0 204
michael@0 205 #define _PKIX_LOG_ERROR(code, level) \
michael@0 206 { \
michael@0 207 if (pkixLoggersErrors) { \
michael@0 208 pkix_Logger_CheckWithCode(pkixLoggersErrors, code, \
michael@0 209 NULL, pkixType, level, plContext); \
michael@0 210 } \
michael@0 211 }
michael@0 212
michael@0 213 #define PKIX_ENTER(type, funcName) \
michael@0 214 PKIX_STD_VARS(funcName); \
michael@0 215 pkixType = PKIX_ ## type ## _ERROR; \
michael@0 216 PKIX_DEBUG_ENTER(type); \
michael@0 217 _PKIX_DEBUG_TRACE(pkixLoggersDebugTrace, ">>>", PKIX_LOGGER_LEVEL_TRACE);
michael@0 218
michael@0 219 #define PKIX_ENTER_NO_LOGGER(type, funcName) \
michael@0 220 PKIX_STD_VARS(funcName); \
michael@0 221 pkixType = PKIX_ ## type ## _ERROR; \
michael@0 222 PKIX_DEBUG_ENTER(type);
michael@0 223
michael@0 224 #define PKIX_DEBUG_ENTER(type) \
michael@0 225 PKIX_ ## type ## _DEBUG_ARG("( Entering %s).\n", myFuncName)
michael@0 226
michael@0 227 #define PKIX_DEBUG_EXIT(type) \
michael@0 228 PKIX_ ## type ## _DEBUG_ARG("( Exiting %s).\n", myFuncName)
michael@0 229
michael@0 230 #define PKIX_OBJECT_UNLOCK(obj) \
michael@0 231 do { \
michael@0 232 if (obj && lockedObject == (PKIX_PL_Object *)(obj)){ \
michael@0 233 pkixTempResult = \
michael@0 234 PKIX_PL_Object_Unlock \
michael@0 235 ((PKIX_PL_Object *)(obj), plContext); \
michael@0 236 if (pkixTempResult) { \
michael@0 237 PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
michael@0 238 pkixTempResult = NULL; \
michael@0 239 } \
michael@0 240 lockedObject = NULL; \
michael@0 241 } else { \
michael@0 242 PORT_Assert(lockedObject == NULL); \
michael@0 243 } \
michael@0 244 } while (0)
michael@0 245
michael@0 246 #define PKIX_DECREF(obj) \
michael@0 247 do { \
michael@0 248 if (obj){ \
michael@0 249 pkixTempResult = PKIX_PL_Object_DecRef \
michael@0 250 ((PKIX_PL_Object *)(obj), plContext); \
michael@0 251 if (pkixTempResult) { \
michael@0 252 PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
michael@0 253 pkixTempResult = NULL; \
michael@0 254 } \
michael@0 255 obj = NULL; \
michael@0 256 } \
michael@0 257 } while (0)
michael@0 258
michael@0 259 #define PKIX_THROW(type, descNum) \
michael@0 260 return PKIX_DoThrow(&stdVars, (PKIX_ ## type ## _ERROR), descNum, \
michael@0 261 pkixErrorClass, plContext);
michael@0 262
michael@0 263 #ifdef PKIX_OBJECT_LEAK_TEST
michael@0 264 #define PKIX_RETURN(type) \
michael@0 265 if (runningLeakTest && fnStackNameArr) { \
michael@0 266 PR_LOG(pkixLog, 5, \
michael@0 267 ("%s%*s<- %s(%d) - %s\n", (errorGenerated ? "*" : " "), \
michael@0 268 stackPosition, " ", fnStackNameArr[stackPosition], \
michael@0 269 stackPosition, myFuncName)); \
michael@0 270 fnStackNameArr[stackPosition--] = NULL; \
michael@0 271 if (errorSetFlag) noErrorState = (noErrorState) ? PKIX_FALSE : PKIX_TRUE; \
michael@0 272 } \
michael@0 273 return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext);
michael@0 274 #else
michael@0 275 #define PKIX_RETURN(type) \
michael@0 276 return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_TRUE, plContext);
michael@0 277 #endif /* PKIX_OBJECT_LEAK_TEST */
michael@0 278
michael@0 279
michael@0 280 #if defined(DEBUG) && !defined(DEBUG_nb95248)
michael@0 281 #define PKIX_RETURN_NO_LOGGER(type) \
michael@0 282 { \
michael@0 283 PKIX_OBJECT_UNLOCK(lockedObject); \
michael@0 284 if ((pkixErrorReceived) || (pkixErrorResult) || pkixErrorList) \
michael@0 285 PKIX_THROW(type, pkixErrorCode); \
michael@0 286 PKIX_DEBUG_EXIT(type); \
michael@0 287 return NULL; \
michael@0 288 }
michael@0 289 #else
michael@0 290 #define PKIX_RETURN_NO_LOGGER(type) \
michael@0 291 return PKIX_DoReturn(&stdVars, (PKIX_ ## type ## _ERROR), PKIX_FALSE, plContext);
michael@0 292 #endif
michael@0 293
michael@0 294 /* disable to disable ;-) */
michael@0 295 /* #define WANT_TRACE_CHECK_FAILURES */
michael@0 296
michael@0 297 #ifdef WANT_TRACE_CHECK_FAILURES
michael@0 298 #define TRACE_CHECK_FAILURE(what, errorstring) \
michael@0 299 if (pkixLog) { \
michael@0 300 PR_LOG(pkixLog, PR_LOG_DEBUG, \
michael@0 301 ("====> [%s] failed: %s\n", #what, errorstring)); \
michael@0 302 }
michael@0 303 #else
michael@0 304 #define TRACE_CHECK_FAILURE(what, errorstring)
michael@0 305 #endif
michael@0 306
michael@0 307 #define PKIX_CHECK(func, descNum) \
michael@0 308 do { \
michael@0 309 pkixErrorResult = (func); \
michael@0 310 if (pkixErrorResult) { \
michael@0 311 TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
michael@0 312 pkixErrorClass = pkixErrorResult->errClass; \
michael@0 313 pkixErrorCode = descNum; \
michael@0 314 goto cleanup; \
michael@0 315 } \
michael@0 316 } while (0)
michael@0 317
michael@0 318 /* like PKIX_CHECK but without goto cleanup */
michael@0 319 #define PKIX_CHECK_NO_GOTO(func, descNum) \
michael@0 320 do { \
michael@0 321 pkixErrorResult = (func); \
michael@0 322 if (pkixErrorResult) { \
michael@0 323 TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
michael@0 324 pkixErrorClass = pkixErrorResult->errClass; \
michael@0 325 pkixErrorCode = descNum; \
michael@0 326 } \
michael@0 327 } while (0)
michael@0 328
michael@0 329 #define PKIX_CHECK_ONLY_FATAL(func, descNum) \
michael@0 330 do { \
michael@0 331 pkixTempErrorReceived = PKIX_FALSE; \
michael@0 332 pkixErrorResult = (func); \
michael@0 333 if (pkixErrorResult) { \
michael@0 334 TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
michael@0 335 pkixTempErrorReceived = PKIX_TRUE; \
michael@0 336 pkixErrorClass = pkixErrorResult->errClass; \
michael@0 337 if (pkixErrorClass == PKIX_FATAL_ERROR) { \
michael@0 338 goto cleanup; \
michael@0 339 } \
michael@0 340 PKIX_DECREF(pkixErrorResult); \
michael@0 341 } \
michael@0 342 } while (0)
michael@0 343
michael@0 344 #define PKIX_LOG_ERROR(descNum) \
michael@0 345 _PKIX_LOG_ERROR(descNum, PKIX_LOGGER_LEVEL_ERROR)
michael@0 346
michael@0 347 #define PKIX_ERROR(descNum) \
michael@0 348 { \
michael@0 349 PKIX_LOG_ERROR(descNum) \
michael@0 350 pkixErrorReceived = PKIX_TRUE; \
michael@0 351 pkixErrorCode = descNum; \
michael@0 352 goto cleanup; \
michael@0 353 }
michael@0 354
michael@0 355 #define PKIX_ERROR_ALLOC_ERROR() \
michael@0 356 { \
michael@0 357 PKIX_LOG_ERROR(PKIX_ALLOCERROR) \
michael@0 358 pkixErrorReceived = PKIX_TRUE; \
michael@0 359 pkixErrorResult = PKIX_ALLOC_ERROR(); \
michael@0 360 goto cleanup; \
michael@0 361 }
michael@0 362
michael@0 363 #define PKIX_ERROR_FATAL(descNum) \
michael@0 364 { \
michael@0 365 pkixErrorReceived = PKIX_TRUE; \
michael@0 366 pkixErrorCode = descNum; \
michael@0 367 pkixErrorClass = PKIX_FATAL_ERROR; \
michael@0 368 _PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \
michael@0 369 goto cleanup; \
michael@0 370 }
michael@0 371
michael@0 372 #define PKIX_CHECK_FATAL(func, descNum) \
michael@0 373 do { \
michael@0 374 pkixErrorResult = (func); \
michael@0 375 if (pkixErrorResult) { \
michael@0 376 TRACE_CHECK_FAILURE((func), PKIX_ErrorText[descNum]) \
michael@0 377 pkixErrorReceived = PKIX_TRUE; \
michael@0 378 pkixErrorCode = descNum; \
michael@0 379 pkixErrorClass = PKIX_FATAL_ERROR; \
michael@0 380 _PKIX_LOG_ERROR(pkixErrorCode, PKIX_LOGGER_LEVEL_FATALERROR); \
michael@0 381 goto fatal; \
michael@0 382 } \
michael@0 383 } while (0)
michael@0 384
michael@0 385 #define PKIX_NULLCHECK_ONE(a) \
michael@0 386 do { \
michael@0 387 if ((a) == NULL){ \
michael@0 388 pkixErrorReceived = PKIX_TRUE; \
michael@0 389 pkixErrorCode = PKIX_NULLARGUMENT; \
michael@0 390 PKIX_RETURN(FATAL); \
michael@0 391 } \
michael@0 392 } while (0)
michael@0 393
michael@0 394 #define PKIX_NULLCHECK_TWO(a, b) \
michael@0 395 do { \
michael@0 396 if (((a) == NULL) || ((b) == NULL)){ \
michael@0 397 pkixErrorReceived = PKIX_TRUE; \
michael@0 398 pkixErrorCode = PKIX_NULLARGUMENT; \
michael@0 399 PKIX_RETURN(FATAL); \
michael@0 400 } \
michael@0 401 } while (0)
michael@0 402
michael@0 403 #define PKIX_NULLCHECK_THREE(a, b, c) \
michael@0 404 do { \
michael@0 405 if (((a) == NULL) || ((b) == NULL) || ((c) == NULL)){ \
michael@0 406 pkixErrorReceived = PKIX_TRUE; \
michael@0 407 pkixErrorCode = PKIX_NULLARGUMENT; \
michael@0 408 PKIX_RETURN(FATAL); \
michael@0 409 } \
michael@0 410 } while (0)
michael@0 411
michael@0 412 #define PKIX_NULLCHECK_FOUR(a, b, c, d) \
michael@0 413 do { \
michael@0 414 if (((a) == NULL) || ((b) == NULL) || \
michael@0 415 ((c) == NULL) || ((d) == NULL)){ \
michael@0 416 pkixErrorReceived = PKIX_TRUE; \
michael@0 417 pkixErrorCode = PKIX_NULLARGUMENT; \
michael@0 418 PKIX_RETURN(FATAL); \
michael@0 419 } \
michael@0 420 } while (0)
michael@0 421
michael@0 422 #define PKIX_OBJECT_LOCK(obj) \
michael@0 423 do { \
michael@0 424 if (obj) { \
michael@0 425 pkixTempResult = \
michael@0 426 PKIX_PL_Object_Lock((PKIX_PL_Object*)(obj), plContext); \
michael@0 427 if (pkixTempResult) { \
michael@0 428 PKIX_DoAddError(stdVarsPtr, pkixTempResult, plContext); \
michael@0 429 pkixTempResult = NULL; \
michael@0 430 pkixErrorCode = PKIX_OBJECTLOCKFAILED; \
michael@0 431 goto cleanup; \
michael@0 432 } \
michael@0 433 lockedObject = (PKIX_PL_Object *)(obj); \
michael@0 434 } \
michael@0 435 } while (0)
michael@0 436
michael@0 437 #define PKIX_ERROR_CREATE(type, descNum, error) \
michael@0 438 { \
michael@0 439 pkixTempResult = (PKIX_Error*)pkix_Throw \
michael@0 440 (PKIX_ ## type ## _ERROR, myFuncName, \
michael@0 441 descNum, PKIX_ ## type ## _ERROR, pkixErrorResult, \
michael@0 442 &error, plContext); \
michael@0 443 if (pkixTempResult) { \
michael@0 444 error = pkixTempResult; \
michael@0 445 pkixTempResult = NULL; \
michael@0 446 } \
michael@0 447 }
michael@0 448
michael@0 449
michael@0 450 #define PKIX_ERROR_RECEIVED \
michael@0 451 (pkixErrorReceived || pkixErrorResult || pkixTempErrorReceived || \
michael@0 452 pkixErrorList)
michael@0 453
michael@0 454 #define PKIX_INCREF(obj) \
michael@0 455 do { \
michael@0 456 if (obj){ \
michael@0 457 pkixTempResult = PKIX_PL_Object_IncRef \
michael@0 458 ((PKIX_PL_Object *)(obj), plContext); \
michael@0 459 if (pkixTempResult) { \
michael@0 460 PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \
michael@0 461 pkixTempResult = NULL; \
michael@0 462 goto cleanup; \
michael@0 463 } \
michael@0 464 } \
michael@0 465 } while (0)
michael@0 466
michael@0 467 #define PKIX_FREE(obj) \
michael@0 468 do { \
michael@0 469 if (obj) { \
michael@0 470 pkixTempResult = PKIX_PL_Free((obj), plContext); \
michael@0 471 if (pkixTempResult) { \
michael@0 472 PKIX_DoAddError(&stdVars, pkixTempResult, plContext); \
michael@0 473 pkixTempResult = NULL; \
michael@0 474 } \
michael@0 475 obj = NULL; \
michael@0 476 } \
michael@0 477 } while (0)
michael@0 478
michael@0 479 #define PKIX_EXACTLY_ONE_NULL(a, b) (((a) && !(b)) || ((b) && !(a)))
michael@0 480
michael@0 481 /* DIGIT MACROS */
michael@0 482
michael@0 483 #define PKIX_ISDIGIT(c) (((c) >= '0') && ((c) <= '9'))
michael@0 484
michael@0 485 #define PKIX_ISXDIGIT(c) \
michael@0 486 (PKIX_ISDIGIT(c) || ( (((c)|0x20) >= 'a') && (((c)|0x20) <= 'f') ))
michael@0 487
michael@0 488 #define PKIX_TOSTRING(a, b, c, d) \
michael@0 489 do { \
michael@0 490 int descNum; \
michael@0 491 if ((a) != NULL) { \
michael@0 492 pkixErrorResult = \
michael@0 493 PKIX_PL_Object_ToString((PKIX_PL_Object *)(a), (b), (c)); \
michael@0 494 descNum = (d); \
michael@0 495 } else { \
michael@0 496 pkixErrorResult = \
michael@0 497 PKIX_PL_String_Create(PKIX_ESCASCII, "(null)", 0, (b), (c)); \
michael@0 498 descNum = PKIX_STRINGCREATEFAILED; \
michael@0 499 } \
michael@0 500 PKIX_CHECK(pkixErrorResult, descNum); \
michael@0 501 } while (0)
michael@0 502
michael@0 503 #define PKIX_EQUALS(a, b, c, d, e) \
michael@0 504 do { \
michael@0 505 if ((a) != NULL && (b) != NULL) { \
michael@0 506 PKIX_CHECK(PKIX_PL_Object_Equals\
michael@0 507 ((PKIX_PL_Object *)(a), \
michael@0 508 (PKIX_PL_Object*)(b), \
michael@0 509 (c), \
michael@0 510 (d)), \
michael@0 511 (e)); \
michael@0 512 } else if ((a) == NULL && (b) == NULL) { \
michael@0 513 *(c) = PKIX_TRUE; \
michael@0 514 } else { \
michael@0 515 *(c) = PKIX_FALSE; \
michael@0 516 } \
michael@0 517 } while (0)
michael@0 518
michael@0 519 #define PKIX_HASHCODE(a, b, c, d) \
michael@0 520 do { \
michael@0 521 if ((a) != NULL) { \
michael@0 522 PKIX_CHECK(PKIX_PL_Object_Hashcode\
michael@0 523 ((PKIX_PL_Object *)(a), (b), (c)), (d)); \
michael@0 524 } else { \
michael@0 525 *(b) = 0; \
michael@0 526 } \
michael@0 527 } while (0)
michael@0 528
michael@0 529 #define PKIX_DUPLICATE(a, b, c, d) \
michael@0 530 do { \
michael@0 531 if ((a) != NULL) { \
michael@0 532 PKIX_CHECK(PKIX_PL_Object_Duplicate\
michael@0 533 ((PKIX_PL_Object *)(a), \
michael@0 534 (PKIX_PL_Object **)(b), \
michael@0 535 (c)), \
michael@0 536 (d)); \
michael@0 537 } else { \
michael@0 538 *(b) = (a); \
michael@0 539 } \
michael@0 540 } while (0)
michael@0 541
michael@0 542 /*
michael@0 543 * DEBUG MACROS
michael@0 544 *
michael@0 545 * Each type has an associated debug flag, which can
michael@0 546 * be set on the compiler line using "-D<debugflag>". For convenience,
michael@0 547 * "-DPKIX_DEBUGALL" turns on debug for all the components.
michael@0 548 *
michael@0 549 * If a type's debug flag is defined, then its two associated macros
michael@0 550 * are defined: PKIX_type_DEBUG(expr) and PKIX_type_DEBUG_ARG(expr, arg),
michael@0 551 * which call PKIX_DEBUG(expr) and PKIX_DEBUG_ARG(expr, arg) respectively,
michael@0 552 * which, in turn, enable standard and consistently formatted output.
michael@0 553 *
michael@0 554 * If a type's debug flag is not defined, the two associated macros
michael@0 555 * are defined as a NO-OP. As such, any PKIX_type_DEBUG or PKIX_type_DEBUG_ARG
michael@0 556 * macros for an undefined type will be stripped from the code during
michael@0 557 * pre-processing, thereby reducing code size.
michael@0 558 */
michael@0 559
michael@0 560 #ifdef PKIX_DEBUGALL
michael@0 561 #define PKIX_REFCOUNTDEBUG 1
michael@0 562 #define PKIX_MEMDEBUG 1
michael@0 563 #define PKIX_MUTEXDEBUG 1
michael@0 564 #define PKIX_OBJECTDEBUG 1
michael@0 565 #define PKIX_STRINGDEBUG 1
michael@0 566 #define PKIX_OIDDEBUG 1
michael@0 567 #define PKIX_LISTDEBUG 1
michael@0 568 #define PKIX_ERRORDEBUG 1
michael@0 569 #define PKIX_BYTEARRAYDEBUG 1
michael@0 570 #define PKIX_RWLOCKDEBUG 1
michael@0 571 #define PKIX_BIGINTDEBUG 1
michael@0 572 #define PKIX_HASHTABLEDEBUG 1
michael@0 573 #define PKIX_X500NAMEDEBUG 1
michael@0 574 #define PKIX_GENERALNAMEDEBUG 1
michael@0 575 #define PKIX_PUBLICKEYDEBUG 1
michael@0 576 #define PKIX_CERTDEBUG 1
michael@0 577 #define PKIX_HTTPCLIENTDEBUG 1
michael@0 578 #define PKIX_DATEDEBUG 1
michael@0 579 #define PKIX_TRUSTANCHORDEBUG 1
michael@0 580 #define PKIX_PROCESSINGPARAMSDEBUG 1
michael@0 581 #define PKIX_VALIDATEPARAMSDEBUG 1
michael@0 582 #define PKIX_VALIDATERESULTDEBUG 1
michael@0 583 #define PKIX_VALIDATEDEBUG 1
michael@0 584 #define PKIX_CERTCHAINCHECKERDEBUG 1
michael@0 585 #define PKIX_REVOCATIONCHECKERDEBUG 1
michael@0 586 #define PKIX_CERTSELECTORDEBUG 1
michael@0 587 #define PKIX_COMCERTSELPARAMSDEBUG 1
michael@0 588 #define PKIX_TARGETCERTCHECKERSTATEDEBUG 1
michael@0 589 #define PKIX_INITIALIZEPARAMSDEBUG 1
michael@0 590 #define PKIX_CERTBASICCONSTRAINTSDEBUG 1
michael@0 591 #define PKIX_CERTNAMECONSTRAINTSDEBUG 1
michael@0 592 #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG 1
michael@0 593 #define PKIX_SUBJALTNAMECHECKERSTATEDEBUG 1
michael@0 594
michael@0 595 #define PKIX_CERTPOLICYQUALIFIERDEBUG 1
michael@0 596 #define PKIX_CERTPOLICYINFODEBUG 1
michael@0 597 #define PKIX_CERTPOLICYNODEDEBUG 1
michael@0 598 #define PKIX_CERTPOLICYCHECKERSTATEDEBUG 1
michael@0 599 #define PKIX_LIFECYCLEDEBUG 1
michael@0 600 #define PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG 1
michael@0 601 #define PKIX_CRLDEBUG 1
michael@0 602 #define PKIX_CRLENTRYDEBUG 1
michael@0 603 #define PKIX_CRLSELECTORDEBUG 1
michael@0 604 #define PKIX_COMCRLSELPARAMSDEBUG 1
michael@0 605 #define PKIX_CERTSTOREDEBUG 1
michael@0 606 #define PKIX_COLLECTIONCERTSTORECONTEXTDEBUG 1
michael@0 607 #define PKIX_DEFAULTCRLCHECKERSTATEDEBUG 1
michael@0 608 #define PKIX_CERTPOLICYMAPDEBUG 1
michael@0 609 #define PKIX_BUILDDEBUG 1
michael@0 610 #define PKIX_BUILDRESULTDEBUG 1
michael@0 611 #define PKIX_FORWARDBUILDERSTATEDEBUG 1
michael@0 612 #define PKIX_SIGNATURECHECKERSTATEDEBUG 1
michael@0 613 #define PKIX_USERDEFINEDMODULESDEBUG 1
michael@0 614 #define PKIX_CONTEXTDEBUG 1
michael@0 615 #define PKIX_DEFAULTREVOCATIONCHECKERDEBUG 1
michael@0 616 #define PKIX_LDAPREQUESTDEBUG 1
michael@0 617 #define PKIX_LDAPRESPONSEDEBUG 1
michael@0 618 #define PKIX_LDAPCLIENTDEBUG 1
michael@0 619 #define PKIX_LDAPDEFAULTCLIENTDEBUG 1
michael@0 620 #define PKIX_SOCKETDEBUG 1
michael@0 621 #define PKIX_RESOURCELIMITSDEBUG 1
michael@0 622 #define PKIX_LOGGERDEBUG 1
michael@0 623 #define PKIX_MONITORLOCKDEBUG 1
michael@0 624 #define PKIX_INFOACCESSDEBUG 1
michael@0 625 #define PKIX_AIAMGRDEBUG 1
michael@0 626 #define PKIX_OCSPCHECKERDEBUG 1
michael@0 627 #define PKIX_OCSPREQUESTDEBUG 1
michael@0 628 #define PKIX_OCSPRESPONSEDEBUG 1
michael@0 629 #define PKIX_HTTPDEFAULTCLIENTDEBUG 1
michael@0 630 #define PKIX_HTTPCERTSTORECONTEXTDEBUG 1
michael@0 631 #define PKIX_VERIFYNODEDEBUG 1
michael@0 632 #endif
michael@0 633
michael@0 634 /*
michael@0 635 * XXX Both PKIX_DEBUG and PKIX_DEBUG_ARG currently use printf.
michael@0 636 * This needs to be replaced with Loggers.
michael@0 637 */
michael@0 638
michael@0 639 #ifdef DEBUG
michael@0 640 #define PKIX_DEBUG(expr) \
michael@0 641 do { \
michael@0 642 _PKIX_DEBUG_TRACE(pkixLoggersErrors, expr, PKIX_LOGGER_LEVEL_DEBUG); \
michael@0 643 (void) fprintf(stderr, "(%s: ", myFuncName); \
michael@0 644 (void) fprintf(stderr, expr); \
michael@0 645 } while (0)
michael@0 646 #else
michael@0 647 #define PKIX_DEBUG(expr)
michael@0 648 #endif
michael@0 649
michael@0 650 /* Logging doesn't support DEBUG with ARG: cannot convert control and arg */
michael@0 651 #define PKIX_DEBUG_ARG(expr, arg) \
michael@0 652 do { \
michael@0 653 (void) printf("(%s: ", myFuncName); \
michael@0 654 (void) printf(expr, arg); \
michael@0 655 } while (0)
michael@0 656
michael@0 657 #if PKIX_FATALDEBUG
michael@0 658 #define PKIX_FATAL_DEBUG(expr) \
michael@0 659 PKIX_DEBUG(expr)
michael@0 660 #define PKIX_FATAL_DEBUG_ARG(expr, arg) \
michael@0 661 PKIX_DEBUG_ARG(expr, arg)
michael@0 662 #else
michael@0 663 #define PKIX_FATAL_DEBUG(expr)
michael@0 664 #define PKIX_FATAL_DEBUG_ARG(expr, arg)
michael@0 665 #endif
michael@0 666
michael@0 667 #if PKIX_REFCOUNTDEBUG
michael@0 668 #define PKIX_REF_COUNT_DEBUG(expr) \
michael@0 669 PKIX_DEBUG(expr)
michael@0 670 #define PKIX_REF_COUNT_DEBUG_ARG(expr, arg) \
michael@0 671 PKIX_DEBUG_ARG(expr, arg)
michael@0 672 #else
michael@0 673 #define PKIX_REF_COUNT_DEBUG(expr)
michael@0 674 #define PKIX_REF_COUNT_DEBUG_ARG(expr, arg)
michael@0 675 #endif
michael@0 676
michael@0 677 #if PKIX_MEMDEBUG
michael@0 678 #define PKIX_MEM_DEBUG(expr) \
michael@0 679 PKIX_DEBUG(expr)
michael@0 680 #define PKIX_MEM_DEBUG_ARG(expr, arg) \
michael@0 681 PKIX_DEBUG_ARG(expr, arg)
michael@0 682 #else
michael@0 683 #define PKIX_MEM_DEBUG(expr)
michael@0 684 #define PKIX_MEM_DEBUG_ARG(expr, arg)
michael@0 685 #endif
michael@0 686
michael@0 687 #if PKIX_MUTEXDEBUG
michael@0 688 #define PKIX_MUTEX_DEBUG(expr) \
michael@0 689 PKIX_DEBUG(expr)
michael@0 690 #define PKIX_MUTEX_DEBUG_ARG(expr, arg) \
michael@0 691 PKIX_DEBUG_ARG(expr, arg)
michael@0 692 #else
michael@0 693 #define PKIX_MUTEX_DEBUG(expr)
michael@0 694 #define PKIX_MUTEX_DEBUG_ARG(expr, arg)
michael@0 695 #endif
michael@0 696
michael@0 697 #if PKIX_OBJECTDEBUG
michael@0 698 #define PKIX_OBJECT_DEBUG(expr) \
michael@0 699 PKIX_DEBUG(expr)
michael@0 700 #define PKIX_OBJECT_DEBUG_ARG(expr, arg) \
michael@0 701 PKIX_DEBUG_ARG(expr, arg)
michael@0 702 #else
michael@0 703 #define PKIX_OBJECT_DEBUG(expr)
michael@0 704 #define PKIX_OBJECT_DEBUG_ARG(expr, arg)
michael@0 705 #endif
michael@0 706
michael@0 707 #if PKIX_ERRORDEBUG
michael@0 708 #define PKIX_ERROR_DEBUG(expr) \
michael@0 709 PKIX_DEBUG(expr)
michael@0 710 #define PKIX_ERROR_DEBUG_ARG(expr, arg) \
michael@0 711 PKIX_DEBUG_ARG(expr, arg)
michael@0 712 #else
michael@0 713 #define PKIX_ERROR_DEBUG(expr)
michael@0 714 #define PKIX_ERROR_DEBUG_ARG(expr, arg)
michael@0 715 #endif
michael@0 716
michael@0 717 #if PKIX_STRINGDEBUG
michael@0 718 #define PKIX_STRING_DEBUG(expr) \
michael@0 719 PKIX_DEBUG(expr)
michael@0 720 #define PKIX_STRING_DEBUG_ARG(expr, arg) \
michael@0 721 PKIX_DEBUG_ARG(expr, arg)
michael@0 722 #else
michael@0 723 #define PKIX_STRING_DEBUG(expr)
michael@0 724 #define PKIX_STRING_DEBUG_ARG(expr, arg)
michael@0 725 #endif
michael@0 726
michael@0 727 #if PKIX_OIDDEBUG
michael@0 728 #define PKIX_OID_DEBUG(expr) \
michael@0 729 PKIX_DEBUG(expr)
michael@0 730 #define PKIX_OID_DEBUG_ARG(expr, arg) \
michael@0 731 PKIX_DEBUG_ARG(expr, arg)
michael@0 732 #else
michael@0 733 #define PKIX_OID_DEBUG(expr)
michael@0 734 #define PKIX_OID_DEBUG_ARG(expr, arg)
michael@0 735 #endif
michael@0 736
michael@0 737 #if PKIX_LISTDEBUG
michael@0 738 #define PKIX_LIST_DEBUG(expr) \
michael@0 739 PKIX_DEBUG(expr)
michael@0 740 #define PKIX_LIST_DEBUG_ARG(expr, arg) \
michael@0 741 PKIX_DEBUG_ARG(expr, arg)
michael@0 742 #else
michael@0 743 #define PKIX_LIST_DEBUG(expr)
michael@0 744 #define PKIX_LIST_DEBUG_ARG(expr, arg)
michael@0 745 #endif
michael@0 746
michael@0 747 #if PKIX_RWLOCKDEBUG
michael@0 748 #define PKIX_RWLOCK_DEBUG(expr) \
michael@0 749 PKIX_DEBUG(expr)
michael@0 750 #define PKIX_RWLOCK_DEBUG_ARG(expr, arg) \
michael@0 751 PKIX_DEBUG_ARG(expr, arg)
michael@0 752 #else
michael@0 753 #define PKIX_RWLOCK_DEBUG(expr)
michael@0 754 #define PKIX_RWLOCK_DEBUG_ARG(expr, arg)
michael@0 755 #endif
michael@0 756
michael@0 757 #if PKIX_BYTEARRAYDEBUG
michael@0 758 #define PKIX_BYTEARRAY_DEBUG(expr) \
michael@0 759 PKIX_DEBUG(expr)
michael@0 760 #define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg) \
michael@0 761 PKIX_DEBUG_ARG(expr, arg)
michael@0 762 #else
michael@0 763 #define PKIX_BYTEARRAY_DEBUG(expr)
michael@0 764 #define PKIX_BYTEARRAY_DEBUG_ARG(expr, arg)
michael@0 765 #endif
michael@0 766
michael@0 767 #if PKIX_HASHTABLEDEBUG
michael@0 768 #define PKIX_HASHTABLE_DEBUG(expr) \
michael@0 769 PKIX_DEBUG(expr)
michael@0 770 #define PKIX_HASHTABLE_DEBUG_ARG(expr, arg) \
michael@0 771 PKIX_DEBUG_ARG(expr, arg)
michael@0 772 #else
michael@0 773 #define PKIX_HASHTABLE_DEBUG(expr)
michael@0 774 #define PKIX_HASHTABLE_DEBUG_ARG(expr, arg)
michael@0 775 #endif
michael@0 776
michael@0 777 #if PKIX_X500NAMEDEBUG
michael@0 778 #define PKIX_X500NAME_DEBUG(expr) \
michael@0 779 PKIX_DEBUG(expr)
michael@0 780 #define PKIX_X500NAME_DEBUG_ARG(expr, arg) \
michael@0 781 PKIX_DEBUG_ARG(expr, arg)
michael@0 782 #else
michael@0 783 #define PKIX_X500NAME_DEBUG(expr)
michael@0 784 #define PKIX_X500NAME_DEBUG_ARG(expr, arg)
michael@0 785 #endif
michael@0 786
michael@0 787 #if PKIX_GENERALNAMEDEBUG
michael@0 788 #define PKIX_GENERALNAME_DEBUG(expr) \
michael@0 789 PKIX_DEBUG(expr)
michael@0 790 #define PKIX_GENERALNAME_DEBUG_ARG(expr, arg) \
michael@0 791 PKIX_DEBUG_ARG(expr, arg)
michael@0 792 #else
michael@0 793 #define PKIX_GENERALNAME_DEBUG(expr)
michael@0 794 #define PKIX_GENERALNAME_DEBUG_ARG(expr, arg)
michael@0 795 #endif
michael@0 796
michael@0 797 #if PKIX_PUBLICKEYDEBUG
michael@0 798 #define PKIX_PUBLICKEY_DEBUG(expr) \
michael@0 799 PKIX_DEBUG(expr)
michael@0 800 #define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg) \
michael@0 801 PKIX_DEBUG_ARG(expr, arg)
michael@0 802 #else
michael@0 803 #define PKIX_PUBLICKEY_DEBUG(expr)
michael@0 804 #define PKIX_PUBLICKEY_DEBUG_ARG(expr, arg)
michael@0 805 #endif
michael@0 806
michael@0 807 #if PKIX_CERTDEBUG
michael@0 808 #define PKIX_CERT_DEBUG(expr) \
michael@0 809 PKIX_DEBUG(expr)
michael@0 810 #define PKIX_CERT_DEBUG_ARG(expr, arg) \
michael@0 811 PKIX_DEBUG_ARG(expr, arg)
michael@0 812 #else
michael@0 813 #define PKIX_CERT_DEBUG(expr)
michael@0 814 #define PKIX_CERT_DEBUG_ARG(expr, arg)
michael@0 815 #endif
michael@0 816
michael@0 817 #if PKIX_CRLDPDEBUG
michael@0 818 #define PKIX_CRLDP_DEBUG(expr) \
michael@0 819 PKIX_DEBUG(expr)
michael@0 820 #define PKIX_CRLDP_DEBUG_ARG(expr, arg) \
michael@0 821 PKIX_DEBUG_ARG(expr, arg)
michael@0 822 #else
michael@0 823 #define PKIX_CRLDP_DEBUG(expr)
michael@0 824 #define PKIX_CRLDP_DEBUG_ARG(expr, arg)
michael@0 825 #endif
michael@0 826
michael@0 827 #if PKIX_HTTPCLIENTDEBUG
michael@0 828 #define PKIX_HTTPCLIENT_DEBUG(expr) \
michael@0 829 PKIX_DEBUG(expr)
michael@0 830 #define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg) \
michael@0 831 PKIX_DEBUG_ARG(expr, arg)
michael@0 832 #else
michael@0 833 #define PKIX_HTTPCLIENT_DEBUG(expr)
michael@0 834 #define PKIX_HTTPCLIENT_DEBUG_ARG(expr, arg)
michael@0 835 #endif
michael@0 836
michael@0 837 #if PKIX_BIGINTDEBUG
michael@0 838 #define PKIX_BIGINT_DEBUG(expr) \
michael@0 839 PKIX_DEBUG(expr)
michael@0 840 #define PKIX_BIGINT_DEBUG_ARG(expr, arg) \
michael@0 841 PKIX_DEBUG_ARG(expr, arg)
michael@0 842 #else
michael@0 843 #define PKIX_BIGINT_DEBUG(expr)
michael@0 844 #define PKIX_BIGINT_DEBUG_ARG(expr, arg)
michael@0 845 #endif
michael@0 846
michael@0 847 #if PKIX_DATEDEBUG
michael@0 848 #define PKIX_DATE_DEBUG(expr) \
michael@0 849 PKIX_DEBUG(expr)
michael@0 850 #define PKIX_DATE_DEBUG_ARG(expr, arg) \
michael@0 851 PKIX_DEBUG_ARG(expr, arg)
michael@0 852 #else
michael@0 853 #define PKIX_DATE_DEBUG(expr)
michael@0 854 #define PKIX_DATE_DEBUG_ARG(expr, arg)
michael@0 855 #endif
michael@0 856
michael@0 857 #if PKIX_TRUSTANCHORDEBUG
michael@0 858 #define PKIX_TRUSTANCHOR_DEBUG(expr) \
michael@0 859 PKIX_DEBUG(expr)
michael@0 860 #define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg) \
michael@0 861 PKIX_DEBUG_ARG(expr, arg)
michael@0 862 #else
michael@0 863 #define PKIX_TRUSTANCHOR_DEBUG(expr)
michael@0 864 #define PKIX_TRUSTANCHOR_DEBUG_ARG(expr, arg)
michael@0 865 #endif
michael@0 866
michael@0 867 #if PKIX_PROCESSINGPARAMSDEBUG
michael@0 868 #define PKIX_PROCESSINGPARAMS_DEBUG(expr) \
michael@0 869 PKIX_DEBUG(expr)
michael@0 870 #define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg) \
michael@0 871 PKIX_DEBUG_ARG(expr, arg)
michael@0 872 #else
michael@0 873 #define PKIX_PROCESSINGPARAMS_DEBUG(expr)
michael@0 874 #define PKIX_PROCESSINGPARAMS_DEBUG_ARG(expr, arg)
michael@0 875 #endif
michael@0 876
michael@0 877 #if PKIX_VALIDATEPARAMSDEBUG
michael@0 878 #define PKIX_VALIDATEPARAMS_DEBUG(expr) \
michael@0 879 PKIX_DEBUG(expr)
michael@0 880 #define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg) \
michael@0 881 PKIX_DEBUG_ARG(expr, arg)
michael@0 882 #else
michael@0 883 #define PKIX_VALIDATEPARAMS_DEBUG(expr)
michael@0 884 #define PKIX_VALIDATEPARAMS_DEBUG_ARG(expr, arg)
michael@0 885 #endif
michael@0 886
michael@0 887 #if PKIX_VALIDATERESULTDEBUG
michael@0 888 #define PKIX_VALIDATERESULT_DEBUG(expr) \
michael@0 889 PKIX_DEBUG(expr)
michael@0 890 #define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg) \
michael@0 891 PKIX_DEBUG_ARG(expr, arg)
michael@0 892 #else
michael@0 893 #define PKIX_VALIDATERESULT_DEBUG(expr)
michael@0 894 #define PKIX_VALIDATERESULT_DEBUG_ARG(expr, arg)
michael@0 895 #endif
michael@0 896
michael@0 897 #if PKIX_VALIDATEDEBUG
michael@0 898 #define PKIX_VALIDATE_DEBUG(expr) \
michael@0 899 PKIX_DEBUG(expr)
michael@0 900 #define PKIX_VALIDATE_DEBUG_ARG(expr, arg) \
michael@0 901 PKIX_DEBUG_ARG(expr, arg)
michael@0 902 #else
michael@0 903 #define PKIX_VALIDATE_DEBUG(expr)
michael@0 904 #define PKIX_VALIDATE_DEBUG_ARG(expr, arg)
michael@0 905 #endif
michael@0 906
michael@0 907 #if PKIX_BUILDDEBUG
michael@0 908 #define PKIX_BUILD_DEBUG(expr) \
michael@0 909 PKIX_DEBUG(expr)
michael@0 910 #define PKIX_BUILD_DEBUG_ARG(expr, arg) \
michael@0 911 PKIX_DEBUG_ARG(expr, arg)
michael@0 912 #else
michael@0 913 #define PKIX_BUILD_DEBUG(expr)
michael@0 914 #define PKIX_BUILD_DEBUG_ARG(expr, arg)
michael@0 915 #endif
michael@0 916
michael@0 917 #if PKIX_CERTCHAINCHECKERDEBUG
michael@0 918 #define PKIX_CERTCHAINCHECKER_DEBUG(expr) \
michael@0 919 PKIX_DEBUG(expr)
michael@0 920 #define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg) \
michael@0 921 PKIX_DEBUG_ARG(expr, arg)
michael@0 922 #else
michael@0 923 #define PKIX_CERTCHAINCHECKER_DEBUG(expr)
michael@0 924 #define PKIX_CERTCHAINCHECKER_DEBUG_ARG(expr, arg)
michael@0 925 #endif
michael@0 926
michael@0 927 #if PKIX_REVOCATIONCHECKERDEBUG
michael@0 928 #define PKIX_REVOCATIONCHECKER_DEBUG(expr) \
michael@0 929 PKIX_DEBUG(expr)
michael@0 930 #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \
michael@0 931 PKIX_DEBUG_ARG(expr, arg)
michael@0 932 #else
michael@0 933 #define PKIX_REVOCATIONCHECKER_DEBUG(expr)
michael@0 934 #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg)
michael@0 935 #endif
michael@0 936
michael@0 937 #if PKIX_REVOCATIONMETHODDEBUG
michael@0 938 #define PKIX_REVOCATIONMETHOD_DEBUG(expr) \
michael@0 939 PKIX_DEBUG(expr)
michael@0 940 #define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg) \
michael@0 941 PKIX_DEBUG_ARG(expr, arg)
michael@0 942 #else
michael@0 943 #define PKIX_REVOCATIONMETHOD_DEBUG(expr)
michael@0 944 #define PKIX_REVOCATIONMETHOD_DEBUG_ARG(expr, arg)
michael@0 945 #endif
michael@0 946
michael@0 947 #if PKIX_CERTSELECTORDEBUG
michael@0 948 #define PKIX_CERTSELECTOR_DEBUG(expr) \
michael@0 949 PKIX_DEBUG(expr)
michael@0 950 #define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg) \
michael@0 951 PKIX_DEBUG_ARG(expr, arg)
michael@0 952 #else
michael@0 953 #define PKIX_CERTSELECTOR_DEBUG(expr)
michael@0 954 #define PKIX_CERTSELECTOR_DEBUG_ARG(expr, arg)
michael@0 955 #endif
michael@0 956
michael@0 957 #if PKIX_COMCERTSELPARAMSDEBUG
michael@0 958 #define PKIX_COMCERTSELPARAMS_DEBUG(expr) \
michael@0 959 PKIX_DEBUG(expr)
michael@0 960 #define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg) \
michael@0 961 PKIX_DEBUG_ARG(expr, arg)
michael@0 962 #else
michael@0 963 #define PKIX_COMCERTSELPARAMS_DEBUG(expr)
michael@0 964 #define PKIX_COMCERTSELPARAMS_DEBUG_ARG(expr, arg)
michael@0 965 #endif
michael@0 966
michael@0 967 #if PKIX_TARGETCERTCHECKERSTATEDEBUG
michael@0 968 #define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr) \
michael@0 969 PKIX_DEBUG(expr)
michael@0 970 #define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 971 PKIX_DEBUG_ARG(expr, arg)
michael@0 972 #else
michael@0 973 #define PKIX_TARGETCERTCHECKERSTATE_DEBUG(expr)
michael@0 974 #define PKIX_TARGETCERTCHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 975 #endif
michael@0 976
michael@0 977 #if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG
michael@0 978 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \
michael@0 979 PKIX_DEBUG(expr)
michael@0 980 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 981 PKIX_DEBUG_ARG(expr, arg)
michael@0 982 #else
michael@0 983 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr)
michael@0 984 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 985 #endif
michael@0 986
michael@0 987 #if PKIX_INITIALIZEPARAMSDEBUG
michael@0 988 #define PKIX_INITIALIZEPARAMS_DEBUG(expr) \
michael@0 989 PKIX_DEBUG(expr)
michael@0 990 #define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg) \
michael@0 991 PKIX_DEBUG_ARG(expr, arg)
michael@0 992 #else
michael@0 993 #define PKIX_INITIALIZEPARAMS_DEBUG(expr)
michael@0 994 #define PKIX_INITIALIZEPARAMS_DEBUG_ARG(expr, arg)
michael@0 995 #endif
michael@0 996
michael@0 997 #if PKIX_CERTBASICCONSTRAINTSDEBUG
michael@0 998 #define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr) \
michael@0 999 PKIX_DEBUG(expr)
michael@0 1000 #define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg) \
michael@0 1001 PKIX_DEBUG_ARG(expr, arg)
michael@0 1002 #else
michael@0 1003 #define PKIX_CERTBASICCONSTRAINTS_DEBUG(expr)
michael@0 1004 #define PKIX_CERTBASICCONSTRAINTS_DEBUG_ARG(expr, arg)
michael@0 1005 #endif
michael@0 1006
michael@0 1007 #if PKIX_CERTNAMECONSTRAINTSDEBUG
michael@0 1008 #define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr) \
michael@0 1009 PKIX_DEBUG(expr)
michael@0 1010 #define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg) \
michael@0 1011 PKIX_DEBUG_ARG(expr, arg)
michael@0 1012 #else
michael@0 1013 #define PKIX_CERTNAMECONSTRAINTS_DEBUG(expr)
michael@0 1014 #define PKIX_CERTNAMECONSTRAINTS_DEBUG_ARG(expr, arg)
michael@0 1015 #endif
michael@0 1016
michael@0 1017 #if PKIX_CERTNAMECONSTRAINTSCHECKERSTATEDEBUG
michael@0 1018 #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr) \
michael@0 1019 PKIX_DEBUG(expr)
michael@0 1020 #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1021 PKIX_DEBUG_ARG(expr, arg)
michael@0 1022 #else
michael@0 1023 #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG(expr)
michael@0 1024 #define PKIX_CERTNAMECONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 1025 #endif
michael@0 1026
michael@0 1027 #if PKIX_SUBJALTNAMECHECKERSTATEDEBUG
michael@0 1028 #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr) \
michael@0 1029 PKIX_DEBUG(expr)
michael@0 1030 #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1031 PKIX_DEBUG_ARG(expr, arg)
michael@0 1032 #else
michael@0 1033 #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG(expr)
michael@0 1034 #define PKIX_SUBJALTNAMECHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 1035 #endif
michael@0 1036
michael@0 1037 #if PKIX_CERTPOLICYQUALIFIERDEBUG
michael@0 1038 #define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr) \
michael@0 1039 PKIX_DEBUG(expr)
michael@0 1040 #define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg) \
michael@0 1041 PKIX_DEBUG_ARG(expr, arg)
michael@0 1042 #else
michael@0 1043 #define PKIX_CERTPOLICYQUALIFIER_DEBUG(expr)
michael@0 1044 #define PKIX_CERTPOLICYQUALIFIER_DEBUG_ARG(expr, arg)
michael@0 1045 #endif
michael@0 1046
michael@0 1047 #if PKIX_CERTPOLICYINFODEBUG
michael@0 1048 #define PKIX_CERTPOLICYINFO_DEBUG(expr) \
michael@0 1049 PKIX_DEBUG(expr)
michael@0 1050 #define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg) \
michael@0 1051 PKIX_DEBUG_ARG(expr, arg)
michael@0 1052 #else
michael@0 1053 #define PKIX_CERTPOLICYINFO_DEBUG(expr)
michael@0 1054 #define PKIX_CERTPOLICYINFO_DEBUG_ARG(expr, arg)
michael@0 1055 #endif
michael@0 1056
michael@0 1057 #if PKIX_CERTPOLICYNODEDEBUG
michael@0 1058 #define PKIX_CERTPOLICYNODE_DEBUG(expr) \
michael@0 1059 PKIX_DEBUG(expr)
michael@0 1060 #define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg) \
michael@0 1061 PKIX_DEBUG_ARG(expr, arg)
michael@0 1062 #else
michael@0 1063 #define PKIX_CERTPOLICYNODE_DEBUG(expr)
michael@0 1064 #define PKIX_CERTPOLICYNODE_DEBUG_ARG(expr, arg)
michael@0 1065 #endif
michael@0 1066
michael@0 1067 #if PKIX_CERTPOLICYCHECKERSTATEDEBUG
michael@0 1068 #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr) \
michael@0 1069 PKIX_DEBUG(expr)
michael@0 1070 #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1071 PKIX_DEBUG_ARG(expr, arg)
michael@0 1072 #else
michael@0 1073 #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG(expr)
michael@0 1074 #define PKIX_CERTPOLICYCHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 1075 #endif
michael@0 1076
michael@0 1077 #if PKIX_LIFECYCLEDEBUG
michael@0 1078 #define PKIX_LIFECYCLE_DEBUG(expr) \
michael@0 1079 PKIX_DEBUG(expr)
michael@0 1080 #define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg) \
michael@0 1081 PKIX_DEBUG_ARG(expr, arg)
michael@0 1082 #else
michael@0 1083 #define PKIX_LIFECYCLE_DEBUG(expr)
michael@0 1084 #define PKIX_LIFECYCLE_DEBUG_ARG(expr, arg)
michael@0 1085 #endif
michael@0 1086
michael@0 1087 #if PKIX_BASICCONSTRAINTSCHECKERSTATEDEBUG
michael@0 1088 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr) \
michael@0 1089 PKIX_DEBUG(expr)
michael@0 1090 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1091 PKIX_DEBUG_ARG(expr, arg)
michael@0 1092 #else
michael@0 1093 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG(expr)
michael@0 1094 #define PKIX_BASICCONSTRAINTSCHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 1095 #endif
michael@0 1096
michael@0 1097 #if PKIX_CRLDEBUG
michael@0 1098 #define PKIX_CRL_DEBUG(expr) \
michael@0 1099 PKIX_DEBUG(expr)
michael@0 1100 #define PKIX_CRL_DEBUG_ARG(expr, arg) \
michael@0 1101 PKIX_DEBUG_ARG(expr, arg)
michael@0 1102 #else
michael@0 1103 #define PKIX_CRL_DEBUG(expr)
michael@0 1104 #define PKIX_CRL_DEBUG_ARG(expr, arg)
michael@0 1105 #endif
michael@0 1106
michael@0 1107 #if PKIX_CRLENTRYDEBUG
michael@0 1108 #define PKIX_CRLENTRY_DEBUG(expr) \
michael@0 1109 PKIX_DEBUG(expr)
michael@0 1110 #define PKIX_CRLENTRY_DEBUG_ARG(expr, arg) \
michael@0 1111 PKIX_DEBUG_ARG(expr, arg)
michael@0 1112 #else
michael@0 1113 #define PKIX_CRLENTRY_DEBUG(expr)
michael@0 1114 #define PKIX_CRLENTRY_DEBUG_ARG(expr, arg)
michael@0 1115 #endif
michael@0 1116
michael@0 1117 #if PKIX_CRLSELECTORDEBUG
michael@0 1118 #define PKIX_CRLSELECTOR_DEBUG(expr) \
michael@0 1119 PKIX_DEBUG(expr)
michael@0 1120 #define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg) \
michael@0 1121 PKIX_DEBUG_ARG(expr, arg)
michael@0 1122 #else
michael@0 1123 #define PKIX_CRLSELECTOR_DEBUG(expr)
michael@0 1124 #define PKIX_CRLSELECTOR_DEBUG_ARG(expr, arg)
michael@0 1125 #endif
michael@0 1126
michael@0 1127 #if PKIX_COMCRLSELPARAMSDEBUG
michael@0 1128 #define PKIX_COMCRLSELPARAMS_DEBUG(expr) \
michael@0 1129 PKIX_DEBUG(expr)
michael@0 1130 #define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg) \
michael@0 1131 PKIX_DEBUG_ARG(expr, arg)
michael@0 1132 #else
michael@0 1133 #define PKIX_COMCRLSELPARAMS_DEBUG(expr)
michael@0 1134 #define PKIX_COMCRLSELPARAMS_DEBUG_ARG(expr, arg)
michael@0 1135 #endif
michael@0 1136
michael@0 1137 #if PKIX_CERTSTOREDEBUG
michael@0 1138 #define PKIX_CERTSTORE_DEBUG(expr) \
michael@0 1139 PKIX_DEBUG(expr)
michael@0 1140 #define PKIX_CERTSTORE_DEBUG_ARG(expr, arg) \
michael@0 1141 PKIX_DEBUG_ARG(expr, arg)
michael@0 1142 #else
michael@0 1143 #define PKIX_CERTSTORE_DEBUG(expr)
michael@0 1144 #define PKIX_CERTSTORE_DEBUG_ARG(expr, arg)
michael@0 1145 #endif
michael@0 1146
michael@0 1147 #if PKIX_COLLECTIONCERTSTORECONTEXTDEBUG
michael@0 1148 #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr) \
michael@0 1149 PKIX_DEBUG(expr)
michael@0 1150 #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \
michael@0 1151 PKIX_DEBUG_ARG(expr, arg)
michael@0 1152 #else
michael@0 1153 #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG(expr)
michael@0 1154 #define PKIX_COLLECTIONCERTSTORECONTEXT_DEBUG_ARG(expr, arg)
michael@0 1155 #endif
michael@0 1156
michael@0 1157 #if PKIX_CRLCHECKERDEBUG
michael@0 1158 #define PKIX_CRLCHECKER_DEBUG(expr) \
michael@0 1159 PKIX_DEBUG(expr)
michael@0 1160 #define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg) \
michael@0 1161 PKIX_DEBUG_ARG(expr, arg)
michael@0 1162 #else
michael@0 1163 #define PKIX_CRLCHECKER_DEBUG(expr)
michael@0 1164 #define PKIX_CRLCHECKER_DEBUG_ARG(expr, arg)
michael@0 1165 #endif
michael@0 1166
michael@0 1167 #if PKIX_CERTPOLICYMAPDEBUG
michael@0 1168 #define PKIX_CERTPOLICYMAP_DEBUG(expr) \
michael@0 1169 PKIX_DEBUG(expr)
michael@0 1170 #define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg) \
michael@0 1171 PKIX_DEBUG_ARG(expr, arg)
michael@0 1172 #else
michael@0 1173 #define PKIX_CERTPOLICYMAP_DEBUG(expr)
michael@0 1174 #define PKIX_CERTPOLICYMAP_DEBUG_ARG(expr, arg)
michael@0 1175 #endif
michael@0 1176
michael@0 1177 #if PKIX_BUILDRESULTDEBUG
michael@0 1178 #define PKIX_BUILDRESULT_DEBUG(expr) \
michael@0 1179 PKIX_DEBUG(expr)
michael@0 1180 #define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg) \
michael@0 1181 PKIX_DEBUG_ARG(expr, arg)
michael@0 1182 #else
michael@0 1183 #define PKIX_BUILDRESULT_DEBUG(expr)
michael@0 1184 #define PKIX_BUILDRESULT_DEBUG_ARG(expr, arg)
michael@0 1185 #endif
michael@0 1186
michael@0 1187 #if PKIX_FORWARDBUILDERSTATEDEBUG
michael@0 1188 #define PKIX_FORWARDBUILDERSTATE_DEBUG(expr) \
michael@0 1189 PKIX_DEBUG(expr)
michael@0 1190 #define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1191 PKIX_DEBUG_ARG(expr, arg)
michael@0 1192 #else
michael@0 1193 #define PKIX_FORWARDBUILDERSTATE_DEBUG(expr)
michael@0 1194 #define PKIX_FORWARDBUILDERSTATE_DEBUG_ARG(expr, arg)
michael@0 1195 #endif
michael@0 1196
michael@0 1197 #if PKIX_SIGNATURECHECKERSTATEDEBUG
michael@0 1198 #define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr) \
michael@0 1199 PKIX_DEBUG(expr)
michael@0 1200 #define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg) \
michael@0 1201 PKIX_DEBUG_ARG(expr, arg)
michael@0 1202 #else
michael@0 1203 #define PKIX_SIGNATURECHECKERSTATE_DEBUG(expr)
michael@0 1204 #define PKIX_SIGNATURECHECKERSTATE_DEBUG_ARG(expr, arg)
michael@0 1205 #endif
michael@0 1206
michael@0 1207 #if PKIX_USERDEFINEDMODULESDEBUG
michael@0 1208 #define PKIX_USERDEFINEDMODULES_DEBUG(expr) \
michael@0 1209 PKIX_DEBUG(expr)
michael@0 1210 #define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg) \
michael@0 1211 PKIX_DEBUG_ARG(expr, arg)
michael@0 1212 #else
michael@0 1213 #define PKIX_USERDEFINEDMODULES_DEBUG(expr)
michael@0 1214 #define PKIX_USERDEFINEDMODULES_DEBUG_ARG(expr, arg)
michael@0 1215 #endif
michael@0 1216
michael@0 1217 #if PKIX_CONTEXTDEBUG
michael@0 1218 #define PKIX_CONTEXT_DEBUG(expr) \
michael@0 1219 PKIX_DEBUG(expr)
michael@0 1220 #define PKIX_CONTEXT_DEBUG_ARG(expr, arg) \
michael@0 1221 PKIX_DEBUG_ARG(expr, arg)
michael@0 1222 #else
michael@0 1223 #define PKIX_CONTEXT_DEBUG(expr)
michael@0 1224 #define PKIX_CONTEXT_DEBUG_ARG(expr, arg)
michael@0 1225 #endif
michael@0 1226
michael@0 1227 #if PKIX_REVOCATIONCHECKERDEBUG
michael@0 1228 #define PKIX_REVOCATIONCHECKER_DEBUG(expr) \
michael@0 1229 PKIX_DEBUG(expr)
michael@0 1230 #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg) \
michael@0 1231 PKIX_DEBUG_ARG(expr, arg)
michael@0 1232 #else
michael@0 1233 #define PKIX_REVOCATIONCHECKER_DEBUG(expr)
michael@0 1234 #define PKIX_REVOCATIONCHECKER_DEBUG_ARG(expr, arg)
michael@0 1235 #endif
michael@0 1236
michael@0 1237 #if PKIX_LDAPREQUESTDEBUG
michael@0 1238 #define PKIX_LDAPREQUEST_DEBUG(expr) \
michael@0 1239 PKIX_DEBUG(expr)
michael@0 1240 #define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg) \
michael@0 1241 PKIX_DEBUG_ARG(expr, arg)
michael@0 1242 #else
michael@0 1243 #define PKIX_LDAPREQUEST_DEBUG(expr)
michael@0 1244 #define PKIX_LDAPREQUEST_DEBUG_ARG(expr, arg)
michael@0 1245 #endif
michael@0 1246
michael@0 1247 #if PKIX_LDAPRESPONSEDEBUG
michael@0 1248 #define PKIX_LDAPRESPONSE_DEBUG(expr) \
michael@0 1249 PKIX_DEBUG(expr)
michael@0 1250 #define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg) \
michael@0 1251 PKIX_DEBUG_ARG(expr, arg)
michael@0 1252 #else
michael@0 1253 #define PKIX_LDAPRESPONSE_DEBUG(expr)
michael@0 1254 #define PKIX_LDAPRESPONSE_DEBUG_ARG(expr, arg)
michael@0 1255 #endif
michael@0 1256
michael@0 1257 #if PKIX_LDAPCLIENTDEBUG
michael@0 1258 #define PKIX_LDAPCLIENT_DEBUG(expr) \
michael@0 1259 PKIX_DEBUG(expr)
michael@0 1260 #define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg) \
michael@0 1261 PKIX_DEBUG_ARG(expr, arg)
michael@0 1262 #else
michael@0 1263 #define PKIX_LDAPCLIENT_DEBUG(expr)
michael@0 1264 #define PKIX_LDAPCLIENT_DEBUG_ARG(expr, arg)
michael@0 1265 #endif
michael@0 1266
michael@0 1267 #if PKIX_LDAPDEFAULTCLIENTDEBUG
michael@0 1268 #define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr) \
michael@0 1269 PKIX_DEBUG(expr)
michael@0 1270 #define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \
michael@0 1271 PKIX_DEBUG_ARG(expr, arg)
michael@0 1272 #else
michael@0 1273 #define PKIX_LDAPDEFAULTCLIENT_DEBUG(expr)
michael@0 1274 #define PKIX_LDAPDEFAULTCLIENT_DEBUG_ARG(expr, arg)
michael@0 1275 #endif
michael@0 1276
michael@0 1277 #if PKIX_SOCKETDEBUG
michael@0 1278 #define PKIX_SOCKET_DEBUG(expr) \
michael@0 1279 PKIX_DEBUG(expr)
michael@0 1280 #define PKIX_SOCKET_DEBUG_ARG(expr, arg) \
michael@0 1281 PKIX_DEBUG_ARG(expr, arg)
michael@0 1282 #else
michael@0 1283 #define PKIX_SOCKET_DEBUG(expr)
michael@0 1284 #define PKIX_SOCKET_DEBUG_ARG(expr, arg)
michael@0 1285 #endif
michael@0 1286
michael@0 1287 #if PKIX_RESOURCELIMITSDEBUG
michael@0 1288 #define PKIX_RESOURCELIMITS_DEBUG(expr) \
michael@0 1289 PKIX_DEBUG(expr)
michael@0 1290 #define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg) \
michael@0 1291 PKIX_DEBUG_ARG(expr, arg)
michael@0 1292 #else
michael@0 1293 #define PKIX_RESOURCELIMITS_DEBUG(expr)
michael@0 1294 #define PKIX_RESOURCELIMITS_DEBUG_ARG(expr, arg)
michael@0 1295 #endif
michael@0 1296
michael@0 1297 #if PKIX_LOGGERDEBUG
michael@0 1298 #define PKIX_LOGGER_DEBUG(expr) \
michael@0 1299 PKIX_DEBUG(expr)
michael@0 1300 #define PKIX_LOGGER_DEBUG_ARG(expr, arg) \
michael@0 1301 PKIX_DEBUG_ARG(expr, arg)
michael@0 1302 #else
michael@0 1303 #define PKIX_LOGGER_DEBUG(expr)
michael@0 1304 #define PKIX_LOGGER_DEBUG_ARG(expr, arg)
michael@0 1305 #endif
michael@0 1306
michael@0 1307 #if PKIX_MONITORLOCKDEBUG
michael@0 1308 #define PKIX_MONITORLOCK_DEBUG(expr) \
michael@0 1309 PKIX_DEBUG(expr)
michael@0 1310 #define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg) \
michael@0 1311 PKIX_DEBUG_ARG(expr, arg)
michael@0 1312 #else
michael@0 1313 #define PKIX_MONITORLOCK_DEBUG(expr)
michael@0 1314 #define PKIX_MONITORLOCK_DEBUG_ARG(expr, arg)
michael@0 1315 #endif
michael@0 1316
michael@0 1317 #if PKIX_INFOACCESSDEBUG
michael@0 1318 #define PKIX_INFOACCESS_DEBUG(expr) \
michael@0 1319 PKIX_DEBUG(expr)
michael@0 1320 #define PKIX_INFOACCESS_DEBUG_ARG(expr, arg) \
michael@0 1321 PKIX_DEBUG_ARG(expr, arg)
michael@0 1322 #else
michael@0 1323 #define PKIX_INFOACCESS_DEBUG(expr)
michael@0 1324 #define PKIX_INFOACCESS_DEBUG_ARG(expr, arg)
michael@0 1325 #endif
michael@0 1326
michael@0 1327 #if PKIX_AIAMGRDEBUG
michael@0 1328 #define PKIX_AIAMGR_DEBUG(expr) \
michael@0 1329 PKIX_DEBUG(expr)
michael@0 1330 #define PKIX_AIAMGR_DEBUG_ARG(expr, arg) \
michael@0 1331 PKIX_DEBUG_ARG(expr, arg)
michael@0 1332 #else
michael@0 1333 #define PKIX_AIAMGR_DEBUG(expr)
michael@0 1334 #define PKIX_AIAMGR_DEBUG_ARG(expr, arg)
michael@0 1335 #endif
michael@0 1336
michael@0 1337 #if PKIX_OCSPCHECKERDEBUG
michael@0 1338 #define PKIX_OCSPCHECKER_DEBUG(expr) \
michael@0 1339 PKIX_DEBUG(expr)
michael@0 1340 #define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg) \
michael@0 1341 PKIX_DEBUG_ARG(expr, arg)
michael@0 1342 #else
michael@0 1343 #define PKIX_OCSPCHECKER_DEBUG(expr)
michael@0 1344 #define PKIX_OCSPCHECKER_DEBUG_ARG(expr, arg)
michael@0 1345 #endif
michael@0 1346
michael@0 1347 #if PKIX_OCSPCERTIDDEBUG
michael@0 1348 #define PKIX_OCSPCERTID_DEBUG(expr) \
michael@0 1349 PKIX_DEBUG(expr)
michael@0 1350 #define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg) \
michael@0 1351 PKIX_DEBUG_ARG(expr, arg)
michael@0 1352 #else
michael@0 1353 #define PKIX_OCSPCERTID_DEBUG(expr)
michael@0 1354 #define PKIX_OCSPCERTID_DEBUG_ARG(expr, arg)
michael@0 1355 #endif
michael@0 1356
michael@0 1357 #if PKIX_OCSPREQUESTDEBUG
michael@0 1358 #define PKIX_OCSPREQUEST_DEBUG(expr) \
michael@0 1359 PKIX_DEBUG(expr)
michael@0 1360 #define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg) \
michael@0 1361 PKIX_DEBUG_ARG(expr, arg)
michael@0 1362 #else
michael@0 1363 #define PKIX_OCSPREQUEST_DEBUG(expr)
michael@0 1364 #define PKIX_OCSPREQUEST_DEBUG_ARG(expr, arg)
michael@0 1365 #endif
michael@0 1366
michael@0 1367 #if PKIX_OCSPRESPONSEDEBUG
michael@0 1368 #define PKIX_OCSPRESPONSE_DEBUG(expr) \
michael@0 1369 PKIX_DEBUG(expr)
michael@0 1370 #define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg) \
michael@0 1371 PKIX_DEBUG_ARG(expr, arg)
michael@0 1372 #else
michael@0 1373 #define PKIX_OCSPRESPONSE_DEBUG(expr)
michael@0 1374 #define PKIX_OCSPRESPONSE_DEBUG_ARG(expr, arg)
michael@0 1375 #endif
michael@0 1376
michael@0 1377 #if PKIX_HTTPDEFAULTCLIENTDEBUG
michael@0 1378 #define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr) \
michael@0 1379 PKIX_DEBUG(expr)
michael@0 1380 #define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg) \
michael@0 1381 PKIX_DEBUG_ARG(expr, arg)
michael@0 1382 #else
michael@0 1383 #define PKIX_HTTPDEFAULTCLIENT_DEBUG(expr)
michael@0 1384 #define PKIX_HTTPDEFAULTCLIENT_DEBUG_ARG(expr, arg)
michael@0 1385 #endif
michael@0 1386
michael@0 1387 #if PKIX_HTTPCERTSTORECONTEXTDEBUG
michael@0 1388 #define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr) \
michael@0 1389 PKIX_DEBUG(expr)
michael@0 1390 #define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg) \
michael@0 1391 PKIX_DEBUG_ARG(expr, arg)
michael@0 1392 #else
michael@0 1393 #define PKIX_HTTPCERTSTORECONTEXT_DEBUG(expr)
michael@0 1394 #define PKIX_HTTPCERTSTORECONTEXT_DEBUG_ARG(expr, arg)
michael@0 1395 #endif
michael@0 1396
michael@0 1397 #if PKIX_VERIFYNODEDEBUG
michael@0 1398 #define PKIX_VERIFYNODE_DEBUG(expr) \
michael@0 1399 PKIX_DEBUG(expr)
michael@0 1400 #define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg) \
michael@0 1401 PKIX_DEBUG_ARG(expr, arg)
michael@0 1402 #else
michael@0 1403 #define PKIX_VERIFYNODE_DEBUG(expr)
michael@0 1404 #define PKIX_VERIFYNODE_DEBUG_ARG(expr, arg)
michael@0 1405 #endif
michael@0 1406
michael@0 1407 #if PKIX_EKUCHECKER
michael@0 1408 #define PKIX_EKUCHECKER_DEBUG(expr) \
michael@0 1409 PKIX_DEBUG(expr)
michael@0 1410 #define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg) \
michael@0 1411 PKIX_DEBUG_ARG(expr, arg)
michael@0 1412 #else
michael@0 1413 #define PKIX_EKUCHECKER_DEBUG(expr)
michael@0 1414 #define PKIX_EKUCHECKER_DEBUG_ARG(expr, arg)
michael@0 1415 #endif
michael@0 1416
michael@0 1417 #if PKIX_CERTVFYPKIXDEBUG
michael@0 1418 #define PKIX_CERTVFYPKIX_DEBUG(expr) \
michael@0 1419 PKIX_DEBUG(expr)
michael@0 1420 #define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg) \
michael@0 1421 PKIX_DEBUG_ARG(expr, arg)
michael@0 1422 #else
michael@0 1423 #define PKIX_CERTVFYPKIX_DEBUG(expr)
michael@0 1424 #define PKIX_CERTVFYPKIX_DEBUG_ARG(expr, arg)
michael@0 1425 #endif
michael@0 1426
michael@0 1427 /*
michael@0 1428 * All object types register themselves with the system using a
michael@0 1429 * pkix_ClassTable_Entry, which consists of a set of functions for that
michael@0 1430 * type and an ASCII string (char *) which is used by the default
michael@0 1431 * ToStringCallback (if necessary). System types register themselves directly
michael@0 1432 * when their respective PKIX_"type"_RegisterSelf functions are called.
michael@0 1433 * User-defined types can be registered using PKIX_PL_Object_RegisterType.
michael@0 1434 * (see comments in pkix_pl_system.h)
michael@0 1435 */
michael@0 1436
michael@0 1437 typedef struct pkix_ClassTable_EntryStruct pkix_ClassTable_Entry;
michael@0 1438 struct pkix_ClassTable_EntryStruct {
michael@0 1439 char *description;
michael@0 1440 PKIX_Int32 objCounter;
michael@0 1441 PKIX_Int32 typeObjectSize;
michael@0 1442 PKIX_PL_DestructorCallback destructor;
michael@0 1443 PKIX_PL_EqualsCallback equalsFunction;
michael@0 1444 PKIX_PL_HashcodeCallback hashcodeFunction;
michael@0 1445 PKIX_PL_ToStringCallback toStringFunction;
michael@0 1446 PKIX_PL_ComparatorCallback comparator;
michael@0 1447 PKIX_PL_DuplicateCallback duplicateFunction;
michael@0 1448 };
michael@0 1449
michael@0 1450 /*
michael@0 1451 * PKIX_ERRORCLASSNAMES is an array of strings, with each string holding a
michael@0 1452 * descriptive name for an error code. This is used by the default
michael@0 1453 * PKIX_PL_Error_ToString function.
michael@0 1454 */
michael@0 1455 extern const char *PKIX_ERRORCLASSNAMES[PKIX_NUMERRORCLASSES];
michael@0 1456
michael@0 1457 #define MAX_STACK_DEPTH 1000
michael@0 1458
michael@0 1459 extern PRLogModuleInfo *pkixLog;
michael@0 1460
michael@0 1461 #define PKIX_MAGIC_HEADER LL_INIT(0xFEEDC0FF, 0xEEFACADE)
michael@0 1462 #define PKIX_MAGIC_HEADER_DESTROYED LL_INIT(0xBAADF00D, 0xDEADBEEF)
michael@0 1463
michael@0 1464 /* see source file for function documentation */
michael@0 1465
michael@0 1466 PKIX_Error *
michael@0 1467 pkix_IsCertSelfIssued(
michael@0 1468 PKIX_PL_Cert *cert,
michael@0 1469 PKIX_Boolean *pSelfIssued,
michael@0 1470 void *plContext);
michael@0 1471
michael@0 1472 PKIX_Error *
michael@0 1473 pkix_Throw(
michael@0 1474 PKIX_ERRORCLASS errClass,
michael@0 1475 const char *funcName,
michael@0 1476 PKIX_ERRORCODE errorTextCode,
michael@0 1477 PKIX_ERRORCLASS overrideClass,
michael@0 1478 PKIX_Error *cause,
michael@0 1479 PKIX_Error **pError,
michael@0 1480 void *plContext);
michael@0 1481
michael@0 1482 PKIX_Error *
michael@0 1483 pkix_CheckTypes(
michael@0 1484 PKIX_PL_Object *first,
michael@0 1485 PKIX_PL_Object *second,
michael@0 1486 PKIX_UInt32 type,
michael@0 1487 void *plContext);
michael@0 1488
michael@0 1489 PKIX_Error *
michael@0 1490 pkix_CheckType(
michael@0 1491 PKIX_PL_Object *object,
michael@0 1492 PKIX_UInt32 type,
michael@0 1493 void *plContext);
michael@0 1494
michael@0 1495 PKIX_Error *
michael@0 1496 pkix_hash(
michael@0 1497 const unsigned char *bytes,
michael@0 1498 PKIX_UInt32 length,
michael@0 1499 PKIX_UInt32 *hash,
michael@0 1500 void *plContext);
michael@0 1501
michael@0 1502 PKIX_Error *
michael@0 1503 pkix_duplicateImmutable(
michael@0 1504 PKIX_PL_Object *object,
michael@0 1505 PKIX_PL_Object **pNewObject,
michael@0 1506 void *plContext);
michael@0 1507
michael@0 1508 PKIX_UInt32
michael@0 1509 pkix_countArray(void **array);
michael@0 1510
michael@0 1511 PKIX_UInt32
michael@0 1512 pkix_hex2i(char c);
michael@0 1513
michael@0 1514 char
michael@0 1515 pkix_i2hex(char c);
michael@0 1516
michael@0 1517 PKIX_Boolean
michael@0 1518 pkix_isPlaintext(unsigned char c, PKIX_Boolean debug);
michael@0 1519
michael@0 1520 PKIX_Error *
michael@0 1521 pkix_CacheCertChain_Lookup(
michael@0 1522 PKIX_PL_Cert* targetCert,
michael@0 1523 PKIX_List* anchors,
michael@0 1524 PKIX_PL_Date *testDate,
michael@0 1525 PKIX_Boolean *pFound,
michael@0 1526 PKIX_BuildResult **pBuildResult,
michael@0 1527 void *plContext);
michael@0 1528
michael@0 1529 PKIX_Error *
michael@0 1530 pkix_CacheCertChain_Remove(
michael@0 1531 PKIX_PL_Cert* targetCert,
michael@0 1532 PKIX_List* anchors,
michael@0 1533 void *plContext);
michael@0 1534
michael@0 1535 PKIX_Error *
michael@0 1536 pkix_CacheCertChain_Add(
michael@0 1537 PKIX_PL_Cert* targetCert,
michael@0 1538 PKIX_List* anchors,
michael@0 1539 PKIX_PL_Date *validityDate,
michael@0 1540 PKIX_BuildResult *buildResult,
michael@0 1541 void *plContext);
michael@0 1542
michael@0 1543 PKIX_Error *
michael@0 1544 pkix_CacheCert_Lookup(
michael@0 1545 PKIX_CertStore *store,
michael@0 1546 PKIX_ComCertSelParams *certSelParams,
michael@0 1547 PKIX_PL_Date *testDate,
michael@0 1548 PKIX_Boolean *pFound,
michael@0 1549 PKIX_List** pCerts,
michael@0 1550 void *plContext);
michael@0 1551
michael@0 1552 PKIX_Error *
michael@0 1553 pkix_CacheCert_Add(
michael@0 1554 PKIX_CertStore *store,
michael@0 1555 PKIX_ComCertSelParams *certSelParams,
michael@0 1556 PKIX_List* certs,
michael@0 1557 void *plContext);
michael@0 1558
michael@0 1559 PKIX_Error *
michael@0 1560 pkix_CacheCrlEntry_Lookup(
michael@0 1561 PKIX_CertStore *store,
michael@0 1562 PKIX_PL_X500Name *certIssuer,
michael@0 1563 PKIX_PL_BigInt *certSerialNumber,
michael@0 1564 PKIX_Boolean *pFound,
michael@0 1565 PKIX_List** pCrlEntryList,
michael@0 1566 void *plContext);
michael@0 1567
michael@0 1568 PKIX_Error *
michael@0 1569 pkix_CacheCrlEntry_Add(
michael@0 1570 PKIX_CertStore *store,
michael@0 1571 PKIX_PL_X500Name *certIssuer,
michael@0 1572 PKIX_PL_BigInt *certSerialNumber,
michael@0 1573 PKIX_List* crlEntryList,
michael@0 1574 void *plContext);
michael@0 1575
michael@0 1576 #ifdef PR_LOGGING
michael@0 1577 void
michael@0 1578 pkix_trace_dump_cert(
michael@0 1579 const char *info,
michael@0 1580 PKIX_PL_Cert *cert,
michael@0 1581 void *plContext);
michael@0 1582 #endif
michael@0 1583
michael@0 1584 #ifdef __cplusplus
michael@0 1585 }
michael@0 1586 #endif
michael@0 1587
michael@0 1588 #endif /* _PKIX_TOOLS_H */

mercurial