diff --git a/README.build b/README.build index bb346aa3..20d195e2 100644 --- a/README.build +++ b/README.build @@ -73,6 +73,12 @@ Configure script options There are several other possible configure options +--enable-openssl Builds in the SSL support + +--with-cyassl Use cyassl instead of OpenSSL... you will need CyaSSL + to have been configured with --enable-opensslExtra +\ when it was built. + --enable-libcrypto by default libwebsockets uses its own built-in md5 and sha-1 implementation for simplicity. However the libcrypto ones diff --git a/configure.ac b/configure.ac index 549b7293..1e4ae42a 100644 --- a/configure.ac +++ b/configure.ac @@ -190,6 +190,18 @@ CFLAGS="$CFLAGS -DLWS_BUILTIN_GETIFADDRS" fi AM_CONDITIONAL(USE_BUILTIN_GETIFADDRS, test x$builtin_getifaddrs = xyes) +# +# +# +AC_ARG_WITH(cyassl, + [ --with-cyassl Use CyaSSL instead of OpenSSL ], + [ use_cyassl=yes + ]) + +if test "x$use_cyassl" = "xyes" ; then +CFLAGS="$CFLAGS -DUSE_CYASSL -DLWS_OPENSSL_SUPPORT" +fi +AM_CONDITIONAL(USE_CYASSL, test x$use_cyassl = xyes) # Checks for header files. diff --git a/lib/Makefile.am b/lib/Makefile.am index 3a51c1ac..775d001e 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -47,6 +47,10 @@ endif libwebsockets_la_CFLAGS=-Wall -std=gnu99 -pedantic libwebsockets_la_LDFLAGS= +if USE_CYASSL +libwebsockets_la_LDFLAGS+= -lcyassl +endif + if DISABLE_DEBUG libwebsockets_la_CFLAGS+= -O4 else diff --git a/lib/libwebsockets.c b/lib/libwebsockets.c index 5c30c926..6efebfae 100644 --- a/lib/libwebsockets.c +++ b/lib/libwebsockets.c @@ -1691,10 +1691,15 @@ libwebsocket_create_context(int port, const char *interf, #ifdef LWS_OPENSSL_SUPPORT context->use_ssl = ssl_cert_filepath != NULL && ssl_private_key_filepath != NULL; +#ifdef USE_CYASSL + lwsl_notice(" Compiled with CYASSL support\n"); +#else + lwsl_notice(" Compiled with OpenSSL support\n"); +#endif if (context->use_ssl) - lwsl_notice(" Compiled with SSL support, using it\n"); + lwsl_notice(" Using SSL mode\n"); else - lwsl_notice(" Compiled with SSL support, not using it\n"); + lwsl_notice(" Using non-SSL mode\n"); #else if (ssl_cert_filepath != NULL && diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index a7f5c27a..7f461ef3 100644 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -93,11 +93,18 @@ #endif #ifdef LWS_OPENSSL_SUPPORT +#ifdef USE_CYASSL +#include +#include +unsigned char * +SHA1(const unsigned char *d, size_t n, unsigned char *md); +#else #include #include #include #include #include +#endif /* not USE_CYASSL */ #endif #include "libwebsockets.h" @@ -487,7 +494,4 @@ user_callback_handle_rxflow(callback_function, struct libwebsocket_context * con unsigned char * SHA1(const unsigned char *d, size_t n, unsigned char *md); -void -MD5(const unsigned char *input, int ilen, unsigned char *output); - #endif diff --git a/lib/server.c b/lib/server.c index 5af1081a..c1b6cd8a 100644 --- a/lib/server.c +++ b/lib/server.c @@ -137,7 +137,9 @@ int lws_server_socket_service(struct libwebsocket_context *context, ssize_t len; #ifdef LWS_OPENSSL_SUPPORT int m; +#ifndef USE_CYASSL BIO *bio; +#endif #endif switch (wsi->mode) {