[Libwebsockets] cmake: Failed to generate SSL certificate for Test Server using cmd.exe

biolaser at frii.com biolaser at frii.com
Fri Feb 12 03:21:51 CET 2021


Additional info:

In the same shell the cmake executed in, I ran the following commands
manually to see if further diagnostic errors would appear - here is the
output generated:

C:\usr\libwebsockets\libwebsockets\build>set
OPENSSL_INPUT_WIN_PATH=C:\usr\libwebsockets\libwebsockets\build\openssl_input.txt

C:\usr\libwebsockets\libwebsockets\build>"C:/Strawberry/c/bin/openssl.exe"
req -new -newkey rsa:2048 -days 10000 -nodes -x509 -keyout
"C:/usr/libwebsockets/libwebsockets/build/libwebsockets-test-server.key.pem"
-out
"C:/usr/libwebsockets/libwebsockets/build/libwebsockets-test-server.pem"
Can't open C:/Strawberry/c/ssl/openssl.cnf for reading, No such file or
directory
15316:error:02001003:system library:fopen:No such
process:crypto/bio/bss_file.c:69:fopen('C:/Strawberry/c/ssl/openssl.cnf','r')
15316:error:2006D080:BIO routines:BIO_new_file:no such
file:crypto/bio/bss_file.c:76:
Generating a RSA private key
..............................................+++++
...+++++
writing new private key to
'C:/usr/libwebsockets/libwebsockets/build/libwebsockets-test-server.key.pem'
-----
unable to find 'distinguished_name' in config
problems making Certificate Request
15316:error:0E06D06A:configuration file routines:NCONF_get_string:no conf
or environment variable:crypto/conf/conf_lib.c:270:


There is no "ssl" subdirectory in C:/Strawberry/c/

I don't think I missed a documented step which would account for this.

What needs to be done to properly complete the Strawberry integration with
SSL?

William Stroupe






On Thu, 11 Feb 2021 16:08:22 -0700, biolaser at frii.com wrote:
> With build environment completely set up for Windows build of
> libwebsockets, I issued the following command:
> 
> cmake .. -DLWS_HAVE_PTHREAD_H=1
-DLWS_EXT_PTHREAD_INCLUDE_DIR="C:\Program
> Files (x86)\pthreads\include" -DLWS_EXT_PTHREAD_LIBRARIES="C:\Program
Files
> (x86)\pthreads\lib\x64\libpthreadGC2.a" -DLWS_WITH_MINIMAL_EXAMPLES=1
> 
> ================= Here is the output - note failure at end of log re:
SSL
> certificate generation ===============================
> 
> -- Building for: Visual Studio 16 2019
> -- Selecting Windows SDK version 10.0.18362.0 to target Windows
> 10.0.19042.
> -- The C compiler identification is MSVC 19.28.29337.0
> -- The CXX compiler identification is MSVC 19.28.29337.0
> -- Detecting C compiler ABI info
> -- Detecting C compiler ABI info - done
> -- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
> Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe -
> skipped
> -- Detecting C compile features
> -- Detecting C compile features - done
> -- Detecting CXX compiler ABI info
> -- Detecting CXX compiler ABI info - done
> -- Check for working CXX compiler: C:/Program Files (x86)/Microsoft
Visual
> Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe -
> skipped
> -- Detecting CXX compile features
> -- Detecting CXX compile features - done
> -- Compiled with LWS_WITH_DIR and LWS_WITH_LEJP_CONF
> -- Found Git: C:/Program Files/Git/cmd/git.exe (found version
> "2.30.1.windows.1")
> Git commit hash: v4.1.0-272-gf04cc95a
> -- Performing Test LWS_HAVE_inline
> -- Performing Test LWS_HAVE_inline - Success
> -- Performing Test LWS_HAVE___inline__
> -- Performing Test LWS_HAVE___inline__ - Failed
> -- Performing Test LWS_HAVE___inline
> -- Performing Test LWS_HAVE___inline - Success
> -- Performing Test LWS_HAVE_MALLOC_TRIM
> -- Performing Test LWS_HAVE_MALLOC_TRIM - Failed
> -- Performing Test LWS_HAVE_MALLOC_USABLE_SIZE
> -- Performing Test LWS_HAVE_MALLOC_USABLE_SIZE - Failed
> -- Looking for fork
> -- Looking for fork - not found
> -- Looking for getenv
> -- Looking for getenv - found
> -- Looking for malloc
> -- Looking for malloc - found
> -- Looking for memset
> -- Looking for memset - found
> -- Looking for realloc
> -- Looking for realloc - found
> -- Looking for socket
> -- Looking for socket - not found
> -- Looking for strerror
> -- Looking for strerror - found
> -- Looking for vfork
> -- Looking for vfork - not found
> -- Looking for execvpe
> -- Looking for execvpe - found
> -- Looking for getifaddrs
> -- Looking for getifaddrs - not found
> -- Looking for snprintf
> -- Looking for snprintf - not found
> -- Looking for _snprintf
> -- Looking for _snprintf - not found
> -- Looking for _vsnprintf
> -- Looking for _vsnprintf - not found
> -- Looking for getloadavg
> -- Looking for getloadavg - not found
> -- Looking for atoll
> -- Looking for atoll - found
> -- Looking for _atoi64
> -- Looking for _atoi64 - found
> -- Looking for _stat32i64
> -- Looking for _stat32i64 - found
> -- Looking for clock_gettime
> -- Looking for clock_gettime - not found
> -- Looking for in6addr.h
> -- Looking for in6addr.h - found
> -- Looking for memory.h
> -- Looking for memory.h - found
> -- Looking for netinet/in.h
> -- Looking for netinet/in.h - not found
> -- Looking for stdint.h
> -- Looking for stdint.h - found
> -- Looking for stdlib.h
> -- Looking for stdlib.h - found
> -- Looking for strings.h
> -- Looking for strings.h - not found
> -- Looking for string.h
> -- Looking for string.h - found
> -- Looking for sys/prctl.h
> -- Looking for sys/prctl.h - not found
> -- Looking for sys/socket.h
> -- Looking for sys/socket.h - not found
> -- Looking for sys/sockio.h
> -- Looking for sys/sockio.h - not found
> -- Looking for sys/stat.h
> -- Looking for sys/stat.h - found
> -- Looking for sys/types.h
> -- Looking for sys/types.h - found
> -- Looking for unistd.h
> -- Looking for unistd.h - not found
> -- Looking for vfork.h
> -- Looking for vfork.h - not found
> -- Looking for sys/capability.h
> -- Looking for sys/capability.h - not found
> -- Looking for malloc.h
> -- Looking for malloc.h - found
> -- Looking for inttypes.h
> -- Looking for inttypes.h - found
> -- Looking for sys/resource.h
> -- Looking for sys/resource.h - not found
> -- Performing Test LWS_HAVE_WIN32_AFUNIX_H
> -- Performing Test LWS_HAVE_WIN32_AFUNIX_H - Success
> -- Looking for cap_set_flag in cap
> -- Looking for cap_set_flag in cap - not found
> -- Looking for 3 include files stdlib.h, ..., string.h
> -- Looking for 3 include files stdlib.h, ..., string.h - found
> -- Performing Test LWS_HAS_INTPTR_T
> -- Performing Test LWS_HAS_INTPTR_T - Success
> -- Performing Test LWS_HAS_PTHREAD_SETNAME_NP
> -- Performing Test LWS_HAS_PTHREAD_SETNAME_NP - Failed
> -- Performing Test LWS_HAS_GETOPT_LONG
> -- Performing Test LWS_HAS_GETOPT_LONG - Failed
> -- Performing Test LWS_HAVE_RTA_PREF
> -- Performing Test LWS_HAVE_RTA_PREF - Failed
> -- Performing Test LWS_HAVE_SUSECONDS_T
> -- Performing Test LWS_HAVE_SUSECONDS_T - Failed
> -- Performing Test LWS_HAVE_PIPE2
> -- Performing Test LWS_HAVE_PIPE2 - Failed
> -- Performing Test LWS_HAVE_TCP_USER_TIMEOUT
> -- Performing Test LWS_HAVE_TCP_USER_TIMEOUT - Failed
> Compiling with SSL support
> -- Found OpenSSL: C:/Program Files/OpenSSL/lib/libcrypto.lib (found
> version "3.0.0")
> OpenSSL include dir: C:/Program Files/OpenSSL/include
> OpenSSL libraries: C:/Program Files/OpenSSL/lib/libssl.lib;C:/Program
> Files/OpenSSL/lib/libcrypto.lib
> -- Looking for openssl/ecdh.h
> -- Looking for openssl/ecdh.h - not found
> -- Looking for SSL_CTX_set1_param
> -- Looking for SSL_CTX_set1_param - found
> -- Looking for SSL_set_info_callback
> -- Looking for SSL_set_info_callback - found
> -- Looking for X509_VERIFY_PARAM_set1_host
> -- Looking for X509_VERIFY_PARAM_set1_host - found
> -- Looking for RSA_set0_key
> -- Looking for RSA_set0_key - found
> -- Looking for X509_get_key_usage
> -- Looking for X509_get_key_usage - found
> -- Looking for EVP_PKEY_new_raw_private_key
> -- Looking for EVP_PKEY_new_raw_private_key - found
> -- Looking for SSL_CTX_get0_certificate
> -- Looking for SSL_CTX_get0_certificate - found
> -- Looking for SSL_get0_alpn_selected
> -- Looking for SSL_get0_alpn_selected - found
> -- Looking for SSL_set_alpn_protos
> -- Looking for SSL_set_alpn_protos - found
> -- Looking for EVP_aes_128_cfb8
> -- Looking for EVP_aes_128_cfb8 - found
> -- Looking for EVP_aes_128_cfb128
> -- Looking for EVP_aes_128_cfb128 - found
> -- Looking for EVP_aes_192_cfb8
> -- Looking for EVP_aes_192_cfb8 - found
> -- Looking for EVP_aes_192_cfb128
> -- Looking for EVP_aes_192_cfb128 - found
> -- Looking for EVP_aes_256_cfb8
> -- Looking for EVP_aes_256_cfb8 - found
> -- Looking for EVP_aes_256_cfb128
> -- Looking for EVP_aes_256_cfb128 - found
> -- Looking for EVP_aes_128_xts
> -- Looking for EVP_aes_128_xts - found
> -- Looking for RSA_verify_pss_mgf1
> -- Looking for RSA_verify_pss_mgf1 - not found
> -- Looking for HMAC_CTX_new
> -- Looking for HMAC_CTX_new - found
> -- Looking for SSL_CTX_set_ciphersuites
> -- Looking for SSL_CTX_set_ciphersuites - not found
> -- Looking for EVP_PKEY_new_raw_private_key
> -- Looking for EVP_PKEY_new_raw_private_key - found
> -- Performing Test LWS_HAVE_SSL_EXTRA_CHAIN_CERTS
> -- Performing Test LWS_HAVE_SSL_EXTRA_CHAIN_CERTS - Success
> -- Performing Test LWS_HAVE_EVP_MD_CTX_free
> -- Performing Test LWS_HAVE_EVP_MD_CTX_free - Success
> -- Looking for ECDSA_SIG_set0
> -- Looking for ECDSA_SIG_set0 - found
> -- Looking for BN_bn2binpad
> -- Looking for BN_bn2binpad - found
> -- Looking for EVP_aes_128_wrap
> -- Looking for EVP_aes_128_wrap - found
> -- Looking for EC_POINT_get_affine_coordinates
> -- Looking for EC_POINT_get_affine_coordinates - found
> -- Looking for SSL_CTX_load_verify_file
> -- Looking for SSL_CTX_load_verify_file - found
> -- Looking for SSL_CTX_load_verify_dir
> -- Looking for SSL_CTX_load_verify_dir - found
> -- Looking for TLS_client_method
> -- Looking for TLS_client_method - found
> -- Looking for TLSv1_2_client_method
> -- Looking for TLSv1_2_client_method - found
> Searching for OpenSSL executable and dlls
> OpenSSL executable: C:/Strawberry/c/bin/openssl.exe
>  GENCERTS = 1
> Generating SSL Certificates for the test-server...
> OPENSSL_INPUT_WIN_PATH =
> C:\usr\libwebsockets\libwebsockets\build\openssl_input.txt
> cmd = "C:/Strawberry/c/bin/openssl.exe" req -new -newkey rsa:2048 -days
> 10000 -nodes -x509 -keyout
>
"C:/usr/libwebsockets/libwebsockets/build/libwebsockets-test-server.key.pem"
> -out
> "C:/usr/libwebsockets/libwebsockets/build/libwebsockets-test-server.pem"
> 
> 
> CMake Warning at lib/tls/CMakeLists.txt:411 (message):
>   !!! Failed to generate SSL certificate for Test Server using cmd.exe
> !!!:
> 
>   OpenSSL return code = 1
> 
> 
> ====================================================
> 
> Any insights on what I'm doing wrong?
> 
> Thanks,
> 
> William Stroupe
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets


More information about the Libwebsockets mailing list