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 |
8 |
the Free Software Foundation; either version 2 of the License, or |
the Free Software Foundation; either version 2 of the License, or |
9 |
(at your option) any later version. |
(at your option) any later version. |
10 |
|
|
11 |
This program is distributed in the hope that it will be useful, |
This program is distributed in the hope that it will be useful, |
12 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
103 |
uint32 sec_flags = SEC_LICENCE_NEG; |
uint32 sec_flags = SEC_LICENCE_NEG; |
104 |
uint16 userlen = strlen(user) + 1; |
uint16 userlen = strlen(user) + 1; |
105 |
uint16 hostlen = strlen(host) + 1; |
uint16 hostlen = strlen(host) + 1; |
106 |
uint16 length = 120 + userlen + hostlen; |
uint16 length = 128 + userlen + hostlen; |
107 |
STREAM s; |
STREAM s; |
108 |
|
|
109 |
s = sec_init(sec_flags, length + 2); |
s = sec_init(sec_flags, length + 2); |
162 |
|
|
163 |
/* Generate a signature for the HWID buffer */ |
/* Generate a signature for the HWID buffer */ |
164 |
licence_generate_hwid(hwid); |
licence_generate_hwid(hwid); |
165 |
sec_sign(signature, licence_sign_key, 16, hwid, sizeof(hwid)); |
sec_sign(signature, 16, licence_sign_key, 16, hwid, sizeof(hwid)); |
166 |
|
|
167 |
/* Now encrypt the HWID */ |
/* Now encrypt the HWID */ |
168 |
RC4_set_key(&crypt_key, 16, licence_key); |
RC4_set_key(&crypt_key, 16, licence_key); |
245 |
licence_generate_hwid(hwid); |
licence_generate_hwid(hwid); |
246 |
memcpy(sealed_buffer, decrypt_token, LICENCE_TOKEN_SIZE); |
memcpy(sealed_buffer, decrypt_token, LICENCE_TOKEN_SIZE); |
247 |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
memcpy(sealed_buffer + LICENCE_TOKEN_SIZE, hwid, LICENCE_HWID_SIZE); |
248 |
sec_sign(out_sig, licence_sign_key, 16, |
sec_sign(out_sig, 16, licence_sign_key, 16, |
249 |
sealed_buffer, sizeof(sealed_buffer)); |
sealed_buffer, sizeof(sealed_buffer)); |
250 |
|
|
251 |
/* Deliberately break signature if licencing disabled */ |
/* Deliberately break signature if licencing disabled */ |