rv = CERT_ImportCerts(certdb, certusage, certcount, sigd->rawCerts, NULL, keepcerts, PR_FALSE, NULL);
rv = CERT_ImportCerts(certdb, certusage, certcount, sigd->rawCerts, &certArray, PR_FALSE, PR_FALSE, NULL); if (rv != SECSuccess) { goto loser; }  if (!keepcerts) { goto done; }   certList = CERT_NewCertList(); if (certList == NULL) { rv = SECFailure; goto loser; } for (i=0; i < certcount; i++) { CERTCertificate *cert = CERT_DupCertificate(certArray[i]); CERT_AddCertToListTail(certList,cert); }   rv = CERT_FilterCertListByUsage(certList,certusage, PR_FALSE); if (rv != SECSuccess) { goto loser; }   for (node = CERT_LIST_HEAD(certList) ; !CERT_LIST_END(node,certList); node= CERT_LIST_NEXT(node)) { CERTCertificateList *certChain;  if (CERT_VerifyCert(certdb, node->cert, PR_TRUE, certusage, PR_Now(), NULL, NULL) != SECSuccess) { continue; }  certChain = CERT_CertChainFromCert(node->cert, certusage, PR_FALSE); if (!certChain) { continue; }   rawArray = (SECItem **)PORT_Alloc(certChain->len*sizeof (SECItem *)); if (!rawArray) { CERT_DestroyCertificateList(certChain); continue; } for (i=0; i < certChain->len; i++) { rawArray[i] = &certChain->certs[i]; } (void )CERT_ImportCerts(certdb, certusage, certChain->len, rawArray,  NULL, keepcerts, PR_FALSE, NULL); PORT_Free(rawArray); CERT_DestroyCertificateList(certChain); }  rv = SECSuccess;
NSS_CMSSignedData_ImportCerts(NSSCMSSignedData *sigd, CERTCertDBHandle *certdb,				SECCertUsage certusage, PRBool keepcerts){    int certcount;    SECStatus rv;    int i;    certcount = NSS_CMSArray_Count((void **)sigd->rawCerts);    rv = CERT_ImportCerts(certdb, certusage, certcount, sigd->rawCerts, NULL,			  keepcerts, PR_FALSE, NULL);    /* XXX CRL handling */    if (sigd->signerInfos != NULL) {	/* fill in all signerinfo's certs */	for (i = 0; sigd->signerInfos[i] != NULL; i++)	    (void)NSS_CMSSignerInfo_GetSigningCertificate(sigd->signerInfos[i], certdb);    }    return rv;}