internal SHA1 users all use libwebsockets_SHA1
authorAndy Green <andy.green@linaro.org>
Thu, 25 Sep 2014 21:56:23 +0000 (05:56 +0800)
committerAndy Green <andy.green@linaro.org>
Thu, 25 Sep 2014 21:56:23 +0000 (05:56 +0800)
Signed-off-by: Andy Green <andy.green@linaro.org>
lib/client.c
lib/private-libwebsockets.h
lib/server-handshake.c
lib/sha-1.c

index 2b9a943..01f2aa1 100755 (executable)
@@ -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,
index 5420e52..7f06627 100755 (executable)
 #ifdef USE_CYASSL
 #include <cyassl/openssl/ssl.h>
 #include <cyassl/error-ssl.h>
-unsigned char *
-SHA1(const unsigned char *d, size_t n, unsigned char *md);
 #else
 #include <openssl/ssl.h>
 #include <openssl/evp.h>
@@ -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)
index 56cf9a1..21beaa0 100644 (file)
@@ -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,
index 98b208b..e68ee38 100644 (file)
@@ -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;