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