NSS_IMPLEMENT void nssCertificateStore_RemoveCertLOCKED ( nssCertificateStore *store, NSSCertificate *cert ) { certificate_hash_entry *entry; entry = (certificate_hash_entry *) nssHash_Lookup(store->issuer_and_serial, cert); if (entry && entry->cert == cert) { remove_certificate_entry(store, cert); remove_subject_entry(store, cert); } }
NSS_IMPLEMENT void nssTrustDomain_RemoveCertFromCacheLOCKED ( NSSTrustDomain *td, NSSCertificate *cert ) { nssList *subjectList; cache_entry *ce; NSSArena *arena; NSSUTF8 *nickname; #ifdef DEBUG_CACHE log_cert_ref("attempt to remove cert", cert); #endif ce = (cache_entry *)nssHash_Lookup(td->cache->issuerAndSN, cert); if (!ce || ce->entry.cert != cert) { /* If it's not in the cache, or a different cert is (this is really * for safety reasons, though it shouldn't happen), do nothing */ #ifdef DEBUG_CACHE PR_LOG(s_log, PR_LOG_DEBUG, ("but it wasn't in the cache")); #endif return; } (void)remove_issuer_and_serial_entry(td->cache, cert); (void)remove_subject_entry(td->cache, cert, &subjectList, &nickname, &arena); if (nssList_Count(subjectList) == 0) { (void)remove_nickname_entry(td->cache, nickname, subjectList); (void)remove_email_entry(td->cache, cert, subjectList); (void)nssList_Destroy(subjectList); nssHash_Remove(td->cache->subject, &cert->subject); /* there are no entries left for this subject, free the space used * for both the nickname and subject entries */ if (arena) { nssArena_Destroy(arena); } } }