~ubuntu-branches/ubuntu/precise/virtualbox/precise-updates

« back to all changes in this revision

Viewing changes to src/VBox/RDP/client/secure.c

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2011-07-04 13:02:31 UTC
  • mfrom: (3.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20110704130231-l843es6wqhx614n7
Tags: 4.0.10-dfsg-1ubuntu1
* Merge from Debian unstable, remaining changes:
  - Add Apport hook.
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Drop *-source packages.
* Add the Modaliases control field manually for maximum backportability.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* -*- c-basic-offset: 8 -*-
2
2
   rdesktop: A Remote Desktop Protocol client.
3
3
   Protocol services - RDP encryption and licensing
4
 
   Copyright (C) Matthew Chapman 1999-2007
 
4
   Copyright (C) Matthew Chapman <matthewc.unsw.edu.au> 1999-2008
 
5
   Copyright 2005-2011 Peter Astrand <astrand@cendio.se> for Cendio AB
5
6
 
6
 
   This program is free software; you can redistribute it and/or modify
 
7
   This program is free software: you can redistribute it and/or modify
7
8
   it under the terms of the GNU General Public License as published by
8
 
   the Free Software Foundation; either version 2 of the License, or
 
9
   the Free Software Foundation, either version 3 of the License, or
9
10
   (at your option) any later version.
10
11
 
11
12
   This program is distributed in the hope that it will be useful,
14
15
   GNU General Public License for more details.
15
16
 
16
17
   You should have received a copy of the GNU General Public License
17
 
   along with this program; if not, write to the Free Software
18
 
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
18
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
19
19
*/
20
20
 
21
21
/*
44
44
extern int g_server_depth;
45
45
extern VCHANNEL g_channels[];
46
46
extern unsigned int g_num_channels;
 
47
extern uint8 g_client_random[SEC_RANDOM_SIZE];
47
48
 
48
49
static int g_rc4_key_len;
49
50
static SSL_RC4 g_rc4_decrypt_key;
677
678
sec_process_crypt_info(STREAM s)
678
679
{
679
680
        uint8 *server_random = NULL;
680
 
        uint8 client_random[SEC_RANDOM_SIZE];
681
681
        uint8 modulus[SEC_MAX_MODULUS_SIZE];
682
682
        uint8 exponent[SEC_EXPONENT_SIZE];
683
683
        uint32 rc4_key_size;
690
690
                return;
691
691
        }
692
692
        DEBUG(("Generating client random\n"));
693
 
        generate_random(client_random);
694
 
        sec_rsa_encrypt(g_sec_crypted_random, client_random, SEC_RANDOM_SIZE,
 
693
        generate_random(g_client_random);
 
694
        sec_rsa_encrypt(g_sec_crypted_random, g_client_random, SEC_RANDOM_SIZE,
695
695
                        g_server_public_key_len, modulus, exponent);
696
 
        sec_generate_keys(client_random, server_random, rc4_key_size);
 
696
        sec_generate_keys(g_client_random, server_random, rc4_key_size);
697
697
}
698
698
 
699
699
 
835
835
                if (channel != MCS_GLOBAL_CHANNEL)
836
836
                {
837
837
                        channel_process(s, channel);
838
 
                        *rdpver = 0xff;
 
838
                        if (rdpver != NULL)
 
839
                                *rdpver = 0xff;
839
840
                        return s;
840
841
                }
841
842
 
847
848
 
848
849
/* Establish a secure connection */
849
850
RD_BOOL
850
 
sec_connect(char *server, char *username)
851
 
{
852
 
        struct stream mcs_data;
853
 
 
854
 
        /* We exchange some RDP data during the MCS-Connect */
855
 
        mcs_data.size = 512;
856
 
        mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size);
857
 
        sec_out_mcs_data(&mcs_data);
858
 
 
859
 
        if (!mcs_connect(server, &mcs_data, username))
860
 
                return False;
861
 
 
862
 
        /*      sec_process_mcs_data(&mcs_data); */
863
 
        if (g_encryption)
864
 
                sec_establish_key();
865
 
        xfree(mcs_data.data);
866
 
        return True;
867
 
}
868
 
 
869
 
/* Establish a secure connection */
870
 
RD_BOOL
871
 
sec_reconnect(char *server)
872
 
{
873
 
        struct stream mcs_data;
874
 
 
875
 
        /* We exchange some RDP data during the MCS-Connect */
876
 
        mcs_data.size = 512;
877
 
        mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size);
878
 
        sec_out_mcs_data(&mcs_data);
879
 
 
880
 
        if (!mcs_reconnect(server, &mcs_data))
 
851
sec_connect(char *server, char *username, RD_BOOL reconnect)
 
852
{
 
853
        struct stream mcs_data;
 
854
 
 
855
        /* We exchange some RDP data during the MCS-Connect */
 
856
        mcs_data.size = 512;
 
857
        mcs_data.p = mcs_data.data = (uint8 *) xmalloc(mcs_data.size);
 
858
        sec_out_mcs_data(&mcs_data);
 
859
 
 
860
        if (!mcs_connect(server, &mcs_data, username, reconnect))
881
861
                return False;
882
862
 
883
863
        /*      sec_process_mcs_data(&mcs_data); */