// Returns false with index in an undefined state if no matching entry was // found. bool OCSPCache::FindInternal(const CertID& aCertID, /*out*/ size_t& index, const MutexAutoLock& /* aProofOfLock */) { if (mEntries.length() == 0) { return false; } SHA384Buffer idHash; SECStatus rv = CertIDHash(idHash, aCertID); if (rv != SECSuccess) { return false; } // mEntries is sorted with the most-recently-used entry at the end. // Thus, searching from the end will often be fastest. index = mEntries.length(); while (index > 0) { --index; if (memcmp(mEntries[index]->mIDHash, idHash, SHA384_LENGTH) == 0) { return true; } } return false; }
Result OCSPCache::Entry::Init(const CertID& aCertID) { SECStatus srv = CertIDHash(mIDHash, aCertID); if (srv != SECSuccess) { return MapPRErrorCodeToResult(PR_GetError()); } return Success; }
SECStatus OCSPCache::Entry::Init(const CertID& aCertID, PRErrorCode aErrorCode, PRTime aThisUpdate, PRTime aValidThrough) { mErrorCode = aErrorCode; mThisUpdate = aThisUpdate; mValidThrough = aValidThrough; return CertIDHash(mIDHash, aCertID); }
SECStatus OCSPCache::Entry::Init(const CERTCertificate* aCert, const CERTCertificate* aIssuerCert, PRErrorCode aErrorCode, PRTime aThisUpdate, PRTime aValidThrough) { mErrorCode = aErrorCode; mThisUpdate = aThisUpdate; mValidThrough = aValidThrough; return CertIDHash(mIDHash, aCert, aIssuerCert); }