1 |
/* |
/* |
2 |
rdesktop: A Remote Desktop Protocol client. |
rdesktop: A Remote Desktop Protocol client. |
3 |
RDP licensing negotiation |
RDP licensing negotiation |
4 |
Copyright (C) Matthew Chapman 1999-2001 |
Copyright (C) Matthew Chapman 1999-2002 |
5 |
|
|
6 |
This program is free software; you can redistribute it and/or modify |
This program is free software; you can redistribute it and/or modify |
7 |
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 |
23 |
|
|
24 |
extern char username[16]; |
extern char username[16]; |
25 |
extern char hostname[16]; |
extern char hostname[16]; |
|
extern BOOL licence; |
|
26 |
|
|
27 |
static uint8 licence_key[16]; |
static uint8 licence_key[16]; |
28 |
static uint8 licence_sign_key[16]; |
static uint8 licence_sign_key[16]; |
249 |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
250 |
sec_sign(out_sig, 16, licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer)); |
sec_sign(out_sig, 16, licence_sign_key, 16, sealed_buffer, sizeof(sealed_buffer)); |
251 |
|
|
|
/* Deliberately break signature if licencing disabled */ |
|
|
if (!licence) |
|
|
memset(out_sig, 0, sizeof(out_sig)); |
|
|
|
|
252 |
/* Now encrypt the HWID */ |
/* Now encrypt the HWID */ |
253 |
RC4_set_key(&crypt_key, 16, licence_key); |
RC4_set_key(&crypt_key, 16, licence_key); |
254 |
RC4(&crypt_key, LICENCE_HWID_SIZE, hwid, crypt_hwid); |
RC4(&crypt_key, LICENCE_HWID_SIZE, hwid, crypt_hwid); |