optimized self-signed certificate detection
This commit is contained in:
@@ -953,15 +953,15 @@ static bool issued_by(private_x509_cert_t *this, certificate_t *issuer,
|
|||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
|
|
||||||
{
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
if (!(x509->get_flags(x509) & X509_CA))
|
if (!(x509->get_flags(x509) & X509_CA))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
if (!sigcheck)
|
if (!sigcheck)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -1208,9 +1208,8 @@ static private_x509_cert_t *load(chunk_t chunk)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check if the certificate self-signed */
|
/* check if the certificate is self-signed */
|
||||||
if (this->subject->equals(this->subject, this->issuer) &&
|
if (issued_by(this, &this->public.interface.interface, TRUE))
|
||||||
issued_by(this, &this->public.interface.interface, TRUE))
|
|
||||||
{
|
{
|
||||||
this->flags |= X509_SELF_SIGNED;
|
this->flags |= X509_SELF_SIGNED;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user