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

42 commits

Author SHA1 Message Date
Andy Green
638558a4db openssl: only use pc libs if no find_package 2024-01-15 09:18:48 +00:00
Fabrice Fontaine
f18fc2316f lib/tls/CMakeLists.txt: fix wolfssl build with pkg-config 2023-12-27 06:36:59 +00:00
zzblydia
5442cf7ebf cmake: ssl lib paths
replace PC_OPENSSL_LIBRARIES with PC_OPENSSL_LINK_LIBRARIES to link library with absolute path.
2023-11-23 09:45:12 +00:00
Andy Green
2da771b129 cmake: mbedtls: mbedtls_ssl_conf_alpn_protocols check 2023-11-02 09:55:50 +00:00
Andy Green
e71398c02a mbedtls: auto adapt to changed session constant 2023-10-31 10:51:20 +00:00
Fabrice Fontaine
c83cf48b90 lib/tls/CMakeLists.txt: fix build without threads
openssl can be built without threads resulting in the following build
failure:

-- Looking for HMAC_CTX_new
-- Looking for HMAC_CTX_new - not found

[...]

In file included from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets.h:661,
                 from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/core/./private-lib-core.h:140,
                 from /home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/lib/plat/unix/unix-misc.c:28:
/home/buildroot/autobuild/instance-0/output-1/build/libwebsockets-4.3.1/include/libwebsockets/lws-genhash.h:85:18: error: field 'ctx' has incomplete type
   85 |         HMAC_CTX ctx;
      |                  ^~~

To fix this build failure, don't unconditionally add pthread if openssl
has been found through pkg-config as openssl.pc will contain the
appropriate dependencies (i.e. -lpthread but also -lz or -latomic)

Fixes:
 - http://autobuild.buildroot.org/results/2ae9e3249b6fcc9e6c30e7783e264fc6599e61df

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-06-14 07:37:03 +01:00
Andy Green
19d9869af6 lejp: increase default complexity limits 2022-06-14 07:36:57 +01:00
Fabrice Fontaine
079726c4b2 tls: cmake: add wolfssl pkg-config support
Use pkg-config to search for wolfssl.pc which is available since version
3.3.3 and
a50af85e95

This will avoid setting manually LWS_WOLFSSL_{INCLUDE_DIRS,LIBRARIES}

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2022-04-22 07:41:11 +01:00
Andy Green
0ca97586d6 mbedtls: improve api detection
mbedtls cmake api detection was not able to work on esp-idf well.

Improve diagnostics and reaction if we ever see that again.
2022-02-01 11:09:48 +00:00
Ferenc Gerlits
133063fc68 cmake: fix compilation with OpenSSL subproject
https://github.com/warmcat/libwebsockets/pull/2535
2022-01-16 10:48:16 +00:00
Andy Green
b8c4820be4 openssl: support SSLKEYLOGFILE client secret logging
This patch checks for the env var SSLKEYLOGFILE=path, if present, then
client connection tls secrets are appended into path.vhostname.

This allows decryption of captured encrypted data for debugging purposes.

SSKEYLOGFILE=path env var method is the same as provided by Firefox and
Chrome for this purpose.
2021-12-13 19:02:49 +00:00
Andy Green
53d195022f cmake: Enable WITH_MINIMAL_EXAMPLES by default
Although many of the examples must be run from the example directory as
cwd, everyone getting started probably wants to try the examples, cmake
knows how to do it, so let's enable it by default.
2021-11-11 11:52:46 +00:00
Andy Green
67f532a8c6 cmake: bring tls include requirement out as PUBLIC
There's no problem for library build, also with LWS_WITH_MINIMAL_EXAMPLES,
but after install at least on OSX, there are problems finding the installed
lws include dir (concealed on most platforms by the path being in the
default search list for the toolchain), and the references in the lws
includes to the tls includes meaning that explicit paths for that must be
available at consuming cmakes.

This patch enhances the cmake config installed by lws to deal with adding
the lws include paths to CMAKE_REQUIRED_INCLUDES and include_directories,
so it can be found before the target is introduced.

The tls include is passed back up the CMakeLists layers and the lws targets
marked with target_include_directories(PUBLIC) with them, so they are
understood as needed by consumers.

More boilerplate is moved out of the example consuming cmakes.

After this, on machines with previous installs of older lws, you may have to
clean out the cmake install path, that is usually something like

/usr/local/lib/cmake/libwebsockets/*

before make installing lws and putting the latest content in there.
2021-10-28 08:12:48 +01:00
Orefkov Aleksander
f0e4eac10b cmake: wrong miniz include dir + mbed link on windows 2021-10-12 09:16:26 +01:00
Andy Green
a8a443e645 wolfssl: update gencrypto 2021-09-08 09:42:11 +01:00
Yucong Sun
81e54df04d cmake: tls: check correct api for availability 2021-07-20 10:34:03 +01:00
Nikias Bassen
ed7215f373 cmake: mbedtls: extra CMAKE_REQUIRED_INCLUDES
Make sure MBEDTLS_INCLUDE_DIRS and MBEDTLS_LIBRARIES are set in parent CMakeLists

Also set MBEDTLS_INCLUDE_DIRS in CMAKE_REQUIRED_INCLUDES so the CHECK_C_SOURCE_COMPILES
checks actually evaluate properly.
2021-07-13 08:27:27 +01:00
Andy Green
2f9bb7a30a tls: JIT Trust
Add support for dynamically determining the CAs needed to validate server
certificates.  This allows you to avoid instantiating > 120 X.509 trusted
CA certs and have them take up heap the whole time.

Works for both openssl and mbedtls.

See READMEs/README.jit-trust.md for the documentation

You likely want the next patch for http redirect enhancements as well.
2021-06-22 15:55:29 +01:00
Andy Green
983edafdb4 mbedtls: add AKID and SKID support 2021-06-22 15:55:29 +01:00
kekxv
c61ce6f07f cmake: tls: use CHECK_SYMBOL_EXISTS 2021-06-15 15:17:34 +01:00
Yucong Sun
abada11fe1 cmake: Allow OPENSSL_INCLUDE_DIR to be empty
on some system the include dir is empty, and the detection will miss a lot of functions and fail to compile.
2021-04-29 05:29:58 +01:00
Andy Green
aa6b3f418e mbedtls: allow central trust store preload
Mbedtls does not have the same concept as openssl about preloading the
system trust store into every SSL_CTX.

This patch allows you to simulate the behaviour by passing in a context
creation-time filepath that all client SSL_CTX will be initialized from.
2021-04-15 19:10:54 +01:00
Mykola Stryebkov
0d06d4bad2 windows: work well with vcpkg pthreads 2021-04-05 10:55:04 +01:00
Andy Green
9483df3b17 openssl: check for X509_VERIFY_PARAM_set1_host also using CHECK_SYMBOL_EXISTS 2021-04-04 17:20:07 +01:00
Andy Green
7451702722 tls-sessions: serialization 2021-04-04 05:45:53 +01:00
Andy Green
e2f1dd1c82 mbedtls: session cache and resume 2021-04-04 05:44:08 +01:00
Catalin
d5753b6298 tls: openssl-only: client-only: session caching 2021-04-04 05:34:11 +01:00
Andy Green
8e5f8491db opensslv3: handle deprecation of EC apis
openssl v3-alpha11 has marked EC_KEY pieces as deprecated... we use it in
LWS_WITH_GENCRYPTO but the related RSA etc pieces were already deprecated
for that.  We use EC_KEY pieces in vhost init...

The apis are not removed but deprecated, we should have a way to keep
trucking, but as it is the deprecation warning is promoted to an error.

Let's add LWS_SUPPRESS_DEPRECATED_API_WARNINGS option off by default.  If
enabled at cmake, external deprecated api warnings are suppressed.  This
gives a general workaround for now for opensslv3.

In addition, even if you don't do that, let's notice we are on openssl v3
and don't build the EC curve selection stuff, I don't think anyone is
actually using it anyway.
2021-02-17 11:39:15 +00:00
Andy Green
1f019f99f4 libressl: adapt type rules
Update libressl rules for options api type,
add some docs to build, use CHECK_SYMBOL_EXISTS since
CHECK_FUNCTION_EXISTS is fooled by the conditionals
in the headers
2021-02-17 11:39:15 +00:00
Andy Green
a8d6ac8923 netbsdBE: enable ctest and fix test cert generation
NetBSD test server cert gen lacked a CN, add it for localhost

Enable Sai -j6 from -j4 for netbsdBE... it's slow but it is SMP

Add build in sai for secure-streams-proxy scenario
2021-01-05 10:56:38 +00:00
Andy Green
9b42fc6aae NetBSD: also need two-arg setpgid
Enable sai
2020-12-07 11:31:53 +00:00
Andy Green
8b82560014 cmake: netbsd: no libdl 2020-12-06 19:39:35 +00:00
Orgad Shaneh
471dbf5280 cmake: mingw: fix openssl linkage
ws32 and friends must come after the openssl libs,
and pthread is required for openssl.
2020-09-18 11:37:17 +01:00
Andy Green
008b355166 freertos: fixes for build on atmel xdk 2020-09-03 12:49:54 +01:00
SCRockz
ad7b17f437 cmake: qnx adaptations
https://github.com/warmcat/libwebsockets/issues/2034
2020-09-03 08:18:52 +01:00
Andy Green
4cd381f933 cmake: tls: wolfssl
PARENT_SCOPE needs adjusting in a few places for wolfssl to work, and
we need a second level export of USE_WOLFSSL through lib/CMakeLists.txt

Add noi/f32 Sai build for WOLFSSL + MINIMAL_EXAMPLES
2020-08-10 15:04:10 +01:00
Andy Green
30e6c22e14 openssl3: migrate genhmac to EVP
The low level apis for HMAC (including those only introduced at 1.1.0...)
are all deprecated in OpenSSL v3.

Let's bite the bullet and migrate to EVP, it's already existing in modern
OpenSSL and we already use it for genhash.

EVP needs a PKEY, sort that out and keep it around until the hmac is
destroyed.
2020-06-16 19:45:35 +01:00
Andy Green
2a772776a9 windows: for data exports use explicit extern
LWS_EXTERN needs to be empty for windows when declaring functions in the
headers.  But for data, it needs the explicit extern otherwise on windows
or mingw based builds, it thinks we are redeclaring the data each time.
2020-06-07 07:53:36 +01:00
Andy Green
d5773c01be openssl-v3: deal with deprecated SSL_CTX_load_verify_locations
Add Sai for openssl-v3 and for boringssl
2020-06-02 08:37:10 +01:00
Andy Green
f98e4a845c sai: add f32 plus openssl-v3 combination 2020-06-02 08:37:10 +01:00
Andy Green
911898ad70 windows: recent win10 support Unix Domain
Allow selection of Unix Domain Sockets on windows since it is supported
for the last couple of years on windows 10

https://devblogs.microsoft.com/commandline/af_unix-comes-to-windows/

... if only they could add a full set of posix pieces to go with it
(and abstract namespace UDS which doesn't work apparently) so that
the parts dealing with uid / gid don't have to be disabled.
2020-06-02 08:37:10 +01:00
Andy Green
b3131fdfdd cmakelist: Augean Stables refactor
Establish a new distributed CMake architecture with CMake code related to
a source directory moving to be in the subdir in its own CMakeLists.txt.
In particular, there's now one in ./lib which calls through to ones
further down the directory tree like ./lib/plat/xxx, ./lib/roles/xxx etc.

This cuts the main CMakelists.txt from 98KB -> 33KB, about a 66% reduction,
and it's much easier to maintain sub-CMakeLists.txt that are in the same
directory as the sources they manage, and conceal all the details that that
level.

Child CMakelists.txt become responsible for:

 - include_directories() definition (this is not supported by CMake
   directly, it passes it back up via PARENT_SCOPE vars in helper
   macros)

 - Addition child CMakeLists.txt inclusion, for example toplevel ->
   role -> role subdir

 - Source file addition to the build

 - Dependent library path resolution... this is now a private thing
   in the child CMakeLists.txt, it just passes back any adaptations
   to include_directories() and the LIB_LIST without filling the
   parent namespace with the details
2020-05-27 08:40:12 +01:00