nssrv = nssCertificateList_DoCallback(subjectList, convert_cert, &pk11cb);
nssrv = nssToken_TraverseCertificatesBySubject(token, NULL, &subject, &search);
PK11_TraverseCertsForSubjectInSlot(CERTCertificate *cert, PK11SlotInfo *slot,	SECStatus(* callback)(CERTCertificate*, void *), void *arg){#ifdef NSS_CLASSIC    pk11DoCertCallback caller;    pk11TraverseSlot callarg;    CK_OBJECT_CLASS certClass = CKO_CERTIFICATE;    CK_ATTRIBUTE theTemplate[] = {	{ CKA_CLASS, NULL, 0 },	{ CKA_SUBJECT, NULL, 0 },    };    CK_ATTRIBUTE *attr = theTemplate;   int templateSize = sizeof(theTemplate)/sizeof(theTemplate[0]);    PK11_SETATTRS(attr,CKA_CLASS, &certClass, sizeof(certClass)); attr++;    PK11_SETATTRS(attr,CKA_SUBJECT,cert->derSubject.data,cert->derSubject.len);    if (slot == NULL)  {	return SECSuccess;    }    caller.noslotcallback = callback;    caller.callback = NULL;    caller.itemcallback = NULL;    caller.callbackArg = arg;    callarg.callback = pk11_DoCerts;    callarg.callbackArg = (void *) & caller;    callarg.findTemplate = theTemplate;    callarg.templateCount = templateSize;        return PK11_TraverseSlot(slot, &callarg);#else    struct nss3_cert_cbstr pk11cb;    PRStatus nssrv = PR_SUCCESS;    NSSToken *token;    NSSDER subject;    NSSTrustDomain *td;    nssList *subjectList;    nssTokenCertSearch search;    pk11cb.callback = callback;    pk11cb.arg = arg;    td = STAN_GetDefaultTrustDomain();    NSSITEM_FROM_SECITEM(&subject, &cert->derSubject);    token = PK11Slot_GetNSSToken(slot);    if (!nssToken_SearchCerts(token, NULL)) {	subjectList = filter_token_certs_subject(token, &subject);	if (subjectList) {	    nssrv = nssCertificateList_DoCallback(subjectList, 	                                          convert_cert, &pk11cb);	}    } else {	subjectList = nssList_Create(NULL, PR_FALSE);	if (!subjectList) {	    return SECFailure;	}	(void)nssTrustDomain_GetCertsForSubjectFromCache(td, &subject, 	                                                 subjectList);	filter_list_for_token_certs(subjectList, token);	/* set the search criteria */	search.callback = convert_and_cache_cert;	search.cbarg = &pk11cb;	search.cached = subjectList;	search.searchType = nssTokenSearchType_TokenOnly;	pk11cb.cached = subjectList;	nssrv = nssCertificateList_DoCallback(subjectList, 	                                      convert_cert, &pk11cb);	if (nssrv == PR_SUCCESS) {	    nssrv = nssToken_TraverseCertificatesBySubject(token, NULL,                                                            &subject, &search);	}    }    if (subjectList) {	nssList_Clear(subjectList, cert_destructor);	nssList_Destroy(subjectList);    }    return (nssrv == PR_SUCCESS) ? SECSuccess : SECFailure;#endif}