1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

525 commits

Author SHA1 Message Date
Alexander Couzens
d7b6c04aaf CMakeLists: build reproducible by default
Using the build user and build hostname as part of the git hash breaks
reproducible builds. Make this part optional, but build reproducible by
default.
2017-12-10 08:48:09 +08:00
Andy Green
8487279e64 plat: remove esp8266
ESP32 module price is now within range of 8266 price.

ESP32 capability and OS support is hugely better than 8266,
we can support mbedtls tls, http/2 etc with ESP32.

I'm no longer testing on ESP8266... there's no more
user traffic... it's time to go.
2017-12-01 11:37:36 +08:00
Alexey Reznichenko
93846135f2 Add a flag to disable CMake exports
Add LWS_EXPORT_LWSTARGETS (defaults to ON) that can be used to disable
  CMake export targets as well as install export for libwebsockets.

AG: add _WITH_
2017-12-01 11:37:35 +08:00
Andy Green
5b74d7108b gcov: add in cmake and adapt defaults
1) Introduce LWS_WITH_GCOV to build with gcc / clang coverage instrumentation.

$ cd build
$ make clean && rm -f `find . -name "*.gcno" -o -name "*.gcda"` && make -j16 && sudo make install && sudo /usr/local/bin/libwebsockets-test-server -s
...
$ gcov `find . -name *.c.gcno | grep -v test-apps` -b | sed "/\.h.\$/,/^$/d"

The above are available in two helper scripts

 - scripts/build-gcov.sh
 - scripts/gcov.sh

2)

CMake defaults changed:

 - LWS_WITH_ZIP_FOPS: OFF
 - LWS_WITH_RANGES: OFF
 - LWS_WITHOUT_EXTENSIONS: ON
 - LWS_WITH_ZLIB: OFF

New CMake controls that default-OFF:

 - LWS_WITH_GENHASH
 - LWS_WITH_GENRSA

these are implied by LWS_WITH_JWS (which is implied by LWS_WITH_ACME)

3) rename ./lib/tls/XXX/server.c and client.c to XXX-server.c / XXX-client.c.

This is because gcov dumps its results using the .c filename part only,
the copies overwrite each other if there are different .c files in the tree
with the same filename part.

4) Add onetime test-client mode and test to ./test-apps/attack.sh

5) Add gcov howto in READMEs/README.build.md using attack.sh
2017-12-01 11:37:35 +08:00
Ben Delarre
dcf5a83ee4 esp32: move check for xxd and genromfs from CMake to esp32.mk 2017-12-01 11:37:35 +08:00
Andy Green
37e8ee2c00 windows: CHECK_FUNCTION_EXISTS workaround 2017-12-01 11:37:35 +08:00
Andy Green
3ec7c1ab21 ACME client plugin
This adds support for a plugin that can be attached to a vhost
to acquire and maintain its TLS cert automatically.

It works the same with both OpenSSL and mbedTLS backends, but
they can't share auth keys, delete the 'auth.jwk' file as it is
in the example JSON when switching between libs
2017-12-01 11:37:35 +08:00
Ralph Lessmann
33b40e0ae4 mingw: fixes 2017-12-01 11:37:33 +08:00
Andy Green
53bbc6be33 cmake: dont build ssh stuff if no SSL enabled 2017-11-28 07:57:36 +08:00
Adam Wolk
2befafca77 cmake: only generate test cert when SERVER and TESTAPPS enabled
apart from LWS_WITHOUT_TEST_SERVER the test server will also not be
built if LWS_WITHOUT_TESTAPPS or LWS_WITHOUT_SERVER is defined,
we update the CMake configuration to skip cert generation and
installation in those cases.

Signed-off-by: Adam Wolk <adam.wolk@koparo.com>
2017-11-26 19:17:06 +08:00
Andy Green
00ffebfd24 tls: add x509 query api
This adds a single api on lws that allows querying elements from the
peer certificate on a connection.

The api works the same regardless of the TLS backend.
2017-11-26 19:16:17 +08:00
Andy Green
41d1326da0 appveyor artifacts debug 2017-11-26 19:16:17 +08:00
Andy Green
97cd393649 cmake: refactor options into groups and move to top of file 2017-11-26 19:16:17 +08:00
Andy Green
278e520479 JWK + JWS: JSON Web Keys RFC7517 + Signatures support RFC7515
This adds some optional apis around JSON Web Keys and JSON Web Signatures.

HMAC SHA256/384/512 and RSA + SHA256/384/512 are supported.

This also add a new "LWS_WITH_SELFTESTS" that enables the selftests.
2017-11-26 19:07:12 +08:00
Andy Green
c32a22c20b lws-genrsa: add resuable backend-independent rsa decrypt in tls/ and migrate sshd to it 2017-11-10 16:56:44 +08:00
Andy Green
dd3e5619cb lws_genhash: add HMAC
Like the simple hashes, these work the same regardless of if the backend is
OpenSSL or mbedTLS.

Also move into ./lib/tls/ and split into two specific to mbedtls or openssl
backends.
2017-11-10 16:56:44 +08:00
Andy Green
46ee0713de hpack: pseudoheader check improvement 2017-11-10 11:01:25 +08:00
Andy Green
5a90bb36d1 lejp: add test app to parse stdin 2017-10-26 18:55:12 +08:00
Andy Green
f9421f084b lejp: integrate header into libwebsockets.h 2017-10-26 18:55:11 +08:00
Andy Green
505a3fc1fc windows: finally fix gzip redefinition warnings 2017-10-26 18:55:11 +08:00
Andy Green
1c70181ca2 build: enable signed vs unsigned warnings on gcc
This enables selected things from -Wextra, can't use -Wextra because it is
fussy enough to complain about unused params on functions... they are
there for a reason.

-Wsign-compare
-Wignored-qualifiers
not -Wimplicit-fallthrough=3 ... only on gcc 7
-Wtype-limits
-Wuninitialized
not -Wclobbered ... only on gcc 7ish

fix the warnings everywhere they were found.
2017-10-25 07:17:29 +08:00
Andy Green
89cb55ea58 tls: split out common, openssl and mbedtls code
- introduce lib/tls/mbedtls lib/tls/openssl
 - move wrapper into lib/tls/mbedtls/wrapper
 - introduce private helpers to hide backend

This patch doesn't replace or remove the wrapper, it moves it
to lib/tls/mbedtls/wrapper.

But it should be now that the ONLY functions directly consuming
wrapper apis are isolated in

  - lib/tls/mbedtls/client.c (180 lines)
  - lib/tls/mbedtls/server.c (317 lines)
  - lib/tls/mbedtls/ssl.c    (325 lines)

In particular there are no uses of openssl or mbedtls-related
constants outside of ./lib/tls any more.
2017-10-25 07:17:29 +08:00
Andy Green
fcf5b2c25a v2.4.0 2017-10-17 13:21:12 +08:00
Andy Green
c83afc66e6 refactor: subdirs for source in lib
Split out some optional code into own sources to
shrink down libwebsockets.c and server.c a bit
2017-10-16 17:28:37 +08:00
Andy Green
904a9c0920 http2: make usable
HTTP/2 support is now able to serve the test server, complete with
websockets, from a single vhost.

 - This works the same with both OpenSSL and mbedTLS.

 - POST is now wired up and works (also for file upload).

 - CGI is wired up and works.

 - Redirect is adapted and works

 - lwsws works.

 - URI urldecode, sanitation and argument parsing wired up for :path

valgrind clean (aside from openssl-style false uninit data usage in mbedtls send occasionally)

h2spec reports:

$ h2spec  -h 127.0.0.1 -p 7681 -t -k -o 1
...
145 tests, 145 passed, 0 skipped, 0 failed"

Incorporates:

 - "https://github.com/warmcat/libwebsockets/pull/1039
	Fixes issue with -Werror=unused-variable flag

 - 2c843a1395
	ssl: fix infinite loop on client cert verification failure

Signed-off-by: Petar Paradzik <petar.paradzik@sartura.hr>"

Caused and fixes Coverity 184887 - 184892
2017-10-16 17:13:49 +08:00
Andy Green
fc995df480 CMake: convert all LWS_USE_... to LWS_WITH_...
Almost all the CMake options begin with LWS_WITH_..., but many of the
symbols passed to lws are LWS_USE_... , this causes neededless confusion,
compounded by the fact that a few CMake options also begin with
LWS_USE_.

This patch globally converts all LWS_USE_... to LWS_WITH_..., so there
is only one prefix to remember in both CMake and the code.

The affected public CMake options are

LWS_USE_BORINGSSL     ->  LWS_WITH_BORINGSSL
LWS_USE_CYASSL        ->  LWS_WITH_CYASSL
LWS_USE_WOLFSSL       ->  LWS_WITH_WOLFSSL
LWS_USE_MBEDTLS       ->  LWS_WITH_MBEDTLS
LWS_USE_BUNDLED_ZLIB  ->  LWS_WITH_BUNDLED_ZLIB
2017-10-16 17:13:48 +08:00
Andy Green
7597ac3766 Plugins: add ssh-base ssh server plugin 2017-10-16 16:59:57 +08:00
Alexander von Gluck IV
8bea6c144e Subject: Haiku: initial platform support
https://github.com/warmcat/libwebsockets/pull/1033
2017-09-27 08:24:05 +08:00
Andy Green
4f267c515e clean up top level of project 2017-09-27 08:24:05 +08:00
Andy Green
98df6722ea LWS_WITH_PEER_LIMITS
Introduces an optional, settable restriction on the number of
simultaneous wsi connections and ah that a single peer IP can
obtain.

The default is disabled for build, and if enabled, unlimited.

However when enabled at CMake, setting info.ip_limit_ah and / or
info.ip_limit_wsi at context creation time will enforce the limits.

Connections past the info.ip_limit_wsi limit are dropped, and
connections needing an ah are forced to stay in the ah waiting list
even when ah are available, while the peer is at the number of
ah in info.ip_limit_ah.
2017-09-19 12:09:17 +08:00
Andy Green
dee2d68b9c cmake: add confirm_command macro and use for genromfs + xxd on ESP32 build
Solves the exact issue in

https://github.com/warmcat/libwebsockets/issues/1021
2017-09-19 12:09:17 +08:00
Andy Green
ca3013ca38 enable -Wundef for UNIX to catch dependencies on preprocessor defines that do not actually exist in the build 2017-09-19 12:08:31 +08:00
Andy Green
0186490fad lws-genhash
This gives you a thin api on top of your TLS library digest functions
which abstracts away whether you are using mbedtls apis or openssl
ones.  Using lws_genhash... apis the same code works either way and
the dependencies on which TLS lib is hidden.
2017-09-10 14:44:12 +08:00
Andy Green
37b994cc69 mbedtls: find LWS_HAVE_X509_VERIFY_PARAM_set1_host in CMake 2017-09-09 08:54:58 +08:00
Andy Green
8cb341314a esp32: unbreak cert gen from mbedtls integration 2017-09-08 20:56:04 +08:00
Andy Green
6d25763d10 esp32: fixes for mbedtls breakout 2017-08-29 08:45:36 +08:00
Andy Green
c0c217bd5a mbedtls: isgnore ECDH_H existence and try to find mbedtls libs + includes by default 2017-08-29 08:45:36 +08:00
Juraj Vijtiuk
41909eac97 mbedtls: Add mbedTLS backend support 2017-08-28 20:22:20 +08:00
Juraj Vijtiuk
77a71e94d1 mbedtls: Add mbedTLS wrapper
This wrapper has come from Espressif's esp-idf

https://github.com/espressif/esp-idf/tree/master/components/openssl

under Apache 2.0, at or around commit

3e4627479b6fff6b652de6d2f0302101e51ee5c2
2017-08-28 20:13:58 +08:00
Juraj Vijtiuk
ea5638cb2c mbedtls: Force mbedTLS usage when built for ESP32 2017-08-28 20:13:48 +08:00
Juraj Vijtiuk
3aaf38d3d8 mbedtls: Add mbedTLS support to CMakeLists.txt 2017-08-28 20:12:32 +08:00
Andy Green
e6bd6296bd v2.3.0 2017-07-28 14:27:25 +08:00
Andy Green
19a320a578 http2: remove cmake option leave code in for now
https://github.com/warmcat/libwebsockets/issues/979
2017-07-25 17:36:31 +08:00
Andy Green
6f11c1361a lws-meta 2017-07-19 08:59:42 +08:00
Andy Green
7262e14dc1 lws_intptr_t 2017-07-07 08:32:04 +08:00
Andy Green
0b629d4037 test-server-libev: disable Werror just on server-libev.c to workaround libev dirt 2017-06-28 11:37:15 +08:00
Andy Green
5939d3a961 test servers: convert to static inclusion of plugins
This eliminates the duplicated implementations of the test protocols,
except dumb-increment (which requires libuv).

This has various advantages, including bringing all the test servers
up to the same set of protocols support.

Triggered by finding a bug in server status protocol that was long
ago fixed in the plugins version.
2017-06-28 11:16:48 +08:00
Andy Green
12a9592426 cmake: fix logic for individual test client build disable 2017-06-28 09:50:54 +08:00
Andy Green
3ff720ff66 support openssl info callback
https://github.com/warmcat/libwebsockets/issues/936
2017-06-20 11:46:49 +08:00
Andy Green
1725332d47 pkgconfig
https://github.com/warmcat/libwebsockets/issues/933
2017-06-19 12:29:48 +08:00