linux EOL

This commit is contained in:
jsorg71 2006-06-26 00:33:04 +00:00
parent a2b270e57a
commit 4f8e2d60ed
17 changed files with 6756 additions and 6750 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,49 +1,49 @@
/* -*- c-basic-offset: 8 -*- /* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client. rdesktop: A Remote Desktop Protocol client.
Generics backingstore operations Generics backingstore operations
Copyright (C) Jay Sorg 2005-2006 Copyright (C) Jay Sorg 2005-2006
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
int bs_get_pixel(int x, int y); int bs_get_pixel(int x, int y);
void bs_set_pixel(int x, int y, int pixel, int rop, int use_clip); void bs_set_pixel(int x, int y, int pixel, int rop, int use_clip);
int bs_do_rop(int rop, int src, int dst); int bs_do_rop(int rop, int src, int dst);
void bs_init(void); void bs_init(void);
void bs_exit(void); void bs_exit(void);
void bs_set_clip(int x, int y, int cx, int cy); void bs_set_clip(int x, int y, int cx, int cy);
void bs_reset_clip(void); void bs_reset_clip(void);
void bs_set_pixel_on(char * data, int x, int y, int width, int bpp, void bs_set_pixel_on(char * data, int x, int y, int width, int bpp,
int pixel); int pixel);
int bs_is_pixel_on(char * data, int x, int y, int width, int bpp); int bs_is_pixel_on(char * data, int x, int y, int width, int bpp);
void bs_copy_mem(char * d, char * s, int n); void bs_copy_mem(char * d, char * s, int n);
void bs_copy_memb(char * d, char * s, int n); void bs_copy_memb(char * d, char * s, int n);
int bs_warp_coords(int * x, int * y, int * cx, int * cy, int bs_warp_coords(int * x, int * y, int * cx, int * cy,
int * srcx, int * srcy); int * srcx, int * srcy);
void bs_rect(int x, int y, int cx, int cy, int colour, int rop); void bs_rect(int x, int y, int cx, int cy, int colour, int rop);
void bs_screenblt(int opcode, int x, int y, int cx, int cy, void bs_screenblt(int opcode, int x, int y, int cx, int cy,
int srcx, int srcy); int srcx, int srcy);
void bs_memblt(int opcode, int x, int y, int cx, int cy, void bs_memblt(int opcode, int x, int y, int cx, int cy,
void * srcdata, int srcwidth, int srcheight, void * srcdata, int srcwidth, int srcheight,
int srcx, int srcy); int srcx, int srcy);
void bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size); void bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size);
void bs_draw_glyph(int x, int y, char * glyph_data, int glyph_width, void bs_draw_glyph(int x, int y, char * glyph_data, int glyph_width,
int glyph_height, int fgcolour); int glyph_height, int fgcolour);
void bs_line(int opcode, int startx, int starty, int endx, int endy, void bs_line(int opcode, int startx, int starty, int endx, int endy,
int pen_width, int pen_style, int pen_colour); int pen_width, int pen_style, int pen_colour);
void bs_patblt(int opcode, int x, int y, int cx, int cy, void bs_patblt(int opcode, int x, int y, int cx, int cy,
int brush_style, char * brush_pattern, int brush_style, char * brush_pattern,
int brush_x_org, int brush_y_org, int brush_x_org, int brush_y_org,
int bgcolour, int fgcolour); int bgcolour, int fgcolour);

View File

@ -192,7 +192,7 @@ enum RDP_INPUT_DEVICE
/* Raster operation masks */ /* Raster operation masks */
#define ROP2_S(rop3) ((uint8) (rop3 & 0xf)) #define ROP2_S(rop3) ((uint8) (rop3 & 0xf))
#define ROP2_P(rop3) ((uint8) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2))) #define ROP2_P(rop3) ((uint8) ((rop3 & 0x3) | ((rop3 & 0x30) >> 2)))
#define ROP_MINUS_1(rop) ((uint8) (rop - 1)) #define ROP_MINUS_1(rop) ((uint8) (rop - 1))
#define ROP2_COPY 0xc #define ROP2_COPY 0xc
@ -355,21 +355,21 @@ enum RDP_INPUT_DEVICE
#define CHANNEL_OPTION_COMPRESS_RDP 0x00800000 #define CHANNEL_OPTION_COMPRESS_RDP 0x00800000
#define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000 #define CHANNEL_OPTION_SHOW_PROTOCOL 0x00200000
/* NT status codes for RDPDR */ /* NT status codes for RDPDR */
#undef STATUS_SUCCESS #undef STATUS_SUCCESS
#define STATUS_SUCCESS 0x00000000 #define STATUS_SUCCESS 0x00000000
#undef STATUS_NOT_IMPLEMENTED #undef STATUS_NOT_IMPLEMENTED
#define STATUS_NOT_IMPLEMENTED 0x00000001 #define STATUS_NOT_IMPLEMENTED 0x00000001
#undef STATUS_PENDING #undef STATUS_PENDING
#define STATUS_PENDING 0x00000103 #define STATUS_PENDING 0x00000103
#ifndef STATUS_NO_MORE_FILES #ifndef STATUS_NO_MORE_FILES
#define STATUS_NO_MORE_FILES 0x80000006 #define STATUS_NO_MORE_FILES 0x80000006
#define STATUS_DEVICE_PAPER_EMPTY 0x8000000e #define STATUS_DEVICE_PAPER_EMPTY 0x8000000e
#define STATUS_DEVICE_POWERED_OFF 0x8000000f #define STATUS_DEVICE_POWERED_OFF 0x8000000f
#define STATUS_DEVICE_OFF_LINE 0x80000010 #define STATUS_DEVICE_OFF_LINE 0x80000010
#define STATUS_DEVICE_BUSY 0x80000011 #define STATUS_DEVICE_BUSY 0x80000011
#endif #endif
#ifndef STATUS_INVALID_HANDLE #ifndef STATUS_INVALID_HANDLE
#define STATUS_INVALID_HANDLE 0xc0000008 #define STATUS_INVALID_HANDLE 0xc0000008

View File

@ -1,8 +1,8 @@
[main] [main]
server=192.168.1.1 server=192.168.1.1
port=3389 port=3389
username=user1 username=user1
password=password1 password=password1
bpp=16 bpp=16
#geometry=300x400 #geometry=300x400
fullscreen fullscreen

View File

@ -20,19 +20,19 @@
#include "rdesktop.h" #include "rdesktop.h"
//#include <openssl/rc4.h> //#include <openssl/rc4.h>
void * void *
ssl_rc4_info_create(void); ssl_rc4_info_create(void);
void void
ssl_rc4_info_delete(void * rc4_info); ssl_rc4_info_delete(void * rc4_info);
void void
ssl_rc4_set_key(void * rc4_info, char * key, int len); ssl_rc4_set_key(void * rc4_info, char * key, int len);
void void
ssl_rc4_crypt(void * rc4_info, char * in_data, char * out_data, int len); ssl_rc4_crypt(void * rc4_info, char * in_data, char * out_data, int len);
int int
ssl_mod_exp(char* out, int out_len, char* in, int in_len, ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len); char* mod, int mod_len, char* exp, int exp_len);
extern char g_username[64]; extern char g_username[64];
extern char g_hostname[16]; extern char g_hostname[16];
@ -172,11 +172,11 @@ licence_process_demand(STREAM s)
licence_generate_hwid(hwid); licence_generate_hwid(hwid);
sec_sign(signature, 16, g_licence_sign_key, 16, hwid, sizeof(hwid)); sec_sign(signature, 16, g_licence_sign_key, 16, hwid, sizeof(hwid));
/* Now encrypt the HWID */ /* Now encrypt the HWID */
crypt_key = ssl_rc4_info_create(); crypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(crypt_key, g_licence_key, 16); ssl_rc4_set_key(crypt_key, g_licence_key, 16);
ssl_rc4_crypt(crypt_key, hwid, hwid, sizeof(hwid)); ssl_rc4_crypt(crypt_key, hwid, hwid, sizeof(hwid));
ssl_rc4_info_delete(crypt_key); ssl_rc4_info_delete(crypt_key);
licence_present(null_data, null_data, licence_data, licence_size, hwid, signature); licence_present(null_data, null_data, licence_data, licence_size, hwid, signature);
xfree(licence_data); xfree(licence_data);
@ -251,11 +251,11 @@ licence_process_authreq(STREAM s)
memcpy(out_token, in_token, LICENCE_TOKEN_SIZE); memcpy(out_token, in_token, LICENCE_TOKEN_SIZE);
/* Decrypt the token. It should read TEST in Unicode. */ /* Decrypt the token. It should read TEST in Unicode. */
crypt_key = ssl_rc4_info_create(); crypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(crypt_key, g_licence_key, 16); ssl_rc4_set_key(crypt_key, g_licence_key, 16);
ssl_rc4_crypt(crypt_key, in_token, decrypt_token, LICENCE_TOKEN_SIZE); ssl_rc4_crypt(crypt_key, in_token, decrypt_token, LICENCE_TOKEN_SIZE);
ssl_rc4_info_delete(crypt_key); ssl_rc4_info_delete(crypt_key);
/* Generate a signature for a buffer of token and HWID */ /* Generate a signature for a buffer of token and HWID */
licence_generate_hwid(hwid); licence_generate_hwid(hwid);
memcpy(sealed_buffer, decrypt_token, LICENCE_TOKEN_SIZE); memcpy(sealed_buffer, decrypt_token, LICENCE_TOKEN_SIZE);
@ -263,11 +263,11 @@ licence_process_authreq(STREAM s)
sec_sign(out_sig, 16, g_licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer)); sec_sign(out_sig, 16, g_licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer));
/* Now encrypt the HWID */ /* Now encrypt the HWID */
crypt_key = ssl_rc4_info_create(); crypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(crypt_key, g_licence_key, 16); ssl_rc4_set_key(crypt_key, g_licence_key, 16);
ssl_rc4_crypt(crypt_key, hwid, crypt_hwid, LICENCE_HWID_SIZE); ssl_rc4_crypt(crypt_key, hwid, crypt_hwid, LICENCE_HWID_SIZE);
ssl_rc4_info_delete(crypt_key); ssl_rc4_info_delete(crypt_key);
licence_send_authresp(out_token, crypt_hwid, out_sig); licence_send_authresp(out_token, crypt_hwid, out_sig);
} }
@ -285,11 +285,11 @@ licence_process_issue(STREAM s)
if (!s_check_rem(s, length)) if (!s_check_rem(s, length))
return; return;
crypt_key = ssl_rc4_info_create(); crypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(crypt_key, g_licence_key, 16); ssl_rc4_set_key(crypt_key, g_licence_key, 16);
ssl_rc4_crypt(crypt_key, s->p, s->p, length); ssl_rc4_crypt(crypt_key, s->p, s->p, length);
ssl_rc4_info_delete(crypt_key); ssl_rc4_info_delete(crypt_key);
in_uint16(s, check); in_uint16(s, check);
if (check != 0) if (check != 0)
return; return;

View File

@ -1,19 +1,19 @@
# makefile # makefile
OBJS = tcp.obj iso.obj mcs.obj secure.obj rdp.obj rdp5.obj orders.obj \ OBJS = tcp.obj iso.obj mcs.obj secure.obj rdp.obj rdp5.obj orders.obj \
bitmap.obj cache.obj mppc.obj pstcache.obj channels.obj licence.obj \ bitmap.obj cache.obj mppc.obj pstcache.obj channels.obj licence.obj \
ssl_calls.obj ssl_calls.obj
UIOBJS = uimain.obj bsops.obj win32.obj UIOBJS = uimain.obj bsops.obj win32.obj
#-w-aus -w-rch #-w-aus -w-rch
CFLAGS = -O2 -w-par -I.. -Ic:\borland\bcc55\include CFLAGS = -O2 -w-par -I.. -Ic:\borland\bcc55\include
LDFLAGS = -W -Lc:\borland\bcc55\lib LDFLAGS = -W -Lc:\borland\bcc55\lib
all: rd all: rd
rd: $(OBJS) $(UIOBJS) rd: $(OBJS) $(UIOBJS)
$(CC) -ewinrdesktop.exe $(LDFLAGS) $(OBJS) $(UIOBJS) $(CC) -ewinrdesktop.exe $(LDFLAGS) $(OBJS) $(UIOBJS)
clean: clean:
del /q $(OBJS) $(UIOBJS) winrdesktop.exe *.tds del /q $(OBJS) $(UIOBJS) winrdesktop.exe *.tds

View File

@ -107,7 +107,7 @@ pstcache_save_bitmap(uint8 cache_id, uint16 cache_idx, uint8 * key,
int int
pstcache_enumerate(uint8 id, HASH_KEY * keylist) pstcache_enumerate(uint8 id, HASH_KEY * keylist)
{ {
int fd, n; int fd, n;
uint16 idx; uint16 idx;
sint16 mru_idx[0xa00]; sint16 mru_idx[0xa00];
uint32 mru_stamp[0xa00]; uint32 mru_stamp[0xa00];

View File

@ -20,22 +20,22 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#ifdef _WIN32 #ifdef _WIN32
#include <winsock2.h> /* winsock2.h first */ #include <winsock2.h> /* winsock2.h first */
#include <windows.h> #include <windows.h>
#include <time.h> #include <time.h>
#else /* WIN32 */ #else /* WIN32 */
#include <dirent.h> #include <dirent.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/time.h> #include <sys/time.h>
#ifdef HAVE_SYS_SELECT_H #ifdef HAVE_SYS_SELECT_H
#include <sys/select.h> #include <sys/select.h>
#else /* HAVE_SYS_SELECT_H */ #else /* HAVE_SYS_SELECT_H */
#include <sys/types.h> #include <sys/types.h>
#include <unistd.h> #include <unistd.h>
#endif /* HAVE_SYS_SELECT_H */ #endif /* HAVE_SYS_SELECT_H */
#endif /* WIN32 */ #endif /* WIN32 */
#include <limits.h> /* PATH_MAX */ #include <limits.h> /* PATH_MAX */
#define VERSION "1.4.1" #define VERSION "1.4.1"

File diff suppressed because it is too large Load Diff

View File

@ -24,44 +24,44 @@
//#include <openssl/md5.h> //#include <openssl/md5.h>
//#include <openssl/sha.h> //#include <openssl/sha.h>
//#include <openssl/bn.h> //#include <openssl/bn.h>
//#include <openssl/x509v3.h> //#include <openssl/x509v3.h>
void * void *
ssl_sha1_info_create(void); ssl_sha1_info_create(void);
void void
ssl_sha1_info_delete(void * sha1_info); ssl_sha1_info_delete(void * sha1_info);
void void
ssl_sha1_clear(void * sha1_info); ssl_sha1_clear(void * sha1_info);
void void
ssl_sha1_transform(void * sha1_info, char * data, int len); ssl_sha1_transform(void * sha1_info, char * data, int len);
void void
ssl_sha1_complete(void * sha1_info, char * data); ssl_sha1_complete(void * sha1_info, char * data);
void * void *
ssl_md5_info_create(void); ssl_md5_info_create(void);
void void
ssl_md5_info_delete(void * md5_info); ssl_md5_info_delete(void * md5_info);
void * void *
ssl_md5_info_create(void); ssl_md5_info_create(void);
void void
ssl_md5_info_delete(void * md5_info); ssl_md5_info_delete(void * md5_info);
void void
ssl_md5_clear(void * md5_info); ssl_md5_clear(void * md5_info);
void void
ssl_md5_transform(void * md5_info, char * data, int len); ssl_md5_transform(void * md5_info, char * data, int len);
void void
ssl_md5_complete(void * md5_info, char * data); ssl_md5_complete(void * md5_info, char * data);
void * void *
ssl_rc4_info_create(void); ssl_rc4_info_create(void);
void void
ssl_rc4_info_delete(void * rc4_info); ssl_rc4_info_delete(void * rc4_info);
void void
ssl_rc4_set_key(void * rc4_info, char * key, int len); ssl_rc4_set_key(void * rc4_info, char * key, int len);
void void
ssl_rc4_crypt(void * rc4_info, char * in_data, char * out_data, int len); ssl_rc4_crypt(void * rc4_info, char * in_data, char * out_data, int len);
int int
ssl_mod_exp(char* out, int out_len, char* in, int in_len, ssl_mod_exp(char* out, int out_len, char* in, int in_len,
char* mod, int mod_len, char* exp, int exp_len); char* mod, int mod_len, char* exp, int exp_len);
extern char g_hostname[16]; extern char g_hostname[16];
extern int g_width; extern int g_width;
extern int g_height; extern int g_height;
@ -82,7 +82,7 @@ static int rc4_key_len;
static void * rc4_decrypt_key = 0; static void * rc4_decrypt_key = 0;
static void * rc4_encrypt_key = 0; static void * rc4_encrypt_key = 0;
//static RSA *server_public_key; //static RSA *server_public_key;
static void * server_public_key; static void * server_public_key;
static uint8 sec_sign_key[16]; static uint8 sec_sign_key[16];
static uint8 sec_decrypt_key[16]; static uint8 sec_decrypt_key[16];
@ -123,19 +123,19 @@ sec_hash_48(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2, uint8 salt)
for (i = 0; i < 3; i++) for (i = 0; i < 3; i++)
{ {
memset(pad, salt + i, i + 1); memset(pad, salt + i, i + 1);
sha = ssl_sha1_info_create(); sha = ssl_sha1_info_create();
ssl_sha1_clear(sha); ssl_sha1_clear(sha);
ssl_sha1_transform(sha, pad, i + 1); ssl_sha1_transform(sha, pad, i + 1);
ssl_sha1_transform(sha, in, 48); ssl_sha1_transform(sha, in, 48);
ssl_sha1_transform(sha, salt1, 32); ssl_sha1_transform(sha, salt1, 32);
ssl_sha1_transform(sha, salt2, 32); ssl_sha1_transform(sha, salt2, 32);
ssl_sha1_complete(sha, shasig); ssl_sha1_complete(sha, shasig);
ssl_sha1_info_delete(sha); ssl_sha1_info_delete(sha);
md5 = ssl_md5_info_create(); md5 = ssl_md5_info_create();
ssl_md5_clear(md5); ssl_md5_clear(md5);
ssl_md5_transform(md5, in, 48); ssl_md5_transform(md5, in, 48);
ssl_md5_transform(md5, shasig, 20); ssl_md5_transform(md5, shasig, 20);
ssl_md5_complete(md5, out + i * 16); ssl_md5_complete(md5, out + i * 16);
ssl_md5_info_delete(md5); ssl_md5_info_delete(md5);
} }
} }
@ -147,13 +147,13 @@ void
sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2) sec_hash_16(uint8 * out, uint8 * in, uint8 * salt1, uint8 * salt2)
{ {
void * md5; void * md5;
md5 = ssl_md5_info_create(); md5 = ssl_md5_info_create();
ssl_md5_clear(md5); ssl_md5_clear(md5);
ssl_md5_transform(md5, in, 16); ssl_md5_transform(md5, in, 16);
ssl_md5_transform(md5, salt1, 32); ssl_md5_transform(md5, salt1, 32);
ssl_md5_transform(md5, salt2, 32); ssl_md5_transform(md5, salt2, 32);
ssl_md5_complete(md5, out); ssl_md5_complete(md5, out);
ssl_md5_info_delete(md5); ssl_md5_info_delete(md5);
} }
@ -207,15 +207,15 @@ sec_generate_keys(uint8 * client_random, uint8 * server_random, int rc4_key_size
memcpy(sec_decrypt_update_key, sec_decrypt_key, 16); memcpy(sec_decrypt_update_key, sec_decrypt_key, 16);
memcpy(sec_encrypt_update_key, sec_encrypt_key, 16); memcpy(sec_encrypt_update_key, sec_encrypt_key, 16);
/* Initialise RC4 state arrays */ /* Initialise RC4 state arrays */
ssl_rc4_info_delete(rc4_decrypt_key);
rc4_decrypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(rc4_decrypt_key, sec_decrypt_key, rc4_key_len);
ssl_rc4_info_delete(rc4_encrypt_key); ssl_rc4_info_delete(rc4_decrypt_key);
rc4_encrypt_key = ssl_rc4_info_create(); rc4_decrypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(rc4_encrypt_key, sec_encrypt_key, rc4_key_len); ssl_rc4_set_key(rc4_decrypt_key, sec_decrypt_key, rc4_key_len);
ssl_rc4_info_delete(rc4_encrypt_key);
rc4_encrypt_key = ssl_rc4_info_create();
ssl_rc4_set_key(rc4_encrypt_key, sec_encrypt_key, rc4_key_len);
} }
static uint8 pad_54[40] = { static uint8 pad_54[40] = {
@ -254,23 +254,23 @@ sec_sign(uint8 * signature, int siglen, uint8 * session_key, int keylen, uint8 *
buf_out_uint32(lenhdr, datalen); buf_out_uint32(lenhdr, datalen);
sha = ssl_sha1_info_create(); sha = ssl_sha1_info_create();
ssl_sha1_clear(sha); ssl_sha1_clear(sha);
ssl_sha1_transform(sha, session_key, keylen); ssl_sha1_transform(sha, session_key, keylen);
ssl_sha1_transform(sha, pad_54, 40); ssl_sha1_transform(sha, pad_54, 40);
ssl_sha1_transform(sha, lenhdr, 4); ssl_sha1_transform(sha, lenhdr, 4);
ssl_sha1_transform(sha, data, datalen); ssl_sha1_transform(sha, data, datalen);
ssl_sha1_complete(sha, shasig); ssl_sha1_complete(sha, shasig);
ssl_sha1_info_delete(sha); ssl_sha1_info_delete(sha);
md5 = ssl_md5_info_create(); md5 = ssl_md5_info_create();
ssl_md5_clear(md5); ssl_md5_clear(md5);
ssl_md5_transform(md5, session_key, keylen); ssl_md5_transform(md5, session_key, keylen);
ssl_md5_transform(md5, pad_92, 48); ssl_md5_transform(md5, pad_92, 48);
ssl_md5_transform(md5, shasig, 20); ssl_md5_transform(md5, shasig, 20);
ssl_md5_complete(md5, md5sig); ssl_md5_complete(md5, md5sig);
ssl_md5_info_delete(md5); ssl_md5_info_delete(md5);
memcpy(signature, md5sig, siglen); memcpy(signature, md5sig, siglen);
} }
@ -282,29 +282,29 @@ sec_update(uint8 * key, uint8 * update_key)
void * sha; void * sha;
void * md5; void * md5;
void * update; void * update;
sha = ssl_sha1_info_create();
ssl_sha1_clear(sha);
ssl_sha1_transform(sha, update_key, rc4_key_len);
ssl_sha1_transform(sha, pad_54, 40);
ssl_sha1_transform(sha, key, rc4_key_len);
ssl_sha1_complete(sha, shasig);
ssl_sha1_info_delete(sha);
md5 = ssl_md5_info_create(); sha = ssl_sha1_info_create();
ssl_md5_clear(md5); ssl_sha1_clear(sha);
ssl_md5_transform(md5, update_key, rc4_key_len); ssl_sha1_transform(sha, update_key, rc4_key_len);
ssl_md5_transform(md5, pad_92, 48); ssl_sha1_transform(sha, pad_54, 40);
ssl_md5_transform(md5, shasig, 20); ssl_sha1_transform(sha, key, rc4_key_len);
ssl_md5_complete(md5, key); ssl_sha1_complete(sha, shasig);
ssl_md5_info_delete(md5); ssl_sha1_info_delete(sha);
md5 = ssl_md5_info_create();
update = ssl_rc4_info_create(); ssl_md5_clear(md5);
ssl_rc4_set_key(update, key, rc4_key_len); ssl_md5_transform(md5, update_key, rc4_key_len);
ssl_rc4_crypt(update, key, key, rc4_key_len); ssl_md5_transform(md5, pad_92, 48);
ssl_rc4_info_delete(update); ssl_md5_transform(md5, shasig, 20);
ssl_md5_complete(md5, key);
ssl_md5_info_delete(md5);
update = ssl_rc4_info_create();
ssl_rc4_set_key(update, key, rc4_key_len);
ssl_rc4_crypt(update, key, key, rc4_key_len);
ssl_rc4_info_delete(update);
if (rc4_key_len == 8) if (rc4_key_len == 8)
sec_make_40bit(key); sec_make_40bit(key);
} }
@ -315,7 +315,7 @@ sec_encrypt(uint8 * data, int length)
{ {
if (sec_encrypt_use_count == 4096) if (sec_encrypt_use_count == 4096)
{ {
sec_update(sec_encrypt_key, sec_encrypt_update_key); sec_update(sec_encrypt_key, sec_encrypt_update_key);
ssl_rc4_set_key(rc4_encrypt_key, sec_encrypt_key, rc4_key_len); ssl_rc4_set_key(rc4_encrypt_key, sec_encrypt_key, rc4_key_len);
sec_encrypt_use_count = 0; sec_encrypt_use_count = 0;
} }
@ -330,10 +330,10 @@ sec_decrypt(uint8 * data, int length)
if (sec_decrypt_use_count == 4096) if (sec_decrypt_use_count == 4096)
{ {
sec_update(sec_decrypt_key, sec_decrypt_update_key); sec_update(sec_decrypt_key, sec_decrypt_update_key);
ssl_rc4_set_key(rc4_decrypt_key, sec_decrypt_key, rc4_key_len); ssl_rc4_set_key(rc4_decrypt_key, sec_decrypt_key, rc4_key_len);
sec_decrypt_use_count = 0; sec_decrypt_use_count = 0;
} }
ssl_rc4_crypt(rc4_decrypt_key, data, data, length); ssl_rc4_crypt(rc4_decrypt_key, data, data, length);
sec_decrypt_use_count++; sec_decrypt_use_count++;
} }
@ -354,8 +354,8 @@ reverse(uint8 * p, int len)
/* Perform an RSA public key encryption operation */ /* Perform an RSA public key encryption operation */
static void static void
sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent) sec_rsa_encrypt(uint8 * out, uint8 * in, int len, uint8 * modulus, uint8 * exponent)
{ {
ssl_mod_exp(out, 64, in, 32, modulus, 64, exponent, 4); ssl_mod_exp(out, 64, in, 32, modulus, 64, exponent, 4);
/* /*
BN_CTX *ctx; BN_CTX *ctx;
BIGNUM mod, exp, x, y; BIGNUM mod, exp, x, y;
@ -578,7 +578,7 @@ sec_parse_public_key(STREAM s, uint8 ** modulus, uint8 ** exponent)
return s_check(s); return s_check(s);
} }
/* Parse a crypto information structure */ /* Parse a crypto information structure */
static BOOL static BOOL
sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size, sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
@ -647,7 +647,7 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
} }
} }
else else
{ {
#if 0 #if 0
uint32 certcount; uint32 certcount;
@ -737,7 +737,7 @@ sec_parse_crypt_info(STREAM s, uint32 * rc4_key_size,
} }
X509_free(server_cert); X509_free(server_cert);
return True; /* There's some garbage here we don't care about */ return True; /* There's some garbage here we don't care about */
#endif #endif
} }
return s_check_end(s); return s_check_end(s);
} }
@ -783,7 +783,7 @@ sec_process_crypt_info(STREAM s)
reverse(sec_crypted_random, SEC_MODULUS_SIZE); reverse(sec_crypted_random, SEC_MODULUS_SIZE);
RSA_free(server_public_key); RSA_free(server_public_key);
server_public_key = NULL; server_public_key = NULL;
#endif #endif
} }
else else

View File

@ -18,30 +18,30 @@
ssl calls ssl calls
*/ */
#include "rdesktop.h" #include "rdesktop.h"
#define APP_CC #define APP_CC
/*****************************************************************************/ /*****************************************************************************/
static void * g_malloc(int size, int zero) static void * g_malloc(int size, int zero)
{ {
void * p; void * p;
p = xmalloc(size); p = xmalloc(size);
if (zero) if (zero)
{ {
memset(p, 0, size); memset(p, 0, size);
} }
return p; return p;
} }
/*****************************************************************************/ /*****************************************************************************/
static void g_free(void * in) static void g_free(void * in)
{ {
xfree(in); xfree(in);
} }
/*****************************************************************************/ /*****************************************************************************/
/*****************************************************************************/ /*****************************************************************************/

View File

@ -28,22 +28,22 @@
#include <arpa/inet.h> /* inet_addr */ #include <arpa/inet.h> /* inet_addr */
#include <errno.h> /* errno */ #include <errno.h> /* errno */
#endif /* _WIN32 */ #endif /* _WIN32 */
#include "rdesktop.h"
#ifdef _WIN32 #include "rdesktop.h"
#define socklen_t int
#define TCP_CLOSE(_sck) closesocket(_sck) #ifdef _WIN32
#define TCP_STRERROR "tcp error" #define socklen_t int
#define TCP_SLEEP(_n) Sleep(_n) #define TCP_CLOSE(_sck) closesocket(_sck)
#define TCP_BLOCKS (WSAGetLastError() == WSAEWOULDBLOCK) #define TCP_STRERROR "tcp error"
#else /* _WIN32 */ #define TCP_SLEEP(_n) Sleep(_n)
#define TCP_CLOSE(_sck) close(_sck) #define TCP_BLOCKS (WSAGetLastError() == WSAEWOULDBLOCK)
#define TCP_STRERROR strerror(errno) #else /* _WIN32 */
#define TCP_SLEEP(_n) sleep(_n) #define TCP_CLOSE(_sck) close(_sck)
#define TCP_BLOCKS (errno == EWOULDBLOCK) #define TCP_STRERROR strerror(errno)
#endif /* _WIN32 */ #define TCP_SLEEP(_n) sleep(_n)
#define TCP_BLOCKS (errno == EWOULDBLOCK)
#endif /* _WIN32 */
#ifndef INADDR_NONE #ifndef INADDR_NONE
#define INADDR_NONE ((unsigned long) -1) #define INADDR_NONE ((unsigned long) -1)
#endif #endif

View File

@ -251,7 +251,7 @@ NOTIFY;
#ifndef PATH_MAX #ifndef PATH_MAX
#define PATH_MAX 256 #define PATH_MAX 256
#endif #endif
#ifndef _WIN32 #ifndef _WIN32
typedef struct fileinfo typedef struct fileinfo
{ {
@ -264,7 +264,7 @@ typedef struct fileinfo
NOTIFY notify; NOTIFY notify;
uint32 info_class; uint32 info_class;
} }
FILEINFO; FILEINFO;
#endif #endif
typedef BOOL(*str_handle_lines_t) (const char *line, void *data); typedef BOOL(*str_handle_lines_t) (const char *line, void *data);

File diff suppressed because it is too large Load Diff

View File

@ -1,83 +1,85 @@
/* -*- c-basic-offset: 8 -*- /* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client. rdesktop: A Remote Desktop Protocol client.
main ui header main ui header
Copyright (C) Jay Sorg 2005-2006 Copyright (C) Jay Sorg 2005-2006
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. (at your option) any later version.
This program is distributed in the hope that it will be useful, This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
/* in uimain.c */ /* in uimain.c */
int int
ui_main(void); ui_main(void);
void void
ui_invalidate(int x, int y, int cx, int cy); ui_invalidate(int x, int y, int cx, int cy);
int int
ui_read_wire(void); ui_read_wire(void);
void void
ui_mouse_move(int x, int y); ui_mouse_move(int x, int y);
void void
ui_mouse_button(int button, int x, int y, int down); ui_mouse_button(int button, int x, int y, int down);
void void
ui_key_down(int key, int ext); ui_key_down(int key, int ext);
void void
ui_key_up(int key, int ext); ui_key_up(int key, int ext);
void
ui_set_modifier_state(int code); void
#define SPLIT_COLOUR15(c, r, g, b) \ ui_set_modifier_state(int code);
{ \
r = ((c >> 7) & 0xf8) | ((c >> 12) & 0x7); \ #define SPLIT_COLOUR15(c, r, g, b) \
g = ((c >> 2) & 0xf8) | ((c >> 8) & 0x7); \ { \
b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \ r = ((c >> 7) & 0xf8) | ((c >> 12) & 0x7); \
} g = ((c >> 2) & 0xf8) | ((c >> 8) & 0x7); \
b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \
#define SPLIT_COLOUR16(c, r, g, b) \ }
{ \
r = ((c >> 8) & 0xf8) | ((c >> 13) & 0x7); \ #define SPLIT_COLOUR16(c, r, g, b) \
g = ((c >> 3) & 0xfc) | ((c >> 9) & 0x3); \ { \
b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \ r = ((c >> 8) & 0xf8) | ((c >> 13) & 0x7); \
} g = ((c >> 3) & 0xfc) | ((c >> 9) & 0x3); \
b = ((c << 3) & 0xf8) | ((c >> 2) & 0x7); \
#define SPLIT_COLOUR32(c, r, g, b) \ }
{ \
r = ((c >> 0) & 0xff); \ #define SPLIT_COLOUR32(c, r, g, b) \
g = ((c >> 8) & 0xff); \ { \
b = ((c >> 16) & 0xff); \ r = ((c >> 0) & 0xff); \
} g = ((c >> 8) & 0xff); \
b = ((c >> 16) & 0xff); \
#define MAKE_COLOUR15(c, r, g, b) \ }
{ \
c = ( \ #define MAKE_COLOUR15(c, r, g, b) \
(((r & 0xff) >> 3) << 10) | \ { \
(((g & 0xff) >> 3) << 5) | \ c = ( \
(((b & 0xff) >> 3) << 0) \ (((r & 0xff) >> 3) << 10) | \
); \ (((g & 0xff) >> 3) << 5) | \
} (((b & 0xff) >> 3) << 0) \
); \
#define MAKE_COLOUR32(c, r, g, b) \ }
{ \
c = ( \ #define MAKE_COLOUR32(c, r, g, b) \
((r & 0xff) << 16) | \ { \
((g & 0xff) << 8) | \ c = ( \
((b & 0xff) << 0) \ ((r & 0xff) << 16) | \
); \ ((g & 0xff) << 8) | \
} ((b & 0xff) << 0) \
); \
#undef UI_MAX }
#define UI_MAX(a, b) (((a) > (b)) ? (a) : (b))
#undef UI_MIN #undef UI_MAX
#define UI_MIN(a, b) (((a) < (b)) ? (a) : (b)) #define UI_MAX(a, b) (((a) > (b)) ? (a) : (b))
#undef UI_MIN
#define UI_MIN(a, b) (((a) < (b)) ? (a) : (b))

File diff suppressed because it is too large Load Diff