27 |
#endif |
#endif |
28 |
|
|
29 |
extern char g_username[16]; |
extern char g_username[16]; |
30 |
extern char hostname[16]; |
extern char g_hostname[16]; |
31 |
|
|
32 |
static uint8 g_licence_key[16]; |
static uint8 g_licence_key[16]; |
33 |
static uint8 g_licence_sign_key[16]; |
static uint8 g_licence_sign_key[16]; |
43 |
|
|
44 |
/* Generate master secret and then key material */ |
/* Generate master secret and then key material */ |
45 |
sec_hash_48(master_secret, pre_master_secret, client_random, server_random, 'A'); |
sec_hash_48(master_secret, pre_master_secret, client_random, server_random, 'A'); |
46 |
sec_hash_48(key_block, master_secret, server_random, client_random, 'A'); |
sec_hash_48(key_block, master_secret, server_random, client_random, 'A'); |
47 |
|
|
48 |
/* Store first 16 bytes of session key as MAC secret */ |
/* Store first 16 bytes of session key as MAC secret */ |
49 |
memcpy(g_licence_sign_key, key_block, 16); |
memcpy(g_licence_sign_key, key_block, 16); |
56 |
licence_generate_hwid(uint8 * hwid) |
licence_generate_hwid(uint8 * hwid) |
57 |
{ |
{ |
58 |
buf_out_uint32(hwid, 2); |
buf_out_uint32(hwid, 2); |
59 |
strncpy((char *) (hwid + 4), hostname, LICENCE_HWID_SIZE - 4); |
strncpy((char *) (hwid + 4), g_hostname, LICENCE_HWID_SIZE - 4); |
60 |
} |
} |
61 |
|
|
62 |
/* Present an existing licence to the server */ |
/* Present an existing licence to the server */ |
174 |
return; |
return; |
175 |
} |
} |
176 |
|
|
177 |
licence_send_request(null_data, null_data, g_username, hostname); |
licence_send_request(null_data, null_data, g_username, g_hostname); |
178 |
} |
} |
179 |
|
|
180 |
/* Send an authentication response packet */ |
/* Send an authentication response packet */ |