pkix_comcrlselparams.c (23818B)
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_comcrlselparams.c 6 * 7 * ComCRLSelParams Function Definitions 8 * 9 */ 10 11 #include "pkix_comcrlselparams.h" 12 13 /* --ComCRLSelParams-Private-Functions------------------------------------ */ 14 15 /* 16 * FUNCTION: pkix_ComCrlSelParams_Destroy 17 * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h) 18 */ 19 static PKIX_Error * 20 pkix_ComCRLSelParams_Destroy( 21 PKIX_PL_Object *object, 22 void *plContext) 23 { 24 PKIX_ComCRLSelParams *params = NULL; 25 26 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Destroy"); 27 PKIX_NULLCHECK_ONE(object); 28 29 PKIX_CHECK(pkix_CheckType 30 (object, PKIX_COMCRLSELPARAMS_TYPE, plContext), 31 PKIX_OBJECTNOTCOMCRLSELPARAMS); 32 33 params = (PKIX_ComCRLSelParams *)object; 34 35 PKIX_DECREF(params->issuerNames); 36 PKIX_DECREF(params->cert); 37 PKIX_DECREF(params->date); 38 PKIX_DECREF(params->maxCRLNumber); 39 PKIX_DECREF(params->minCRLNumber); 40 PKIX_DECREF(params->crldpList); 41 42 cleanup: 43 44 PKIX_RETURN(COMCRLSELPARAMS); 45 } 46 47 /* 48 * FUNCTION: pkix_ComCRLSelParams_ToString_Helper 49 * DESCRIPTION: 50 * 51 * Helper function that creates a string representation of ComCRLSelParams 52 * pointed to by "crlParams" and stores the result at "pString". 53 * 54 * PARAMETERS 55 * "crlParams" 56 * Address of ComCRLSelParams whose string representation is desired. 57 * Must be non-NULL. 58 * "pString" 59 * Address of object pointer's destination. Must be non-NULL. 60 * "plContext" - Platform-specific context pointer. 61 * 62 * THREAD SAFETY: 63 * Conditionally Thread Safe 64 * (see Thread Safety Definitions in Programmer's Guide) 65 * 66 * RETURNS: 67 * Returns NULL if the function succeeds. 68 * Returns a CRLEntry Error if the function fails in a non-fatal way. 69 * Returns a Fatal Error if the function fails in an unrecoverable way. 70 */ 71 static PKIX_Error * 72 pkix_ComCRLSelParams_ToString_Helper( 73 PKIX_ComCRLSelParams *crlParams, 74 PKIX_PL_String **pString, 75 void *plContext) 76 { 77 PKIX_PL_String *crlIssuerNamesString = NULL; 78 PKIX_PL_String *crlDateString = NULL; 79 PKIX_PL_String *crlMaxCRLNumberString = NULL; 80 PKIX_PL_String *crlMinCRLNumberString = NULL; 81 PKIX_PL_String *crlCertString = NULL; 82 PKIX_PL_String *crlParamsString = NULL; 83 char *asciiFormat = NULL; 84 PKIX_PL_String *formatString = NULL; 85 86 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_ToString_Helper"); 87 PKIX_NULLCHECK_TWO(crlParams, pString); 88 89 asciiFormat = 90 "\n\t[\n" 91 "\tIssuerNames: %s\n" 92 "\tDate: %s\n" 93 "\tmaxCRLNumber: %s\n" 94 "\tminCRLNumber: %s\n" 95 "\tCertificate: %s\n" 96 "\t]\n"; 97 98 PKIX_CHECK(PKIX_PL_String_Create 99 (PKIX_ESCASCII, 100 asciiFormat, 101 0, 102 &formatString, 103 plContext), 104 PKIX_STRINGCREATEFAILED); 105 106 PKIX_TOSTRING 107 (crlParams->issuerNames, &crlIssuerNamesString, plContext, 108 PKIX_LISTTOSTRINGFAILED); 109 110 PKIX_TOSTRING(crlParams->date, &crlDateString, plContext, 111 PKIX_DATETOSTRINGFAILED); 112 113 PKIX_TOSTRING 114 (crlParams->maxCRLNumber, &crlMaxCRLNumberString, plContext, 115 PKIX_BIGINTTOSTRINGFAILED); 116 117 PKIX_TOSTRING 118 (crlParams->minCRLNumber, &crlMinCRLNumberString, plContext, 119 PKIX_BIGINTTOSTRINGFAILED); 120 121 PKIX_TOSTRING(crlParams->cert, &crlCertString, plContext, 122 PKIX_CERTTOSTRINGFAILED); 123 124 PKIX_CHECK(PKIX_PL_Sprintf 125 (&crlParamsString, 126 plContext, 127 formatString, 128 crlIssuerNamesString, 129 crlDateString, 130 crlMaxCRLNumberString, 131 crlMinCRLNumberString, 132 crlCertString), 133 PKIX_SPRINTFFAILED); 134 135 *pString = crlParamsString; 136 137 cleanup: 138 139 PKIX_DECREF(crlIssuerNamesString); 140 PKIX_DECREF(crlDateString); 141 PKIX_DECREF(crlMaxCRLNumberString); 142 PKIX_DECREF(crlMinCRLNumberString); 143 PKIX_DECREF(crlCertString); 144 PKIX_DECREF(formatString); 145 146 PKIX_RETURN(COMCRLSELPARAMS); 147 } 148 149 /* 150 * FUNCTION: pkix_ComCRLSelParams_ToString 151 * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h) 152 */ 153 static PKIX_Error * 154 pkix_ComCRLSelParams_ToString( 155 PKIX_PL_Object *object, 156 PKIX_PL_String **pString, 157 void *plContext) 158 { 159 PKIX_PL_String *crlParamsString = NULL; 160 PKIX_ComCRLSelParams *crlParams = NULL; 161 162 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_ToString"); 163 PKIX_NULLCHECK_TWO(object, pString); 164 165 PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), 166 PKIX_OBJECTNOTCOMCRLSELPARAMS); 167 168 crlParams = (PKIX_ComCRLSelParams *) object; 169 170 PKIX_CHECK(pkix_ComCRLSelParams_ToString_Helper 171 (crlParams, &crlParamsString, plContext), 172 PKIX_COMCRLSELPARAMSTOSTRINGHELPERFAILED); 173 174 *pString = crlParamsString; 175 176 cleanup: 177 178 PKIX_RETURN(COMCRLSELPARAMS); 179 } 180 181 /* 182 * FUNCTION: pkix_ComCRLSelParams_Hashcode 183 * (see comments for PKIX_PL_HashcodeCallback in pkix_pl_system.h) 184 */ 185 static PKIX_Error * 186 pkix_ComCRLSelParams_Hashcode( 187 PKIX_PL_Object *object, 188 PKIX_UInt32 *pHashcode, 189 void *plContext) 190 { 191 PKIX_ComCRLSelParams *crlParams = NULL; 192 PKIX_UInt32 namesHash = 0; 193 PKIX_UInt32 certHash = 0; 194 PKIX_UInt32 dateHash = 0; 195 PKIX_UInt32 maxCRLNumberHash = 0; 196 PKIX_UInt32 minCRLNumberHash = 0; 197 PKIX_UInt32 hash = 0; 198 199 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Hashcode"); 200 PKIX_NULLCHECK_TWO(object, pHashcode); 201 202 PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), 203 PKIX_OBJECTNOTCOMCRLSELPARAMS); 204 205 crlParams = (PKIX_ComCRLSelParams *)object; 206 207 PKIX_HASHCODE(crlParams->issuerNames, &namesHash, plContext, 208 PKIX_OBJECTHASHCODEFAILED); 209 210 PKIX_HASHCODE(crlParams->cert, &certHash, plContext, 211 PKIX_OBJECTHASHCODEFAILED); 212 213 PKIX_HASHCODE(crlParams->date, &dateHash, plContext, 214 PKIX_OBJECTHASHCODEFAILED); 215 216 PKIX_HASHCODE(crlParams->maxCRLNumber, &maxCRLNumberHash, plContext, 217 PKIX_OBJECTHASHCODEFAILED); 218 219 PKIX_HASHCODE(crlParams->minCRLNumber, &minCRLNumberHash, plContext, 220 PKIX_OBJECTHASHCODEFAILED); 221 222 223 hash = (((namesHash << 3) + certHash) << 3) + dateHash; 224 hash = (hash << 3) + maxCRLNumberHash + minCRLNumberHash; 225 226 *pHashcode = hash; 227 228 cleanup: 229 230 PKIX_RETURN(COMCRLSELPARAMS); 231 } 232 233 /* 234 * FUNCTION: pkix_ComCRLSelParams_Equals 235 * (see comments for PKIX_PL_Equals_Callback in pkix_pl_system.h) 236 */ 237 static PKIX_Error * 238 pkix_ComCRLSelParams_Equals( 239 PKIX_PL_Object *firstObject, 240 PKIX_PL_Object *secondObject, 241 PKIX_Boolean *pResult, 242 void *plContext) 243 { 244 PKIX_ComCRLSelParams *firstCrlParams = NULL; 245 PKIX_ComCRLSelParams *secondCrlParams = NULL; 246 PKIX_UInt32 secondType; 247 PKIX_Boolean cmpResult = PKIX_FALSE; 248 249 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Equals"); 250 PKIX_NULLCHECK_THREE(firstObject, secondObject, pResult); 251 252 /* test that firstObject is a ComCRLSelParams */ 253 PKIX_CHECK(pkix_CheckType 254 (firstObject, PKIX_COMCRLSELPARAMS_TYPE, plContext), 255 PKIX_FIRSTOBJECTNOTCOMCRLSELPARAMS); 256 257 firstCrlParams = (PKIX_ComCRLSelParams *)firstObject; 258 secondCrlParams = (PKIX_ComCRLSelParams *)secondObject; 259 260 /* 261 * Since we know firstObject is a ComCRLSelParams, if both references 262 * are identical, they must be equal 263 */ 264 if (firstCrlParams == secondCrlParams){ 265 *pResult = PKIX_TRUE; 266 goto cleanup; 267 } 268 269 /* 270 * If secondComCRLSelParams isn't a ComCRLSelParams, we don't 271 * throw an error. We simply return a Boolean result of FALSE 272 */ 273 *pResult = PKIX_FALSE; 274 PKIX_CHECK(PKIX_PL_Object_GetType 275 ((PKIX_PL_Object *)secondCrlParams, &secondType, plContext), 276 PKIX_COULDNOTGETTYPEOFSECONDARGUMENT); 277 278 if (secondType != PKIX_COMCRLSELPARAMS_TYPE) { 279 goto cleanup; 280 } 281 282 /* Compare Issuer Names */ 283 PKIX_EQUALS 284 (firstCrlParams->issuerNames, 285 secondCrlParams->issuerNames, 286 &cmpResult, 287 plContext, 288 PKIX_LISTEQUALSFAILED); 289 290 if (cmpResult != PKIX_TRUE) { 291 goto cleanup; 292 } 293 294 /* Compare Date */ 295 PKIX_EQUALS 296 (firstCrlParams->date, 297 secondCrlParams->date, 298 &cmpResult, 299 plContext, 300 PKIX_DATEEQUALSFAILED); 301 302 if (cmpResult != PKIX_TRUE) { 303 goto cleanup; 304 } 305 306 /* Compare Max CRL Number */ 307 PKIX_EQUALS 308 (firstCrlParams->maxCRLNumber, 309 secondCrlParams->maxCRLNumber, 310 &cmpResult, 311 plContext, 312 PKIX_BIGINTEQUALSFAILED); 313 314 if (cmpResult != PKIX_TRUE) { 315 goto cleanup; 316 } 317 318 /* Compare Min CRL Number */ 319 PKIX_EQUALS 320 (firstCrlParams->minCRLNumber, 321 secondCrlParams->minCRLNumber, 322 &cmpResult, 323 plContext, 324 PKIX_BIGINTEQUALSFAILED); 325 326 if (cmpResult != PKIX_TRUE) { 327 goto cleanup; 328 } 329 330 /* Compare Cert */ 331 PKIX_EQUALS 332 (firstCrlParams->cert, 333 secondCrlParams->cert, 334 &cmpResult, 335 plContext, 336 PKIX_CERTEQUALSFAILED); 337 338 *pResult = cmpResult; 339 340 cleanup: 341 342 PKIX_RETURN(COMCRLSELPARAMS); 343 } 344 345 /* 346 * FUNCTION: pkix_ComCRLSelParams_Duplicate 347 * (see comments for PKIX_PL_Duplicate_Callback in pkix_pl_system.h) 348 */ 349 static PKIX_Error * 350 pkix_ComCRLSelParams_Duplicate( 351 PKIX_PL_Object *object, 352 PKIX_PL_Object **pNewObject, 353 void *plContext) 354 { 355 PKIX_ComCRLSelParams *old; 356 PKIX_ComCRLSelParams *new = NULL; 357 358 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Duplicate"); 359 PKIX_NULLCHECK_TWO(object, pNewObject); 360 361 PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), 362 PKIX_OBJECTNOTCOMCRLSELPARAMS); 363 364 old = (PKIX_ComCRLSelParams *)object; 365 366 PKIX_CHECK(PKIX_PL_Object_Alloc 367 (PKIX_COMCRLSELPARAMS_TYPE, 368 (PKIX_UInt32)(sizeof (PKIX_ComCRLSelParams)), 369 (PKIX_PL_Object **)&new, 370 plContext), 371 PKIX_OBJECTALLOCFAILED); 372 373 PKIX_DUPLICATE(old->cert, &new->cert, plContext, 374 PKIX_OBJECTDUPLICATECERTFAILED); 375 376 PKIX_DUPLICATE(old->crldpList, &new->crldpList, plContext, 377 PKIX_OBJECTDUPLICATECERTFAILED); 378 379 PKIX_DUPLICATE(old->issuerNames, &new->issuerNames, plContext, 380 PKIX_OBJECTDUPLICATEISSUERNAMESFAILED); 381 382 PKIX_DUPLICATE(old->date, &new->date, plContext, 383 PKIX_OBJECTDUPLICATEDATEFAILED); 384 385 PKIX_DUPLICATE(old->maxCRLNumber, &new->maxCRLNumber, plContext, 386 PKIX_OBJECTDUPLICATEMAXCRLNUMBERFAILED); 387 388 PKIX_DUPLICATE(old->minCRLNumber, &new->minCRLNumber, plContext, 389 PKIX_OBJECTDUPLICATEMINCRLNUMBERFAILED); 390 391 *pNewObject = (PKIX_PL_Object *)new; 392 393 cleanup: 394 395 if (PKIX_ERROR_RECEIVED){ 396 PKIX_DECREF(new); 397 } 398 399 PKIX_RETURN(COMCRLSELPARAMS); 400 } 401 402 /* 403 * FUNCTION: pkix_ComCrlSelParams_RegisterSelf 404 * DESCRIPTION: 405 * Registers PKIX_COMCRLSELPARAMS_TYPE and its related functions with 406 * systemClasses[] 407 * THREAD SAFETY: 408 * Not Thread Safe - for performance and complexity reasons 409 * 410 * Since this function is only called by PKIX_PL_Initialize, which should 411 * only be called once, it is acceptable that this function is not 412 * thread-safe. 413 */ 414 PKIX_Error * 415 pkix_ComCRLSelParams_RegisterSelf(void *plContext) 416 { 417 extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES]; 418 pkix_ClassTable_Entry entry; 419 420 PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_RegisterSelf"); 421 422 entry.description = "ComCRLSelParams"; 423 entry.objCounter = 0; 424 entry.typeObjectSize = sizeof(PKIX_ComCRLSelParams); 425 entry.destructor = pkix_ComCRLSelParams_Destroy; 426 entry.equalsFunction = pkix_ComCRLSelParams_Equals; 427 entry.hashcodeFunction = pkix_ComCRLSelParams_Hashcode; 428 entry.toStringFunction = pkix_ComCRLSelParams_ToString; 429 entry.comparator = NULL; 430 entry.duplicateFunction = pkix_ComCRLSelParams_Duplicate; 431 432 systemClasses[PKIX_COMCRLSELPARAMS_TYPE] = entry; 433 434 PKIX_RETURN(COMCRLSELPARAMS); 435 } 436 437 /* --ComCRLSelParams-Public-Functions------------------------------------- */ 438 439 /* 440 * FUNCTION: PKIX_ComCRLSelParams_Create (see comments in pkix_crlsel.h) 441 */ 442 PKIX_Error * 443 PKIX_ComCRLSelParams_Create( 444 PKIX_ComCRLSelParams **pParams, 445 void *plContext) 446 { 447 PKIX_ComCRLSelParams *params = NULL; 448 449 PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_Create"); 450 PKIX_NULLCHECK_ONE(pParams); 451 452 PKIX_CHECK(PKIX_PL_Object_Alloc 453 (PKIX_COMCRLSELPARAMS_TYPE, 454 sizeof (PKIX_ComCRLSelParams), 455 (PKIX_PL_Object **)¶ms, 456 plContext), 457 PKIX_COULDNOTCREATECOMMONCRLSELECTORPARAMSOBJECT); 458 459 /* initialize fields */ 460 params->issuerNames = NULL; 461 params->cert = NULL; 462 params->crldpList = NULL; 463 params->date = NULL; 464 params->nistPolicyEnabled = PKIX_TRUE; 465 params->maxCRLNumber = NULL; 466 params->minCRLNumber = NULL; 467 468 *pParams = params; 469 470 cleanup: 471 472 PKIX_RETURN(COMCRLSELPARAMS); 473 } 474 475 /* 476 * FUNCTION: PKIX_ComCRLSelParams_GetIssuerNames (see comments in pkix_crlsel.h) 477 */ 478 PKIX_Error * 479 PKIX_ComCRLSelParams_GetIssuerNames( 480 PKIX_ComCRLSelParams *params, 481 PKIX_List **pIssuerNames, 482 void *plContext) 483 { 484 PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_GetIssuerNames"); 485 PKIX_NULLCHECK_TWO(params, pIssuerNames); 486 487 PKIX_INCREF(params->issuerNames); 488 489 *pIssuerNames = params->issuerNames; 490 491 cleanup: 492 PKIX_RETURN(COMCRLSELPARAMS); 493 } 494 495 /* 496 * FUNCTION: PKIX_ComCRLSelParams_SetIssuerNames (see comments in pkix_crlsel.h) 497 */ 498 PKIX_Error * 499 PKIX_ComCRLSelParams_SetIssuerNames( 500 PKIX_ComCRLSelParams *params, 501 PKIX_List *names, 502 void *plContext) 503 { 504 PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_SetIssuerNames"); 505 PKIX_NULLCHECK_ONE(params); /* allows null for names from spec */ 506 507 PKIX_DECREF(params->issuerNames); 508 509 PKIX_INCREF(names); /* if NULL, allows to reset for no action */ 510 511 params->issuerNames = names; 512 513 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 514 ((PKIX_PL_Object *)params, plContext), 515 PKIX_OBJECTINVALIDATECACHEFAILED); 516 517 cleanup: 518 519 PKIX_RETURN(COMCRLSELPARAMS); 520 } 521 522 /* 523 * FUNCTION: PKIX_ComCRLSelParams_AddIssuerName (see comments in pkix_crlsel.h) 524 */ 525 PKIX_Error * 526 PKIX_ComCRLSelParams_AddIssuerName( 527 PKIX_ComCRLSelParams *params, 528 PKIX_PL_X500Name *name, 529 void *plContext) 530 { 531 PKIX_List *list = NULL; 532 533 PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_AddIssuerName"); 534 PKIX_NULLCHECK_ONE(params); 535 536 if (name != NULL) { 537 538 if (params->issuerNames == NULL) { 539 540 PKIX_CHECK(PKIX_List_Create(&list, plContext), 541 PKIX_LISTCREATEFAILED); 542 params->issuerNames = list; 543 } 544 545 PKIX_CHECK(PKIX_List_AppendItem 546 (params->issuerNames, (PKIX_PL_Object *)name, plContext), 547 PKIX_LISTAPPENDITEMFAILED); 548 549 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 550 ((PKIX_PL_Object *)params, plContext), 551 PKIX_OBJECTINVALIDATECACHEFAILED); 552 553 } 554 555 cleanup: 556 557 PKIX_RETURN(COMCRLSELPARAMS); 558 } 559 560 561 /* 562 * FUNCTION: PKIX_ComCRLSelParams_GetCertificateChecking 563 * (see comments in pkix_crlsel.h) 564 */ 565 PKIX_Error * 566 PKIX_ComCRLSelParams_GetCertificateChecking( 567 PKIX_ComCRLSelParams *params, 568 PKIX_PL_Cert **pCert, 569 void *plContext) 570 { 571 PKIX_ENTER(COMCRLSELPARAMS, 572 "PKIX_ComCRLSelParams_GetCertificateChecking"); 573 PKIX_NULLCHECK_TWO(params, pCert); 574 575 PKIX_INCREF(params->cert); 576 577 *pCert = params->cert; 578 579 cleanup: 580 PKIX_RETURN(COMCRLSELPARAMS); 581 } 582 583 /* 584 * FUNCTION: PKIX_ComCRLSelParams_SetCertificateChecking 585 * (see comments in pkix_crlsel.h) 586 */ 587 PKIX_Error * 588 PKIX_ComCRLSelParams_SetCertificateChecking( 589 PKIX_ComCRLSelParams *params, 590 PKIX_PL_Cert *cert, 591 void *plContext) 592 { 593 PKIX_ENTER(COMCRLSELPARAMS, 594 "PKIX_ComCRLSelParams_SetCertificateChecking"); 595 PKIX_NULLCHECK_ONE(params); /* allows cert to be NULL from spec */ 596 597 PKIX_DECREF(params->cert); 598 599 PKIX_INCREF(cert); 600 601 params->cert = cert; 602 603 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 604 ((PKIX_PL_Object *)params, plContext), 605 PKIX_OBJECTINVALIDATECACHEFAILED); 606 607 cleanup: 608 609 PKIX_RETURN(COMCRLSELPARAMS); 610 } 611 612 613 /* 614 * FUNCTION: PKIX_ComCRLSelParams_GetDateAndTime (see comments in pkix_crlsel.h) 615 */ 616 PKIX_Error * 617 PKIX_ComCRLSelParams_GetDateAndTime( 618 PKIX_ComCRLSelParams *params, 619 PKIX_PL_Date **pDate, 620 void *plContext) 621 { 622 PKIX_ENTER(COMCRLSELPARAMS, 623 "PKIX_ComCRLSelParams_GetDateAndTime"); 624 PKIX_NULLCHECK_TWO(params, pDate); 625 626 PKIX_INCREF(params->date); 627 628 *pDate = params->date; 629 630 cleanup: 631 PKIX_RETURN(COMCRLSELPARAMS); 632 } 633 634 /* 635 * FUNCTION: PKIX_ComCRLSelParams_SetDateAndTime (see comments in pkix_crlsel.h) 636 */ 637 PKIX_Error * 638 PKIX_ComCRLSelParams_SetDateAndTime( 639 PKIX_ComCRLSelParams *params, 640 PKIX_PL_Date *date, 641 void *plContext) 642 { 643 PKIX_ENTER(COMCRLSELPARAMS, 644 "PKIX_ComCRLSelParams_SetDateAndTime"); 645 PKIX_NULLCHECK_ONE(params); /* allows date to be NULL from spec */ 646 647 PKIX_DECREF (params->date); 648 649 PKIX_INCREF(date); 650 651 params->date = date; 652 653 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 654 ((PKIX_PL_Object *)params, plContext), 655 PKIX_OBJECTINVALIDATECACHEFAILED); 656 657 cleanup: 658 659 PKIX_RETURN(COMCRLSELPARAMS); 660 } 661 662 /* 663 * FUNCTION: PKIX_ComCRLSelParams_GetDateAndTime (see comments in pkix_crlsel.h) 664 */ 665 PKIX_Error * 666 PKIX_ComCRLSelParams_GetNISTPolicyEnabled( 667 PKIX_ComCRLSelParams *params, 668 PKIX_Boolean *pEnabled, 669 void *plContext) 670 { 671 PKIX_ENTER(COMCRLSELPARAMS, 672 "PKIX_ComCRLSelParams_GetNISTPolicyEnabled"); 673 PKIX_NULLCHECK_TWO(params, pEnabled); 674 675 *pEnabled = params->nistPolicyEnabled; 676 677 PKIX_RETURN(COMCRLSELPARAMS); 678 } 679 680 /* 681 * FUNCTION: PKIX_ComCRLSelParams_SetDateAndTime (see comments in pkix_crlsel.h) 682 */ 683 PKIX_Error * 684 PKIX_ComCRLSelParams_SetNISTPolicyEnabled( 685 PKIX_ComCRLSelParams *params, 686 PKIX_Boolean enabled, 687 void *plContext) 688 { 689 PKIX_ENTER(COMCRLSELPARAMS, 690 "PKIX_ComCRLSelParams_SetNISTPolicyEnabled"); 691 PKIX_NULLCHECK_ONE(params); /* allows date to be NULL from spec */ 692 693 params->nistPolicyEnabled = enabled; 694 695 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 696 ((PKIX_PL_Object *)params, plContext), 697 PKIX_OBJECTINVALIDATECACHEFAILED); 698 699 cleanup: 700 701 PKIX_RETURN(COMCRLSELPARAMS); 702 } 703 704 /* 705 * FUNCTION: PKIX_ComCRLSelParams_GetMaxCRLNumber 706 * (see comments in pkix_crlsel.h) 707 */ 708 PKIX_Error * 709 PKIX_ComCRLSelParams_GetMaxCRLNumber( 710 PKIX_ComCRLSelParams *params, 711 PKIX_PL_BigInt **pMaxCRLNumber, 712 void *plContext) 713 { 714 PKIX_ENTER(COMCRLSELPARAMS, 715 "PKIX_ComCRLSelParams_GetMaxCRLNumber"); 716 PKIX_NULLCHECK_TWO(params, pMaxCRLNumber); 717 718 PKIX_INCREF(params->maxCRLNumber); 719 720 *pMaxCRLNumber = params->maxCRLNumber; 721 722 cleanup: 723 PKIX_RETURN(COMCRLSELPARAMS); 724 } 725 726 /* 727 * FUNCTION: PKIX_ComCRLSelParams_SetMaxCRLNumber 728 * (see comments in pkix_crlsel.h) 729 */ 730 PKIX_Error * 731 PKIX_ComCRLSelParams_SetMaxCRLNumber( 732 PKIX_ComCRLSelParams *params, 733 PKIX_PL_BigInt *maxCRLNumber, 734 void *plContext) 735 { 736 PKIX_ENTER(COMCRLSELPARAMS, 737 "PKIX_ComCRLSelParams_SetMaxCRLNumber"); 738 PKIX_NULLCHECK_ONE(params); /* maxCRLNumber can be NULL - from spec */ 739 740 PKIX_DECREF(params->maxCRLNumber); 741 742 PKIX_INCREF(maxCRLNumber); 743 744 params->maxCRLNumber = maxCRLNumber; 745 746 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 747 ((PKIX_PL_Object *)params, plContext), 748 PKIX_OBJECTINVALIDATECACHEFAILED); 749 750 cleanup: 751 752 PKIX_RETURN(COMCRLSELPARAMS); 753 } 754 755 756 /* 757 * FUNCTION: PKIX_ComCRLSelParams_GetMinCRLNumber 758 * (see comments in pkix_crlsel.h) 759 */ 760 PKIX_Error * 761 PKIX_ComCRLSelParams_GetMinCRLNumber( 762 PKIX_ComCRLSelParams *params, 763 PKIX_PL_BigInt **pMinCRLNumber, 764 void *plContext) 765 { 766 PKIX_ENTER(COMCRLSELPARAMS, 767 "PKIX_ComCRLSelParams_GetMinCRLNumber"); 768 PKIX_NULLCHECK_TWO(params, pMinCRLNumber); 769 770 PKIX_INCREF(params->minCRLNumber); 771 772 *pMinCRLNumber = params->minCRLNumber; 773 774 cleanup: 775 PKIX_RETURN(COMCRLSELPARAMS); 776 } 777 778 /* 779 * FUNCTION: PKIX_ComCRLSelParams_SetMinCRLNumber 780 * (see comments in pkix_crlsel.h) 781 */ 782 PKIX_Error * 783 PKIX_ComCRLSelParams_SetMinCRLNumber( 784 PKIX_ComCRLSelParams *params, 785 PKIX_PL_BigInt *minCRLNumber, 786 void *plContext) 787 { 788 PKIX_ENTER(COMCRLSELPARAMS, 789 "PKIX_ComCRLSelParams_SetMinCRLNumber"); 790 PKIX_NULLCHECK_ONE(params); /* minCRLNumber can be NULL - from spec */ 791 792 PKIX_DECREF(params->minCRLNumber); 793 794 PKIX_INCREF(minCRLNumber); 795 796 params->minCRLNumber = minCRLNumber; 797 798 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 799 ((PKIX_PL_Object *)params, plContext), 800 PKIX_OBJECTINVALIDATECACHEFAILED); 801 802 cleanup: 803 804 PKIX_RETURN(COMCRLSELPARAMS); 805 } 806 807 808 PKIX_Error* 809 PKIX_ComCRLSelParams_SetCrlDp( 810 PKIX_ComCRLSelParams *params, 811 PKIX_List *crldpList, 812 void *plContext) 813 { 814 PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_SetCrlDp"); 815 PKIX_NULLCHECK_ONE(params); /* minCRLNumber can be NULL - from spec */ 816 817 PKIX_INCREF(crldpList); 818 params->crldpList = crldpList; 819 820 PKIX_CHECK(PKIX_PL_Object_InvalidateCache 821 ((PKIX_PL_Object *)params, plContext), 822 PKIX_OBJECTINVALIDATECACHEFAILED); 823 cleanup: 824 825 PKIX_RETURN(COMCRLSELPARAMS); 826 }