self-signed certificates were not marked by x509_cert.c
This commit is contained in:
@@ -940,22 +940,27 @@ static bool issued_by(private_x509_cert_t *this, certificate_t *issuer,
|
||||
bool valid;
|
||||
x509_t *x509 = (x509_t*)issuer;
|
||||
|
||||
if (&this->public.interface.interface == issuer &&
|
||||
(this->flags & X509_SELF_SIGNED))
|
||||
if (&this->public.interface.interface == issuer)
|
||||
{
|
||||
return TRUE;
|
||||
if (this->flags & X509_SELF_SIGNED)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
if (issuer->get_type(issuer) != CERT_X509)
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!(x509->get_flags(x509) & X509_CA))
|
||||
{
|
||||
return FALSE;
|
||||
if (issuer->get_type(issuer) != CERT_X509)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!this->issuer->equals(this->issuer, issuer->get_subject(issuer)))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
if (!(x509->get_flags(x509) & X509_CA))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
if (!sigcheck)
|
||||
{
|
||||
@@ -1202,7 +1207,10 @@ static private_x509_cert_t *load(chunk_t chunk)
|
||||
destroy(this);
|
||||
return NULL;
|
||||
}
|
||||
if (issued_by(this, &this->public.interface.interface, FALSE))
|
||||
|
||||
/* check if the certificate self-signed */
|
||||
if (this->subject->equals(this->subject, this->issuer) &&
|
||||
issued_by(this, &this->public.interface.interface, TRUE))
|
||||
{
|
||||
this->flags |= X509_SELF_SIGNED;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user