2011-07-12 04:46:03 +04:00
|
|
|
/**
|
2012-10-09 07:02:04 +04:00
|
|
|
* FreeRDP: A Remote Desktop Protocol Implementation
|
2011-07-12 04:46:03 +04:00
|
|
|
* RDP Licensing
|
|
|
|
*
|
|
|
|
* Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#ifndef FREERDP_LIB_CORE_LICENSE_H
|
|
|
|
#define FREERDP_LIB_CORE_LICENSE_H
|
2011-07-12 04:46:03 +04:00
|
|
|
|
|
|
|
#include "rdp.h"
|
2013-03-22 00:45:25 +04:00
|
|
|
|
2019-09-22 17:42:31 +03:00
|
|
|
#include <freerdp/license.h>
|
2012-02-17 09:58:30 +04:00
|
|
|
#include <freerdp/crypto/crypto.h>
|
|
|
|
#include <freerdp/crypto/certificate.h>
|
2011-07-12 04:46:03 +04:00
|
|
|
|
|
|
|
#include <freerdp/freerdp.h>
|
2014-09-12 16:36:29 +04:00
|
|
|
#include <freerdp/log.h>
|
2016-08-10 10:12:55 +03:00
|
|
|
#include <freerdp/api.h>
|
2018-11-01 13:02:54 +03:00
|
|
|
#include <freerdp/license.h>
|
2013-03-22 00:45:25 +04:00
|
|
|
|
|
|
|
#include <winpr/stream.h>
|
2011-07-12 04:46:03 +04:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 dwVersion;
|
|
|
|
UINT32 cbCompanyName;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* pbCompanyName;
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 cbProductId;
|
2012-10-09 11:01:37 +04:00
|
|
|
BYTE* pbProductId;
|
2014-02-17 03:02:50 +04:00
|
|
|
} LICENSE_PRODUCT_INFO;
|
2011-07-12 04:46:03 +04:00
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-10-09 11:01:37 +04:00
|
|
|
UINT16 type;
|
|
|
|
UINT16 length;
|
|
|
|
BYTE* data;
|
2011-07-12 04:46:03 +04:00
|
|
|
} LICENSE_BLOB;
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
2012-10-09 11:26:39 +04:00
|
|
|
UINT32 count;
|
2011-07-12 04:46:03 +04:00
|
|
|
LICENSE_BLOB* array;
|
|
|
|
} SCOPE_LIST;
|
|
|
|
|
2011-07-15 10:02:09 +04:00
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
LICENSE_STATE_AWAIT,
|
|
|
|
LICENSE_STATE_PROCESS,
|
|
|
|
LICENSE_STATE_ABORTED,
|
|
|
|
LICENSE_STATE_COMPLETED
|
|
|
|
} LICENSE_STATE;
|
|
|
|
|
2011-07-12 04:46:03 +04:00
|
|
|
struct rdp_license
|
|
|
|
{
|
2011-07-15 10:02:09 +04:00
|
|
|
LICENSE_STATE state;
|
2013-02-05 18:46:25 +04:00
|
|
|
rdpRdp* rdp;
|
|
|
|
rdpCertificate* certificate;
|
2013-02-05 18:30:53 +04:00
|
|
|
BYTE* Modulus;
|
|
|
|
UINT32 ModulusLength;
|
|
|
|
BYTE Exponent[4];
|
2013-02-05 08:57:04 +04:00
|
|
|
BYTE HardwareId[HWID_LENGTH];
|
|
|
|
BYTE ClientRandom[CLIENT_RANDOM_LENGTH];
|
|
|
|
BYTE ServerRandom[SERVER_RANDOM_LENGTH];
|
|
|
|
BYTE MasterSecret[MASTER_SECRET_LENGTH];
|
|
|
|
BYTE PremasterSecret[PREMASTER_SECRET_LENGTH];
|
|
|
|
BYTE SessionKeyBlob[SESSION_KEY_BLOB_LENGTH];
|
|
|
|
BYTE MacSaltKey[MAC_SALT_KEY_LENGTH];
|
|
|
|
BYTE LicensingEncryptionKey[LICENSING_ENCRYPTION_KEY_LENGTH];
|
2014-02-17 03:02:50 +04:00
|
|
|
LICENSE_PRODUCT_INFO* ProductInfo;
|
2013-02-05 08:57:04 +04:00
|
|
|
LICENSE_BLOB* ErrorInfo;
|
|
|
|
LICENSE_BLOB* KeyExchangeList;
|
|
|
|
LICENSE_BLOB* ServerCertificate;
|
|
|
|
LICENSE_BLOB* ClientUserName;
|
|
|
|
LICENSE_BLOB* ClientMachineName;
|
|
|
|
LICENSE_BLOB* PlatformChallenge;
|
|
|
|
LICENSE_BLOB* EncryptedPremasterSecret;
|
|
|
|
LICENSE_BLOB* EncryptedPlatformChallenge;
|
2019-11-06 17:24:51 +03:00
|
|
|
LICENSE_BLOB* EncryptedPlatformChallengeResponse;
|
2013-02-05 08:57:04 +04:00
|
|
|
LICENSE_BLOB* EncryptedHardwareId;
|
|
|
|
SCOPE_LIST* ScopeList;
|
2014-04-02 16:17:39 +04:00
|
|
|
UINT32 PacketHeaderLength;
|
2011-07-12 04:46:03 +04:00
|
|
|
};
|
|
|
|
|
2016-08-10 10:12:55 +03:00
|
|
|
FREERDP_LOCAL int license_recv(rdpLicense* license, wStream* s);
|
|
|
|
|
|
|
|
FREERDP_LOCAL rdpLicense* license_new(rdpRdp* rdp);
|
|
|
|
FREERDP_LOCAL void license_free(rdpLicense* license);
|
2011-07-12 04:46:03 +04:00
|
|
|
|
2014-09-12 16:36:29 +04:00
|
|
|
#define LICENSE_TAG FREERDP_TAG("core.license")
|
2011-07-12 09:57:09 +04:00
|
|
|
#ifdef WITH_DEBUG_LICENSE
|
2016-10-07 15:04:40 +03:00
|
|
|
#define DEBUG_LICENSE(...) WLog_DBG(LICENSE_TAG, __VA_ARGS__)
|
2011-07-12 09:57:09 +04:00
|
|
|
#else
|
2019-11-06 17:24:51 +03:00
|
|
|
#define DEBUG_LICENSE(...) \
|
|
|
|
do \
|
|
|
|
{ \
|
|
|
|
} while (0)
|
2011-07-12 09:57:09 +04:00
|
|
|
#endif
|
|
|
|
|
2017-06-06 15:01:41 +03:00
|
|
|
#endif /* FREERDP_LIB_CORE_LICENSE_H */
|