libwebsockets icon indicating copy to clipboard operation
libwebsockets copied to clipboard

WolfSSL not compatible with LWS due to missing SSL_CTX_use_certificate_ASN1

Open 0xg0nz0 opened this issue 1 year ago • 0 comments

Error:

[build] /workspaces/iggy-cpp-client/build/libwebsockets/src/lws/lib/tls/openssl/openssl-client.c:1100:21: error: implicit declaration of function 'SSL_CTX_use_certificate_ASN1'; did you mean 'SSL_CTX_use_certificate_file'? [-Werror=implicit-function-declaration]
[build]  1100 |                 n = SSL_CTX_use_certificate_ASN1(vh->tls.ssl_client_ctx,
[build]       |                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
[build]       |                     SSL_CTX_use_certificate_file

In WolfSSL the OpenSSL compatibility layer is incomplete, and this is one of the missing functions. You need to load the certificate from a file or wolfSSL_CTX_use_certificate_buffer and pass SSL_FILETYPE_ASN1 to specify ASN.1 format certificates.

Versions:

  • CMake 3.22.1
  • gcc 11.4.0
  • Ubuntu 22.04
  • WolfSSL 5.6.6 built from vcpkg
  • LWS v4.3.3 from GitHub
  • args: -DLWS_WITH_WOLFSSL=1 -DLWS_WOLFSSL_INCLUDE_DIRS=${WOLFSSL_INCLUDE_DIR} -DLWS_WOLFSSL_LIBRARIES=${WOLFSSL_INSTALL_DIR}/lib

0xg0nz0 avatar Feb 23 '24 16:02 0xg0nz0