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