summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGernot Tenchio <gernot@tenchio.de>2011-08-25 22:33:06 +0200
committerGernot Tenchio <gernot@tenchio.de>2011-08-25 22:34:42 +0200
commit7b80ff5b3a5bf61e6ba758f2b5f9e0db9eca69c5 (patch)
treef15841f51a3dae405ec7ea659439cff6a1182b8b
parent27eadfa8992cbddaed3a5c66dc91ecff6a005814 (diff)
downloadlibvncserver-7b80ff5b3a5bf61e6ba758f2b5f9e0db9eca69c5.zip
libvncserver-7b80ff5b3a5bf61e6ba758f2b5f9e0db9eca69c5.tar.gz
websockets: added gcrypt based sha1 digest funtion
-rwxr-xr-xlibvncserver/websockets.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libvncserver/websockets.c b/libvncserver/websockets.c
index da00522..ae6a71b 100755
--- a/libvncserver/websockets.c
+++ b/libvncserver/websockets.c
@@ -163,6 +163,21 @@ min (int a, int b) {
}
#ifdef LIBVNCSERVER_WITH_CLIENT_GCRYPT
+#include <gcrypt.h>
+#ifndef SHA_DIGEST_LENGTH
+#define SHA_DIGEST_LENGTH 20
+#endif
+static void webSocketsGenSha1Key(char *target, int size, char *key)
+{
+ gcry_md_hd_t c;
+ unsigned char tmp[SHA_DIGEST_LENGTH];
+ gcry_md_open(&c, GCRY_MD_SHA1, 0);
+ gcry_md_write(c, key, strlen(key));
+ gcry_md_write(c, GUID, sizeof(GUID) - 1);
+ gcry_md_final(c);
+ if (-1 == __b64_ntop(gcry_md_read(c, 0), SHA_DIGEST_LENGTH, target, size))
+ rfbErr("b64_ntop failed\n");
+}
#else
#include <openssl/sha.h>
OpenPOWER on IntegriCloud