Remove lots of licensing stuff we didn't need after all.
authorSteinar H. Gunderson <sesse@samfundet.no>
Sun, 6 Feb 2005 13:49:37 +0000 (13:49 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Sun, 6 Feb 2005 13:49:37 +0000 (13:49 +0000)
Makefile
licence.c [deleted file]
secure.c

index 32a6404..362807c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ CFLAGS=-g -Wall
 LIBS=-lcrypto
 
 all: rdpsrv protodiff
-OBJS=rdpsrv.o iso.o tcp.o util.o mcs.o secure.o channels.o rdp.o licence.o rdp5.o
+OBJS=rdpsrv.o iso.o tcp.o util.o mcs.o secure.o channels.o rdp.o rdp5.o
 OBJS_PROTODIFF=protodiff.o tcp.o util.o
 
 rdpsrv: $(OBJS)
diff --git a/licence.c b/licence.c
deleted file mode 100644 (file)
index 28c035b..0000000
--- a/licence.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
-   rdesktop: A Remote Desktop Protocol client.
-   RDP licensing negotiation
-   Copyright (C) Matthew Chapman 1999-2002
-   
-   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
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-   
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "rdesktop.h"
-
-#include <openssl/rc4.h>
-
-extern char g_username[16];
-extern char hostname[16];
-
-static uint8 g_licence_key[16];
-static uint8 g_licence_sign_key[16];
-
-BOOL g_licence_issued = False;
-
-/* Generate a session key and RC4 keys, given client and server randoms */
-void
-licence_generate_keys(uint8 * client_key, uint8 * server_key, uint8 * client_rsa)
-{
-       uint8 session_key[48];
-       uint8 temp_hash[48];
-
-       /* Generate session key - two rounds of sec_hash_48 */
-       sec_hash_48(temp_hash, client_rsa, client_key, server_key, 65);
-       sec_hash_48(session_key, temp_hash, server_key, client_key, 65);
-
-       /* Store first 16 bytes of session key, for generating signatures */
-       memcpy(g_licence_sign_key, session_key, 16);
-
-       /* Generate RC4 key */
-       sec_hash_16(g_licence_key, &session_key[16], client_key, server_key);
-
-       {
-               int i;
-
-               printf("g_license_key:\n");
-               for (i = 0; i < 16; ++i)
-                       printf(" 0x%02x", g_licence_key[i]);
-               printf("\n");
-
-               printf("g_license_sign_key:\n");
-               for (i = 0; i < 16; ++i)
-                       printf(" 0x%02x", g_licence_sign_key[i]);
-               printf("\n");
-       }
-}
-
-// "TEST" in UTF-16
-unsigned char license_token[] = {
-       0x54, 0x00, 0x45, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00
-};
-
-void
-send_authreq()
-{
-       RC4_KEY crypt_key;
-       uint8 in_token[LICENCE_TOKEN_SIZE], encrypt_token[LICENCE_TOKEN_SIZE];
-       uint8 signature[LICENCE_SIGNATURE_SIZE];
-
-       STREAM s = sec_init(38, SEC_LICENCE_NEG);
-       
-       out_uint8(s, LICENCE_TAG_AUTHREQ);
-       out_uint8(s, 3);  // version
-       out_uint16_le(s, 38); // length
-
-       // unknown
-       out_uint16_le(s, 0xffff);
-       out_uint16_le(s, 0xffff);
-       out_uint16_le(s, 0x0000);
-
-       out_uint16_le(s, LICENCE_TOKEN_SIZE);
-       memcpy(in_token, license_token, LICENCE_TOKEN_SIZE);
-
-       // encrypt the token
-       RC4_set_key(&crypt_key, 16, g_licence_key);
-       RC4(&crypt_key, LICENCE_TOKEN_SIZE, in_token, encrypt_token);
-
-       out_uint8p(s, encrypt_token, LICENCE_TOKEN_SIZE);
-
-       // what are we supposed to sign here, really? guess at the
-       // token, nothing else has been sent...
-       sec_sign(signature, 16, g_licence_sign_key, 16, encrypt_token, LICENCE_TOKEN_SIZE);
-       out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);
-
-       s_mark_end(s);
-       sec_send(s, SEC_LICENCE_NEG);
-}
-
index 45cebf0..cf98676 100644 (file)
--- a/secure.c
+++ b/secure.c
@@ -31,7 +31,7 @@ extern int g_width;
 extern int g_height;
 extern int keylayout;
 extern BOOL g_encryption;
-extern BOOL g_licence_issued;
+BOOL g_licence_issued;
 extern BOOL g_use_rdp5;
 extern BOOL g_console_session;
 extern int g_server_bpp;
@@ -736,21 +736,9 @@ sec_process_mcs_data(STREAM s)
 extern unsigned char cacert[];
 extern BOOL g_licence_issued;
 
-unsigned char demand_license[] = {
-       0x01, 0x03, 0x86, 0x00, 0x9c, 0x6e, 0xef, 0x5a, 0x26, 0x45, 0x88, 0x86, 0x0e, 0xdf, 0xa4, 0x4a,
-       0x45, 0xc7, 0x5a, 0x4c, 0xec, 0x33, 0xff, 0x4c, 0xd8, 0x4b, 0xd2, 0x4e, 0xd2, 0x22, 0x16, 0xde,
-       0x1e, 0x5b, 0x06, 0x6e, 0x00, 0x00, 0x05, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x4d, 0x00, 0x69, 0x00,
-       0x63, 0x00, 0x72, 0x00, 0x6f, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x66, 0x00, 0x74, 0x00, 0x20, 0x00,
-       0x43, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x70, 0x00, 0x6f, 0x00, 0x72, 0x00, 0x61, 0x00, 0x74, 0x00,
-       0x69, 0x00, 0x6f, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x41, 0x00, 0x30, 0x00,
-       0x32, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x04, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0xf6, 0x00, 0x00,
-       0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x0e, 0x00, 0x6d, 0x69, 0x63, 0x72, 0x6f, 0x73, 0x6f, 0x66,
-       0x74, 0x2e, 0x63, 0x6f, 0x6d, 0x00 
-};
 unsigned char result_license[] = {
         0xff, 0x03, 0x10, 0x00, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0xa0, 0x5f, 0x00, 0x00
 };
-
 unsigned char demand_active[] = {
        0x24, 0x01, 0x11, 0x00, 0xea, 0x03, 0xea, 0x03, 0x01, 0x00, 0x04, 0x00, 0x0e, 0x01, 0x52, 0x44,
        0x50, 0x00, 0x09, 0x00, 0x00, 0x00, 0x09, 0x00, 0x08, 0x00, 0xea, 0x03, 0x40, 0xe4, 0x01, 0x00,
@@ -777,60 +765,6 @@ unsigned char demand_active[] = {
 #define EXPECT16(value) { in_uint16_le(s, unknown); if (unknown != (value)) printf("Unknown value on code line %u; expected 0x%x, got 0x%x\n", __LINE__, (value), unknown); }
 #define EXPECT32(value) { in_uint32_le(s, unknown); if (unknown != (value)) printf("Unknown value on code line %u; expected 0x%x, got 0x%x\n", __LINE__, (value), unknown); }
 
-void
-process_presented_license(STREAM s)
-{
-       unsigned char client_license_random[SEC_RANDOM_SIZE];
-       unsigned char client_license_rsa_data[SEC_MODULUS_SIZE];
-
-       uint16 length, license_size;
-       uint32 unknown;
-       uint8 *license, hwid[LICENCE_HWID_SIZE], signature[LICENCE_SIGNATURE_SIZE];
-       int i;
-       
-       EXPECT8(2);                   // version
-       in_uint16_le(s, length);
-
-       EXPECT32(1);                  // unknown
-       EXPECT16(0);
-       EXPECT16(0x0201);
-
-       in_uint8a(s, client_license_random, SEC_RANDOM_SIZE);
-       EXPECT16(0);
-       EXPECT16(SEC_MODULUS_SIZE + SEC_PADDING_SIZE);
-       in_uint8a(s, client_license_rsa_data, SEC_MODULUS_SIZE);
-       in_uint8s(s, SEC_PADDING_SIZE);
-
-       EXPECT16(1);
-       in_uint16_le(s, license_size);
-
-       license = (uint8 *)xmalloc(license_size);
-       in_uint8a(s, license, license_size);
-
-       printf("Received license:\n");
-       for (i = 0; i < license_size; ++i)
-               printf(" 0x%02x", license[i]);
-       printf("\n");
-
-       EXPECT16(1);
-       EXPECT16(LICENCE_HWID_SIZE);
-       in_uint8a(s, hwid, LICENCE_HWID_SIZE);
-
-       printf("License hardware ID:\n");
-       for (i = 0; i < LICENCE_HWID_SIZE; ++i)
-               printf(" 0x%02x", hwid[i]);
-       printf("\n");
-
-       in_uint8a(s, signature, LICENCE_SIGNATURE_SIZE);
-
-       if (!s_check_end(s)) {
-               printf("Unknown data at the end of presented license!");
-       }
-
-       // now we can generate the keys we need
-       licence_generate_keys(client_license_random, demand_license + 4, client_license_rsa_data);
-//     send_authreq();
-}
 
 /* Receive secure transport packet */
 STREAM
@@ -856,26 +790,8 @@ sec_recv(void)
                        {
                                uint8 tag;
                                in_uint8(s, tag);
-                               
-                               if (tag == LICENCE_TAG_PRESENT) {
-                                       process_presented_license(s);
-
-                                       {
-                                               STREAM s;
-                                               s = sec_init(SEC_LICENCE_NEG, sizeof(result_license));
-                                               out_uint8p(s, result_license, sizeof(result_license));
-                                               s_mark_end(s);
-                                               sec_send(s, SEC_LICENCE_NEG);
-                                       }
-                                       
-                                       {
-                                               STREAM s;
-                                               s = sec_init(SEC_ENCRYPT, sizeof(demand_active));
-                                               out_uint8p(s, demand_active, sizeof(demand_active));
-                                               s_mark_end(s);
-                                               sec_send(s, SEC_ENCRYPT);
-                                       }
-                               }
+                       
+                               printf("License tag %x, unimplemented\n", tag);
                                
                                return NULL;
                        }
@@ -883,17 +799,25 @@ sec_recv(void)
                        if (sec_flags & SEC_LOGON_INFO) 
                        {
                                rdp_get_logon_info(s);
-                       
-                               // demand a license
+                               
+                               // say "licensing is OK", then demand
+                               // activity
                                {
                                        STREAM s;
-
-                                       s = sec_init(SEC_LICENCE_NEG, sizeof(demand_license));
-                                       out_uint8p(s, demand_license, sizeof(demand_license));
+                                       s = sec_init(SEC_LICENCE_NEG, sizeof(result_license));
+                                       out_uint8p(s, result_license, sizeof(result_license));
                                        s_mark_end(s);
                                        sec_send(s, SEC_LICENCE_NEG);
                                }
-                               
+                       
+                               {
+                                       STREAM s;
+                                       s = sec_init(SEC_ENCRYPT, sizeof(demand_active));
+                                       out_uint8p(s, demand_active, sizeof(demand_active));
+                                       s_mark_end(s);
+                                       sec_send(s, SEC_ENCRYPT);
+                               }
+
                                return NULL;
                        }