Compare commits

...
7 Commits
Author SHA1 Message Date
Sergio R. Caprile 381e31198b Merge pull request #3722 from cesanta/fixmdashenable
fix mdash enablement trashing tests
2026-10-06 12:40:58 -03:00
Sergio R. Caprile 28ba381bd9 fix mdash enablement trashing tests 2026-10-06 12:24:19 -03:00
cpq 567963b034 Nit in mqtt example 2026-10-06 15:41:31 +01:00
Sergio R. Caprile 7d3fe4f9cb Merge pull request #3721 from cesanta/tls
Built-in TLS: accept a chain that contains the configured CA
2026-10-06 08:58:36 -03:00
cpq c8bf39dcd8 Built-in TLS: accept a chain that contains the configured CA 2026-10-06 12:41:25 +01:00
cpq 393c811f31 Fixed cert emptiness check 2026-10-06 12:33:02 +01:00
robert be40827e17 Add links for STM32 cubemx projects 2026-10-06 12:32:46 +03:00
14 changed files with 49 additions and 5 deletions

No files matched your search

+14 -2
View File
@@ -18800,6 +18800,18 @@ static int mg_tls_recv_cert(struct mg_connection *c, bool is_client) {
} // else r = 0 or -2 => subj not found or pubkey not matching
}
// Single CA: accept the chain if the CA itself is in it, e.g. a
// cross-signed copy of the root. Same subject and same public key
// means the same trusted key, and the links below ci are verified
if (tls->ca_der.len > 0 && ca.subj.len == ci->subj.len &&
memcmp(ca.subj.value, ci->subj.value, ca.subj.len) == 0 &&
ca.pubkey.len == ci->pubkey.len &&
memcmp(ca.pubkey.buf, ci->pubkey.buf, ca.pubkey.len) == 0) {
found_ca = true;
MG_VERBOSE(("CA found in chain at depth %d", certnum - 1));
break;
}
if (certnum == sizeof(certs) / sizeof(certs[0]) - 1) {
mg_error(c, "too many certificates in the chain");
return -1;
@@ -19602,7 +19614,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
if (!c->is_client) tls->is_twoway = true; // server + CA: two-way auth
}
if (opts->cert.buf == NULL) {
if (opts->cert.buf == NULL || opts->cert.len == 0) {
MG_VERBOSE(("No certificate provided"));
goto xit;
}
@@ -19631,7 +19643,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
}
// parse PEM or DER EC key
if (opts->key.buf == NULL) {
if (opts->key.buf == NULL || opts->key.len == 0) {
mg_error(c, "Certificate provided without a private key");
return;
}
+14 -2
View File
@@ -1931,6 +1931,18 @@ static int mg_tls_recv_cert(struct mg_connection *c, bool is_client) {
} // else r = 0 or -2 => subj not found or pubkey not matching
}
// Single CA: accept the chain if the CA itself is in it, e.g. a
// cross-signed copy of the root. Same subject and same public key
// means the same trusted key, and the links below ci are verified
if (tls->ca_der.len > 0 && ca.subj.len == ci->subj.len &&
memcmp(ca.subj.value, ci->subj.value, ca.subj.len) == 0 &&
ca.pubkey.len == ci->pubkey.len &&
memcmp(ca.pubkey.buf, ci->pubkey.buf, ca.pubkey.len) == 0) {
found_ca = true;
MG_VERBOSE(("CA found in chain at depth %d", certnum - 1));
break;
}
if (certnum == sizeof(certs) / sizeof(certs[0]) - 1) {
mg_error(c, "too many certificates in the chain");
return -1;
@@ -2733,7 +2745,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
if (!c->is_client) tls->is_twoway = true; // server + CA: two-way auth
}
if (opts->cert.buf == NULL) {
if (opts->cert.buf == NULL || opts->cert.len == 0) {
MG_VERBOSE(("No certificate provided"));
goto xit;
}
@@ -2762,7 +2774,7 @@ void mg_tls_init(struct mg_connection *c, const struct mg_tls_opts *opts) {
}
// parse PEM or DER EC key
if (opts->key.buf == NULL) {
if (opts->key.buf == NULL || opts->key.len == 0) {
mg_error(c, "Certificate provided without a private key");
return;
}
+1
View File
@@ -309,6 +309,7 @@ mip_diabish: CC = gcc
mip_diabish: CFLAGS += -std=gnu89 -Werror=declaration-after-statement -Werror=vla -Wno-pedantic
mip_diabish: mip_test
mip_vc98: MDASH = 0
mip_vc98: mip_test.c mongoose.c mongoose.h packed_fs.c Makefile
$(DOCKER) mdashnet/vc98 wine cl mip_test.c packed_fs.c $(VCFLAGS) $(DEFS) $(TFLAGS) /Fe$@.exe
$(DOCKER) -e WINEPREFIX=/tmp/wineprefix mdashnet/vc98 wine $@.exe
+1
View File
@@ -593,6 +593,7 @@ bool mip_x_test(struct mg_mgr *mgr) {
// Clear
s_error = false;
mg_mgr_poll(mgr, 0); // prevent mDash from trashing mg_mgr_free()
mg_mgr_free(mgr);
ASSERT(mgr->conns == NULL); // Deconstruction OK
printf("HEALTH_DASHBOARD\t\"cleanup\": %s\n", s_error ? "false":"true");
+1 -1
View File
@@ -12,7 +12,7 @@
#define MQTT_QOS 1
#define MQTT_RECONNECT_PERIOD_MS 3000
#define TLS_CA ""
#define TLS_CA "" // Use https://mongoose.ws/tls/
#define TLS_KEY ""
#define TLS_CRT ""
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-f429zi-dashboard-full
# Nucleo-F429ZI Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-f746zg-dashboard-full
# Nucleo-F746ZG Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-f756zg-dashboard-full
# Nucleo-F756ZG Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-h743zi-dashboard-full
# Nucleo-H743ZI Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-n657x0-q-dashboard-full
# Nucleo-N657X0-Q Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/nucleo-u5a5zj-q-dashboard-full
# Nucleo-U5A5ZJ-Q Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/portenta-h7-dashboard-full
# Portenta H7 Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project https://github.com/mongoose-examples/stm32h573i-dk-dashboard-full
# STM32H573I-DK Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the
@@ -1,3 +1,5 @@
See full project at https://github.com/mongoose-examples/stm32h747i-disco-dashboard-full
# STM32H747I-DISCO Mongoose Integration
This guide explains how to bring up a production-grade Web UI dashboard on the