diff --git a/lib/client.c b/lib/client.c index 2b9a943c..01f2aa13 100755 --- a/lib/client.c +++ b/lib/client.c @@ -947,7 +947,7 @@ libwebsockets_generate_client_handshake(struct libwebsocket_context *context, key_b64[39] = '\0'; /* enforce composed length below buf sizeof */ n = sprintf(buf, "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11", key_b64); - SHA1((unsigned char *)buf, n, (unsigned char *)hash); + libwebsockets_SHA1((unsigned char *)buf, n, (unsigned char *)hash); lws_b64_encode_string(hash, 20, wsi->u.hdr.ah->initial_handshake_hash_base64, diff --git a/lib/private-libwebsockets.h b/lib/private-libwebsockets.h index 5420e523..7f06627f 100755 --- a/lib/private-libwebsockets.h +++ b/lib/private-libwebsockets.h @@ -160,8 +160,6 @@ #ifdef USE_CYASSL #include #include -unsigned char * -SHA1(const unsigned char *d, size_t n, unsigned char *md); #else #include #include @@ -825,8 +823,6 @@ enum lws_ssl_capable_status { #ifndef LWS_OPENSSL_SUPPORT #define LWS_SSL_ENABLED(context) (0) -unsigned char * -SHA1(const unsigned char *d, size_t n, unsigned char *md); #define lws_context_init_server_ssl(_a, _b) (0) #define lws_ssl_destroy(_a) #define lws_context_init_http2_ssl(_a) diff --git a/lib/server-handshake.c b/lib/server-handshake.c index 56cf9a13..21beaa0d 100644 --- a/lib/server-handshake.c +++ b/lib/server-handshake.c @@ -188,7 +188,7 @@ handshake_0405(struct libwebsocket_context *context, struct libwebsocket *wsi) "%s258EAFA5-E914-47DA-95CA-C5AB0DC85B11", lws_hdr_simple_ptr(wsi, WSI_TOKEN_KEY)); - SHA1(context->service_buffer, n, hash); + libwebsockets_SHA1(context->service_buffer, n, hash); accept_len = lws_b64_encode_string((char *)hash, 20, (char *)context->service_buffer, diff --git a/lib/sha-1.c b/lib/sha-1.c index 98b208b2..e68ee38d 100644 --- a/lib/sha-1.c +++ b/lib/sha-1.c @@ -286,8 +286,8 @@ sha1_result(struct sha1_ctxt *ctxt, void *digest0) * This should look and work like the libcrypto implementation */ -unsigned char * -SHA1(const unsigned char *d, size_t n, unsigned char *md) +LWS_VISIBLE unsigned char * +libwebsockets_SHA1(const unsigned char *d, size_t n, unsigned char *md) { struct sha1_ctxt ctx;