diff options
Diffstat (limited to 'security/manager/ssl/nsNSSCertificateDB.cpp')
-rw-r--r-- | security/manager/ssl/nsNSSCertificateDB.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/security/manager/ssl/nsNSSCertificateDB.cpp b/security/manager/ssl/nsNSSCertificateDB.cpp index fc3caf29b5..d74746b189 100644 --- a/security/manager/ssl/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/nsNSSCertificateDB.cpp @@ -10,6 +10,7 @@ #include "NSSCertDBTrustDomain.h" #include "SharedSSLState.h" #include "certdb.h" +#include "mozilla/glean/GleanMetrics.h" #include "mozilla/Assertions.h" #include "mozilla/Base64.h" #include "mozilla/Casting.h" @@ -56,6 +57,24 @@ extern LazyLogModule gPIPNSSLog; NS_IMPL_ISUPPORTS(nsNSSCertificateDB, nsIX509CertDB) NS_IMETHODIMP +nsNSSCertificateDB::CountTrustObjects(uint32_t* aCount) { + UniquePK11SlotInfo slot(PK11_GetInternalKeySlot()); + PK11GenericObject* objects = + PK11_FindGenericObjects(slot.get(), CKO_NSS_TRUST); + int count = 0; + for (PK11GenericObject* cursor = objects; cursor; + cursor = PK11_GetNextGenericObject(cursor)) { + count++; + } + PK11_DestroyGenericObjects(objects); + + mozilla::glean::cert_verifier::trust_obj_count.Set(count); + + *aCount = count; + return NS_OK; +} + +NS_IMETHODIMP nsNSSCertificateDB::FindCertByDBKey(const nsACString& aDBKey, /*out*/ nsIX509Cert** _cert) { NS_ENSURE_ARG_POINTER(_cert); |