You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CMakeLists.txt
+2Lines changed: 2 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -232,6 +232,8 @@ option(LWS_CTEST_INTERNET_AVAILABLE "CTest will performs tests that need the Int
232
232
#
233
233
option(LWS_WITH_SSL"Include SSL support (defaults to OpenSSL or similar, mbedTLS if LWS_WITH_MBEDTLS is set)"ON)
234
234
option(LWS_WITH_MBEDTLS"Use mbedTLS (>=2.0) replacement for OpenSSL. When setting this, you also may need to specify LWS_MBEDTLS_LIBRARIES and LWS_MBEDTLS_INCLUDE_DIRS"OFF)
235
+
option(LWS_WITH_BEARSSL"Use BearSSL replacement for OpenSSL. When setting this, you also may need to specify LWS_BEARSSL_LIBRARIES and LWS_BEARSSL_INCLUDE_DIRS"OFF)
236
+
set(LWS_BEARSSL_PROFILE "full"CACHESTRING"BearSSL profile to use (e.g. full, client, minimal)")
235
237
option(LWS_WITH_SCHANNEL"Use Windows SChannel for SSL"OFF)
236
238
option(LWS_WITH_BORINGSSL"Use BoringSSL replacement for OpenSSL"OFF)
Copy file name to clipboardExpand all lines: READMEs/README.build-windows.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,16 @@ additional CMake options on lws:
122
122
-DLWS_WITH_MBEDTLS=TRUE
123
123
```
124
124
125
+
### Alternative: BearSSL (or OpenSSL/MbedTLS, see above)
126
+
127
+
BearSSL is a highly optimized, minimalistic alternative to OpenSSL and MbedTLS. It is easily cross-compiled or built on Windows. Note that BearSSL currently does not support DTLS. To use it, simply provide the include and library paths:
Copy file name to clipboardExpand all lines: READMEs/README.build.md
+14-6Lines changed: 14 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -334,6 +334,8 @@ plugins and lwsws.
334
334
- If you are really restricted on memory, code size, or don't care about TLS
335
335
speed, mbedTLS is a good choice: `cmake .. -DLWS_WITH_MBEDTLS=1`
336
336
337
+
- If you want an extremely lightweight, highly optimized TLS library with a minimal memory footprint and fast execution speed, BearSSL is a strong alternative: `cmake .. -DLWS_WITH_BEARSSL=1`. Note that BearSSL currently does not support DTLS.
338
+
337
339
- If cpu and memory is not super restricted and you care about TLS speed,
338
340
OpenSSL or a directly compatible variant like Boring SSL is a good choice.
339
341
@@ -354,12 +356,18 @@ Lws supports both almost the same, so instead of taking my word for it you are
354
356
invited to try it both ways and see which the results (including, eg, binary
355
357
size and memory usage as well as speed) suggest you use.
356
358
357
-
NOTE: one major difference with mbedTLS is it does not load the system trust
358
-
store by default. That has advantages and disadvantages, but the disadvantage
359
-
is you must provide the CA cert to lws built against mbedTLS for it to be able
360
-
to validate it, ie, use -A with the test client. The minimal test clients
361
-
have the CA cert for warmcat.com and libwebsockets.org and use it if they see
362
-
they were built with mbedTLS.
359
+
NOTE: one major difference with mbedTLS and BearSSL is they do not natively load the OS trust
360
+
store by default in the same way OpenSSL does.
361
+
362
+
For mbedTLS, you must provide the CA cert to lws for it to be able
363
+
to validate it, ie, use `-A` with the test client.
364
+
365
+
For BearSSL, LWS implements a multi-cert PEM parser and fallback sequence to emulate OpenSSL's behavior:
366
+
1. It checks the `SSL_CERT_FILE` and `SSL_CERT_DIR` environment variables for runtime overrides.
367
+
2. It falls back to probing standard OS locations (e.g. `/etc/ssl/certs/ca-certificates.crt`).
368
+
3. It defaults to the CMake-configured `LWS_OPENSSL_CLIENT_CERTS` if all else fails.
369
+
370
+
This allows BearSSL to validate most system certificates out of the box on Linux. The minimal test clients also automatically include the CA cert for warmcat.com if they see they were built with mbedTLS or BearSSL.
0 commit comments