Check the CA bit on trusted CAs too
diff --git a/library/x509_crt.c b/library/x509_crt.c
index 47745a7..94d8552 100644
--- a/library/x509_crt.c
+++ b/library/x509_crt.c
@@ -1607,6 +1607,7 @@
     while( trust_ca != NULL )
     {
         if( trust_ca->version == 0 ||
+            trust_ca->ca_istrue == 0 ||
             child->issuer_raw.len != trust_ca->subject_raw.len ||
             memcmp( child->issuer_raw.p, trust_ca->subject_raw.p,
                     child->issuer_raw.len ) != 0 )