PKIFSCVPMemoryHelper.cpp

Go to the documentation of this file.
00001 
00009 #include "private/PKIFSCVPMemoryHelper.h"
00010 #include "PKIFSCVP.h"
00011 #include "SCVP.h"
00012 #include "ToolkitUtils.h"
00013 #include "components.h"
00014 
00015 //*****************************************************************
00016 //  Memory helper
00017 //*****************************************************************
00018 
00019 //declare these as non-member functions instead of private functions
00020 //no need to make them visible beyond this file
00028 void FreeValPolRequestMembers(ValPolRequest* pValPolRequest)
00029 {
00030 }
00038 void FreeValPolResponseMembers(ValPolResponse* pValPolResponse)
00039 {
00040     LOG_STRING_DEBUG("FreeValPolResponseMembers", TOOLKIT_SCVP_ASN, 0, NULL);
00041 
00042     if(!pValPolResponse)
00043         return;
00044 
00045     
00046     DListNode* cur = NULL, *tmp = NULL;
00047     DListNode* cur2 = NULL, *tmp2 = NULL;
00048     //deleting authPolicies
00049     if(pValPolResponse->authPolicies.count > 0)
00050     {
00051         cur = pValPolResponse->authPolicies.head;
00052         while(NULL != cur)
00053         {
00054             tmp = cur->next;
00055 
00056             if(NULL != cur && NULL != cur->data)
00057                 delete cur->data;
00058             delete cur;
00059             cur = tmp;
00060         }
00061     }
00062 
00063     //deleting supportedChecks
00064     if(pValPolResponse->supportedChecks.count > 0)
00065     {
00066         cur = pValPolResponse->supportedChecks.head;
00067         while(NULL != cur)
00068         {
00069             tmp = cur->next;
00070 
00071             if(NULL != cur && NULL != cur->data)
00072                 delete cur->data;
00073             delete cur;
00074             cur = tmp;
00075         }
00076     }
00077 
00078     //deleting supportedWantBacks
00079     if(pValPolResponse->supportedWantBacks.count > 0)
00080     {
00081         cur = pValPolResponse->supportedWantBacks.head;
00082         while(NULL != cur)
00083         {
00084             tmp = cur->next;
00085 
00086             if(NULL != cur && NULL != cur->data)
00087                 delete cur->data;
00088             delete cur;
00089             cur = tmp;
00090         }
00091     }
00092 
00093     //deleting validationPolicies
00094     if(pValPolResponse->validationPolicies.count > 0)
00095     {
00096         cur = pValPolResponse->validationPolicies.head;
00097         while(NULL != cur)
00098         {
00099             tmp = cur->next;
00100 
00101             if(NULL != cur && NULL != cur->data)
00102                 delete cur->data;
00103             delete cur;
00104             cur = tmp;
00105         }
00106     }
00107     //deleting validationAlgs
00108     if(pValPolResponse->validationAlgs.count > 0)
00109     {
00110         cur = pValPolResponse->validationAlgs.head;
00111         while(NULL != cur)
00112         {
00113             tmp = cur->next;
00114 
00115             if(NULL != cur && NULL != cur->data)
00116                 delete cur->data;
00117             delete cur;
00118             cur = tmp;
00119         }
00120     }
00121 
00122     //deleting signatureGeneration
00123     if(pValPolResponse->signatureGeneration.count > 0)
00124     {
00125         cur = pValPolResponse->signatureGeneration.head;
00126         while(NULL != cur)
00127         {
00128             tmp = cur->next;
00129 
00130             if(NULL != cur && NULL != cur->data)
00131                 delete cur->data;
00132             delete cur;
00133             cur = tmp;
00134         }
00135     }
00136 
00137     //deleting signatureVerification
00138     if(pValPolResponse->signatureVerification.count > 0)
00139     {
00140         cur = pValPolResponse->signatureVerification.head;
00141         while(NULL != cur)
00142         {
00143             tmp = cur->next;
00144 
00145             if(NULL != cur && NULL != cur->data)
00146                 delete cur->data;
00147             delete cur;
00148             cur = tmp;
00149         }
00150     }
00151 
00152     //deleting hashAlgorithms
00153     if(pValPolResponse->hashAlgorithms.count > 0)
00154     {
00155         cur = pValPolResponse->hashAlgorithms.head;
00156         while(NULL != cur)
00157         {
00158             tmp = cur->next;
00159 
00160             if(NULL != cur && NULL != cur->data)
00161                 delete cur->data;
00162             delete cur;
00163             cur = tmp;
00164         }
00165     }
00166 
00167     //deleting serverPublicKeys
00168     if(pValPolResponse->serverPublicKeys.count > 0)
00169     {
00170         cur = pValPolResponse->serverPublicKeys.head;
00171         while(NULL != cur)
00172         {
00173             tmp = cur->next;
00174 
00175             if(NULL != cur && NULL != cur->data)
00176                 delete cur->data;
00177             delete cur;
00178             cur = tmp;
00179         }
00180     }
00181 
00182     //delete user policy set from defaultPolicyValues
00183     if(pValPolResponse->defaultPolicyValues.m.userPolicySetPresent)
00184     {
00185         if(0 < pValPolResponse->defaultPolicyValues.userPolicySet.count)
00186         {
00187             cur = pValPolResponse->defaultPolicyValues.userPolicySet.head;
00188             while(NULL != cur)
00189             {
00190                 tmp = cur->next;
00191 
00192                 if(NULL != cur && NULL != cur->data)
00193                     delete cur->data;
00194 
00195                 delete cur;
00196                 cur = tmp;
00197             }
00198         }
00199     }
00200 
00201     //delete TAs from defaultPolicyValues
00202     if(pValPolResponse->defaultPolicyValues.m.trustAnchorsPresent)
00203     {
00204         if(0 < pValPolResponse->defaultPolicyValues.trustAnchors.count)
00205         {
00206             cur = pValPolResponse->defaultPolicyValues.trustAnchors.head;
00207             while(NULL != cur)
00208             {
00209                 PKCReference* tmpRef = NULL;
00210                 if(NULL != cur->data)
00211                 {
00212                     tmpRef = (PKCReference*)cur->data;
00213 
00214                     if(NULL != tmpRef)
00215                     {
00216                         if(tmpRef->t == T_PKCReference_pkcRef)
00217                         {
00218                             cur2 = tmpRef->u.pkcRef->issuerSerial.issuer.head;
00219                             while(NULL != cur2)
00220                             {
00221                                 tmp2 = cur2->next;
00222                                 if(NULL != cur2 && NULL != cur2->data)
00223                                     delete cur2->data;
00224                                 delete cur2;
00225                                 cur2 = tmp2;
00226                             }
00227                             
00228                             if(NULL != tmpRef->u.pkcRef)
00229                                 delete tmpRef->u.pkcRef;
00230                         }
00231                         else if(tmpRef->t == T_PKCReference_cert)
00232                         {
00233                             if(NULL != tmpRef->u.cert)
00234                                 delete tmpRef->u.cert;
00235                         }
00236 
00237                         
00238                         delete tmpRef;
00239                     }
00240 
00241                 }
00242                 tmp = cur->next;
00243                 delete cur;
00244                 cur = tmp;
00245             }
00246         }
00247     }
00248     //delete key usages from defaultPolicyValues
00249     if(pValPolResponse->defaultPolicyValues.m.keyUsagesPresent)
00250     {
00251         if(0 < pValPolResponse->defaultPolicyValues.keyUsages.count)
00252         {
00253             cur = pValPolResponse->defaultPolicyValues.keyUsages.head;
00254             while(NULL != cur)
00255             {
00256                 tmp = cur->next;
00257 
00258                 if(NULL != cur && NULL != cur->data)
00259                     delete cur->data;
00260 
00261                 delete cur;
00262                 cur = tmp;
00263             }
00264         }
00265     }
00266     //delete EKUs from defaultPolicyValues
00267     if(pValPolResponse->defaultPolicyValues.m.extendedKeyUsagesPresent)
00268     {
00269         if(0 < pValPolResponse->defaultPolicyValues.extendedKeyUsages.count)
00270         {
00271             cur = pValPolResponse->defaultPolicyValues.extendedKeyUsages.head;
00272             while(NULL != cur)
00273             {
00274                 tmp = cur->next;
00275         
00276                 if(NULL != cur && NULL != cur->data)
00277                     delete cur->data;
00278                 
00279                 delete cur;
00280                 cur = tmp;
00281             }
00282         }
00283     }
00284     //delete SKUs from defaultPolicyValues
00285     if(pValPolResponse->defaultPolicyValues.m.specifiedKeyUsagesPresent)
00286     {
00287         if(0 < pValPolResponse->defaultPolicyValues.specifiedKeyUsages.count)
00288         {
00289             cur = pValPolResponse->defaultPolicyValues.specifiedKeyUsages.head;
00290             while(NULL != cur)
00291             {
00292                 tmp = cur->next;
00293                 
00294                 if(NULL != cur && NULL != cur->data)
00295                     delete cur->data;
00296                 
00297                 delete cur;
00298                 cur = tmp;
00299             }
00300         }
00301     }
00302 
00303     
00304     
00305 }
00313 void FreeRequestMembers(CVRequest* pRequest)
00314 {
00315     LOG_STRING_DEBUG("FreeRequestMembers", TOOLKIT_SCVP_ASN, 0, NULL);
00316 
00317     if(!pRequest)
00318         return;
00319 
00320     //deleting requestor reference
00321     DListNode* cur = NULL, *tmp = NULL;
00322     DListNode* cur2 = NULL, *tmp2 = NULL;
00323     if(pRequest->m.requestorRefPresent)
00324     {
00325         cur = pRequest->requestorRef.head;
00326         while(NULL != cur)
00327         {
00328             tmp = cur->next;
00329 
00330             if(NULL != cur && NULL != cur->data)
00331                 delete cur->data;
00332             delete cur;
00333             cur = tmp;
00334         }
00335     }
00336 
00337     if(pRequest->query.queriedCerts.t == T_CertReferences_pkcRefs)
00338     {
00339         cur = NULL; tmp = NULL;
00340         if(0 != pRequest->query.queriedCerts.u.pkcRefs->count)
00341         {
00342             cur = pRequest->query.queriedCerts.u.pkcRefs->head;
00343             while(NULL != cur)
00344             {
00345                 PKCReference* tmpRef = NULL;
00346                 
00347                 if(NULL != cur->data)
00348                     tmpRef = (PKCReference*)cur->data;
00349                 if(NULL != tmpRef)
00350                 {
00351                     if(tmpRef->t == T_PKCReference_pkcRef)
00352                     {
00353                         cur2 = tmpRef->u.pkcRef->issuerSerial.issuer.head;
00354                         while(NULL != cur2)
00355                         {
00356                             tmp2 = cur2->next;
00357 
00358                             if(NULL != cur2 && NULL != cur2->data)
00359                                 delete cur2->data;
00360 
00361                             delete cur2;
00362                             cur2 = tmp2;
00363                         }
00364                         
00365                         if(NULL != tmpRef->u.pkcRef)
00366                             delete tmpRef->u.pkcRef;
00367                     }
00368                     else if(tmpRef->t == T_PKCReference_cert)
00369                     {
00370                         if(NULL != tmpRef->u.cert)
00371                             delete tmpRef->u.cert;
00372                     }
00373 
00374                     
00375                 }
00376                 tmp = cur->next;
00377                 delete cur;
00378                 cur = tmp;
00379             }
00380         }
00381     }
00382     else if(pRequest->query.queriedCerts.t == T_CertReferences_acRefs)
00383     {
00384         cur = NULL; tmp = NULL;
00385         if(0 != pRequest->query.queriedCerts.u.acRefs->count)
00386         {
00387             cur = pRequest->query.queriedCerts.u.acRefs->head;
00388             while(NULL != cur)
00389             {
00390                 ACReference* tmpRef = NULL;
00391                 
00392                 if(NULL != cur->data)
00393                     tmpRef = (ACReference*)cur->data;
00394                 if(NULL != tmpRef)
00395                 {
00396                     if(tmpRef->t == T_ACReference_acRef)
00397                     {
00398                         cur2 = tmpRef->u.acRef->issuerSerial.issuer.head;
00399                         while(NULL != cur2)
00400                         {
00401                             tmp2 = cur2->next;
00402 
00403                             if(NULL != cur2 && NULL != cur2->data)
00404                                 delete cur2->data;
00405 
00406                             delete cur2;
00407                             cur2 = tmp2;
00408                         }
00409                         
00410                         if(NULL != tmpRef->u.acRef)
00411                             delete tmpRef->u.acRef;
00412                     }
00413                     else if(tmpRef->t == T_ACReference_attrCert)
00414                     {
00415                         if(NULL != tmpRef->u.attrCert)
00416                             delete tmpRef->u.attrCert;
00417                     }
00418                         
00419                 }
00420                 tmp = cur->next;
00421                 delete cur;
00422                 cur = tmp;
00423             }
00424         }
00425     }
00426 
00427     //delete query checks
00428     cur = NULL; tmp = NULL;
00429     if(0 < pRequest->query.checks.count)
00430     {
00431         cur = pRequest->query.checks.head;
00432         while(NULL != cur)
00433         {
00434             tmp = cur->next;
00435         
00436             if(NULL != cur && NULL != cur->data)
00437                 delete cur->data;
00438 
00439             delete cur;
00440             cur = tmp;
00441         }
00442     }
00443 
00444     //delete wantbacks
00445     cur = NULL; tmp = NULL;
00446     if(pRequest->query.m.wantBackPresent)
00447     {
00448         if(0 < pRequest->query.wantBack.count)
00449         {
00450             cur = pRequest->query.wantBack.head;
00451             while(NULL != cur)
00452             {
00453                 tmp = cur->next;
00454                 
00455                 if(NULL != cur && NULL != cur->data)
00456                     delete cur->data;
00457 
00458                 delete cur;
00459                 cur = tmp;
00460             }
00461         }
00462     }
00463 
00464     //delete intermidiate certs from query
00465     cur = NULL; tmp = NULL;
00466     if(pRequest->query.m.intermediateCertsPresent)
00467     {
00468         if(0 < pRequest->query.intermediateCerts.count)
00469         {
00470             cur = pRequest->query.intermediateCerts.head;
00471             while(NULL != cur)
00472             {
00473                 tmp = cur->next;
00474 
00475                 if(NULL != cur && NULL != cur->data)
00476                     delete cur->data;
00477 
00478                 delete cur;
00479                 cur = tmp;
00480             }
00481         }
00482     }
00483 
00484     //delete rev i info from query
00485     cur = NULL; tmp = NULL;
00486     if(pRequest->query.m.revInfosPresent)
00487     {
00488         if(0 < pRequest->query.revInfos.count)
00489         {
00490             cur = pRequest->query.revInfos.head;
00491             while(NULL != cur)
00492             {
00493                 RevocationInfo* tmpRef = NULL;
00494                 if(NULL != cur->data)
00495                 {
00496                     tmpRef = (RevocationInfo*)cur->data;
00497                     
00498                     if(tmpRef->t == T_RevocationInfo_crl)
00499                     {
00500                         if(tmpRef->u.crl != NULL)
00501                             delete tmpRef->u.crl;
00502                     }
00503                     else if(tmpRef->t == T_RevocationInfo_delta_crl)
00504                     {
00505                         if(tmpRef->u.delta_crl != NULL)
00506                             delete tmpRef->u.delta_crl;
00507                     }
00508                     else if(tmpRef->t == T_RevocationInfo_ocsp)
00509                     {
00510                         if(tmpRef->u.ocsp != NULL)
00511                             delete tmpRef->u.ocsp;
00512                     }
00513                     else if(tmpRef->t == T_RevocationInfo_other)
00514                     {
00515                         if(tmpRef->u.other != NULL)
00516                             delete tmpRef->u.other;
00517                     }
00518 
00519 
00520                     delete tmpRef;
00521                 }
00522                 tmp = cur->next;
00523                 delete cur;
00524                 cur = tmp;
00525             }
00526         }
00527     }
00528     //delete user policy set from query.validationPolicy
00529     if(pRequest->query.validationPolicy.m.userPolicySetPresent)
00530     {
00531         if(0 < pRequest->query.validationPolicy.userPolicySet.count)
00532         {
00533             cur = pRequest->query.validationPolicy.userPolicySet.head;
00534             while(NULL != cur)
00535             {
00536                 tmp = cur->next;
00537 
00538                 if(NULL != cur && NULL != cur->data)
00539                     delete cur->data;
00540 
00541                 delete cur;
00542                 cur = tmp;
00543             }
00544         }
00545     }
00546 
00547     //delete TAs from query.validationPolicy
00548     if(pRequest->query.validationPolicy.m.trustAnchorsPresent)
00549     {
00550         if(0 < pRequest->query.validationPolicy.trustAnchors.count)
00551         {
00552             cur = pRequest->query.validationPolicy.trustAnchors.head;
00553             while(NULL != cur)
00554             {
00555                 PKCReference* tmpRef = NULL;
00556                 if(NULL != cur->data)
00557                 {
00558                     tmpRef = (PKCReference*)cur->data;
00559 
00560                     if(NULL != tmpRef)
00561                     {
00562                         if(tmpRef->t == T_PKCReference_pkcRef)
00563                         {
00564                             cur2 = tmpRef->u.pkcRef->issuerSerial.issuer.head;
00565                             while(NULL != cur2)
00566                             {
00567                                 tmp2 = cur2->next;
00568                                 if(NULL != cur2 && NULL != cur2->data)
00569                                     delete cur2->data;
00570                                 delete cur2;
00571                                 cur2 = tmp2;
00572                             }
00573                             
00574                             if(NULL != tmpRef->u.pkcRef)
00575                                 delete tmpRef->u.pkcRef;
00576                         }
00577                         else if(tmpRef->t == T_PKCReference_cert)
00578                         {
00579                             if(NULL != tmpRef->u.cert)
00580                                 delete tmpRef->u.cert;
00581                         }
00582 
00583                         
00584                         delete tmpRef;
00585                     }
00586 
00587                 }
00588                 tmp = cur->next;
00589                 delete cur;
00590                 cur = tmp;
00591             }
00592         }
00593     }
00594     //delete key usages from query.validationPolicy
00595     if(pRequest->query.validationPolicy.m.keyUsagesPresent)
00596     {
00597         if(0 < pRequest->query.validationPolicy.keyUsages.count)
00598         {
00599             cur = pRequest->query.validationPolicy.keyUsages.head;
00600             while(NULL != cur)
00601             {
00602                 tmp = cur->next;
00603 
00604                 if(NULL != cur && NULL != cur->data)
00605                     delete cur->data;
00606 
00607                 delete cur;
00608                 cur = tmp;
00609             }
00610         }
00611     }
00612     //delete EKUs from query.validationPolicy
00613     if(pRequest->query.validationPolicy.m.extendedKeyUsagesPresent)
00614     {
00615         if(0 < pRequest->query.validationPolicy.extendedKeyUsages.count)
00616         {
00617             cur = pRequest->query.validationPolicy.extendedKeyUsages.head;
00618             while(NULL != cur)
00619             {
00620                 tmp = cur->next;
00621         
00622                 if(NULL != cur && NULL != cur->data)
00623                     delete cur->data;
00624 
00625                 
00626                 delete cur;
00627                 cur = tmp;
00628             }
00629         }
00630     }
00631     //delete SKUs from query.validationPolicy
00632     if(pRequest->query.validationPolicy.m.specifiedKeyUsagesPresent)
00633     {
00634         if(0 < pRequest->query.validationPolicy.specifiedKeyUsages.count)
00635         {
00636             cur = pRequest->query.validationPolicy.specifiedKeyUsages.head;
00637             while(NULL != cur)
00638             {
00639                 tmp = cur->next;
00640                 
00641                 if(NULL != cur && NULL != cur->data)
00642                     delete cur->data;
00643                 
00644                 delete cur;
00645                 cur = tmp;
00646             }
00647         }
00648     }
00649 
00650     if(pRequest->requestorText != NULL)
00651     {
00652         delete pRequest->requestorText;
00653     }
00654 }
00662 void FreeResponseMembers(CVResponse* pResponse)
00663 {
00664     LOG_STRING_DEBUG("FreeResponseMembers", TOOLKIT_SCVP_ASN, 0, NULL);
00665 
00666     if(!pResponse)
00667         return;
00668 
00669     
00670     DListNode* cur = NULL, *tmp = NULL;
00671     DListNode* cur2 = NULL, *tmp2 = NULL;
00672 
00673 
00674     //delete request ref
00675     if(pResponse->m.requestRefPresent)
00676     {
00677         if(pResponse->requestRef.t == T_RequestReference_fullRequest)
00678         {
00679             if(pResponse->requestRef.u.fullRequest != NULL)
00680                 delete pResponse->requestRef.u.fullRequest;
00681         }
00682     }
00683 
00684     //delete requestor ref
00685     if(pResponse->m.requestorRefPresent)
00686     {
00687         cur = pResponse->requestorRef.head;
00688         while(NULL != cur)
00689         {
00690             tmp = cur->next;
00691 
00692             RevocationInfo* tmpOther = (RevocationInfo*)cur->data;
00693 
00694             if(NULL != cur && NULL != cur->data)
00695                 delete cur->data;
00696             delete cur;
00697             cur = tmp;
00698         }
00699     }
00700 
00701     //delete requestor name
00702     if(pResponse->m.requestorNamePresent)
00703     {
00704         cur = pResponse->requestorName.head;
00705         while(NULL != cur)
00706         {
00707             tmp = cur->next;
00708 
00709             if(NULL != cur && NULL != cur->data)
00710                 delete cur->data;
00711             delete cur;
00712             cur = tmp;
00713         }
00714     }
00715     
00716     if(pResponse->m.replyObjectsPresent)
00717     {
00718         cur = pResponse->replyObjects.head;
00719         while(NULL != cur)
00720         {
00721             CertReply* tmpRef = NULL;
00722             if(NULL != cur->data)
00723             {
00724                 tmpRef = (CertReply*)cur->data;
00725                 
00726                 cur2 = NULL;
00727                 if(0 < tmpRef->replyChecks.count)
00728                 {
00729                     cur2 = tmpRef->replyChecks.head;
00730                     while(NULL != cur2)
00731                     {
00732                         tmp2 = cur2->next;
00733 
00734                         if(NULL != cur2 && NULL != cur2->data)
00735                             delete cur2->data;
00736                         delete cur2;
00737                         cur2 = tmp2;
00738                     }
00739                 }
00740 
00741                 cur2 = NULL;
00742                 if(0 < tmpRef->replyWantBacks.count)
00743                 {
00744                     cur2 = tmpRef->replyWantBacks.head;
00745                     while(NULL != cur2)
00746                     {
00747                         tmp2 = cur2->next;
00748 
00749                         if(NULL != cur2 && NULL != cur2->data)
00750                             delete cur2->data;
00751                         delete cur2;
00752                         cur2 = tmp2;
00753                     }
00754                 }
00755 
00756                 cur2 = NULL;
00757                 if(tmpRef->m.validationErrorsPresent)
00758                 {
00759                     if(0 < tmpRef->validationErrors.count)
00760                     {
00761                         cur2 = tmpRef->validationErrors.head;
00762                         while(NULL != cur2)
00763                         {
00764                             tmp2 = cur2->next;
00765 
00766                             if(NULL != cur2 && NULL != cur2->data)
00767                                 delete cur2->data;
00768                             delete cur2;
00769                             cur2 = tmp2;
00770                         }
00771                     }
00772                 }
00773 
00774                 cur2 = NULL;
00775                 if(tmpRef->cert.t == T_CertReference_pkc)
00776                 {
00777                     if(tmpRef->cert.u.pkc->t == T_PKCReference_cert)
00778                     {
00779                         if(tmpRef->cert.u.pkc->u.cert != NULL)
00780                         {
00781                             delete tmpRef->cert.u.pkc->u.cert;
00782                         }
00783                     }
00784                     else if(tmpRef->cert.u.pkc->t == T_PKCReference_pkcRef)
00785                     {
00786                             
00787                         DListNode* cur3 = NULL, *tmp3 = NULL;
00788                         cur = tmpRef->cert.u.pkc->u.pkcRef->issuerSerial.issuer.head;
00789                         while(NULL != cur3)
00790                         {
00791                             tmp3 = cur3->next;
00792                             if(NULL != cur3 && NULL != cur3->data)
00793                                 delete cur3->data;
00794                             delete cur3;
00795                             cur3 = tmp3;
00796                         }
00797 
00798                         if(tmpRef->cert.u.pkc->u.pkcRef->issuerSerial.serialNumber != NULL)
00799                             delete tmpRef->cert.u.pkc->u.pkcRef->issuerSerial.serialNumber;
00800                         delete tmpRef->cert.u.pkc->u.pkcRef;
00801                     }
00802 
00803                     delete tmpRef->cert.u.pkc;
00804                 }
00805                 if(tmpRef->cert.t == T_CertReference_ac)
00806                 {
00807                     if(tmpRef->cert.u.ac->t == T_ACReference_attrCert)
00808                     {
00809                         if(tmpRef->cert.u.ac->u.attrCert != NULL)
00810                         {
00811                             delete tmpRef->cert.u.ac->u.attrCert;
00812                         }
00813                     }
00814                     else if(tmpRef->cert.u.ac->t == T_ACReference_acRef)
00815                     {
00816                         DListNode* cur3 = NULL, *tmp3 = NULL;
00817                         cur = tmpRef->cert.u.ac->u.acRef->issuerSerial.issuer.head;
00818                         while(NULL != cur3)
00819                         {
00820                             tmp3 = cur3->next;
00821                             if(NULL != cur3 && NULL != cur3->data)
00822                                 delete cur3->data;
00823                             delete cur3;
00824                             cur3 = tmp3;
00825                         }
00826 
00827                         if(tmpRef->cert.u.ac->u.acRef->issuerSerial.serialNumber != NULL)
00828                             delete tmpRef->cert.u.ac->u.acRef->issuerSerial.serialNumber;
00829                         
00830                         delete tmpRef->cert.u.ac->u.acRef;
00831                     }
00832 
00833                     delete tmpRef->cert.u.ac;
00834                 }
00835 
00836                 delete tmpRef;
00837 
00838             }
00839             delete cur;
00840             cur = tmp;
00841         }
00842     }
00843 
00844     if(pResponse->m.respValidationPolicyPresent)
00845     {
00846         //delete user policy set from respValidationPolicy
00847         if(pResponse->respValidationPolicy.m.userPolicySetPresent)
00848         {
00849             if(0 < pResponse->respValidationPolicy.userPolicySet.count)
00850             {
00851                 cur = pResponse->respValidationPolicy.userPolicySet.head;
00852                 while(NULL != cur)
00853                 {
00854                     tmp = cur->next;
00855 
00856                     if(NULL != cur && NULL != cur->data)
00857                         delete cur->data;
00858 
00859                     delete cur;
00860                     cur = tmp;
00861                 }
00862             }
00863         }
00864 
00865         //delete TAs from respValidationPolicy
00866         if(pResponse->respValidationPolicy.m.trustAnchorsPresent)
00867         {
00868             if(0 < pResponse->respValidationPolicy.trustAnchors.count)
00869             {
00870                 cur = pResponse->respValidationPolicy.trustAnchors.head;
00871                 while(NULL != cur)
00872                 {
00873                     PKCReference* tmpRef = NULL;
00874                     if(NULL != cur->data)
00875                     {
00876                         tmpRef = (PKCReference*)cur->data;
00877 
00878                         if(NULL != tmpRef)
00879                         {
00880                             if(tmpRef->t == T_PKCReference_pkcRef)
00881                             {
00882                                 cur2 = tmpRef->u.pkcRef->issuerSerial.issuer.head;
00883                                 while(NULL != cur2)
00884                                 {
00885                                     tmp2 = cur2->next;
00886                                     if(NULL != cur2 && NULL != cur2->data)
00887                                         delete cur2->data;
00888                                     delete cur2;
00889                                     cur2 = tmp2;
00890                                 }
00891                                 
00892                                 if(NULL != tmpRef->u.pkcRef)
00893                                     delete tmpRef->u.pkcRef;
00894                             }
00895                             else if(tmpRef->t == T_PKCReference_cert)
00896                             {
00897                                 if(NULL != tmpRef->u.cert)
00898                                     delete tmpRef->u.cert;
00899                             }
00900 
00901                             
00902                             delete tmpRef;
00903                         }
00904 
00905                     }
00906                     tmp = cur->next;
00907                     delete cur;
00908                     cur = tmp;
00909                 }
00910             }
00911         }
00912         //delete key usages from respValidationPolicy
00913         if(pResponse->respValidationPolicy.m.keyUsagesPresent)
00914         {
00915             if(0 < pResponse->respValidationPolicy.keyUsages.count)
00916             {
00917                 cur = pResponse->respValidationPolicy.keyUsages.head;
00918                 while(NULL != cur)
00919                 {
00920                     tmp = cur->next;
00921 
00922                     if(NULL != cur && NULL != cur->data)
00923                         delete cur->data;
00924 
00925                     delete cur;
00926                     cur = tmp;
00927                 }
00928             }
00929         }
00930         //delete EKUs from respValidationPolicy
00931         if(pResponse->respValidationPolicy.m.extendedKeyUsagesPresent)
00932         {
00933             if(0 < pResponse->respValidationPolicy.extendedKeyUsages.count)
00934             {
00935                 cur = pResponse->respValidationPolicy.extendedKeyUsages.head;
00936                 while(NULL != cur)
00937                 {
00938                     tmp = cur->next;
00939             
00940                     if(NULL != cur && NULL != cur->data)
00941                         delete cur->data;
00942 
00943                     
00944                     delete cur;
00945                     cur = tmp;
00946                 }
00947             }
00948         }
00949         //delete SKUs from respValidationPolicy
00950         if(pResponse->respValidationPolicy.m.specifiedKeyUsagesPresent)
00951         {
00952             if(0 < pResponse->respValidationPolicy.specifiedKeyUsages.count)
00953             {
00954                 cur = pResponse->respValidationPolicy.specifiedKeyUsages.head;
00955                 while(NULL != cur)
00956                 {
00957                     tmp = cur->next;
00958                     
00959                     if(NULL != cur && NULL != cur->data)
00960                         delete cur->data;
00961                     
00962                     delete cur;
00963                     cur = tmp;
00964                 }
00965             }
00966         }
00967     }
00968 
00969     if(pResponse->responseStatus.m.errorMessagePresent > 0 && pResponse->responseStatus.errorMessage != NULL)
00970     {
00971         delete pResponse->responseStatus.errorMessage;
00972     }
00973 
00974     if(pResponse->requestorText != NULL)
00975     {
00976         delete pResponse->requestorText;
00977     }
00978 }
00988 PKIFSCVPMemoryHelper::PKIFSCVPMemoryHelper()
00989 {
00990     LOG_STRING_DEBUG("PKIFSCVPMemoryHelper::PKIFSCVPMemoryHelper()", TOOLKIT_SCVP_ASN, 0, this);
00991 
00992     pRequest = NULL;
00993     pResponse = NULL;
00994     pValPolRequest = NULL;
00995     pValPolResponse = NULL;
00996 }
01004 PKIFSCVPMemoryHelper::~PKIFSCVPMemoryHelper()
01005 {
01006     LOG_STRING_DEBUG("PKIFSCVPMemoryHelper::~PKIFSCVPMemoryHelper()", TOOLKIT_SCVP_ASN, 0, this);
01007 
01008     if(NULL != pRequest)
01009     {
01010         FreeRequestMembers(pRequest);
01011         delete pRequest;
01012     }
01013 
01014     if(NULL != pResponse)
01015     {
01016         FreeResponseMembers(pResponse);
01017         delete pResponse;
01018     }
01019 
01020     if(NULL != pValPolResponse)
01021     {
01022         FreeValPolResponseMembers(pValPolResponse);
01023         delete pValPolResponse;
01024     }
01025     if(NULL != pValPolRequest)
01026     {
01027         FreeValPolRequestMembers(pValPolRequest);
01028         delete pValPolRequest;
01029     }
01030 }

Generated on Mon Nov 15 11:15:55 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6