20 |
|
|
21 |
#include "rdesktop.h" |
#include "rdesktop.h" |
22 |
|
|
|
#ifdef WITH_OPENSSL |
|
23 |
#include <openssl/rc4.h> |
#include <openssl/rc4.h> |
24 |
#include <openssl/md5.h> |
#include <openssl/md5.h> |
25 |
#include <openssl/sha.h> |
#include <openssl/sha.h> |
26 |
#include <openssl/bn.h> |
#include <openssl/bn.h> |
27 |
#include <openssl/x509v3.h> |
#include <openssl/x509v3.h> |
|
#else |
|
|
#include "crypto/rc4.h" |
|
|
#include "crypto/md5.h" |
|
|
#include "crypto/sha.h" |
|
|
#include "crypto/bn.h" |
|
|
#endif |
|
28 |
|
|
29 |
extern char hostname[16]; |
extern char g_hostname[16]; |
30 |
extern int g_width; |
extern int g_width; |
31 |
extern int g_height; |
extern int g_height; |
32 |
extern int keylayout; |
extern int g_keylayout; |
33 |
extern BOOL g_encryption; |
extern BOOL g_encryption; |
34 |
extern BOOL g_licence_issued; |
extern BOOL g_licence_issued; |
35 |
extern BOOL g_use_rdp5; |
extern BOOL g_use_rdp5; |
403 |
static void |
static void |
404 |
sec_out_mcs_data(STREAM s) |
sec_out_mcs_data(STREAM s) |
405 |
{ |
{ |
406 |
int hostlen = 2 * strlen(hostname); |
int hostlen = 2 * strlen(g_hostname); |
407 |
int length = 158 + 76 + 12 + 4; |
int length = 158 + 76 + 12 + 4; |
408 |
unsigned int i; |
unsigned int i; |
409 |
|
|
439 |
out_uint16_le(s, g_height); |
out_uint16_le(s, g_height); |
440 |
out_uint16_le(s, 0xca01); |
out_uint16_le(s, 0xca01); |
441 |
out_uint16_le(s, 0xaa03); |
out_uint16_le(s, 0xaa03); |
442 |
out_uint32_le(s, keylayout); |
out_uint32_le(s, g_keylayout); |
443 |
out_uint32_le(s, 2600); /* Client build. We are now 2600 compatible :-) */ |
out_uint32_le(s, 2600); /* Client build. We are now 2600 compatible :-) */ |
444 |
|
|
445 |
/* Unicode name of client, padded to 32 bytes */ |
/* Unicode name of client, padded to 32 bytes */ |
446 |
rdp_out_unistr(s, hostname, hostlen); |
rdp_out_unistr(s, g_hostname, hostlen); |
447 |
out_uint8s(s, 30 - hostlen); |
out_uint8s(s, 30 - hostlen); |
448 |
|
|
449 |
out_uint32_le(s, 4); |
out_uint32_le(s, 4); |
813 |
|
|
814 |
/* Receive secure transport packet */ |
/* Receive secure transport packet */ |
815 |
STREAM |
STREAM |
816 |
sec_recv(void) |
sec_recv(uint8 * rdpver) |
817 |
{ |
{ |
818 |
uint32 sec_flags; |
uint32 sec_flags; |
819 |
uint16 channel; |
uint16 channel; |
820 |
STREAM s; |
STREAM s; |
821 |
|
|
822 |
while ((s = mcs_recv(&channel)) != NULL) |
while ((s = mcs_recv(&channel, rdpver)) != NULL) |
823 |
{ |
{ |
824 |
|
if (rdpver != NULL) |
825 |
|
{ |
826 |
|
if (*rdpver != 3) |
827 |
|
{ |
828 |
|
if (*rdpver & 0x80) |
829 |
|
{ |
830 |
|
in_uint8s(s, 8); /* signature */ |
831 |
|
sec_decrypt(s->p, s->end - s->p); |
832 |
|
} |
833 |
|
return s; |
834 |
|
} |
835 |
|
} |
836 |
if (g_encryption || !g_licence_issued) |
if (g_encryption || !g_licence_issued) |
837 |
{ |
{ |
838 |
in_uint32_le(s, sec_flags); |
in_uint32_le(s, sec_flags); |
853 |
if (channel != MCS_GLOBAL_CHANNEL) |
if (channel != MCS_GLOBAL_CHANNEL) |
854 |
{ |
{ |
855 |
channel_process(s, channel); |
channel_process(s, channel); |
856 |
continue; |
*rdpver = 0xff; |
857 |
|
return s; |
858 |
} |
} |
859 |
|
|
860 |
return s; |
return s; |