Merge commit from fork

verify chain in bundle
This commit is contained in:
Sergio R. Caprile authored and GitHub committed 2026-08-11 09:00:21 -03:00
commit d8764746a4
2 files changed
+10 -2

No files matched your search

+5 -1
View File
@@ -18382,7 +18382,11 @@ static int mg_tls_recv_cert(struct mg_connection *c, bool is_client) {
mg_error(c, r < 0 ? "failed to parse CA bundle"
: "failed to find issuing CA in bundle");
return -1;
} // else r > 0 => issuer found
} else if (!ca.is_ca || // candidate issuer found
!mg_tls_verify_cert_signature(&certs[certnum - 1], &ca)) {
mg_error(c, "failed to verify CA");
return -1;
} // issuer verified. NOTE(): may fail if two diff CAs share a CN
MG_VERBOSE(("CA serial: %M", mg_print_hex, ca.sn.len, ca.sn.buf));
}
if (!found_ca && tls->ca_der.len > 0) { // single cert or server
+5 -1
View File
@@ -1892,7 +1892,11 @@ static int mg_tls_recv_cert(struct mg_connection *c, bool is_client) {
mg_error(c, r < 0 ? "failed to parse CA bundle"
: "failed to find issuing CA in bundle");
return -1;
} // else r > 0 => issuer found
} else if (!ca.is_ca || // candidate issuer found
!mg_tls_verify_cert_signature(&certs[certnum - 1], &ca)) {
mg_error(c, "failed to verify CA");
return -1;
} // issuer verified. NOTE(): may fail if two diff CAs share a CN
MG_VERBOSE(("CA serial: %M", mg_print_hex, ca.sn.len, ca.sn.buf));
}
if (!found_ca && tls->ca_der.len > 0) { // single cert or server