From 90d87f130c880820a29381fda7a4cd0831f49149 Mon Sep 17 00:00:00 2001 From: Anthony Tong Date: Mon, 19 Sep 2011 11:44:13 -0400 Subject: [PATCH] work on licensing - get device licensing from rdp5.2 servers (?) to not reject license request with ERR_INVALID_CLIENT --- libfreerdp-core/license.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libfreerdp-core/license.c b/libfreerdp-core/license.c index 5d389e307..9545b406c 100644 --- a/libfreerdp-core/license.c +++ b/libfreerdp-core/license.c @@ -330,15 +330,15 @@ void license_encrypt_premaster_secret(rdpLicense* license) crypto_rsa_encrypt(license->premaster_secret, PREMASTER_SECRET_LENGTH, key_length, modulus, exponent, encrypted_premaster_secret); - license->encrypted_premaster_secret->type = BB_ANY_BLOB; + license->encrypted_premaster_secret->type = BB_RANDOM_BLOB; license->encrypted_premaster_secret->length = PREMASTER_SECRET_LENGTH; license->encrypted_premaster_secret->data = encrypted_premaster_secret; #else encrypted_premaster_secret = (uint8*) xmalloc(MODULUS_MAX_SIZE); memset(encrypted_premaster_secret, 0, MODULUS_MAX_SIZE); - license->encrypted_premaster_secret->type = BB_ANY_BLOB; - license->encrypted_premaster_secret->length = MODULUS_MAX_SIZE; + license->encrypted_premaster_secret->type = BB_RANDOM_BLOB; + license->encrypted_premaster_secret->length = PREMASTER_SECRET_LENGTH; license->encrypted_premaster_secret->data = encrypted_premaster_secret; #endif } @@ -480,13 +480,16 @@ void license_write_binary_blob(STREAM* s, LICENSE_BLOB* blob) void license_write_padded_binary_blob(STREAM* s, LICENSE_BLOB* blob) { + uint16 pad_len; + + pad_len = 72 % blob->length; stream_write_uint16(s, blob->type); /* wBlobType (2 bytes) */ - stream_write_uint16(s, blob->length + LICENSING_PADDING_SIZE); /* wBlobLen (2 bytes) */ + stream_write_uint16(s, blob->length + pad_len); /* wBlobLen (2 bytes) */ if (blob->length > 0) stream_write(s, blob->data, blob->length); /* blobData */ - stream_write_zero(s, LICENSING_PADDING_SIZE); + stream_write_zero(s, pad_len); } /**