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

http://github.com/zpao/v8monkey · C Header · 1622 lines · 1355 code · 170 blank · 97 comment · 104 complexity · 46fbed003697f5f762a168e1c6bcf739 MD5 · raw file

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