s = stream_new(12);
settings = settings_new();
+ settings->encryption_methods =
+ ENCRYPTION_40BIT_FLAG |
+ ENCRYPTION_56BIT_FLAG |
+ ENCRYPTION_128BIT_FLAG |
+ ENCRYPTION_FIPS_FLAG;
+
gcc_write_client_security_data(s, settings);
ASSERT_STREAM(s, (uint8*) gcc_client_security_data_expected, sizeof(gcc_client_security_data_expected));
#include <freerdp/types.h>
#include <freerdp/utils/unicode.h>
-#define PERF_FLAG_NONE 0x00000000
-#define PERF_DISABLE_WALLPAPER 0x00000001
-#define PERF_DISABLE_FULLWINDOWDRAG 0x00000002
-#define PERF_DISABLE_MENUANIMATIONS 0x00000004
-#define PERF_DISABLE_THEMING 0x00000008
-#define PERF_DISABLE_CURSOR_SHADOW 0x00000020
-#define PERF_DISABLE_CURSORSETTINGS 0x00000040
-#define PERF_ENABLE_FONT_SMOOTHING 0x00000080
-#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100
+/* Performance Flags */
+#define PERF_FLAG_NONE 0x00000000
+#define PERF_DISABLE_WALLPAPER 0x00000001
+#define PERF_DISABLE_FULLWINDOWDRAG 0x00000002
+#define PERF_DISABLE_MENUANIMATIONS 0x00000004
+#define PERF_DISABLE_THEMING 0x00000008
+#define PERF_DISABLE_CURSOR_SHADOW 0x00000020
+#define PERF_DISABLE_CURSORSETTINGS 0x00000040
+#define PERF_ENABLE_FONT_SMOOTHING 0x00000080
+#define PERF_ENABLE_DESKTOP_COMPOSITION 0x00000100
+
+/* Encryption Methods */
+#define ENCRYPTION_40BIT_FLAG 0x00000001
+#define ENCRYPTION_128BIT_FLAG 0x00000002
+#define ENCRYPTION_56BIT_FLAG 0x00000008
+#define ENCRYPTION_FIPS_FLAG 0x00000010
struct rdp_chan
{
uint32 kbd_fn_keys;
uint32 client_build;
uint32 selected_protocol;
+ uint32 encryption_methods;
int console_session;
uint32 redirected_session_id;
void ber_write_integer(STREAM* s, uint32 value)
{
ber_write_universal_tag(s, BER_TAG_INTEGER);
- ber_write_length(s, 2);
- stream_write_uint16_be(s, value);
+
+ if (value <= 0xFF)
+ {
+ ber_write_length(s, 1);
+ stream_write_uint8(s, value);
+ }
+ else if (value <= 0xFFFF)
+ {
+ ber_write_length(s, 2);
+ stream_write_uint16_be(s, value);
+ }
+ else if (value <= 0xFFFFFFFF)
+ {
+ ber_write_length(s, 4);
+ stream_write_uint32_be(s, value);
+ }
}
void gcc_write_client_security_data(STREAM* s, rdpSettings *settings)
{
- uint16 encryptionMethods;
-
gcc_write_user_data_header(s, CS_SECURITY, 12);
- encryptionMethods = ENCRYPTION_40BIT_FLAG | ENCRYPTION_128BIT_FLAG;
-
if (settings->encryption > 0)
{
- stream_write_uint32(s, encryptionMethods); /* encryptionMethods */
+ stream_write_uint32(s, settings->encryption_methods); /* encryptionMethods */
stream_write_uint32(s, 0); /* extEncryptionMethods */
}
else
{
/* French locale, disable encryption */
stream_write_uint32(s, 0); /* encryptionMethods */
- stream_write_uint32(s, encryptionMethods); /* extEncryptionMethods */
+ stream_write_uint32(s, settings->encryption_methods); /* extEncryptionMethods */
}
}
#define CONNECTION_TYPE_WAN 0x05
#define CONNECTION_TYPE_LAN 0x06
-/* Encryption Methods */
-#define ENCRYPTION_40BIT_FLAG 0x00000001
-#define ENCRYPTION_128BIT_FLAG 0x00000002
-#define ENCRYPTION_56BIT_FLAG 0x00000008
-#define ENCRYPTION_FIPS_FLAG 0x00000010
-
/* Cluster Information Flags */
#define REDIRECTION_SUPPORTED 0x00000001
#define REDIRECTED_SESSIONID_FIELD_VALID 0x00000002
static void mcs_write_domain_parameters(STREAM* s, DOMAIN_PARAMETERS* domainParameters)
{
- ber_write_sequence_of_tag(s, 32);
+ int length;
+ uint8 *bm, *em;
+
+ stream_get_mark(s, bm);
+ stream_seek(s, 2);
+
ber_write_integer(s, domainParameters->maxChannelIds);
ber_write_integer(s, domainParameters->maxUserIds);
ber_write_integer(s, domainParameters->maxTokenIds);
ber_write_integer(s, domainParameters->maxHeight);
ber_write_integer(s, domainParameters->maxMCSPDUsize);
ber_write_integer(s, domainParameters->protocolVersion);
+
+ stream_get_mark(s, em);
+ length = (em - bm) - 2;
+ stream_set_mark(s, bm);
+
+ ber_write_sequence_of_tag(s, length);
+ stream_set_mark(s, em);
}
/**
void mcs_write_connect_initial(STREAM* s, rdpMcs* mcs, STREAM* user_data)
{
int length;
- int gcc_CCrq_length = stream_get_length(user_data);
+ uint8 *bm, *em;
- length = gcc_CCrq_length + (3* 34) + 13;
+ int gcc_CCrq_length = stream_get_length(user_data);
- /* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
- ber_write_application_tag(s, MCS_TYPE_CONNECT_INITIAL, length);
+ stream_get_mark(s, bm);
+ stream_seek(s, 5);
/* callingDomainSelector (OCTET_STRING) */
ber_write_octet_string(s, callingDomainSelector, sizeof(callingDomainSelector));
/* userData (OCTET_STRING) */
ber_write_octet_string(s, user_data->data, gcc_CCrq_length);
+
+ stream_get_mark(s, em);
+ length = (em - bm) - 5;
+ stream_set_mark(s, bm);
+
+ /* Connect-Initial (APPLICATION 101, IMPLICIT SEQUENCE) */
+ ber_write_application_tag(s, MCS_TYPE_CONNECT_INITIAL, length);
+ stream_set_mark(s, em);
}
int mcs_recv(rdpMcs* mcs)
PERF_DISABLE_MENUANIMATIONS |
PERF_DISABLE_WALLPAPER;
+ settings->encryption_methods =
+ ENCRYPTION_40BIT_FLAG |
+ ENCRYPTION_128BIT_FLAG;
+
settings->uniconv = freerdp_uniconv_new();
gethostname(settings->client_hostname, sizeof(settings->client_hostname) - 1);
}