summaryrefslogtreecommitdiffstats
path: root/libxrdp/xrdp_sec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libxrdp/xrdp_sec.c')
-rw-r--r--libxrdp/xrdp_sec.c37
1 files changed, 34 insertions, 3 deletions
diff --git a/libxrdp/xrdp_sec.c b/libxrdp/xrdp_sec.c
index a4fe8c5a..d0f84273 100644
--- a/libxrdp/xrdp_sec.c
+++ b/libxrdp/xrdp_sec.c
@@ -271,6 +271,7 @@ xrdp_sec_create(struct xrdp_rdp *owner, struct trans *trans, int crypt_level,
self->encrypt_rc4_info = ssl_rc4_info_create();
self->mcs_layer = xrdp_mcs_create(self, trans, &self->client_mcs_data,
&self->server_mcs_data);
+ self->fastpath_layer = xrdp_fastpath_create(self, trans);
self->chan_layer = xrdp_channel_create(self, self->mcs_layer);
DEBUG((" out xrdp_sec_create"));
return self;
@@ -288,6 +289,7 @@ xrdp_sec_delete(struct xrdp_sec *self)
xrdp_channel_delete(self->chan_layer);
xrdp_mcs_delete(self->mcs_layer);
+ xrdp_fastpath_delete(self->fastpath_layer);
ssl_rc4_info_delete(self->decrypt_rc4_info); /* TODO clear all data */
ssl_rc4_info_delete(self->encrypt_rc4_info); /* TODO clear all data */
ssl_des3_info_delete(self->decrypt_fips_info);
@@ -948,7 +950,37 @@ xrdp_sec_establish_keys(struct xrdp_sec *self)
ssl_rc4_set_key(self->decrypt_rc4_info, self->decrypt_key, self->rc4_key_len);
ssl_rc4_set_key(self->encrypt_rc4_info, self->encrypt_key, self->rc4_key_len);
}
-
+/*****************************************************************************/
+/* returns error */
+int APP_CC
+xrdp_sec_recv_fastpath(struct xrdp_sec *self, struct stream *s)
+{
+ if (xrdp_fastpath_recv(self->fastpath_layer, s) != 0) {
+ return 1;
+ }
+
+ if (self->crypt_level == CRYPT_LEVEL_FIPS)
+ {
+ in_uint8s(s, 4); /* fipsInformation (4 bytes) */
+ }
+
+ in_uint8s(s, 8); /* dataSignature (8 bytes), skip for now */
+
+ if (self->fastpath_layer->secFlags & FASTPATH_INPUT_ENCRYPTED)
+ {
+ xrdp_sec_decrypt(self, s->p, (int)(s->end - s->p));
+ }
+
+ if (self->fastpath_layer->numEvents == 0) {
+ /**
+ * If numberEvents is not provided in fpInputHeader, it will be provided
+ * as one additional byte here.
+ */
+ in_uint8(s, self->fastpath_layer->numEvents); /* numEvents (1 byte) (optional) */
+ }
+
+ return 0;
+}
/*****************************************************************************/
/* returns error */
int APP_CC
@@ -963,7 +995,7 @@ xrdp_sec_recv(struct xrdp_sec *self, struct stream *s, int *chan)
if (xrdp_mcs_recv(self->mcs_layer, s, chan) != 0)
{
- DEBUG((" out xrdp_sec_recv error"));
+ DEBUG((" out xrdp_sec_recv : error"));
return 1;
}
@@ -1181,7 +1213,6 @@ xrdp_sec_send(struct xrdp_sec *self, struct stream *s, int chan)
DEBUG((" out xrdp_sec_send"));
return 0;
}
-
/*****************************************************************************/
/* http://msdn.microsoft.com/en-us/library/cc240510.aspx
2.2.1.3.2 Client Core Data (TS_UD_CS_CORE) */