Require intermediate CAs to have basicConstraints CA:true.
[openssl.git] / crypto / x509 / x509_vfy.c
index afd8299bb4bb9353cda58e78aa5d8158d28d26ac..ffa211badb9804318751b2b262e8d91a4aea9599 100644 (file)
@@ -484,8 +484,9 @@ static int check_chain_extensions(X509_STORE_CTX *ctx)
                 ret = 1;
             break;
         default:
+            /* X509_V_FLAG_X509_STRICT is implicit for intermediate CAs */
             if ((ret == 0)
-                || ((ctx->param->flags & X509_V_FLAG_X509_STRICT)
+                || ((i + 1 < num || ctx->param->flags & X509_V_FLAG_X509_STRICT)
                     && (ret != 1))) {
                 ret = 0;
                 ctx->error = X509_V_ERR_INVALID_CA;