security/nss/lib/libpkix/pkix/crlsel/pkix_comcrlselparams.c

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rwxr-xr-x

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial