19 |
*/ |
*/ |
20 |
|
|
21 |
#include "rdesktop.h" |
#include "rdesktop.h" |
22 |
|
|
23 |
|
#ifdef WITH_OPENSSL |
24 |
|
#include <openssl/rc4.h> |
25 |
|
#else |
26 |
#include "crypto/rc4.h" |
#include "crypto/rc4.h" |
27 |
|
#endif |
28 |
|
|
29 |
extern char username[16]; |
extern char username[16]; |
30 |
extern char hostname[16]; |
extern char hostname[16]; |
|
extern BOOL licence; |
|
31 |
|
|
32 |
static uint8 licence_key[16]; |
static uint8 licence_key[16]; |
33 |
static uint8 licence_sign_key[16]; |
static uint8 licence_sign_key[16]; |
254 |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
255 |
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)); |
256 |
|
|
|
/* Deliberately break signature if licencing disabled */ |
|
|
if (!licence) |
|
|
memset(out_sig, 0, sizeof(out_sig)); |
|
|
|
|
257 |
/* Now encrypt the HWID */ |
/* Now encrypt the HWID */ |
258 |
RC4_set_key(&crypt_key, 16, licence_key); |
RC4_set_key(&crypt_key, 16, licence_key); |
259 |
RC4(&crypt_key, LICENCE_HWID_SIZE, hwid, crypt_hwid); |
RC4(&crypt_key, LICENCE_HWID_SIZE, hwid, crypt_hwid); |