try to cache the same instance of equal certificates

This commit is contained in:
Martin Willi
2008-04-07 08:44:43 +00:00
parent b5dbcc6270
commit da5e7bdb4c
+14 -1
View File
@@ -118,13 +118,26 @@ static bool issued_by(private_cert_cache_t *this,
enumerator = this->relations->create_enumerator(this->relations); enumerator = this->relations->create_enumerator(this->relations);
while (enumerator->enumerate(enumerator, &current)) while (enumerator->enumerate(enumerator, &current))
{ {
if (current->subject == subject && current->issuer == issuer) bool match = FALSE;
/* check for equal certificates */
if (subject->equals(subject, current->subject))
{
match = TRUE;
subject = current->subject;
}
if (issuer->equals(issuer, current->issuer))
{
issuer = current->issuer;
/* if both certs match, we already have a relation */
if (match)
{ {
current->last_use = time(NULL); current->last_use = time(NULL);
found = current; found = current;
break; break;
} }
} }
}
enumerator->destroy(enumerator); enumerator->destroy(enumerator);
if (found) if (found)
{ {