FreeRDP
|
#include <freerdp/config.h>
#include "settings.h"
#include <freerdp/license.h>
#include <winpr/crt.h>
#include <winpr/assert.h>
#include <winpr/crypto.h>
#include <winpr/shell.h>
#include <winpr/path.h>
#include <winpr/file.h>
#include <freerdp/log.h>
#include <freerdp/crypto/certificate.h>
#include "license.h"
#include "../crypto/crypto.h"
#include "../crypto/certificate.h"
Functions | |
static BOOL | license_send_error_alert (rdpLicense *license, UINT32 dwErrorCode, UINT32 dwStateTransition, const LICENSE_BLOB *info) |
static BOOL | license_set_state (rdpLicense *license, LICENSE_STATE state) |
static const char * | license_get_state_string (LICENSE_STATE state) |
static const char * | license_preferred_key_exchange_alg_string (UINT32 alg, char *buffer, size_t size) |
static const char * | license_request_type_string (UINT32 type) |
static const char * | licencse_blob_type_string (UINT16 type) |
static wStream * | license_send_stream_init (rdpLicense *license) |
Initialize a license packet stream. More... | |
static void | license_generate_randoms (rdpLicense *license) |
static BOOL | license_generate_keys (rdpLicense *license) |
static BOOL | license_generate_hwid (rdpLicense *license) |
static BOOL | license_encrypt_premaster_secret (rdpLicense *license) |
static LICENSE_PRODUCT_INFO * | license_new_product_info (void) |
static void | license_free_product_info (LICENSE_PRODUCT_INFO *productInfo) |
static BOOL | license_read_product_info (wStream *s, LICENSE_PRODUCT_INFO *productInfo) |
static LICENSE_BLOB * | license_new_binary_blob (UINT16 type) |
static void | license_free_binary_blob (LICENSE_BLOB *blob) |
static BOOL | license_read_binary_blob_data (LICENSE_BLOB *blob, UINT16 type, const void *data, size_t length) |
static BOOL | license_read_binary_blob (wStream *s, LICENSE_BLOB *blob) |
static BOOL | license_write_binary_blob (wStream *s, const LICENSE_BLOB *blob) |
static SCOPE_LIST * | license_new_scope_list (void) |
static BOOL | license_scope_list_resize (SCOPE_LIST *scopeList, UINT32 count) |
static void | license_free_scope_list (SCOPE_LIST *scopeList) |
static BOOL | license_read_scope_list (wStream *s, SCOPE_LIST *scopeList) |
static BOOL | license_write_scope_list (wStream *s, const SCOPE_LIST *scopeList) |
static BOOL | license_read_license_request_packet (rdpLicense *license, wStream *s) |
static BOOL | license_write_license_request_packet (const rdpLicense *license, wStream *s) |
static BOOL | license_read_platform_challenge_packet (rdpLicense *license, wStream *s) |
static BOOL | license_send_platform_challenge_packet (rdpLicense *license) |
static BOOL | license_read_new_or_upgrade_license_packet (rdpLicense *license, wStream *s) |
static BOOL | license_read_error_alert_packet (rdpLicense *license, wStream *s) |
static BOOL | license_write_new_license_request_packet (const rdpLicense *license, wStream *s) |
static BOOL | license_read_new_license_request_packet (rdpLicense *license, wStream *s) |
static BOOL | license_answer_license_request (rdpLicense *license) |
static BOOL | license_send_platform_challenge_response (rdpLicense *license) |
static BOOL | license_read_platform_challenge_response (rdpLicense *license, wStream *s) |
static BOOL | license_read_client_platform_challenge_response (rdpLicense *license, wStream *s) |
static BOOL | license_write_client_platform_challenge_response (rdpLicense *license, wStream *s) |
static BOOL | license_read_server_upgrade_license (rdpLicense *license, wStream *s) |
static BOOL | license_write_server_upgrade_license (const rdpLicense *license, wStream *s) |
static BOOL | license_send_license_info (rdpLicense *license, const LICENSE_BLOB *calBlob, const BYTE *signature, size_t signature_length) |
static BOOL | license_read_license_info (rdpLicense *license, wStream *s) |
static state_run_t | license_client_recv (rdpLicense *license, wStream *s) |
static state_run_t | license_server_recv (rdpLicense *license, wStream *s) |
static BOOL | license_ensure_state (rdpLicense *license, LICENSE_STATE state, UINT32 msg) |
state_run_t | license_recv (rdpLicense *license, wStream *s) |
static BOOL | license_check_stream_length (wStream *s, SSIZE_T expect, const char *where) |
static BOOL | license_check_stream_capacity (wStream *s, size_t expect, const char *where) |
static BOOL | computeCalHash (const char *hostname, char *hashStr, size_t len) |
static BOOL | saveCal (const rdpSettings *settings, const BYTE *data, size_t length, const char *hostname) |
static BYTE * | loadCalFile (const rdpSettings *settings, const char *hostname, size_t *dataLen) |
static BOOL | license_read_preamble (wStream *s, BYTE *bMsgType, BYTE *flags, UINT16 *wMsgSize) |
static BOOL | license_write_preamble (wStream *s, BYTE bMsgType, BYTE flags, UINT16 wMsgSize) |
static BOOL | license_send (rdpLicense *license, wStream *s, BYTE type) |
static BOOL | license_server_send_new_or_upgrade_license (rdpLicense *license, BOOL upgrade) |
static BOOL | license_get_server_rsa_public_key (rdpLicense *license) |
static BOOL | license_rc4_with_licenseKey (const rdpLicense *license, const BYTE *input, size_t len, LICENSE_BLOB *target) |
static BOOL | license_encrypt_and_MAC (rdpLicense *license, const BYTE *input, size_t len, LICENSE_BLOB *target, BYTE *mac, size_t mac_length) |
static BOOL | license_decrypt_and_check_MAC (rdpLicense *license, const BYTE *input, size_t len, LICENSE_BLOB *target, const BYTE *packetMac) |
static BOOL | license_write_product_info (wStream *s, const LICENSE_PRODUCT_INFO *productInfo) |
static BOOL | license_write_encrypted_premaster_secret_blob (wStream *s, const LICENSE_BLOB *blob, UINT32 ModulusLength) |
static BOOL | license_read_encrypted_premaster_secret_blob (wStream *s, LICENSE_BLOB *blob, UINT32 *ModulusLength) |
static BOOL | license_check_preferred_alg (rdpLicense *license, UINT32 PreferredKeyExchangeAlg, const char *where) |
static BOOL | license_send_license_request_packet (rdpLicense *license) |
static BOOL | license_read_encrypted_blob (const rdpLicense *license, wStream *s, LICENSE_BLOB *target) |
BOOL | license_send_valid_client_error_packet (rdpRdp *rdp) |
rdpLicense * | license_new (rdpRdp *rdp) |
void | license_free (rdpLicense *license) |
LICENSE_STATE | license_get_state (const rdpLicense *license) |
LICENSE_TYPE | license_get_type (const rdpLicense *license) |
BOOL | license_server_send_request (rdpLicense *license) |
static BOOL | license_set_string (const char *what, const char *value, BYTE **bdst, UINT32 *dstLen) |
BOOL | license_server_configure (rdpLicense *license) |
rdpLicense * | license_get (rdpContext *context) |
Variables | |
static const char | licenseStore [] = "licenses" |
#define EXTENDED_ERROR_MSG_SUPPORTED 0x80 |
#define HWID_LENGTH 20 |
#define HWID_PLATFORM_ID_LENGTH 4 |
#define HWID_UNIQUE_DATA_LENGTH 16 |
#define KEY_EXCHANGE_ALG_RSA 0x00000001 |
#define LICENSE_PKT_CS_MASK (LICENSE_INFO | NEW_LICENSE_REQUEST | PLATFORM_CHALLENGE_RESPONSE | ERROR_ALERT) |
#define LICENSE_PKT_MASK (LICENSE_PKT_CS_MASK | LICENSE_PKT_SC_MASK) |
#define LICENSE_PKT_SC_MASK (LICENSE_REQUEST | PLATFORM_CHALLENGE | NEW_LICENSE | UPGRADE_LICENSE | ERROR_ALERT) |
#define LICENSE_PREAMBLE_LENGTH 4 |
#define LicenseProtocolVersionMask 0x0F |
#define LICENSING_ENCRYPTION_KEY_LENGTH 16 |
#define LICENSING_PADDING_SIZE 8 |
#define MAC_SALT_KEY_LENGTH 16 |
#define MASTER_SECRET_LENGTH 48 |
#define PLATFORM_CHALLENGE_RESPONSE_VERSION 0x0100 |
#define PLATFORMID (CLIENT_OS_ID_WINNT_POST_52 | CLIENT_IMAGE_ID_MICROSOFT) |
#define PREAMBLE_VERSION_2_0 0x02 |
#define PREAMBLE_VERSION_3_0 0x03 |
#define PREMASTER_SECRET_LENGTH 48 |
#define SERVER_RANDOM_LENGTH 32 |
#define SESSION_KEY_BLOB_LENGTH 48 |
#define TAG FREERDP_TAG("core.license") |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
enum LicenseRequestType |
|
static |
|
static |
|
static |
Send a NEW_LICENSE_REQUEST packet. msdn{cc241918}
license | license module |
|
static |
|
static |
|
static |
|
static |
Receive an RDP licensing packet. msdn{cc240479}
license | license module |
s | stream |
|
static |
Decrypt the input using the license key and check the MAC
license | rdpLicense to get keys and salt from |
input | the input data to decrypt and MAC |
len | size of input |
target | a target LICENSE_BLOB where the decrypted input will be stored |
packetMac | the signature buffer (16 bytes) |
|
static |
Encrypt the input using the license key and MAC the input for a signature
license | rdpLicense to get keys and salt from |
input | the input data to encrypt and MAC |
len | size of input |
target | a target LICENSE_BLOB where the encrypted input will be stored |
mac | the signature buffer (16 bytes) |
|
static |
|
static |
void license_free | ( | rdpLicense * | license | ) |
Free license module.
license | license module to be freed |
|
static |
Free License Binary Blob (LICENSE_BINARY_BLOB). msdn{cc240481}
blob | license binary blob |
|
static |
Free Product Information (LICENSE_PRODUCT_INFO). msdn{cc241915}
productInfo | product information |
|
static |
Free License Scope List (SCOPE_LIST). msdn{cc241916}
scopeList | scope list |
|
static |
Generate Unique Hardware Identifier (CLIENT_HARDWARE_ID).
license | license module |
|
static |
Generate License Cryptographic Keys.
license | license module |
|
static |
rdpLicense* license_get | ( | rdpContext * | context | ) |
|
static |
LICENSE_STATE license_get_state | ( | const rdpLicense * | license | ) |
|
static |
LICENSE_TYPE license_get_type | ( | const rdpLicense * | license | ) |
rdpLicense* license_new | ( | rdpRdp * | rdp | ) |
Instantiate new license module.
rdp | RDP module |
|
static |
Allocate New License Binary Blob (LICENSE_BINARY_BLOB). msdn{cc240481}
|
static |
Allocate New Product Information (LICENSE_PRODUCT_INFO). msdn{cc241915}
|
static |
Allocate New License Scope List (SCOPE_LIST). msdn{cc241916}
|
static |
|
static |
|
static |
Read License Binary Blob (LICENSE_BINARY_BLOB). msdn{cc240481}
s | stream |
blob | license binary blob |
|
static |
|
static |
|
static |
|
static |
|
static |
Read an ERROR_ALERT packet. msdn{cc240482}
license | license module |
s | stream |
|
static |
|
static |
Read a LICENSE_REQUEST packet. msdn{cc241914}
license | license module |
s | stream |
|
static |
|
static |
Read a NEW_LICENSE packet. msdn{cc241926}
license | license module |
s | stream |
|
static |
|
static |
|
static |
Read a licensing preamble. msdn{cc240480}
s | stream |
bMsgType | license message type |
flags | message flags |
wMsgSize | message size |
|
static |
Read Product Information (PRODUCT_INFO). msdn{cc241915}
s | stream |
productInfo | product information |
|
static |
Read License Scope List (SCOPE_LIST). msdn{cc241916}
s | stream |
scopeList | scope list |
|
static |
state_run_t license_recv | ( | rdpLicense * | license, |
wStream * | s | ||
) |
|
static |
|
static |
Send an RDP licensing packet. msdn{cc240479}
license | license module |
s | stream |
Using EXTENDED_ERROR_MSG_SUPPORTED here would cause mstsc to crash when running in server mode! This flag seems to be incorrectly documented.
|
static |
|
static |
|
static |
|
static |
|
static |
Send Client Challenge Response Packet. msdn{cc241922}
license | license module |
|
static |
Initialize a license packet stream.
license | license module |
BOOL license_send_valid_client_error_packet | ( | rdpRdp * | rdp | ) |
Send Server License Error - Valid Client Packet. msdn{cc241922}
rdp | A pointer to the context to use |
BOOL license_server_configure | ( | rdpLicense * | license | ) |
|
static |
|
static |
BOOL license_server_send_request | ( | rdpLicense * | license | ) |
|
static |
|
static |
|
static |
Write License Binary Blob (LICENSE_BINARY_BLOB). msdn{cc240481}
s | stream |
blob | license binary blob |
|
static |
|
static |
|
static |
|
static |
Write a NEW_LICENSE_REQUEST packet. msdn{cc241918}
license | license module |
s | stream |
|
static |
Write a licensing preamble. msdn{cc240480}
s | stream |
bMsgType | license message type |
flags | message flags |
wMsgSize | message size |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |