Example #1
0
/* Process a new licence packet */
static void
licence_process_new_license(STREAM s)
{
	RDSSL_RC4 crypt_key;
	uint32 length;
	int i;

	in_uint8s(s, 2);	// Skip license binary blob type
	in_uint16_le(s, length);
	if (!s_check_rem(s, length))
		return;

	rdssl_rc4_set_key(&crypt_key, g_licence_key, 16);
	rdssl_rc4_crypt(&crypt_key, s->p, s->p, length);

	/* Parse NEW_LICENSE_INFO block */
	in_uint8s(s, 4);	// skip dwVersion

	/* Skip strings, Scope, CompanyName and ProductId to get
	   to the LicenseInfo which we store in license blob. */
	length = 0;
	for (i = 0; i < 4; i++)
	{
		in_uint8s(s, length);
		in_uint32_le(s, length);
		if (!s_check_rem(s, length))
			return;
	}

	g_licence_issued = True;
	save_licence(s->p, length);
}
Example #2
0
/* Process a Server New (or Upgrade) License packet */
static void
licence_process_new_license(rdpLicence * licence, STREAM s)
{
    int i;
    uint32 length;
    uint32 os_major;
    uint32 os_minor;
    CryptoRc4 crypt_key;

    /* Licensing Binary BLOB with EncryptedLicenseInfo: */
    in_uint8s(s, 2);	/* wBlobType should be 0x0009 (BB_ENCRYPTED_DATA_BLOB) */
    in_uint16_le(s, length);	/* wBlobLen */

    /* RC4-encrypted New License Information */
    if (!s_check_rem(s, length))
        return;

    crypt_key = crypto_rc4_init(licence->licence_key, 16);
    crypto_rc4(crypt_key, length, s->p, s->p);	/* decrypt in place */
    crypto_rc4_free(crypt_key);

    /* dwVersion */
    in_uint16_le(s, os_major);	/* OS major version */
    in_uint16_le(s, os_minor);	/* OS minor version */

    /* Skip Scope, CompanyName and ProductId */
    for (i = 0; i < 3; i++)
    {
        in_uint32_le(s, length);
        if (!s_check_rem(s, length))
            return;
        in_uint8s(s, length);
    }

    /* LicenseInfo - CAL from license server */
    in_uint32_le(s, length);
    if (!s_check_rem(s, length))
        return;
    licence->licence_issued = True;
    save_licence(s->p, length);
}
Example #3
0
/* Process an licence issue packet */
static void
licence_process_issue(STREAM s)
{
	RC4_KEY crypt_key;
	uint32 length;
	uint16 check;

	in_uint8s(s, 2);	/* 3d 45 - unknown */
	in_uint16_le(s, length);
	if (!s_check_rem(s, length))
		return;

	RC4_set_key(&crypt_key, 16, licence_key);
	RC4(&crypt_key, length, s->p, s->p);

	in_uint16(s, check);
	if (check != 0)
		return;

	licence_issued = True;
	save_licence(s->p, length-2);
}
Example #4
0
/* Process an licence issue packet */
static void
licence_process_issue(STREAM s)
{
	void * crypt_key;
	uint32 length;
	uint16 check;
	int i;

	in_uint8s(s, 2);	/* 3d 45 - unknown */
	in_uint16_le(s, length);
	if (!s_check_rem(s, length))
		return;

	crypt_key = ssl_rc4_info_create();
	ssl_rc4_set_key(crypt_key, (char *)g_licence_key, 16);
	ssl_rc4_crypt(crypt_key, (char *)s->p, (char *)s->p, length);
	ssl_rc4_info_delete(crypt_key);

	in_uint16(s, check);
	if (check != 0)
		return;

	g_licence_issued = True;

	in_uint8s(s, 2);	/* pad */

	/* advance to fourth string */
	length = 0;
	for (i = 0; i < 4; i++)
	{
		in_uint8s(s, length);
		in_uint32_le(s, length);
		if (!s_check_rem(s, length))
			return;
	}

	g_licence_issued = True;
	save_licence(s->p, length);
}
Example #5
0
/* Process an licence issue packet */
static void
licence_process_issue(RDPCLIENT * This, STREAM s)
{
	RC4_KEY crypt_key;
	uint32 length;
	uint16 check;
	int i;

	in_uint8s(s, 2);	/* 3d 45 - unknown */
	in_uint16_le(s, length);
	if (!s_check_rem(s, length))
		return;

	RC4_set_key(&crypt_key, 16, This->licence.key);
	RC4(&crypt_key, length, s->p, s->p);

	in_uint16(s, check);
	if (check != 0)
		return;

	This->licence_issued = True;

	in_uint8s(s, 2);	/* pad */

	/* advance to fourth string */
	length = 0;
	for (i = 0; i < 4; i++)
	{
		in_uint8s(s, length);
		in_uint32_le(s, length);
		if (!s_check_rem(s, length))
			return;
	}

	This->licence_issued = True;
	save_licence(This, s->p, length);
}
Example #6
0
/* Process an licence issue packet */
static void
licence_process_issue(RDConnectionRef conn, RDStreamRef s)
{
	RC4_KEY crypt_key;
	uint32 length;
	uint16 check;
	int i;

	in_uint8s(s, 2);	/* 3d 45 - unknown */
	in_uint16_le(s, length);
	if (!s_check_rem(s, length))
		return;

	RC4_set_key(&crypt_key, 16, conn->licenseKey);
	RC4(&crypt_key, length, s->p, s->p);

	in_uint16(s, check);
	if (check != 0)
		return;

	conn->licenseIssued = True;

	in_uint8s(s, 2);	/* pad */

	/* advance to fourth string */
	length = 0;
	for (i = 0; i < 4; i++)
	{
		in_uint8s(s, length);
		in_uint32_le(s, length);
		if (!s_check_rem(s, length))
			return;
	}

	conn->licenseIssued = True;
	save_licence(s->p, length);
}