]> git.sesse.net Git - rdpsrv/blobdiff - licence.c
Decode mouse events, try to send RDP4 bitmap updates back (?).
[rdpsrv] / licence.c
index f862ecdcf91d158de0abc8c09094c1217d1bd252..28c035becf4f07cc94340f65a65f108fe9153f0b 100644 (file)
--- a/licence.c
+++ b/licence.c
@@ -62,3 +62,44 @@ licence_generate_keys(uint8 * client_key, uint8 * server_key, uint8 * client_rsa
        }
 }
 
+// "TEST" in UTF-16
+unsigned char license_token[] = {
+       0x54, 0x00, 0x45, 0x00, 0x53, 0x00, 0x54, 0x00, 0x00, 0x00
+};
+
+void
+send_authreq()
+{
+       RC4_KEY crypt_key;
+       uint8 in_token[LICENCE_TOKEN_SIZE], encrypt_token[LICENCE_TOKEN_SIZE];
+       uint8 signature[LICENCE_SIGNATURE_SIZE];
+
+       STREAM s = sec_init(38, SEC_LICENCE_NEG);
+       
+       out_uint8(s, LICENCE_TAG_AUTHREQ);
+       out_uint8(s, 3);  // version
+       out_uint16_le(s, 38); // length
+
+       // unknown
+       out_uint16_le(s, 0xffff);
+       out_uint16_le(s, 0xffff);
+       out_uint16_le(s, 0x0000);
+
+       out_uint16_le(s, LICENCE_TOKEN_SIZE);
+       memcpy(in_token, license_token, LICENCE_TOKEN_SIZE);
+
+       // encrypt the token
+       RC4_set_key(&crypt_key, 16, g_licence_key);
+       RC4(&crypt_key, LICENCE_TOKEN_SIZE, in_token, encrypt_token);
+
+       out_uint8p(s, encrypt_token, LICENCE_TOKEN_SIZE);
+
+       // what are we supposed to sign here, really? guess at the
+       // token, nothing else has been sent...
+       sec_sign(signature, 16, g_licence_sign_key, 16, encrypt_token, LICENCE_TOKEN_SIZE);
+       out_uint8p(s, signature, LICENCE_SIGNATURE_SIZE);
+
+       s_mark_end(s);
+       sec_send(s, SEC_LICENCE_NEG);
+}
+