andre@0: /* This Source Code Form is subject to the terms of the Mozilla Public andre@0: * License, v. 2.0. If a copy of the MPL was not distributed with this andre@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ andre@0: /* andre@0: * pkix_comcrlselparams.c andre@0: * andre@0: * ComCRLSelParams Function Definitions andre@0: * andre@0: */ andre@0: andre@0: #include "pkix_comcrlselparams.h" andre@0: andre@0: /* --ComCRLSelParams-Private-Functions------------------------------------ */ andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCrlSelParams_Destroy andre@0: * (see comments for PKIX_PL_DestructorCallback in pkix_pl_system.h) andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_Destroy( andre@0: PKIX_PL_Object *object, andre@0: void *plContext) andre@0: { andre@0: PKIX_ComCRLSelParams *params = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Destroy"); andre@0: PKIX_NULLCHECK_ONE(object); andre@0: andre@0: PKIX_CHECK(pkix_CheckType andre@0: (object, PKIX_COMCRLSELPARAMS_TYPE, plContext), andre@0: PKIX_OBJECTNOTCOMCRLSELPARAMS); andre@0: andre@0: params = (PKIX_ComCRLSelParams *)object; andre@0: andre@0: PKIX_DECREF(params->issuerNames); andre@0: PKIX_DECREF(params->cert); andre@0: PKIX_DECREF(params->date); andre@0: PKIX_DECREF(params->maxCRLNumber); andre@0: PKIX_DECREF(params->minCRLNumber); andre@0: PKIX_DECREF(params->crldpList); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCRLSelParams_ToString_Helper andre@0: * DESCRIPTION: andre@0: * andre@0: * Helper function that creates a string representation of ComCRLSelParams andre@0: * pointed to by "crlParams" and stores the result at "pString". andre@0: * andre@0: * PARAMETERS andre@0: * "crlParams" andre@0: * Address of ComCRLSelParams whose string representation is desired. andre@0: * Must be non-NULL. andre@0: * "pString" andre@0: * Address of object pointer's destination. Must be non-NULL. andre@0: * "plContext" - Platform-specific context pointer. andre@0: * andre@0: * THREAD SAFETY: andre@0: * Conditionally Thread Safe andre@0: * (see Thread Safety Definitions in Programmer's Guide) andre@0: * andre@0: * RETURNS: andre@0: * Returns NULL if the function succeeds. andre@0: * Returns a CRLEntry Error if the function fails in a non-fatal way. andre@0: * Returns a Fatal Error if the function fails in an unrecoverable way. andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_ToString_Helper( andre@0: PKIX_ComCRLSelParams *crlParams, andre@0: PKIX_PL_String **pString, andre@0: void *plContext) andre@0: { andre@0: PKIX_PL_String *crlIssuerNamesString = NULL; andre@0: PKIX_PL_String *crlDateString = NULL; andre@0: PKIX_PL_String *crlMaxCRLNumberString = NULL; andre@0: PKIX_PL_String *crlMinCRLNumberString = NULL; andre@0: PKIX_PL_String *crlCertString = NULL; andre@0: PKIX_PL_String *crlParamsString = NULL; andre@0: char *asciiFormat = NULL; andre@0: PKIX_PL_String *formatString = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_ToString_Helper"); andre@0: PKIX_NULLCHECK_TWO(crlParams, pString); andre@0: andre@0: asciiFormat = andre@0: "\n\t[\n" andre@0: "\tIssuerNames: %s\n" andre@0: "\tDate: %s\n" andre@0: "\tmaxCRLNumber: %s\n" andre@0: "\tminCRLNumber: %s\n" andre@0: "\tCertificate: %s\n" andre@0: "\t]\n"; andre@0: andre@0: PKIX_CHECK(PKIX_PL_String_Create andre@0: (PKIX_ESCASCII, andre@0: asciiFormat, andre@0: 0, andre@0: &formatString, andre@0: plContext), andre@0: PKIX_STRINGCREATEFAILED); andre@0: andre@0: PKIX_TOSTRING andre@0: (crlParams->issuerNames, &crlIssuerNamesString, plContext, andre@0: PKIX_LISTTOSTRINGFAILED); andre@0: andre@0: PKIX_TOSTRING(crlParams->date, &crlDateString, plContext, andre@0: PKIX_DATETOSTRINGFAILED); andre@0: andre@0: PKIX_TOSTRING andre@0: (crlParams->maxCRLNumber, &crlMaxCRLNumberString, plContext, andre@0: PKIX_BIGINTTOSTRINGFAILED); andre@0: andre@0: PKIX_TOSTRING andre@0: (crlParams->minCRLNumber, &crlMinCRLNumberString, plContext, andre@0: PKIX_BIGINTTOSTRINGFAILED); andre@0: andre@0: PKIX_TOSTRING(crlParams->cert, &crlCertString, plContext, andre@0: PKIX_CERTTOSTRINGFAILED); andre@0: andre@0: PKIX_CHECK(PKIX_PL_Sprintf andre@0: (&crlParamsString, andre@0: plContext, andre@0: formatString, andre@0: crlIssuerNamesString, andre@0: crlDateString, andre@0: crlMaxCRLNumberString, andre@0: crlMinCRLNumberString, andre@0: crlCertString), andre@0: PKIX_SPRINTFFAILED); andre@0: andre@0: *pString = crlParamsString; andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_DECREF(crlIssuerNamesString); andre@0: PKIX_DECREF(crlDateString); andre@0: PKIX_DECREF(crlMaxCRLNumberString); andre@0: PKIX_DECREF(crlMinCRLNumberString); andre@0: PKIX_DECREF(crlCertString); andre@0: PKIX_DECREF(formatString); andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCRLSelParams_ToString andre@0: * (see comments for PKIX_PL_ToStringCallback in pkix_pl_system.h) andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_ToString( andre@0: PKIX_PL_Object *object, andre@0: PKIX_PL_String **pString, andre@0: void *plContext) andre@0: { andre@0: PKIX_PL_String *crlParamsString = NULL; andre@0: PKIX_ComCRLSelParams *crlParams = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_ToString"); andre@0: PKIX_NULLCHECK_TWO(object, pString); andre@0: andre@0: PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), andre@0: PKIX_OBJECTNOTCOMCRLSELPARAMS); andre@0: andre@0: crlParams = (PKIX_ComCRLSelParams *) object; andre@0: andre@0: PKIX_CHECK(pkix_ComCRLSelParams_ToString_Helper andre@0: (crlParams, &crlParamsString, plContext), andre@0: PKIX_COMCRLSELPARAMSTOSTRINGHELPERFAILED); andre@0: andre@0: *pString = crlParamsString; andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCRLSelParams_Hashcode andre@0: * (see comments for PKIX_PL_HashcodeCallback in pkix_pl_system.h) andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_Hashcode( andre@0: PKIX_PL_Object *object, andre@0: PKIX_UInt32 *pHashcode, andre@0: void *plContext) andre@0: { andre@0: PKIX_ComCRLSelParams *crlParams = NULL; andre@0: PKIX_UInt32 namesHash = 0; andre@0: PKIX_UInt32 certHash = 0; andre@0: PKIX_UInt32 dateHash = 0; andre@0: PKIX_UInt32 maxCRLNumberHash = 0; andre@0: PKIX_UInt32 minCRLNumberHash = 0; andre@0: PKIX_UInt32 hash = 0; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Hashcode"); andre@0: PKIX_NULLCHECK_TWO(object, pHashcode); andre@0: andre@0: PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), andre@0: PKIX_OBJECTNOTCOMCRLSELPARAMS); andre@0: andre@0: crlParams = (PKIX_ComCRLSelParams *)object; andre@0: andre@0: PKIX_HASHCODE(crlParams->issuerNames, &namesHash, plContext, andre@0: PKIX_OBJECTHASHCODEFAILED); andre@0: andre@0: PKIX_HASHCODE(crlParams->cert, &certHash, plContext, andre@0: PKIX_OBJECTHASHCODEFAILED); andre@0: andre@0: PKIX_HASHCODE(crlParams->date, &dateHash, plContext, andre@0: PKIX_OBJECTHASHCODEFAILED); andre@0: andre@0: PKIX_HASHCODE(crlParams->maxCRLNumber, &maxCRLNumberHash, plContext, andre@0: PKIX_OBJECTHASHCODEFAILED); andre@0: andre@0: PKIX_HASHCODE(crlParams->minCRLNumber, &minCRLNumberHash, plContext, andre@0: PKIX_OBJECTHASHCODEFAILED); andre@0: andre@0: andre@0: hash = (((namesHash << 3) + certHash) << 3) + dateHash; andre@0: hash = (hash << 3) + maxCRLNumberHash + minCRLNumberHash; andre@0: andre@0: *pHashcode = hash; andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCRLSelParams_Equals andre@0: * (see comments for PKIX_PL_Equals_Callback in pkix_pl_system.h) andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_Equals( andre@0: PKIX_PL_Object *firstObject, andre@0: PKIX_PL_Object *secondObject, andre@0: PKIX_Boolean *pResult, andre@0: void *plContext) andre@0: { andre@0: PKIX_ComCRLSelParams *firstCrlParams = NULL; andre@0: PKIX_ComCRLSelParams *secondCrlParams = NULL; andre@0: PKIX_UInt32 secondType; andre@0: PKIX_Boolean cmpResult = PKIX_FALSE; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Equals"); andre@0: PKIX_NULLCHECK_THREE(firstObject, secondObject, pResult); andre@0: andre@0: /* test that firstObject is a ComCRLSelParams */ andre@0: PKIX_CHECK(pkix_CheckType andre@0: (firstObject, PKIX_COMCRLSELPARAMS_TYPE, plContext), andre@0: PKIX_FIRSTOBJECTNOTCOMCRLSELPARAMS); andre@0: andre@0: firstCrlParams = (PKIX_ComCRLSelParams *)firstObject; andre@0: secondCrlParams = (PKIX_ComCRLSelParams *)secondObject; andre@0: andre@0: /* andre@0: * Since we know firstObject is a ComCRLSelParams, if both references andre@0: * are identical, they must be equal andre@0: */ andre@0: if (firstCrlParams == secondCrlParams){ andre@0: *pResult = PKIX_TRUE; andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* andre@0: * If secondComCRLSelParams isn't a ComCRLSelParams, we don't andre@0: * throw an error. We simply return a Boolean result of FALSE andre@0: */ andre@0: *pResult = PKIX_FALSE; andre@0: PKIX_CHECK(PKIX_PL_Object_GetType andre@0: ((PKIX_PL_Object *)secondCrlParams, &secondType, plContext), andre@0: PKIX_COULDNOTGETTYPEOFSECONDARGUMENT); andre@0: andre@0: if (secondType != PKIX_COMCRLSELPARAMS_TYPE) { andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* Compare Issuer Names */ andre@0: PKIX_EQUALS andre@0: (firstCrlParams->issuerNames, andre@0: secondCrlParams->issuerNames, andre@0: &cmpResult, andre@0: plContext, andre@0: PKIX_LISTEQUALSFAILED); andre@0: andre@0: if (cmpResult != PKIX_TRUE) { andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* Compare Date */ andre@0: PKIX_EQUALS andre@0: (firstCrlParams->date, andre@0: secondCrlParams->date, andre@0: &cmpResult, andre@0: plContext, andre@0: PKIX_DATEEQUALSFAILED); andre@0: andre@0: if (cmpResult != PKIX_TRUE) { andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* Compare Max CRL Number */ andre@0: PKIX_EQUALS andre@0: (firstCrlParams->maxCRLNumber, andre@0: secondCrlParams->maxCRLNumber, andre@0: &cmpResult, andre@0: plContext, andre@0: PKIX_BIGINTEQUALSFAILED); andre@0: andre@0: if (cmpResult != PKIX_TRUE) { andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* Compare Min CRL Number */ andre@0: PKIX_EQUALS andre@0: (firstCrlParams->minCRLNumber, andre@0: secondCrlParams->minCRLNumber, andre@0: &cmpResult, andre@0: plContext, andre@0: PKIX_BIGINTEQUALSFAILED); andre@0: andre@0: if (cmpResult != PKIX_TRUE) { andre@0: goto cleanup; andre@0: } andre@0: andre@0: /* Compare Cert */ andre@0: PKIX_EQUALS andre@0: (firstCrlParams->cert, andre@0: secondCrlParams->cert, andre@0: &cmpResult, andre@0: plContext, andre@0: PKIX_CERTEQUALSFAILED); andre@0: andre@0: *pResult = cmpResult; andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCRLSelParams_Duplicate andre@0: * (see comments for PKIX_PL_Duplicate_Callback in pkix_pl_system.h) andre@0: */ andre@0: static PKIX_Error * andre@0: pkix_ComCRLSelParams_Duplicate( andre@0: PKIX_PL_Object *object, andre@0: PKIX_PL_Object **pNewObject, andre@0: void *plContext) andre@0: { andre@0: PKIX_ComCRLSelParams *old; andre@0: PKIX_ComCRLSelParams *new = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_Duplicate"); andre@0: PKIX_NULLCHECK_TWO(object, pNewObject); andre@0: andre@0: PKIX_CHECK(pkix_CheckType(object, PKIX_COMCRLSELPARAMS_TYPE, plContext), andre@0: PKIX_OBJECTNOTCOMCRLSELPARAMS); andre@0: andre@0: old = (PKIX_ComCRLSelParams *)object; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_Alloc andre@0: (PKIX_COMCRLSELPARAMS_TYPE, andre@0: (PKIX_UInt32)(sizeof (PKIX_ComCRLSelParams)), andre@0: (PKIX_PL_Object **)&new, andre@0: plContext), andre@0: PKIX_OBJECTALLOCFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->cert, &new->cert, plContext, andre@0: PKIX_OBJECTDUPLICATECERTFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->crldpList, &new->crldpList, plContext, andre@0: PKIX_OBJECTDUPLICATECERTFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->issuerNames, &new->issuerNames, plContext, andre@0: PKIX_OBJECTDUPLICATEISSUERNAMESFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->date, &new->date, plContext, andre@0: PKIX_OBJECTDUPLICATEDATEFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->maxCRLNumber, &new->maxCRLNumber, plContext, andre@0: PKIX_OBJECTDUPLICATEMAXCRLNUMBERFAILED); andre@0: andre@0: PKIX_DUPLICATE(old->minCRLNumber, &new->minCRLNumber, plContext, andre@0: PKIX_OBJECTDUPLICATEMINCRLNUMBERFAILED); andre@0: andre@0: *pNewObject = (PKIX_PL_Object *)new; andre@0: andre@0: cleanup: andre@0: andre@0: if (PKIX_ERROR_RECEIVED){ andre@0: PKIX_DECREF(new); andre@0: } andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: pkix_ComCrlSelParams_RegisterSelf andre@0: * DESCRIPTION: andre@0: * Registers PKIX_COMCRLSELPARAMS_TYPE and its related functions with andre@0: * systemClasses[] andre@0: * THREAD SAFETY: andre@0: * Not Thread Safe - for performance and complexity reasons andre@0: * andre@0: * Since this function is only called by PKIX_PL_Initialize, which should andre@0: * only be called once, it is acceptable that this function is not andre@0: * thread-safe. andre@0: */ andre@0: PKIX_Error * andre@0: pkix_ComCRLSelParams_RegisterSelf(void *plContext) andre@0: { andre@0: extern pkix_ClassTable_Entry systemClasses[PKIX_NUMTYPES]; andre@0: pkix_ClassTable_Entry entry; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "pkix_ComCRLSelParams_RegisterSelf"); andre@0: andre@0: entry.description = "ComCRLSelParams"; andre@0: entry.objCounter = 0; andre@0: entry.typeObjectSize = sizeof(PKIX_ComCRLSelParams); andre@0: entry.destructor = pkix_ComCRLSelParams_Destroy; andre@0: entry.equalsFunction = pkix_ComCRLSelParams_Equals; andre@0: entry.hashcodeFunction = pkix_ComCRLSelParams_Hashcode; andre@0: entry.toStringFunction = pkix_ComCRLSelParams_ToString; andre@0: entry.comparator = NULL; andre@0: entry.duplicateFunction = pkix_ComCRLSelParams_Duplicate; andre@0: andre@0: systemClasses[PKIX_COMCRLSELPARAMS_TYPE] = entry; andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* --ComCRLSelParams-Public-Functions------------------------------------- */ andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_Create (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_Create( andre@0: PKIX_ComCRLSelParams **pParams, andre@0: void *plContext) andre@0: { andre@0: PKIX_ComCRLSelParams *params = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_Create"); andre@0: PKIX_NULLCHECK_ONE(pParams); andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_Alloc andre@0: (PKIX_COMCRLSELPARAMS_TYPE, andre@0: sizeof (PKIX_ComCRLSelParams), andre@0: (PKIX_PL_Object **)¶ms, andre@0: plContext), andre@0: PKIX_COULDNOTCREATECOMMONCRLSELECTORPARAMSOBJECT); andre@0: andre@0: /* initialize fields */ andre@0: params->issuerNames = NULL; andre@0: params->cert = NULL; andre@0: params->crldpList = NULL; andre@0: params->date = NULL; andre@0: params->nistPolicyEnabled = PKIX_TRUE; andre@0: params->maxCRLNumber = NULL; andre@0: params->minCRLNumber = NULL; andre@0: andre@0: *pParams = params; andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetIssuerNames (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetIssuerNames( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_List **pIssuerNames, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_GetIssuerNames"); andre@0: PKIX_NULLCHECK_TWO(params, pIssuerNames); andre@0: andre@0: PKIX_INCREF(params->issuerNames); andre@0: andre@0: *pIssuerNames = params->issuerNames; andre@0: andre@0: cleanup: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetIssuerNames (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetIssuerNames( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_List *names, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_SetIssuerNames"); andre@0: PKIX_NULLCHECK_ONE(params); /* allows null for names from spec */ andre@0: andre@0: PKIX_DECREF(params->issuerNames); andre@0: andre@0: PKIX_INCREF(names); /* if NULL, allows to reset for no action */ andre@0: andre@0: params->issuerNames = names; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_AddIssuerName (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_AddIssuerName( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_X500Name *name, andre@0: void *plContext) andre@0: { andre@0: PKIX_List *list = NULL; andre@0: andre@0: PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_AddIssuerName"); andre@0: PKIX_NULLCHECK_ONE(params); andre@0: andre@0: if (name != NULL) { andre@0: andre@0: if (params->issuerNames == NULL) { andre@0: andre@0: PKIX_CHECK(PKIX_List_Create(&list, plContext), andre@0: PKIX_LISTCREATEFAILED); andre@0: params->issuerNames = list; andre@0: } andre@0: andre@0: PKIX_CHECK(PKIX_List_AppendItem andre@0: (params->issuerNames, (PKIX_PL_Object *)name, plContext), andre@0: PKIX_LISTAPPENDITEMFAILED); andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: } andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetCertificateChecking andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetCertificateChecking( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_Cert **pCert, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_GetCertificateChecking"); andre@0: PKIX_NULLCHECK_TWO(params, pCert); andre@0: andre@0: PKIX_INCREF(params->cert); andre@0: andre@0: *pCert = params->cert; andre@0: andre@0: cleanup: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetCertificateChecking andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetCertificateChecking( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_Cert *cert, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_SetCertificateChecking"); andre@0: PKIX_NULLCHECK_ONE(params); /* allows cert to be NULL from spec */ andre@0: andre@0: PKIX_DECREF(params->cert); andre@0: andre@0: PKIX_INCREF(cert); andre@0: andre@0: params->cert = cert; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetDateAndTime (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetDateAndTime( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_Date **pDate, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_GetDateAndTime"); andre@0: PKIX_NULLCHECK_TWO(params, pDate); andre@0: andre@0: PKIX_INCREF(params->date); andre@0: andre@0: *pDate = params->date; andre@0: andre@0: cleanup: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetDateAndTime (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetDateAndTime( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_Date *date, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_SetDateAndTime"); andre@0: PKIX_NULLCHECK_ONE(params); /* allows date to be NULL from spec */ andre@0: andre@0: PKIX_DECREF (params->date); andre@0: andre@0: PKIX_INCREF(date); andre@0: andre@0: params->date = date; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetDateAndTime (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetNISTPolicyEnabled( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_Boolean *pEnabled, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_GetNISTPolicyEnabled"); andre@0: PKIX_NULLCHECK_TWO(params, pEnabled); andre@0: andre@0: *pEnabled = params->nistPolicyEnabled; andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetDateAndTime (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetNISTPolicyEnabled( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_Boolean enabled, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_SetNISTPolicyEnabled"); andre@0: PKIX_NULLCHECK_ONE(params); /* allows date to be NULL from spec */ andre@0: andre@0: params->nistPolicyEnabled = enabled; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetMaxCRLNumber andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetMaxCRLNumber( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_BigInt **pMaxCRLNumber, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_GetMaxCRLNumber"); andre@0: PKIX_NULLCHECK_TWO(params, pMaxCRLNumber); andre@0: andre@0: PKIX_INCREF(params->maxCRLNumber); andre@0: andre@0: *pMaxCRLNumber = params->maxCRLNumber; andre@0: andre@0: cleanup: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetMaxCRLNumber andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetMaxCRLNumber( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_BigInt *maxCRLNumber, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_SetMaxCRLNumber"); andre@0: PKIX_NULLCHECK_ONE(params); /* maxCRLNumber can be NULL - from spec */ andre@0: andre@0: PKIX_DECREF(params->maxCRLNumber); andre@0: andre@0: PKIX_INCREF(maxCRLNumber); andre@0: andre@0: params->maxCRLNumber = maxCRLNumber; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_GetMinCRLNumber andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_GetMinCRLNumber( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_BigInt **pMinCRLNumber, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_GetMinCRLNumber"); andre@0: PKIX_NULLCHECK_TWO(params, pMinCRLNumber); andre@0: andre@0: PKIX_INCREF(params->minCRLNumber); andre@0: andre@0: *pMinCRLNumber = params->minCRLNumber; andre@0: andre@0: cleanup: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: /* andre@0: * FUNCTION: PKIX_ComCRLSelParams_SetMinCRLNumber andre@0: * (see comments in pkix_crlsel.h) andre@0: */ andre@0: PKIX_Error * andre@0: PKIX_ComCRLSelParams_SetMinCRLNumber( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_PL_BigInt *minCRLNumber, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, andre@0: "PKIX_ComCRLSelParams_SetMinCRLNumber"); andre@0: PKIX_NULLCHECK_ONE(params); /* minCRLNumber can be NULL - from spec */ andre@0: andre@0: PKIX_DECREF(params->minCRLNumber); andre@0: andre@0: PKIX_INCREF(minCRLNumber); andre@0: andre@0: params->minCRLNumber = minCRLNumber; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: } andre@0: andre@0: andre@0: PKIX_Error* andre@0: PKIX_ComCRLSelParams_SetCrlDp( andre@0: PKIX_ComCRLSelParams *params, andre@0: PKIX_List *crldpList, andre@0: void *plContext) andre@0: { andre@0: PKIX_ENTER(COMCRLSELPARAMS, "PKIX_ComCRLSelParams_SetCrlDp"); andre@0: PKIX_NULLCHECK_ONE(params); /* minCRLNumber can be NULL - from spec */ andre@0: andre@0: PKIX_INCREF(crldpList); andre@0: params->crldpList = crldpList; andre@0: andre@0: PKIX_CHECK(PKIX_PL_Object_InvalidateCache andre@0: ((PKIX_PL_Object *)params, plContext), andre@0: PKIX_OBJECTINVALIDATECACHEFAILED); andre@0: cleanup: andre@0: andre@0: PKIX_RETURN(COMCRLSELPARAMS); andre@0: }