summaryrefslogtreecommitdiffstats
path: root/libvncserver/rfbcrypto_polarssl.c
diff options
context:
space:
mode:
authorGernot Tenchio <gernot@tenchio.de>2011-09-18 21:20:53 +0200
committerGernot Tenchio <gernot@tenchio.de>2011-09-19 22:16:38 +0200
commitbd9cae3d122bc602e5a3d2638c0bb9435f8fc47c (patch)
tree0ae9effe5bac988008aea546951001b6652725eb /libvncserver/rfbcrypto_polarssl.c
parentcb0340ccc5351a2ab31ad03b2dc13334ba349d71 (diff)
downloadlibtdevnc-bd9cae3d122bc602e5a3d2638c0bb9435f8fc47c.tar.gz
libtdevnc-bd9cae3d122bc602e5a3d2638c0bb9435f8fc47c.zip
Add support for different crypto implementations
Diffstat (limited to 'libvncserver/rfbcrypto_polarssl.c')
-rw-r--r--libvncserver/rfbcrypto_polarssl.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/libvncserver/rfbcrypto_polarssl.c b/libvncserver/rfbcrypto_polarssl.c
new file mode 100644
index 0000000..f28dca3
--- /dev/null
+++ b/libvncserver/rfbcrypto_polarssl.c
@@ -0,0 +1,26 @@
+#include <string.h>
+#include <polarssl/md5.h>
+#include <polarssl/sha1.h>
+#include "rfbcrypto.h"
+
+void digestmd5(const struct iovec *iov, int iovcnt, void *dest)
+{
+ md5_context c;
+ int i;
+
+ md5_starts(&c);
+ for (i = 0; i < iovcnt; i++)
+ md5_update(&c, iov[i].iov_base, iov[i].iov_len);
+ md5_finish(dest, &c);
+}
+
+void digestsha1(const struct iovec *iov, int iovcnt, void *dest)
+{
+ sha1_context c;
+ int i;
+
+ sha1_starts(&c);
+ for (i = 0; i < iovcnt; i++)
+ sha1_update(&c, iov[i].iov_base, iov[i].iov_len);
+ sha1_finish(dest, &c);
+}