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_procparams.c
6 *
7 * ProcessingParams Object Functions
8 *
9 */
10
11 #include "pkix_procparams.h"
12
13 /* --Private-Functions-------------------------------------------- */
14
15 /*
16 * FUNCTION: pkix_ProcessingParams_Destroy
17 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h)
18 */
19 static PKIX_Error *
pkix_ProcessingParams_Destroy(PKIX_PL_Object * object,void * plContext)20 pkix_ProcessingParams_Destroy(
21 PKIX_PL_Object *object,
22 void *plContext)
23 {
24 PKIX_ProcessingParams *params = NULL;
25
26 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_Destroy");
27 PKIX_NULLCHECK_ONE(object);
28
29 /* Check that this object is a processing params object */
30 PKIX_CHECK(pkix_CheckType
31 (object, PKIX_PROCESSINGPARAMS_TYPE, plContext),
32 PKIX_OBJECTNOTPROCESSINGPARAMS);
33
34 params = (PKIX_ProcessingParams *)object;
35
36 PKIX_DECREF(params->trustAnchors);
37 PKIX_DECREF(params->hintCerts);
38 PKIX_DECREF(params->constraints);
39 PKIX_DECREF(params->date);
40 PKIX_DECREF(params->initialPolicies);
41 PKIX_DECREF(params->certChainCheckers);
42 PKIX_DECREF(params->revChecker);
43 PKIX_DECREF(params->certStores);
44 PKIX_DECREF(params->resourceLimits);
45
46 cleanup:
47
48 PKIX_RETURN(PROCESSINGPARAMS);
49 }
50
51 /*
52 * FUNCTION: pkix_ProcessingParams_Equals
53 * (see comments for PKIX_PL_EqualsCallback in pkix_pl_system.h)
54 */
55 static PKIX_Error *
pkix_ProcessingParams_Equals(PKIX_PL_Object * first,PKIX_PL_Object * second,PKIX_Boolean * pResult,void * plContext)56 pkix_ProcessingParams_Equals(
57 PKIX_PL_Object *first,
58 PKIX_PL_Object *second,
59 PKIX_Boolean *pResult,
60 void *plContext)
61 {
62 PKIX_UInt32 secondType;
63 PKIX_Boolean cmpResult;
64 PKIX_ProcessingParams *firstProcParams = NULL;
65 PKIX_ProcessingParams *secondProcParams = NULL;
66
67 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_Equals");
68 PKIX_NULLCHECK_THREE(first, second, pResult);
69
70 PKIX_CHECK(pkix_CheckType(first, PKIX_PROCESSINGPARAMS_TYPE, plContext),
71 PKIX_FIRSTOBJECTNOTPROCESSINGPARAMS);
72
73 PKIX_CHECK(PKIX_PL_Object_GetType(second, &secondType, plContext),
74 PKIX_COULDNOTGETTYPEOFSECONDARGUMENT);
75
76 *pResult = PKIX_FALSE;
77
78 if (secondType != PKIX_PROCESSINGPARAMS_TYPE) goto cleanup;
79
80 firstProcParams = (PKIX_ProcessingParams *)first;
81 secondProcParams = (PKIX_ProcessingParams *)second;
82
83 /* Do the simplest tests first */
84 if ((firstProcParams->qualifiersRejected) !=
85 (secondProcParams->qualifiersRejected)) {
86 goto cleanup;
87 }
88
89 if (firstProcParams->isCrlRevocationCheckingEnabled !=
90 secondProcParams->isCrlRevocationCheckingEnabled) {
91 goto cleanup;
92 }
93 if (firstProcParams->isCrlRevocationCheckingEnabledWithNISTPolicy !=
94 secondProcParams->isCrlRevocationCheckingEnabledWithNISTPolicy) {
95 goto cleanup;
96 }
97
98 /* trustAnchors can never be NULL */
99
100 PKIX_EQUALS
101 (firstProcParams->trustAnchors,
102 secondProcParams->trustAnchors,
103 &cmpResult,
104 plContext,
105 PKIX_OBJECTEQUALSFAILED);
106
107 if (!cmpResult) goto cleanup;
108
109 PKIX_EQUALS
110 (firstProcParams->hintCerts,
111 secondProcParams->hintCerts,
112 &cmpResult,
113 plContext,
114 PKIX_OBJECTEQUALSFAILED);
115
116 if (!cmpResult) goto cleanup;
117
118 PKIX_EQUALS
119 (firstProcParams->date,
120 secondProcParams->date,
121 &cmpResult,
122 plContext,
123 PKIX_OBJECTEQUALSFAILED);
124
125 if (!cmpResult) goto cleanup;
126
127 PKIX_EQUALS
128 (firstProcParams->constraints,
129 secondProcParams->constraints,
130 &cmpResult,
131 plContext,
132 PKIX_OBJECTEQUALSFAILED);
133
134 if (!cmpResult) goto cleanup;
135
136 PKIX_EQUALS
137 (firstProcParams->initialPolicies,
138 secondProcParams->initialPolicies,
139 &cmpResult,
140 plContext,
141 PKIX_OBJECTEQUALSFAILED);
142
143 if (!cmpResult) goto cleanup;
144
145 /* There is no Equals function for CertChainCheckers */
146
147 PKIX_EQUALS
148 ((PKIX_PL_Object *)firstProcParams->certStores,
149 (PKIX_PL_Object *)secondProcParams->certStores,
150 &cmpResult,
151 plContext,
152 PKIX_OBJECTEQUALSFAILED);
153
154 if (!cmpResult) goto cleanup;
155
156 PKIX_EQUALS
157 (firstProcParams->resourceLimits,
158 secondProcParams->resourceLimits,
159 &cmpResult,
160 plContext,
161 PKIX_OBJECTEQUALSFAILED);
162
163 if (cmpResult == PKIX_FALSE) {
164 *pResult = PKIX_FALSE;
165 goto cleanup;
166 }
167
168 *pResult = cmpResult;
169
170 cleanup:
171
172 PKIX_RETURN(PROCESSINGPARAMS);
173 }
174
175 /*
176 * FUNCTION: pkix_ProcessingParams_Hashcode
177 * (see comments for PKIX_PL_HashcodeCallback in pkix_pl_system.h)
178 */
179 static PKIX_Error *
pkix_ProcessingParams_Hashcode(PKIX_PL_Object * object,PKIX_UInt32 * pHashcode,void * plContext)180 pkix_ProcessingParams_Hashcode(
181 PKIX_PL_Object *object,
182 PKIX_UInt32 *pHashcode,
183 void *plContext)
184 {
185 PKIX_ProcessingParams *procParams = NULL;
186 PKIX_UInt32 hash = 0;
187 PKIX_UInt32 anchorsHash = 0;
188 PKIX_UInt32 hintCertsHash = 0;
189 PKIX_UInt32 dateHash = 0;
190 PKIX_UInt32 constraintsHash = 0;
191 PKIX_UInt32 initialHash = 0;
192 PKIX_UInt32 rejectedHash = 0;
193 PKIX_UInt32 certChainCheckersHash = 0;
194 PKIX_UInt32 revCheckerHash = 0;
195 PKIX_UInt32 certStoresHash = 0;
196 PKIX_UInt32 resourceLimitsHash = 0;
197
198 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_Hashcode");
199 PKIX_NULLCHECK_TWO(object, pHashcode);
200
201 PKIX_CHECK(pkix_CheckType
202 (object, PKIX_PROCESSINGPARAMS_TYPE, plContext),
203 PKIX_OBJECTNOTPROCESSINGPARAMS);
204
205 procParams = (PKIX_ProcessingParams*)object;
206
207 PKIX_HASHCODE(procParams->trustAnchors, &anchorsHash, plContext,
208 PKIX_OBJECTHASHCODEFAILED);
209
210 PKIX_HASHCODE(procParams->hintCerts, &hintCertsHash, plContext,
211 PKIX_OBJECTHASHCODEFAILED);
212
213 PKIX_HASHCODE(procParams->date, &dateHash, plContext,
214 PKIX_OBJECTHASHCODEFAILED);
215
216 PKIX_HASHCODE(procParams->constraints, &constraintsHash, plContext,
217 PKIX_OBJECTHASHCODEFAILED);
218
219 PKIX_HASHCODE(procParams->initialPolicies, &initialHash, plContext,
220 PKIX_OBJECTHASHCODEFAILED);
221
222 rejectedHash = procParams->qualifiersRejected;
223
224 /* There is no Hash function for CertChainCheckers */
225
226 PKIX_HASHCODE(procParams->certStores, &certStoresHash, plContext,
227 PKIX_OBJECTHASHCODEFAILED);
228
229 PKIX_HASHCODE(procParams->resourceLimits,
230 &resourceLimitsHash,
231 plContext,
232 PKIX_OBJECTHASHCODEFAILED);
233
234 hash = (31 * ((31 * anchorsHash) + hintCertsHash + dateHash)) +
235 constraintsHash + initialHash + rejectedHash;
236
237 hash += ((((certStoresHash + resourceLimitsHash) << 7) +
238 certChainCheckersHash + revCheckerHash +
239 procParams->isCrlRevocationCheckingEnabled +
240 procParams->isCrlRevocationCheckingEnabledWithNISTPolicy) << 7);
241
242 *pHashcode = hash;
243
244 cleanup:
245
246 PKIX_RETURN(PROCESSINGPARAMS);
247 }
248
249 /*
250 * FUNCTION: pkix_ProcessingParams_ToString
251 * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h)
252 */
253 static PKIX_Error *
pkix_ProcessingParams_ToString(PKIX_PL_Object * object,PKIX_PL_String ** pString,void * plContext)254 pkix_ProcessingParams_ToString(
255 PKIX_PL_Object *object,
256 PKIX_PL_String **pString,
257 void *plContext)
258 {
259 PKIX_ProcessingParams *procParams = NULL;
260 char *asciiFormat = NULL;
261 PKIX_PL_String *formatString = NULL;
262 PKIX_PL_String *procParamsString = NULL;
263 PKIX_PL_String *anchorsString = NULL;
264 PKIX_PL_String *dateString = NULL;
265 PKIX_PL_String *constraintsString = NULL;
266 PKIX_PL_String *InitialPoliciesString = NULL;
267 PKIX_PL_String *qualsRejectedString = NULL;
268 PKIX_List *certStores = NULL;
269 PKIX_PL_String *certStoresString = NULL;
270 PKIX_PL_String *resourceLimitsString = NULL;
271
272 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_ToString");
273 PKIX_NULLCHECK_TWO(object, pString);
274
275 PKIX_CHECK(pkix_CheckType
276 (object, PKIX_PROCESSINGPARAMS_TYPE, plContext),
277 PKIX_OBJECTNOTPROCESSINGPARAMS);
278
279 asciiFormat =
280 "[\n"
281 "\tTrust Anchors: \n"
282 "\t********BEGIN LIST OF TRUST ANCHORS********\n"
283 "\t\t%s\n"
284 "\t********END LIST OF TRUST ANCHORS********\n"
285 "\tDate: \t\t%s\n"
286 "\tTarget Constraints: %s\n"
287 "\tInitial Policies: %s\n"
288 "\tQualifiers Rejected: %s\n"
289 "\tCert Stores: %s\n"
290 "\tResource Limits: %s\n"
291 "\tCRL Checking Enabled: %d\n"
292 "]\n";
293
294 PKIX_CHECK(PKIX_PL_String_Create
295 (PKIX_ESCASCII,
296 asciiFormat,
297 0,
298 &formatString,
299 plContext),
300 PKIX_STRINGCREATEFAILED);
301
302 procParams = (PKIX_ProcessingParams*)object;
303
304 PKIX_TOSTRING(procParams->trustAnchors, &anchorsString, plContext,
305 PKIX_OBJECTTOSTRINGFAILED);
306
307 PKIX_TOSTRING(procParams->date, &dateString, plContext,
308 PKIX_OBJECTTOSTRINGFAILED);
309
310 PKIX_TOSTRING(procParams->constraints, &constraintsString, plContext,
311 PKIX_OBJECTTOSTRINGFAILED);
312
313 PKIX_TOSTRING
314 (procParams->initialPolicies, &InitialPoliciesString, plContext,
315 PKIX_OBJECTTOSTRINGFAILED);
316
317 PKIX_CHECK(PKIX_PL_String_Create
318 (PKIX_ESCASCII,
319 (procParams->qualifiersRejected)?"TRUE":"FALSE",
320 0,
321 &qualsRejectedString,
322 plContext),
323 PKIX_STRINGCREATEFAILED);
324
325 /* There is no ToString function for CertChainCheckers */
326
327 PKIX_CHECK(PKIX_ProcessingParams_GetCertStores
328 (procParams, &certStores, plContext),
329 PKIX_PROCESSINGPARAMSGETCERTSTORESFAILED);
330
331 PKIX_TOSTRING(certStores, &certStoresString, plContext,
332 PKIX_LISTTOSTRINGFAILED);
333
334 PKIX_TOSTRING(procParams->resourceLimits,
335 &resourceLimitsString,
336 plContext,
337 PKIX_OBJECTTOSTRINGFAILED);
338
339 PKIX_CHECK(PKIX_PL_Sprintf
340 (&procParamsString,
341 plContext,
342 formatString,
343 anchorsString,
344 dateString,
345 constraintsString,
346 InitialPoliciesString,
347 qualsRejectedString,
348 certStoresString,
349 resourceLimitsString,
350 procParams->isCrlRevocationCheckingEnabled,
351 procParams->isCrlRevocationCheckingEnabledWithNISTPolicy),
352 PKIX_SPRINTFFAILED);
353
354 *pString = procParamsString;
355
356 cleanup:
357
358 PKIX_DECREF(formatString);
359 PKIX_DECREF(anchorsString);
360 PKIX_DECREF(dateString);
361 PKIX_DECREF(constraintsString);
362 PKIX_DECREF(InitialPoliciesString);
363 PKIX_DECREF(qualsRejectedString);
364 PKIX_DECREF(certStores);
365 PKIX_DECREF(certStoresString);
366 PKIX_DECREF(resourceLimitsString);
367
368 PKIX_RETURN(PROCESSINGPARAMS);
369 }
370
371 /*
372 * FUNCTION: pkix_ProcessingParams_Duplicate
373 * (see comments for PKIX_PL_DuplicateCallback in pkix_pl_system.h)
374 */
375 static PKIX_Error *
pkix_ProcessingParams_Duplicate(PKIX_PL_Object * object,PKIX_PL_Object ** pNewObject,void * plContext)376 pkix_ProcessingParams_Duplicate(
377 PKIX_PL_Object *object,
378 PKIX_PL_Object **pNewObject,
379 void *plContext)
380 {
381 PKIX_ProcessingParams *params = NULL;
382 PKIX_ProcessingParams *paramsDuplicate = NULL;
383
384 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_Duplicate");
385 PKIX_NULLCHECK_TWO(object, pNewObject);
386
387 PKIX_CHECK(pkix_CheckType
388 (object, PKIX_PROCESSINGPARAMS_TYPE, plContext),
389 PKIX_OBJECTNOTPROCESSINGPARAMS);
390
391 params = (PKIX_ProcessingParams *)object;
392
393 PKIX_CHECK(PKIX_PL_Object_Alloc
394 (PKIX_PROCESSINGPARAMS_TYPE,
395 sizeof (PKIX_ProcessingParams),
396 (PKIX_PL_Object **)¶msDuplicate,
397 plContext),
398 PKIX_PROCESSINGPARAMSCREATEFAILED);
399
400 /* initialize fields */
401 PKIX_DUPLICATE
402 (params->trustAnchors,
403 &(paramsDuplicate->trustAnchors),
404 plContext,
405 PKIX_OBJECTDUPLICATEFAILED);
406
407 PKIX_DUPLICATE
408 (params->hintCerts, &(paramsDuplicate->hintCerts), plContext,
409 PKIX_OBJECTDUPLICATEFAILED);
410
411 PKIX_DUPLICATE
412 (params->constraints,
413 &(paramsDuplicate->constraints),
414 plContext,
415 PKIX_OBJECTDUPLICATEFAILED);
416
417 PKIX_DUPLICATE
418 (params->date, &(paramsDuplicate->date), plContext,
419 PKIX_OBJECTDUPLICATEFAILED);
420
421 PKIX_DUPLICATE
422 (params->initialPolicies,
423 &(paramsDuplicate->initialPolicies),
424 plContext,
425 PKIX_OBJECTDUPLICATEFAILED);
426
427 paramsDuplicate->initialPolicyMappingInhibit =
428 params->initialPolicyMappingInhibit;
429 paramsDuplicate->initialAnyPolicyInhibit =
430 params->initialAnyPolicyInhibit;
431 paramsDuplicate->initialExplicitPolicy = params->initialExplicitPolicy;
432 paramsDuplicate->qualifiersRejected = params->qualifiersRejected;
433
434 PKIX_DUPLICATE
435 (params->certChainCheckers,
436 &(paramsDuplicate->certChainCheckers),
437 plContext,
438 PKIX_OBJECTDUPLICATEFAILED);
439
440 PKIX_DUPLICATE
441 (params->revChecker,
442 &(paramsDuplicate->revChecker),
443 plContext,
444 PKIX_OBJECTDUPLICATEFAILED);
445
446 PKIX_DUPLICATE
447 (params->certStores, &(paramsDuplicate->certStores), plContext,
448 PKIX_OBJECTDUPLICATEFAILED);
449
450 PKIX_DUPLICATE
451 (params->resourceLimits,
452 &(paramsDuplicate->resourceLimits),
453 plContext,
454 PKIX_OBJECTDUPLICATEFAILED);
455
456 paramsDuplicate->isCrlRevocationCheckingEnabled =
457 params->isCrlRevocationCheckingEnabled;
458
459 paramsDuplicate->isCrlRevocationCheckingEnabledWithNISTPolicy =
460 params->isCrlRevocationCheckingEnabledWithNISTPolicy;
461
462 *pNewObject = (PKIX_PL_Object *)paramsDuplicate;
463
464 cleanup:
465
466 if (PKIX_ERROR_RECEIVED){
467 PKIX_DECREF(paramsDuplicate);
468 }
469
470 PKIX_RETURN(PROCESSINGPARAMS);
471
472 }
473
474 /*
475 * FUNCTION: pkix_ProcessingParams_RegisterSelf
476 * DESCRIPTION:
477 * Registers PKIX_PROCESSINGPARAMS_TYPE and its related functions with
478 * systemClasses[]
479 * THREAD SAFETY:
480 * Not Thread Safe - for performance and complexity reasons
481 *
482 * Since this function is only called by PKIX_PL_Initialize, which should
483 * only be called once, it is acceptable that this function is not
484 * thread-safe.
485 */
486 PKIX_Error *
pkix_ProcessingParams_RegisterSelf(void * plContext)487 pkix_ProcessingParams_RegisterSelf(void *plContext)
488 {
489 extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES];
490 pkix_ClassTable_Entry entry;
491
492 PKIX_ENTER(PROCESSINGPARAMS, "pkix_ProcessingParams_RegisterSelf");
493
494 entry.description = "ProcessingParams";
495 entry.objCounter = 0;
496 entry.typeObjectSize = sizeof(PKIX_ProcessingParams);
497 entry.destructor = pkix_ProcessingParams_Destroy;
498 entry.equalsFunction = pkix_ProcessingParams_Equals;
499 entry.hashcodeFunction = pkix_ProcessingParams_Hashcode;
500 entry.toStringFunction = pkix_ProcessingParams_ToString;
501 entry.comparator = NULL;
502 entry.duplicateFunction = pkix_ProcessingParams_Duplicate;
503
504 systemClasses[PKIX_PROCESSINGPARAMS_TYPE] = entry;
505
506 PKIX_RETURN(PROCESSINGPARAMS);
507 }
508
509 /* --Public-Functions--------------------------------------------- */
510
511 /*
512 * FUNCTION: PKIX_ProcessingParams_Create (see comments in pkix_params.h)
513 */
514 PKIX_Error *
PKIX_ProcessingParams_Create(PKIX_ProcessingParams ** pParams,void * plContext)515 PKIX_ProcessingParams_Create(
516 PKIX_ProcessingParams **pParams,
517 void *plContext)
518 {
519 PKIX_ProcessingParams *params = NULL;
520
521 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_Create");
522 PKIX_NULLCHECK_ONE(pParams);
523
524 PKIX_CHECK(PKIX_PL_Object_Alloc
525 (PKIX_PROCESSINGPARAMS_TYPE,
526 sizeof (PKIX_ProcessingParams),
527 (PKIX_PL_Object **)¶ms,
528 plContext),
529 PKIX_COULDNOTCREATEPROCESSINGPARAMSOBJECT);
530
531 /* initialize fields */
532 PKIX_CHECK(PKIX_List_Create(¶ms->trustAnchors, plContext),
533 PKIX_LISTCREATEFAILED);
534 PKIX_CHECK(PKIX_List_SetImmutable(params->trustAnchors, plContext),
535 PKIX_LISTSETIMMUTABLEFAILED);
536
537 PKIX_CHECK(PKIX_PL_Date_Create_UTCTime
538 (NULL, ¶ms->date, plContext),
539 PKIX_DATECREATEUTCTIMEFAILED);
540
541 params->hintCerts = NULL;
542 params->constraints = NULL;
543 params->initialPolicies = NULL;
544 params->initialPolicyMappingInhibit = PKIX_FALSE;
545 params->initialAnyPolicyInhibit = PKIX_FALSE;
546 params->initialExplicitPolicy = PKIX_FALSE;
547 params->qualifiersRejected = PKIX_FALSE;
548 params->certChainCheckers = NULL;
549 params->revChecker = NULL;
550 params->certStores = NULL;
551 params->resourceLimits = NULL;
552
553 params->isCrlRevocationCheckingEnabled = PKIX_TRUE;
554
555 params->isCrlRevocationCheckingEnabledWithNISTPolicy = PKIX_TRUE;
556
557 params->useAIAForCertFetching = PKIX_FALSE;
558 params->qualifyTargetCert = PKIX_TRUE;
559 params->useOnlyTrustAnchors = PKIX_TRUE;
560
561 *pParams = params;
562 params = NULL;
563
564 cleanup:
565
566 PKIX_DECREF(params);
567
568 PKIX_RETURN(PROCESSINGPARAMS);
569
570 }
571
572 /*
573 * FUNCTION: PKIX_ProcessingParams_GetUseAIAForCertFetching
574 * (see comments in pkix_params.h)
575 */
576 PKIX_Error *
PKIX_ProcessingParams_GetUseAIAForCertFetching(PKIX_ProcessingParams * params,PKIX_Boolean * pUseAIA,void * plContext)577 PKIX_ProcessingParams_GetUseAIAForCertFetching(
578 PKIX_ProcessingParams *params,
579 PKIX_Boolean *pUseAIA, /* list of TrustAnchor */
580 void *plContext)
581 {
582 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_GetUseAIAForCertFetching");
583 PKIX_NULLCHECK_TWO(params, pUseAIA);
584
585 *pUseAIA = params->useAIAForCertFetching;
586
587 PKIX_RETURN(PROCESSINGPARAMS);
588 }
589
590 /*
591 * FUNCTION: PKIX_ProcessingParams_SetUseAIAForCertFetching
592 * (see comments in pkix_params.h)
593 */
594 PKIX_Error *
PKIX_ProcessingParams_SetUseAIAForCertFetching(PKIX_ProcessingParams * params,PKIX_Boolean useAIA,void * plContext)595 PKIX_ProcessingParams_SetUseAIAForCertFetching(
596 PKIX_ProcessingParams *params,
597 PKIX_Boolean useAIA,
598 void *plContext)
599 {
600 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_SetUseAIAForCertFetching");
601 PKIX_NULLCHECK_ONE(params);
602
603 params->useAIAForCertFetching = useAIA;
604
605 PKIX_RETURN(PROCESSINGPARAMS);
606 }
607
608 /*
609 * FUNCTION: PKIX_ProcessingParams_GetQualifyTargetCert
610 * (see comments in pkix_params.h)
611 */
612 PKIX_Error *
PKIX_ProcessingParams_GetValidateTargetCert(PKIX_ProcessingParams * params,PKIX_Boolean * pQualifyTargetCert,void * plContext)613 PKIX_ProcessingParams_GetValidateTargetCert(
614 PKIX_ProcessingParams *params,
615 PKIX_Boolean *pQualifyTargetCert,
616 void *plContext)
617 {
618 PKIX_ENTER(PROCESSINGPARAMS,
619 "PKIX_ProcessingParams_GetValidateTargetCert");
620 PKIX_NULLCHECK_TWO(params, pQualifyTargetCert);
621
622 *pQualifyTargetCert = params->qualifyTargetCert;
623
624 PKIX_RETURN(PROCESSINGPARAMS);
625 }
626
627 /*
628 * FUNCTION: PKIX_ProcessingParams_SetQualifyTargetCert
629 * (see comments in pkix_params.h)
630 */
631 PKIX_Error *
PKIX_ProcessingParams_SetQualifyTargetCert(PKIX_ProcessingParams * params,PKIX_Boolean qualifyTargetCert,void * plContext)632 PKIX_ProcessingParams_SetQualifyTargetCert(
633 PKIX_ProcessingParams *params,
634 PKIX_Boolean qualifyTargetCert,
635 void *plContext)
636 {
637 PKIX_ENTER(PROCESSINGPARAMS,
638 "PKIX_ProcessingParams_SetQualifyTargetCert");
639 PKIX_NULLCHECK_ONE(params);
640
641 params->qualifyTargetCert = qualifyTargetCert;
642
643 PKIX_RETURN(PROCESSINGPARAMS);
644 }
645
646 /*
647 * FUNCTION: PKIX_ProcessingParams_SetTrustAnchors
648 * (see comments in pkix_params.h)
649 */
650 PKIX_Error *
PKIX_ProcessingParams_SetTrustAnchors(PKIX_ProcessingParams * params,PKIX_List * anchors,void * plContext)651 PKIX_ProcessingParams_SetTrustAnchors(
652 PKIX_ProcessingParams *params,
653 PKIX_List *anchors, /* list of TrustAnchor */
654 void *plContext)
655 {
656 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_SetTrustAnchors");
657 PKIX_NULLCHECK_TWO(params, anchors);
658
659 PKIX_DECREF(params->trustAnchors);
660
661 PKIX_INCREF(anchors);
662 params->trustAnchors = anchors;
663 PKIX_CHECK(PKIX_List_SetImmutable(params->trustAnchors, plContext),
664 PKIX_LISTSETIMMUTABLEFAILED);
665
666 cleanup:
667 PKIX_RETURN(PROCESSINGPARAMS);
668 }
669
670 /*
671 * FUNCTION: PKIX_ProcessingParams_GetTrustAnchors
672 * (see comments in pkix_params.h)
673 */
674 PKIX_Error *
PKIX_ProcessingParams_GetTrustAnchors(PKIX_ProcessingParams * params,PKIX_List ** pAnchors,void * plContext)675 PKIX_ProcessingParams_GetTrustAnchors(
676 PKIX_ProcessingParams *params,
677 PKIX_List **pAnchors, /* list of TrustAnchor */
678 void *plContext)
679 {
680 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_GetTrustAnchors");
681 PKIX_NULLCHECK_TWO(params, pAnchors);
682
683 PKIX_INCREF(params->trustAnchors);
684
685 *pAnchors = params->trustAnchors;
686
687 cleanup:
688 PKIX_RETURN(PROCESSINGPARAMS);
689 }
690
691 /**
692 * FUNCTION: PKIX_ProcessingParams_SetUseOnlyTrustAnchors
693 * (see comments in pkix_params.h)
694 */
695 PKIX_Error *
PKIX_ProcessingParams_GetUseOnlyTrustAnchors(PKIX_ProcessingParams * params,PKIX_Boolean * pUseOnlyTrustAnchors,void * plContext)696 PKIX_ProcessingParams_GetUseOnlyTrustAnchors(
697 PKIX_ProcessingParams *params,
698 PKIX_Boolean *pUseOnlyTrustAnchors,
699 void *plContext)
700 {
701 PKIX_ENTER(PROCESSINGPARAMS,
702 "PKIX_ProcessingParams_SetUseTrustAnchorsOnly");
703 PKIX_NULLCHECK_TWO(params, pUseOnlyTrustAnchors);
704
705 *pUseOnlyTrustAnchors = params->useOnlyTrustAnchors;
706
707 PKIX_RETURN(PROCESSINGPARAMS);
708 }
709
710 /**
711 * FUNCTION: PKIX_ProcessingParams_SetUseOnlyTrustAnchors
712 * (see comments in pkix_params.h)
713 */
714 PKIX_Error *
PKIX_ProcessingParams_SetUseOnlyTrustAnchors(PKIX_ProcessingParams * params,PKIX_Boolean useOnlyTrustAnchors,void * plContext)715 PKIX_ProcessingParams_SetUseOnlyTrustAnchors(
716 PKIX_ProcessingParams *params,
717 PKIX_Boolean useOnlyTrustAnchors,
718 void *plContext)
719 {
720 PKIX_ENTER(PROCESSINGPARAMS,
721 "PKIX_ProcessingParams_SetUseTrustAnchorsOnly");
722 PKIX_NULLCHECK_ONE(params);
723
724 params->useOnlyTrustAnchors = useOnlyTrustAnchors;
725
726 PKIX_RETURN(PROCESSINGPARAMS);
727 }
728
729 /*
730 * FUNCTION: PKIX_ProcessingParams_GetDate (see comments in pkix_params.h)
731 */
732 PKIX_Error *
PKIX_ProcessingParams_GetDate(PKIX_ProcessingParams * params,PKIX_PL_Date ** pDate,void * plContext)733 PKIX_ProcessingParams_GetDate(
734 PKIX_ProcessingParams *params,
735 PKIX_PL_Date **pDate,
736 void *plContext)
737 {
738 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_GetDate");
739 PKIX_NULLCHECK_TWO(params, pDate);
740
741 PKIX_INCREF(params->date);
742 *pDate = params->date;
743
744 cleanup:
745 PKIX_RETURN(PROCESSINGPARAMS);
746 }
747
748 /*
749 * FUNCTION: PKIX_ProcessingParams_SetDate (see comments in pkix_params.h)
750 */
751 PKIX_Error *
PKIX_ProcessingParams_SetDate(PKIX_ProcessingParams * params,PKIX_PL_Date * date,void * plContext)752 PKIX_ProcessingParams_SetDate(
753 PKIX_ProcessingParams *params,
754 PKIX_PL_Date *date,
755 void *plContext)
756 {
757 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_SetDate");
758 PKIX_NULLCHECK_ONE(params);
759
760 PKIX_DECREF(params->date);
761
762 PKIX_INCREF(date);
763 params->date = date;
764
765 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
766 ((PKIX_PL_Object *)params, plContext),
767 PKIX_OBJECTINVALIDATECACHEFAILED);
768
769 cleanup:
770
771 if (PKIX_ERROR_RECEIVED && params) {
772 PKIX_DECREF(params->date);
773 }
774
775 PKIX_RETURN(PROCESSINGPARAMS);
776 }
777
778 /*
779 * FUNCTION: PKIX_ProcessingParams_GetTargetCertConstraints
780 * (see comments in pkix_params.h)
781 */
782 PKIX_Error *
PKIX_ProcessingParams_GetTargetCertConstraints(PKIX_ProcessingParams * params,PKIX_CertSelector ** pConstraints,void * plContext)783 PKIX_ProcessingParams_GetTargetCertConstraints(
784 PKIX_ProcessingParams *params,
785 PKIX_CertSelector **pConstraints,
786 void *plContext)
787 {
788 PKIX_ENTER(PROCESSINGPARAMS,
789 "PKIX_ProcessingParams_GetTargetCertConstraints");
790
791 PKIX_NULLCHECK_TWO(params, pConstraints);
792
793 PKIX_INCREF(params->constraints);
794 *pConstraints = params->constraints;
795
796 cleanup:
797 PKIX_RETURN(PROCESSINGPARAMS);
798 }
799
800 /*
801 * FUNCTION: PKIX_ProcessingParams_SetTargetCertConstraints
802 * (see comments in pkix_params.h)
803 */
804 PKIX_Error *
PKIX_ProcessingParams_SetTargetCertConstraints(PKIX_ProcessingParams * params,PKIX_CertSelector * constraints,void * plContext)805 PKIX_ProcessingParams_SetTargetCertConstraints(
806 PKIX_ProcessingParams *params,
807 PKIX_CertSelector *constraints,
808 void *plContext)
809 {
810
811 PKIX_ENTER(PROCESSINGPARAMS,
812 "PKIX_ProcessingParams_SetTargetCertConstraints");
813
814 PKIX_NULLCHECK_ONE(params);
815
816 PKIX_DECREF(params->constraints);
817
818 PKIX_INCREF(constraints);
819 params->constraints = constraints;
820
821 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
822 ((PKIX_PL_Object *)params, plContext),
823 PKIX_OBJECTINVALIDATECACHEFAILED);
824
825 cleanup:
826 if (PKIX_ERROR_RECEIVED && params) {
827 PKIX_DECREF(params->constraints);
828 }
829
830 PKIX_RETURN(PROCESSINGPARAMS);
831 }
832
833 /*
834 * FUNCTION: PKIX_ProcessingParams_GetInitialPolicies
835 * (see comments in pkix_params.h)
836 */
837 PKIX_Error *
PKIX_ProcessingParams_GetInitialPolicies(PKIX_ProcessingParams * params,PKIX_List ** pInitPolicies,void * plContext)838 PKIX_ProcessingParams_GetInitialPolicies(
839 PKIX_ProcessingParams *params,
840 PKIX_List **pInitPolicies, /* list of PKIX_PL_OID */
841 void *plContext)
842 {
843
844 PKIX_ENTER(PROCESSINGPARAMS,
845 "PKIX_ProcessingParams_GetInitialPolicies");
846
847 PKIX_NULLCHECK_TWO(params, pInitPolicies);
848
849 if (params->initialPolicies == NULL) {
850 PKIX_CHECK(PKIX_List_Create
851 (¶ms->initialPolicies, plContext),
852 PKIX_UNABLETOCREATELIST);
853 PKIX_CHECK(PKIX_List_SetImmutable
854 (params->initialPolicies, plContext),
855 PKIX_UNABLETOMAKELISTIMMUTABLE);
856 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
857 ((PKIX_PL_Object *)params, plContext),
858 PKIX_OBJECTINVALIDATECACHEFAILED);
859 }
860
861 PKIX_INCREF(params->initialPolicies);
862 *pInitPolicies = params->initialPolicies;
863
864 cleanup:
865
866 PKIX_RETURN(PROCESSINGPARAMS);
867 }
868
869 /*
870 * FUNCTION: PKIX_ProcessingParams_SetInitialPolicies
871 * (see comments in pkix_params.h)
872 */
873 PKIX_Error *
PKIX_ProcessingParams_SetInitialPolicies(PKIX_ProcessingParams * params,PKIX_List * initPolicies,void * plContext)874 PKIX_ProcessingParams_SetInitialPolicies(
875 PKIX_ProcessingParams *params,
876 PKIX_List *initPolicies, /* list of PKIX_PL_OID */
877 void *plContext)
878 {
879 PKIX_ENTER(PROCESSINGPARAMS,
880 "PKIX_ProcessingParams_SetInitialPolicies");
881 PKIX_NULLCHECK_ONE(params);
882
883 PKIX_DECREF(params->initialPolicies);
884
885 PKIX_INCREF(initPolicies);
886 params->initialPolicies = initPolicies;
887
888 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
889 ((PKIX_PL_Object *)params, plContext),
890 PKIX_OBJECTINVALIDATECACHEFAILED);
891
892 cleanup:
893
894 if (PKIX_ERROR_RECEIVED && params) {
895 PKIX_DECREF(params->initialPolicies);
896 }
897 PKIX_RETURN(PROCESSINGPARAMS);
898 }
899
900 /*
901 * FUNCTION: PKIX_ProcessingParams_GetPolicyQualifiersRejected
902 * (see comments in pkix_params.h)
903 */
904 PKIX_Error *
PKIX_ProcessingParams_GetPolicyQualifiersRejected(PKIX_ProcessingParams * params,PKIX_Boolean * pRejected,void * plContext)905 PKIX_ProcessingParams_GetPolicyQualifiersRejected(
906 PKIX_ProcessingParams *params,
907 PKIX_Boolean *pRejected,
908 void *plContext)
909 {
910 PKIX_ENTER(PROCESSINGPARAMS,
911 "PKIX_ProcessingParams_GetPolicyQualifiersRejected");
912
913 PKIX_NULLCHECK_TWO(params, pRejected);
914
915 *pRejected = params->qualifiersRejected;
916
917 PKIX_RETURN(PROCESSINGPARAMS);
918 }
919
920 /*
921 * FUNCTION: PKIX_ProcessingParams_SetPolicyQualifiersRejected
922 * (see comments in pkix_params.h)
923 */
924 PKIX_Error *
PKIX_ProcessingParams_SetPolicyQualifiersRejected(PKIX_ProcessingParams * params,PKIX_Boolean rejected,void * plContext)925 PKIX_ProcessingParams_SetPolicyQualifiersRejected(
926 PKIX_ProcessingParams *params,
927 PKIX_Boolean rejected,
928 void *plContext)
929 {
930 PKIX_ENTER(PROCESSINGPARAMS,
931 "PKIX_ProcessingParams_SetPolicyQualifiersRejected");
932
933 PKIX_NULLCHECK_ONE(params);
934
935 params->qualifiersRejected = rejected;
936
937 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
938 ((PKIX_PL_Object *)params, plContext),
939 PKIX_OBJECTINVALIDATECACHEFAILED);
940
941 cleanup:
942
943 PKIX_RETURN(PROCESSINGPARAMS);
944 }
945
946 /*
947 * FUNCTION: PKIX_ProcessingParams_GetCertChainCheckers
948 * (see comments in pkix_params.h)
949 */
950 PKIX_Error *
PKIX_ProcessingParams_GetCertChainCheckers(PKIX_ProcessingParams * params,PKIX_List ** pCheckers,void * plContext)951 PKIX_ProcessingParams_GetCertChainCheckers(
952 PKIX_ProcessingParams *params,
953 PKIX_List **pCheckers, /* list of PKIX_CertChainChecker */
954 void *plContext)
955 {
956 PKIX_ENTER(PROCESSINGPARAMS,
957 "PKIX_ProcessingParams_GetCertChainCheckers");
958 PKIX_NULLCHECK_TWO(params, pCheckers);
959
960 PKIX_INCREF(params->certChainCheckers);
961 *pCheckers = params->certChainCheckers;
962
963 cleanup:
964 PKIX_RETURN(PROCESSINGPARAMS);
965 }
966
967 /*
968 * FUNCTION: PKIX_ProcessingParams_SetCertChainCheckers
969 * (see comments in pkix_params.h)
970 */
971 PKIX_Error *
PKIX_ProcessingParams_SetCertChainCheckers(PKIX_ProcessingParams * params,PKIX_List * checkers,void * plContext)972 PKIX_ProcessingParams_SetCertChainCheckers(
973 PKIX_ProcessingParams *params,
974 PKIX_List *checkers, /* list of PKIX_CertChainChecker */
975 void *plContext)
976 {
977
978 PKIX_ENTER(PROCESSINGPARAMS,
979 "PKIX_ProcessingParams_SetCertChainCheckers");
980 PKIX_NULLCHECK_ONE(params);
981
982 PKIX_DECREF(params->certChainCheckers);
983
984 PKIX_INCREF(checkers);
985 params->certChainCheckers = checkers;
986
987 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
988 ((PKIX_PL_Object *)params, plContext),
989 PKIX_OBJECTINVALIDATECACHEFAILED);
990
991 cleanup:
992
993 if (PKIX_ERROR_RECEIVED && params) {
994 PKIX_DECREF(params->certChainCheckers);
995 }
996
997 PKIX_RETURN(PROCESSINGPARAMS);
998 }
999
1000 /*
1001 * FUNCTION: PKIX_ProcessingParams_AddCertChainCheckers
1002 * (see comments in pkix_params.h)
1003 */
1004 PKIX_Error *
PKIX_ProcessingParams_AddCertChainChecker(PKIX_ProcessingParams * params,PKIX_CertChainChecker * checker,void * plContext)1005 PKIX_ProcessingParams_AddCertChainChecker(
1006 PKIX_ProcessingParams *params,
1007 PKIX_CertChainChecker *checker,
1008 void *plContext)
1009 {
1010 PKIX_List *list = NULL;
1011
1012 PKIX_ENTER(PROCESSINGPARAMS,
1013 "PKIX_ProcessingParams_AddCertChainChecker");
1014 PKIX_NULLCHECK_TWO(params, checker);
1015
1016 if (params->certChainCheckers == NULL) {
1017
1018 PKIX_CHECK(PKIX_List_Create(&list, plContext),
1019 PKIX_LISTCREATEFAILED);
1020
1021 params->certChainCheckers = list;
1022 }
1023
1024 PKIX_CHECK(PKIX_List_AppendItem
1025 (params->certChainCheckers, (PKIX_PL_Object *)checker, plContext),
1026 PKIX_LISTAPPENDITEMFAILED);
1027
1028 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1029 ((PKIX_PL_Object *)params, plContext),
1030 PKIX_OBJECTINVALIDATECACHEFAILED);
1031
1032 list = NULL;
1033
1034 cleanup:
1035
1036 if (list && params) {
1037 PKIX_DECREF(params->certChainCheckers);
1038 }
1039
1040 PKIX_RETURN(PROCESSINGPARAMS);
1041 }
1042
1043 /*
1044 * FUNCTION: PKIX_ProcessingParams_GetRevocationChecker
1045 * (see comments in pkix_params.h)
1046 */
1047 PKIX_Error *
PKIX_ProcessingParams_GetRevocationChecker(PKIX_ProcessingParams * params,PKIX_RevocationChecker ** pChecker,void * plContext)1048 PKIX_ProcessingParams_GetRevocationChecker(
1049 PKIX_ProcessingParams *params,
1050 PKIX_RevocationChecker **pChecker,
1051 void *plContext)
1052 {
1053
1054 PKIX_ENTER
1055 (PROCESSINGPARAMS, "PKIX_ProcessingParams_GetRevocationCheckers");
1056 PKIX_NULLCHECK_TWO(params, pChecker);
1057
1058 PKIX_INCREF(params->revChecker);
1059 *pChecker = params->revChecker;
1060
1061 cleanup:
1062
1063 PKIX_RETURN(PROCESSINGPARAMS);
1064 }
1065
1066 /*
1067 * FUNCTION: PKIX_ProcessingParams_SetRevocationChecker
1068 * (see comments in pkix_params.h)
1069 */
1070 PKIX_Error *
PKIX_ProcessingParams_SetRevocationChecker(PKIX_ProcessingParams * params,PKIX_RevocationChecker * checker,void * plContext)1071 PKIX_ProcessingParams_SetRevocationChecker(
1072 PKIX_ProcessingParams *params,
1073 PKIX_RevocationChecker *checker,
1074 void *plContext)
1075 {
1076
1077 PKIX_ENTER(PROCESSINGPARAMS,
1078 "PKIX_ProcessingParams_InitRevocationChecker");
1079 PKIX_NULLCHECK_ONE(params);
1080
1081 PKIX_DECREF(params->revChecker);
1082 PKIX_INCREF(checker);
1083 params->revChecker = checker;
1084
1085 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1086 ((PKIX_PL_Object *)params, plContext),
1087 PKIX_OBJECTINVALIDATECACHEFAILED);
1088 cleanup:
1089
1090 PKIX_RETURN(PROCESSINGPARAMS);
1091 }
1092
1093 /*
1094 * FUNCTION: PKIX_ProcessingParams_GetCertStores
1095 * (see comments in pkix_params.h)
1096 */
1097 PKIX_Error *
PKIX_ProcessingParams_GetCertStores(PKIX_ProcessingParams * params,PKIX_List ** pStores,void * plContext)1098 PKIX_ProcessingParams_GetCertStores(
1099 PKIX_ProcessingParams *params,
1100 PKIX_List **pStores, /* list of PKIX_CertStore */
1101 void *plContext)
1102 {
1103 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_GetCertStores");
1104
1105 PKIX_NULLCHECK_TWO(params, pStores);
1106
1107 if (!params->certStores){
1108 PKIX_CHECK(PKIX_List_Create(¶ms->certStores, plContext),
1109 PKIX_UNABLETOCREATELIST);
1110 }
1111
1112 PKIX_INCREF(params->certStores);
1113 *pStores = params->certStores;
1114
1115 cleanup:
1116
1117 PKIX_RETURN(PROCESSINGPARAMS);
1118 }
1119
1120 /*
1121 * FUNCTION: PKIX_ProcessingParams_SetCertStores
1122 * (see comments in pkix_params.h)
1123 */
1124 PKIX_Error *
PKIX_ProcessingParams_SetCertStores(PKIX_ProcessingParams * params,PKIX_List * stores,void * plContext)1125 PKIX_ProcessingParams_SetCertStores(
1126 PKIX_ProcessingParams *params,
1127 PKIX_List *stores, /* list of PKIX_CertStore */
1128 void *plContext)
1129 {
1130 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_SetCertStores");
1131
1132 PKIX_NULLCHECK_ONE(params);
1133
1134 PKIX_DECREF(params->certStores);
1135
1136 PKIX_INCREF(stores);
1137 params->certStores = stores;
1138
1139 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1140 ((PKIX_PL_Object *)params, plContext),
1141 PKIX_OBJECTINVALIDATECACHEFAILED);
1142
1143 cleanup:
1144
1145 if (PKIX_ERROR_RECEIVED && params) {
1146 PKIX_DECREF(params->certStores);
1147 }
1148
1149 PKIX_RETURN(PROCESSINGPARAMS);
1150 }
1151
1152 /*
1153 * FUNCTION: PKIX_ProcessingParams_AddCertStore
1154 * (see comments in pkix_params.h)
1155 */
1156 PKIX_Error *
PKIX_ProcessingParams_AddCertStore(PKIX_ProcessingParams * params,PKIX_CertStore * store,void * plContext)1157 PKIX_ProcessingParams_AddCertStore(
1158 PKIX_ProcessingParams *params,
1159 PKIX_CertStore *store,
1160 void *plContext)
1161 {
1162 PKIX_List *certStores = NULL;
1163
1164 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_AddCertStore");
1165 PKIX_NULLCHECK_TWO(params, store);
1166
1167 PKIX_CHECK(PKIX_ProcessingParams_GetCertStores
1168 (params, &certStores, plContext),
1169 PKIX_PROCESSINGPARAMSGETCERTSTORESFAILED);
1170
1171 PKIX_CHECK(PKIX_List_AppendItem
1172 (certStores, (PKIX_PL_Object *)store, plContext),
1173 PKIX_LISTAPPENDITEMFAILED);
1174
1175 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1176 ((PKIX_PL_Object *)params, plContext),
1177 PKIX_OBJECTINVALIDATECACHEFAILED);
1178
1179 cleanup:
1180
1181 PKIX_DECREF(certStores);
1182 PKIX_RETURN(PROCESSINGPARAMS);
1183 }
1184
1185 /*
1186 * FUNCTION: PKIX_ProcessingParams_SetResourceLimits
1187 * (see comments in pkix_params.h)
1188 */
1189 PKIX_Error *
PKIX_ProcessingParams_SetResourceLimits(PKIX_ProcessingParams * params,PKIX_ResourceLimits * resourceLimits,void * plContext)1190 PKIX_ProcessingParams_SetResourceLimits(
1191 PKIX_ProcessingParams *params,
1192 PKIX_ResourceLimits *resourceLimits,
1193 void *plContext)
1194 {
1195 PKIX_ENTER(PROCESSINGPARAMS,
1196 "PKIX_ProcessingParams_SetResourceLimits");
1197
1198 PKIX_NULLCHECK_TWO(params, resourceLimits);
1199
1200 PKIX_DECREF(params->resourceLimits);
1201 PKIX_INCREF(resourceLimits);
1202 params->resourceLimits = resourceLimits;
1203
1204 cleanup:
1205 if (PKIX_ERROR_RECEIVED && params) {
1206 PKIX_DECREF(params->resourceLimits);
1207 }
1208
1209 PKIX_RETURN(PROCESSINGPARAMS);
1210 }
1211
1212 /*
1213 * FUNCTION: PKIX_ProcessingParams_GetResourceLimits
1214 * (see comments in pkix_params.h)
1215 */
1216 PKIX_Error *
PKIX_ProcessingParams_GetResourceLimits(PKIX_ProcessingParams * params,PKIX_ResourceLimits ** pResourceLimits,void * plContext)1217 PKIX_ProcessingParams_GetResourceLimits(
1218 PKIX_ProcessingParams *params,
1219 PKIX_ResourceLimits **pResourceLimits,
1220 void *plContext)
1221 {
1222 PKIX_ENTER(PROCESSINGPARAMS,
1223 "PKIX_ProcessingParams_GetResourceLimits");
1224
1225 PKIX_NULLCHECK_TWO(params, pResourceLimits);
1226
1227 PKIX_INCREF(params->resourceLimits);
1228 *pResourceLimits = params->resourceLimits;
1229
1230 cleanup:
1231 PKIX_RETURN(PROCESSINGPARAMS);
1232 }
1233
1234 /*
1235 * FUNCTION: PKIX_ProcessingParams_IsAnyPolicyInhibited
1236 * (see comments in pkix_params.h)
1237 */
1238 PKIX_Error *
PKIX_ProcessingParams_IsAnyPolicyInhibited(PKIX_ProcessingParams * params,PKIX_Boolean * pInhibited,void * plContext)1239 PKIX_ProcessingParams_IsAnyPolicyInhibited(
1240 PKIX_ProcessingParams *params,
1241 PKIX_Boolean *pInhibited,
1242 void *plContext)
1243 {
1244 PKIX_ENTER(PROCESSINGPARAMS,
1245 "PKIX_ProcessingParams_IsAnyPolicyInhibited");
1246
1247 PKIX_NULLCHECK_TWO(params, pInhibited);
1248
1249 *pInhibited = params->initialAnyPolicyInhibit;
1250
1251 PKIX_RETURN(PROCESSINGPARAMS);
1252 }
1253
1254 /*
1255 * FUNCTION: PKIX_ProcessingParams_SetAnyPolicyInhibited
1256 * (see comments in pkix_params.h)
1257 */
1258 PKIX_Error *
PKIX_ProcessingParams_SetAnyPolicyInhibited(PKIX_ProcessingParams * params,PKIX_Boolean inhibited,void * plContext)1259 PKIX_ProcessingParams_SetAnyPolicyInhibited(
1260 PKIX_ProcessingParams *params,
1261 PKIX_Boolean inhibited,
1262 void *plContext)
1263 {
1264 PKIX_ENTER(PROCESSINGPARAMS,
1265 "PKIX_ProcessingParams_SetAnyPolicyInhibited");
1266
1267 PKIX_NULLCHECK_ONE(params);
1268
1269 params->initialAnyPolicyInhibit = inhibited;
1270
1271 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1272 ((PKIX_PL_Object *)params, plContext),
1273 PKIX_OBJECTINVALIDATECACHEFAILED);
1274
1275 cleanup:
1276
1277 PKIX_RETURN(PROCESSINGPARAMS);
1278 }
1279
1280 /*
1281 * FUNCTION: PKIX_ProcessingParams_IsExplicitPolicyRequired
1282 * (see comments in pkix_params.h)
1283 */
1284 PKIX_Error *
PKIX_ProcessingParams_IsExplicitPolicyRequired(PKIX_ProcessingParams * params,PKIX_Boolean * pRequired,void * plContext)1285 PKIX_ProcessingParams_IsExplicitPolicyRequired(
1286 PKIX_ProcessingParams *params,
1287 PKIX_Boolean *pRequired,
1288 void *plContext)
1289 {
1290 PKIX_ENTER(PROCESSINGPARAMS,
1291 "PKIX_ProcessingParams_IsExplicitPolicyRequired");
1292
1293 PKIX_NULLCHECK_TWO(params, pRequired);
1294
1295 *pRequired = params->initialExplicitPolicy;
1296
1297 PKIX_RETURN(PROCESSINGPARAMS);
1298 }
1299
1300 /*
1301 * FUNCTION: PKIX_ProcessingParams_SetExplicitPolicyRequired
1302 * (see comments in pkix_params.h)
1303 */
1304 PKIX_Error *
PKIX_ProcessingParams_SetExplicitPolicyRequired(PKIX_ProcessingParams * params,PKIX_Boolean required,void * plContext)1305 PKIX_ProcessingParams_SetExplicitPolicyRequired(
1306 PKIX_ProcessingParams *params,
1307 PKIX_Boolean required,
1308 void *plContext)
1309 {
1310 PKIX_ENTER(PROCESSINGPARAMS,
1311 "PKIX_ProcessingParams_SetExplicitPolicyRequired");
1312
1313 PKIX_NULLCHECK_ONE(params);
1314
1315 params->initialExplicitPolicy = required;
1316
1317 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1318 ((PKIX_PL_Object *)params, plContext),
1319 PKIX_OBJECTINVALIDATECACHEFAILED);
1320
1321 cleanup:
1322
1323 PKIX_RETURN(PROCESSINGPARAMS);
1324 }
1325
1326 /*
1327 * FUNCTION: PKIX_ProcessingParams_IsPolicyMappingInhibited
1328 * (see comments in pkix_params.h)
1329 */
1330 PKIX_Error *
PKIX_ProcessingParams_IsPolicyMappingInhibited(PKIX_ProcessingParams * params,PKIX_Boolean * pInhibited,void * plContext)1331 PKIX_ProcessingParams_IsPolicyMappingInhibited(
1332 PKIX_ProcessingParams *params,
1333 PKIX_Boolean *pInhibited,
1334 void *plContext)
1335 {
1336 PKIX_ENTER(PROCESSINGPARAMS,
1337 "PKIX_ProcessingParams_IsPolicyMappingInhibited");
1338
1339 PKIX_NULLCHECK_TWO(params, pInhibited);
1340
1341 *pInhibited = params->initialPolicyMappingInhibit;
1342
1343 PKIX_RETURN(PROCESSINGPARAMS);
1344 }
1345
1346 /*
1347 * FUNCTION: PKIX_ProcessingParams_SetPolicyMappingInhibited
1348 * (see comments in pkix_params.h)
1349 */
1350 PKIX_Error *
PKIX_ProcessingParams_SetPolicyMappingInhibited(PKIX_ProcessingParams * params,PKIX_Boolean inhibited,void * plContext)1351 PKIX_ProcessingParams_SetPolicyMappingInhibited(
1352 PKIX_ProcessingParams *params,
1353 PKIX_Boolean inhibited,
1354 void *plContext)
1355 {
1356 PKIX_ENTER(PROCESSINGPARAMS,
1357 "PKIX_ProcessingParams_SetPolicyMappingInhibited");
1358
1359 PKIX_NULLCHECK_ONE(params);
1360
1361 params->initialPolicyMappingInhibit = inhibited;
1362
1363 PKIX_CHECK(PKIX_PL_Object_InvalidateCache
1364 ((PKIX_PL_Object *)params, plContext),
1365 PKIX_OBJECTINVALIDATECACHEFAILED);
1366
1367 cleanup:
1368
1369 PKIX_RETURN(PROCESSINGPARAMS);
1370 }
1371
1372 /*
1373 * FUNCTION: PKIX_ProcessingParams_SetHintCerts
1374 * (see comments in pkix_params.h)
1375 */
1376 PKIX_Error *
PKIX_ProcessingParams_SetHintCerts(PKIX_ProcessingParams * params,PKIX_List * hintCerts,void * plContext)1377 PKIX_ProcessingParams_SetHintCerts(
1378 PKIX_ProcessingParams *params,
1379 PKIX_List *hintCerts,
1380 void *plContext)
1381 {
1382 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_SetHintCerts");
1383
1384 PKIX_NULLCHECK_ONE(params);
1385
1386 PKIX_DECREF(params->hintCerts);
1387 PKIX_INCREF(hintCerts);
1388 params->hintCerts = hintCerts;
1389
1390 cleanup:
1391 if (PKIX_ERROR_RECEIVED && params) {
1392 PKIX_DECREF(params->hintCerts);
1393 }
1394
1395 PKIX_RETURN(PROCESSINGPARAMS);
1396 }
1397
1398 /*
1399 * FUNCTION: PKIX_ProcessingParams_GetHintCerts
1400 * (see comments in pkix_params.h)
1401 */
1402 PKIX_Error *
PKIX_ProcessingParams_GetHintCerts(PKIX_ProcessingParams * params,PKIX_List ** pHintCerts,void * plContext)1403 PKIX_ProcessingParams_GetHintCerts(
1404 PKIX_ProcessingParams *params,
1405 PKIX_List **pHintCerts,
1406 void *plContext)
1407 {
1408 PKIX_ENTER(PROCESSINGPARAMS, "PKIX_ProcessingParams_GetHintCerts");
1409
1410 PKIX_NULLCHECK_TWO(params, pHintCerts);
1411
1412 PKIX_INCREF(params->hintCerts);
1413 *pHintCerts = params->hintCerts;
1414
1415 cleanup:
1416 PKIX_RETURN(PROCESSINGPARAMS);
1417 }
1418