summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_sec.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2006-04-12 02:45:26 +0000
committerjsorg71 <jsorg71>2006-04-12 02:45:26 +0000
commitab61191620ba5dbb88758802eff69686db513163 (patch)
tree8d552d621ab6b58674ab651ecbb66d3d8c8dd122 /libxrdp/xrdp_sec.c
parentda4f53d48c5ff38cb984691d54bdb1fbe30d2673 (diff)
downloadxrdp-proprietary-ab61191620ba5dbb88758802eff69686db513163.tar.gz
xrdp-proprietary-ab61191620ba5dbb88758802eff69686db513163.zip
added seg_sign
Diffstat (limited to 'libxrdp/xrdp_sec.c')
-rw-r--r--libxrdp/xrdp_sec.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index 49088204..47f67815 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -599,6 +599,48 @@ xrdp_sec_recv(struct xrdp_sec* self, struct stream* s, int* chan)
}
/*****************************************************************************/
+/* Output a uint32 into a buffer (little-endian) */
+static void
+buf_out_uint32(char* buffer, int value)
+{
+ buffer[0] = (value) & 0xff;
+ buffer[1] = (value >> 8) & 0xff;
+ buffer[2] = (value >> 16) & 0xff;
+ buffer[3] = (value >> 24) & 0xff;
+}
+
+/*****************************************************************************/
+/* Generate a MAC hash (5.2.3.1), using a combination of SHA1 and MD5 */
+static void APP_CC
+xrdp_sec_sign(struct xrdp_sec* self, char* out, int out_len,
+ char* data, int data_len)
+{
+ char shasig[20];
+ char md5sig[16];
+ char lenhdr[4];
+ void* sha1_info;
+ void* md5_info;
+
+ buf_out_uint32(lenhdr, data_len);
+ sha1_info = ssl_sha1_info_create();
+ md5_info = ssl_md5_info_create();
+ ssl_sha1_clear(sha1_info);
+ ssl_sha1_transform(sha1_info, self->sign_key, self->rc4_key_len);
+ ssl_sha1_transform(sha1_info, pad_54, 40);
+ ssl_sha1_transform(sha1_info, lenhdr, 4);
+ ssl_sha1_transform(sha1_info, data, data_len);
+ ssl_sha1_complete(sha1_info, shasig);
+ ssl_md5_clear(md5_info);
+ ssl_md5_transform(md5_info, self->sign_key, self->rc4_key_len);
+ ssl_md5_transform(md5_info, pad_92, 48);
+ ssl_md5_transform(md5_info, shasig, 20);
+ ssl_md5_complete(md5_info, md5sig);
+ g_memcpy(out, md5sig, out_len);
+ ssl_sha1_info_delete(sha1_info);
+ ssl_md5_info_delete(md5_info);
+}
+
+/*****************************************************************************/
/* returns error */
/* TODO needs outgoing encryption */
int APP_CC