Skip to content
This repository was archived by the owner on Jan 29, 2023. It is now read-only.

Commit c40546a

Browse files
authored
v1.1.1
### Release v1.1.1 1. Permit sites with "Chain could not be linked to a trust anchor" such as mqtt.thingstream.io. 2. Add example MQTTS_ThingStream to demonstrate new feature
1 parent 934dac2 commit c40546a

File tree

2 files changed

+47
-10
lines changed

2 files changed

+47
-10
lines changed

src/SSLClient/bearssl/src/x509/x509_minimal.c

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,15 +301,33 @@ xm_end_chain(const br_x509_class **ctx)
301301
br_x509_minimal_context *cc;
302302

303303
cc = (br_x509_minimal_context *)(void *)ctx;
304-
if (cc->err == 0) {
305-
if (cc->num_certs == 0) {
304+
305+
if (cc->err == 0)
306+
{
307+
if (cc->num_certs == 0)
308+
{
306309
cc->err = BR_ERR_X509_EMPTY_CHAIN;
307-
} else {
308-
cc->err = BR_ERR_X509_NOT_TRUSTED;
310+
}
311+
else
312+
{
313+
// KH mod to permit BR_ERR_X509_NOT_TRUSTED
314+
#if 1 //PERMIT_X509_NOT_TRUSTED
315+
316+
//cc->err = BR_ERR_X509_NOT_TRUSTED;
317+
cc->err = BR_ERR_X509_OK;
318+
return 0;
319+
320+
#else
321+
cc->err = BR_ERR_X509_NOT_TRUSTED;
322+
#endif
323+
//////
309324
}
310-
} else if (cc->err == BR_ERR_X509_OK) {
325+
}
326+
else if (cc->err == BR_ERR_X509_OK)
327+
{
311328
return 0;
312329
}
330+
313331
return (unsigned)cc->err;
314332
}
315333

@@ -319,6 +337,7 @@ xm_get_pkey(const br_x509_class *const *ctx, unsigned *usages)
319337
br_x509_minimal_context *cc;
320338

321339
cc = (br_x509_minimal_context *)(void *)ctx;
340+
322341
if (cc->err == BR_ERR_X509_OK
323342
|| cc->err == BR_ERR_X509_NOT_TRUSTED)
324343
{

src/SSLClient/bearssl/src/x509/x509_minimal.t0

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -250,15 +250,33 @@ xm_end_chain(const br_x509_class **ctx)
250250
br_x509_minimal_context *cc;
251251

252252
cc = (br_x509_minimal_context *)(void *)ctx;
253-
if (cc->err == 0) {
254-
if (cc->num_certs == 0) {
253+
254+
if (cc->err == 0)
255+
{
256+
if (cc->num_certs == 0)
257+
{
255258
cc->err = BR_ERR_X509_EMPTY_CHAIN;
256-
} else {
257-
cc->err = BR_ERR_X509_NOT_TRUSTED;
259+
}
260+
else
261+
{
262+
// KH mod to permit BR_ERR_X509_NOT_TRUSTED
263+
#if 1 //PERMIT_X509_NOT_TRUSTED
264+
265+
//cc->err = BR_ERR_X509_NOT_TRUSTED;
266+
cc->err = BR_ERR_X509_OK;
267+
return 0;
268+
269+
#else
270+
cc->err = BR_ERR_X509_NOT_TRUSTED;
271+
#endif
272+
//////
258273
}
259-
} else if (cc->err == BR_ERR_X509_OK) {
274+
}
275+
else if (cc->err == BR_ERR_X509_OK)
276+
{
260277
return 0;
261278
}
279+
262280
return (unsigned)cc->err;
263281
}
264282

0 commit comments

Comments
 (0)